Changeset 15980 in josm for trunk/src/org
- Timestamp:
- 2020-03-01T23:35:49+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r15979 r15980 18 18 import java.util.LinkedList; 19 19 import java.util.List; 20 import java.util.Locale;21 20 import java.util.Map; 22 21 import java.util.Objects; … … 302 301 } 303 302 304 private static final String POSSIBLE_THROWS = possibleThrows(); 305 306 static final String possibleThrows() { 307 StringBuilder sb = new StringBuilder(); 308 for (Severity s : Severity.values()) { 309 if (sb.length() > 0) { 310 sb.append('/'); 311 } 312 sb.append("throw") 313 .append(s.name().charAt(0)) 314 .append(s.name().substring(1).toLowerCase(Locale.ENGLISH)); 315 } 316 return sb.toString(); 317 } 303 private static final String POSSIBLE_THROWS = "throwError/throwWarning/throwOther"; 318 304 319 305 static TagCheck ofMapCSSRule(final GroupedMapCSSRule rule) throws IllegalDataException { … … 335 321 ? ((Keyword) ai.val).val 336 322 : null; 337 if (ai.key.startsWith("throw")) { 338 try { 339 check.errors.put(ai, Severity.valueOf(ai.key.substring("throw".length()).toUpperCase(Locale.ENGLISH))); 340 } catch (IllegalArgumentException e) { 341 Logging.log(Logging.LEVEL_WARN, 342 "Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS+'.', e); 343 } 323 if ("throwError".equals(ai.key)) { 324 check.errors.put(ai, Severity.ERROR); 325 } else if ("throwWarning".equals(ai.key)) { 326 check.errors.put(ai, Severity.WARNING); 327 } else if ("throwOther".equals(ai.key)) { 328 check.errors.put(ai, Severity.OTHER); 329 } else if (ai.key.startsWith("throw")) { 330 Logging.log(Logging.LEVEL_WARN, 331 "Unsupported " + ai.key + " instruction. Allowed instructions are " + POSSIBLE_THROWS + '.', null); 344 332 } else if ("fixAdd".equals(ai.key)) { 345 333 check.fixCommands.add(FixCommand.fixAdd(ai.val));
Note:
See TracChangeset
for help on using the changeset viewer.