- Timestamp:
- 2014-06-03T20:18:18+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r7140 r7213 162 162 } 163 163 164 static final String POSSIBLE_THROWS = possibleThrows(); 165 166 static final String possibleThrows() { 167 StringBuffer sb = new StringBuffer(); 168 for (Severity s : Severity.values()) { 169 if (sb.length() > 0) { 170 sb.append('/'); 171 } 172 sb.append("throw") 173 .append(s.name().charAt(0)) 174 .append(s.name().substring(1).toLowerCase()); 175 } 176 return sb.toString(); 177 } 178 164 179 static TagCheck ofMapCSSRule(final GroupedMapCSSRule rule) { 165 180 final TagCheck check = new TagCheck(rule); … … 178 193 : null; 179 194 if (ai.key.startsWith("throw")) { 180 final Severity severity = Severity.valueOf(ai.key.substring("throw".length()).toUpperCase()); 181 check.errors.put(ai, severity); 195 try { 196 final Severity severity = Severity.valueOf(ai.key.substring("throw".length()).toUpperCase()); 197 check.errors.put(ai, severity); 198 } catch (IllegalArgumentException e) { 199 Main.warn("Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS); 200 } 182 201 } else if ("fixAdd".equals(ai.key)) { 183 202 final PrimitiveToTag toTag = PrimitiveToTag.ofMapCSSObject(ai.val, false); … … 203 222 } 204 223 if (check.errors.isEmpty() && !containsSetClassExpression) { 205 throw new RuntimeException("No throwError/throwWarning/throwOthergiven! You should specify a validation error message for " + rule.selectors);224 throw new RuntimeException("No "+POSSIBLE_THROWS+" given! You should specify a validation error message for " + rule.selectors); 206 225 } else if (check.errors.size() > 1) { 207 throw new RuntimeException("More than one throwError/throwWarning/throwOthergiven! You should specify a single validation error message for " + rule.selectors);226 throw new RuntimeException("More than one "+POSSIBLE_THROWS+" given! You should specify a single validation error message for " + rule.selectors); 208 227 } 209 228 return check;
Note:
See TracChangeset
for help on using the changeset viewer.