Changeset 5379 in josm


Ignore:
Timestamp:
2012-07-28T23:16:44+02:00 (12 years ago)
Author:
bastiK
Message:

fixed #5679 - Validator: value of name tag not in presets if a preset specifies a name value

(respect key ignore rules E, S and F also for tags where some value for this key is found in the presets)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/ignoretags.cfg

    r3937 r5379  
    1818; Ignore valid and semi-valid keys that equal...
    1919;
     20E:name
    2021E:loc_name
    2122E:attribution
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r5270 r5379  
    458458            }
    459459            if (checkValues && value != null && value.length() > 0 && presetsValueData != null) {
    460                 Set<String> values = presetsValueData.get(key);
    461                 if (values == null) {
    462                     boolean ignore = false;
    463                     for (String a : ignoreDataStartsWith) {
    464                         if (key.startsWith(a)) {
    465                             ignore = true;
    466                         }
    467                     }
    468                     for (String a : ignoreDataEquals) {
    469                         if(key.equals(a)) {
    470                             ignore = true;
    471                         }
    472                     }
    473                     for (String a : ignoreDataEndsWith) {
    474                         if(key.endsWith(a)) {
    475                             ignore = true;
    476                         }
    477                     }
    478                     if (!ignore) {
    479                         String i = marktr("Key ''{0}'' not in presets.");
    480                         errors.add( new TestError(this, Severity.OTHER, tr("Presets do not contain property key"),
    481                                 tr(i, key), MessageFormat.format(i, key), INVALID_VALUE, p) );
    482                         withErrors.put(p, "UPK");
    483                     }
    484                 } else if (values.size() > 0 && !values.contains(prop.getValue())) {
    485                     boolean ignore = false;
    486                     for (IgnoreKeyPair a : ignoreDataKeyPair) {
    487                         if (key.equals(a.key) && value.equals(a.value)) {
    488                             ignore = true;
    489                         }
    490                     }
    491 
    492                     for (IgnoreTwoKeyPair a : ignoreDataTwoKeyPair) {
    493                         if (key.equals(a.key2) && value.equals(a.value2)) {
    494                             ignore = true;
    495                         }
    496                     }
    497 
    498                     if (!ignore) {
    499                         String i = marktr("Value ''{0}'' for key ''{1}'' not in presets.");
    500                         errors.add( new TestError(this, Severity.OTHER, tr("Presets do not contain property value"),
    501                                 tr(i, prop.getValue(), key), MessageFormat.format(i, prop.getValue(), key), INVALID_VALUE, p) );
    502                         withErrors.put(p, "UPV");
     460                boolean ignore = false;
     461                for (String a : ignoreDataStartsWith) {
     462                    if (key.startsWith(a)) {
     463                        ignore = true;
     464                    }
     465                }
     466                for (String a : ignoreDataEquals) {
     467                    if(key.equals(a)) {
     468                        ignore = true;
     469                    }
     470                }
     471                for (String a : ignoreDataEndsWith) {
     472                    if(key.endsWith(a)) {
     473                        ignore = true;
     474                    }
     475                }
     476                if (!ignore) {
     477                    String i = marktr("Key ''{0}'' not in presets.");
     478                    errors.add( new TestError(this, Severity.OTHER, tr("Presets do not contain property key"),
     479                            tr(i, key), MessageFormat.format(i, key), INVALID_VALUE, p) );
     480                    withErrors.put(p, "UPK");
     481                } else {
     482                    Set<String> values = presetsValueData.get(key);
     483                    if (values != null && values.size() > 0 && !values.contains(prop.getValue())) {
     484                        ignore = false;
     485                        for (IgnoreKeyPair a : ignoreDataKeyPair) {
     486                            if (key.equals(a.key) && value.equals(a.value)) {
     487                                ignore = true;
     488                            }
     489                        }
     490
     491                        for (IgnoreTwoKeyPair a : ignoreDataTwoKeyPair) {
     492                            if (key.equals(a.key2) && value.equals(a.value2)) {
     493                                ignore = true;
     494                            }
     495                        }
     496
     497                        if (!ignore) {
     498                            String i = marktr("Value ''{0}'' for key ''{1}'' not in presets.");
     499                            errors.add( new TestError(this, Severity.OTHER, tr("Presets do not contain property value"),
     500                                    tr(i, prop.getValue(), key), MessageFormat.format(i, prop.getValue(), key), INVALID_VALUE, p) );
     501                            withErrors.put(p, "UPV");
     502                        }
    503503                    }
    504504                }
Note: See TracChangeset for help on using the changeset viewer.