Changeset 10493 in osm for applications/editors/josm
- Timestamp:
- 2008-09-05T12:30:12+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
r10490 r10493 56 56 import org.openstreetmap.josm.plugins.validator.util.Bag; 57 57 import org.openstreetmap.josm.plugins.validator.util.Util; 58 import org.openstreetmap.josm.plugins.validator.util.Entities; 58 59 import org.openstreetmap.josm.tools.GBC; 59 60 import org.openstreetmap.josm.tools.XmlObjectParser; … … 123 124 protected static int INVALID_SPACE = 1204; 124 125 protected static int INVALID_KEY_SPACE = 1205; 126 protected static int INVALID_HTML = 1206; 125 127 /** 1250 and up is used by tagcheck */ 126 128 … … 128 130 protected JList Sources; 129 131 132 133 protected static Entities entities = new Entities(); 130 134 /** 131 135 * Constructor … … 336 340 tr(s, key), MessageFormat.format(s, key), INVALID_SPACE, p) ); 337 341 withErrors.add(p, "SPACE"); 342 } 343 if( checkValues && value != null && !value.equals(entities.unescape(value)) && !withErrors.contains(p, "HTML")) 344 { 345 errors.add( new TestError(this, Severity.OTHER, tr("Property values contain HTML entity"), 346 tr(s, key), MessageFormat.format(s, key), INVALID_HTML, p) ); 347 withErrors.add(p, "HTML"); 338 348 } 339 349 if( checkValues && value != null && value.length() > 0 && presetsValueData != null) … … 584 594 commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, value.trim()) ); 585 595 else if(key.startsWith(" ") || key.endsWith(" ")) 586 {587 596 commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)), key, key.trim()) ); 588 }589 597 else 590 598 { 591 String replacementKey = spellCheckKeyData.get(key); 592 if( replacementKey != null ) 593 commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)), key, replacementKey) ); 599 String evalue = entities.unescape(value); 600 if(!evalue.equals(value)) 601 commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, evalue) ); 602 else 603 { 604 String replacementKey = spellCheckKeyData.get(key); 605 if( replacementKey != null ) 606 { 607 commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)), 608 key, replacementKey) ); 609 } 610 } 594 611 } 595 612 } … … 610 627 { 611 628 int code = testError.getCode(); 612 return code == INVALID_KEY || code == EMPTY_VALUES || code == INVALID_SPACE || code == INVALID_KEY_SPACE; 629 return code == INVALID_KEY || code == EMPTY_VALUES || code == INVALID_SPACE || code == INVALID_KEY_SPACE || code == INVALID_HTML; 613 630 } 614 631
Note:
See TracChangeset
for help on using the changeset viewer.