Changeset 14525 in josm for trunk/src/org


Ignore:
Timestamp:
2018-12-08T22:01:44+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #17088 - False positive in test "Missing name:* translation"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java

    r11191 r14525  
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    7 import java.util.HashSet;
     7import java.util.Arrays;
     8import java.util.List;
     9import java.util.Map.Entry;
    810import java.util.Set;
    911import java.util.regex.Pattern;
     12import java.util.stream.Collectors;
    1013
    1114import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    3437    protected static final int NAME_TRANSLATION_MISSING = 1502;
    3538    private static final Pattern NAME_SPLIT_PATTERN = Pattern.compile(" - ");
     39
     40    private static final List<String> EXCLUSIONS = Arrays.asList(
     41            "name:botanical",
     42            "name:etymology:wikidata",
     43            "name:full",
     44            "name:genitive",
     45            "name:left",
     46            "name:prefix",
     47            "name:right",
     48            "name:source"
     49            );
    3650
    3751    /**
     
    6478    @Override
    6579    public void check(OsmPrimitive p) {
    66         Set<String> names = new HashSet<>();
    67 
    68         p.getKeys().forEach((key, n) -> {
    69             if (n != null && key.startsWith("name:") && !"name:etymology:wikidata".equals(key)) {
    70                 names.add(n);
    71             }
    72         });
     80        Set<String> names = p.getKeys().entrySet().stream()
     81                .filter(e -> e.getValue() != null && e.getKey().startsWith("name:") && !EXCLUSIONS.contains(e.getKey()))
     82                .map(Entry::getValue)
     83                .collect(Collectors.toSet());
    7384
    7485        if (names.isEmpty()) return;
Note: See TracChangeset for help on using the changeset viewer.