Changeset 14732 in josm


Ignore:
Timestamp:
2019-01-25T09:17:38+01:00 (3 weeks ago)
Author:
GerdP
Message:

fix #17246 NPE in TagChecker (regression of r14727)

Unit test added

Location:
trunk
Files:
2 edited

Legend:

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

    r14727 r14732  
    631631        if (presetValues != null)
    632632            sets.add(presetValues);
    633         sets.add(oftenUsedTags.get(key));
     633        Set<String> usedValues = oftenUsedTags.get(key);
     634        if (usedValues != null)
     635            sets.add(usedValues);
    634636        for (Set<String> possibleValues: sets) {
    635637            if (possibleValues.contains(harmonizedValue)) {
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java

    r14696 r14732  
    201201    }
    202202
     203    /**
     204     * Key in presets but not in ignored.cfg. Caused a NPE with r14727.
     205     * @throws IOException if any I/O error occurs
     206     */
     207    @Test
     208    public void testRegression17246() throws IOException {
     209        final List<TestError> errors = test(OsmUtils.createPrimitive("node access=privat"));
     210        assertEquals(1, errors.size());
     211        assertEquals("Unknown property value", errors.get(0).getMessage());
     212        assertEquals("Value 'privat' for key 'access' is unknown, maybe 'private' is meant?",
     213                errors.get(0).getDescription());
     214        assertEquals(Severity.WARNING, errors.get(0).getSeverity());
     215        assertFalse(errors.get(0).isFixable());
     216    }
     217
    203218}
Note: See TracChangeset for help on using the changeset viewer.