Changeset 5475 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2012-08-24T13:24:55+02:00 (12 years ago)
Author:
bastiK
Message:

applied #7811 - Vague "Suspicious tag/value combinations" message for absent denomination tag (patch by mrwojo, slightly modified)

File:
1 edited

Legend:

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

    r5380 r5475  
    8383    protected static final List<String> ignoreDataEndsWith = new ArrayList<String>();
    8484    protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>();
    85     protected static final List<IgnoreTwoKeyPair> ignoreDataTwoKeyPair = new ArrayList<IgnoreTwoKeyPair>();
    8685
    8786    /** The preferences prefix */
     
    175174        ignoreDataEndsWith.clear();
    176175        ignoreDataKeyPair.clear();
    177         ignoreDataTwoKeyPair.clear();
    178176
    179177        spellCheckKeyData = new HashMap<String, String>();
     
    249247                            tmp.value = line.substring(mid+1);
    250248                            ignoreDataKeyPair.add(tmp);
    251                         } else if (key.equals("T:")) {
    252                             IgnoreTwoKeyPair tmp = new IgnoreTwoKeyPair();
    253                             int mid = line.indexOf("=");
    254                             int split = line.indexOf("|");
    255                             tmp.key1 = line.substring(0, mid);
    256                             tmp.value1 = line.substring(mid+1, split);
    257                             line = line.substring(split+1);
    258                             mid = line.indexOf("=");
    259                             tmp.key2 = line.substring(0, mid);
    260                             tmp.value2 = line.substring(mid+1);
    261                             ignoreDataTwoKeyPair.add(tmp);
    262249                        }
    263250                        continue;
     
    362349
    363350        if (checkComplex) {
    364             Map<String, String> props = (p.getKeys() == null) ? Collections.<String, String>emptyMap() : p.getKeys();
    365             for (Entry<String, String> prop : props.entrySet()) {
    366                 boolean ignore = true;
    367                 String key1 = prop.getKey();
    368                 String value1 = prop.getValue();
    369 
    370                 for (IgnoreTwoKeyPair a : ignoreDataTwoKeyPair) {
    371                     if (key1.equals(a.key1) && value1.equals(a.value1)) {
    372                         ignore = false;
    373                         for (Entry<String, String> prop2 : props.entrySet()) {
    374                             String key2 = prop2.getKey();
    375                             String value2 = prop2.getValue();
    376                             for (IgnoreTwoKeyPair b : ignoreDataTwoKeyPair) {
    377                                 if (key2.equals(b.key2) && value2.equals(b.value2)) {
    378                                     ignore = true;
    379                                     break;
    380                                 }
    381                             }
    382                             if (ignore) {
    383                                 break;
    384                             }
    385                         }
    386                     }
    387                     if (ignore) {
    388                         break;
    389                     }
    390                 }
    391 
    392                 if (!ignore) {
    393                     errors.add( new TestError(this, Severity.OTHER, tr("Suspicious tag/value combinations"),
    394                             tr("Suspicious tag/value combinations"), tr("Suspicious tag/value combinations"), 1272, p) );
    395                     withErrors.put(p, "TC");
    396                 }
    397             }
    398 
    399351            Map<String, String> keys = p.getKeys();
    400352            for (CheckerData d : checkerData) {
     
    482434                    for (IgnoreKeyPair a : ignoreDataKeyPair) {
    483435                        if (key.equals(a.key) && value.equals(a.value)) {
    484                             ignore = true;
    485                         }
    486                     }
    487 
    488                     for (IgnoreTwoKeyPair a : ignoreDataTwoKeyPair) {
    489                         if (key.equals(a.key2) && value.equals(a.value2)) {
    490436                            ignore = true;
    491437                        }
     
    801747    }
    802748
    803     protected static class IgnoreTwoKeyPair {
    804         public String key1;
    805         public String value1;
    806         public String key2;
    807         public String value2;
    808     }
    809 
    810749    protected static class IgnoreKeyPair {
    811750        public String key;
Note: See TracChangeset for help on using the changeset viewer.