Changeset 15994 in josm for trunk/src/org
- Timestamp:
- 2020-03-02T00:54:04+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r15888 r15994 23 23 import java.util.Map; 24 24 import java.util.Map.Entry; 25 import java.util.OptionalInt; 25 26 import java.util.Set; 26 27 import java.util.regex.Pattern; … … 451 452 452 453 static boolean containsUnusualUnicodeCharacter(String key, String value) { 453 return value != null && value.chars().anyMatch(c -> isUnusualUnicodeBlock(key, c)); 454 return getUnusualUnicodeCharacter(key, value).isPresent(); 455 } 456 457 static OptionalInt getUnusualUnicodeCharacter(String key, String value) { 458 return value == null 459 ? OptionalInt.empty() 460 : value.chars().filter(c -> isUnusualUnicodeBlock(key, c)).findFirst(); 454 461 } 455 462 … … 678 685 withErrors.put(p, "ICV"); 679 686 } 680 if ((containsUnusualUnicodeCharacter(key, value)) && !withErrors.contains(p, "UUCV")) { 687 final OptionalInt unusualUnicodeCharacter = getUnusualUnicodeCharacter(key, value); 688 if (unusualUnicodeCharacter.isPresent() && !withErrors.contains(p, "UUCV")) { 689 final String codepoint = String.format(Locale.ROOT, "U+%04X", unusualUnicodeCharacter.getAsInt()); 681 690 errors.add(TestError.builder(this, Severity.WARNING, UNUSUAL_UNICODE_CHAR_VALUE) 682 .message(tr("Tag value contains unusual Unicode character "), s, key)691 .message(tr("Tag value contains unusual Unicode character {0}", codepoint), s, key) 683 692 .primitives(p) 684 693 .build());
Note:
See TracChangeset
for help on using the changeset viewer.