Changeset 21540 in osm for applications/editors/josm/plugins/validator/src
- Timestamp:
- 2010-06-01T09:21:21+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
r21440 r21540 141 141 protected static int LONG_VALUE = 1208; 142 142 protected static int LONG_KEY = 1209; 143 protected static int LOW_CHAR_VALUE = 1210; 144 protected static int LOW_CHAR_KEY = 1211; 143 145 /** 1250 and up is used by tagcheck */ 144 146 … … 391 393 392 394 /** 395 * Checks given string (key or value) if it contains characters with code below 0x20 (either newline or some other special characters) 396 * @param s string to check 397 */ 398 private boolean containsLow(String s) { 399 if (s==null) return false; 400 for(int i=0;i<s.length();i++) { 401 if (s.charAt(i)<0x20) return true; 402 } 403 return false; 404 } 405 406 /** 393 407 * Checks the primitive properties 394 408 * @param p The primitive to check … … 474 488 String key = prop.getKey(); 475 489 String value = prop.getValue(); 490 if( checkValues && (containsLow(value)) && !withErrors.contains(p, "ICV")) 491 { 492 errors.add( new TestError(this, Severity.WARNING, tr("Tag value contains character with code less than 0x20"), 493 tr(s, key), MessageFormat.format(s, key), LOW_CHAR_VALUE, p) ); 494 withErrors.add(p, "ICV"); 495 } 496 if( checkKeys && (containsLow(key)) && !withErrors.contains(p, "ICK")) 497 { 498 errors.add( new TestError(this, Severity.WARNING, tr("Tag key contains character with code less than 0x20"), 499 tr(s, key), MessageFormat.format(s, key), LOW_CHAR_KEY, p) ); 500 withErrors.add(p, "ICK"); 501 } 476 502 if( checkValues && (value!=null && value.length() > 255) && !withErrors.contains(p, "LV")) 477 503 { … … 480 506 withErrors.add(p, "LV"); 481 507 } 482 if( checkKeys && ( value!=null && key.length() > 255) && !withErrors.contains(p, "LK"))508 if( checkKeys && (key!=null && key.length() > 255) && !withErrors.contains(p, "LK")) 483 509 { 484 510 errors.add( new TestError(this, Severity.ERROR, tr("Tag key longer than allowed"),
Note:
See TracChangeset
for help on using the changeset viewer.