Changeset 15079 in josm


Ignore:
Timestamp:
2019-05-15T22:41:37+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #17691 - fix issue where SimilarNamedWay crashes on a subset of names (patch by taylor.smock)

Location:
trunk
Files:
2 edited

Legend:

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

    r15007 r15079  
    245245            for (int i = 0; i < words.length; i++) {
    246246                String word = words[i];
    247                 part = name.substring(start, start + word.length());
     247                if (start + word.length() <= name.length()) {
     248                    part = name.substring(start, start + word.length());
     249                }
    248250                if (word.equalsIgnoreCase(part)) {
    249251                    break;
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java

    r13390 r15079  
    130130        checkSimilarity("case only", "Rue éèçàïù", "Rue EeCAIU", true);
    131131    }
     132
     133     /**
     134      * Test names that previously caused a crash
     135      */
     136     @Test
     137     public void testSimilarNamesRegression() {
     138         assertFalse(test.similaryName("Unnecessary Name", "Third"));
     139     }
    132140}
Note: See TracChangeset for help on using the changeset viewer.