Changeset 7417 in josm
- Timestamp:
- 2014-08-16T11:56:17+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r7356 r7417 52 52 import org.openstreetmap.josm.gui.preferences.validator.ValidatorTagCheckerRulesPreference; 53 53 import org.openstreetmap.josm.io.CachedFile; 54 import org.openstreetmap.josm.io.IllegalDataException; 54 55 import org.openstreetmap.josm.io.UTFInputStreamReader; 55 56 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 195 196 } 196 197 197 static TagCheck ofMapCSSRule(final GroupedMapCSSRule rule) {198 static TagCheck ofMapCSSRule(final GroupedMapCSSRule rule) throws IllegalDataException { 198 199 final TagCheck check = new TagCheck(rule); 199 200 boolean containsSetClassExpression = false; … … 244 245 check.assertions.put(val, false); 245 246 } else { 246 throw new RuntimeException("Cannot add instruction " + ai.key + ": " + ai.val + "!");247 throw new IllegalDataException("Cannot add instruction " + ai.key + ": " + ai.val + "!"); 247 248 } 248 249 } 249 250 } 250 251 if (check.errors.isEmpty() && !containsSetClassExpression) { 251 throw new RuntimeException("No "+POSSIBLE_THROWS+" given! You should specify a validation error message for " + rule.selectors);252 throw new IllegalDataException("No "+POSSIBLE_THROWS+" given! You should specify a validation error message for " + rule.selectors); 252 253 } else if (check.errors.size() > 1) { 253 throw new RuntimeException("More than one "+POSSIBLE_THROWS+" given! You should specify a single validation error message for " + rule.selectors);254 throw new IllegalDataException("More than one "+POSSIBLE_THROWS+" given! You should specify a single validation error message for " + rule.selectors); 254 255 } 255 256 return check; … … 281 282 List<TagCheck> result = new ArrayList<>(); 282 283 for (Map.Entry<Declaration, List<Selector>> map : g.entrySet()) { 283 result.add(TagCheck.ofMapCSSRule( 284 new GroupedMapCSSRule(map.getValue(), map.getKey()))); 284 try { 285 result.add(TagCheck.ofMapCSSRule( 286 new GroupedMapCSSRule(map.getValue(), map.getKey()))); 287 } catch (IllegalDataException e) { 288 Main.error("Cannot add MapCss rule: "+e.getMessage()); 289 } 285 290 } 286 291 return result; -
trunk/src/org/openstreetmap/josm/io/IllegalDataException.java
r3083 r7417 2 2 package org.openstreetmap.josm.io; 3 3 4 public class IllegalDataException extends Exception{ 4 /** 5 * Generic exception raised when illegal data is read. 6 * @since 2070 7 */ 8 public class IllegalDataException extends Exception { 5 9 6 public IllegalDataException() { 7 super(); 8 } 9 10 /** 11 * Constructs a new {@code IllegalDataException}. 12 * @param message the detail message (which is saved for later retrieval 13 * by the {@link #getMessage()} method). 14 * @param cause the cause (which is saved for later retrieval by the 15 * {@link #getCause()} method). 16 */ 10 17 public IllegalDataException(String message, Throwable cause) { 11 18 super(message, cause); 12 19 } 13 20 21 /** 22 * Constructs a new {@code IllegalDataException}. 23 * @param message the detail message (which is saved for later retrieval 24 * by the {@link #getMessage()} method). 25 */ 14 26 public IllegalDataException(String message) { 15 27 super(message); 16 28 } 17 29 30 /** 31 * Constructs a new {@code IllegalDataException}. 32 * @param cause the cause (which is saved for later retrieval by the 33 * {@link #getCause()} method). 34 */ 18 35 public IllegalDataException(Throwable cause) { 19 36 super(cause); 20 37 } 21 22 38 }
Note:
See TracChangeset
for help on using the changeset viewer.