Changeset 18496 in josm for trunk/test/unit


Ignore:
Timestamp:
2022-06-21T18:31:54+02:00 (22 months ago)
Author:
taylor.smock
Message:

Fix #22156: ArithmeticException: / by zero in org.openstreetmap.josm.data.osm.search.SearchCompiler$Nth.match

This was caused by nth%: 0, as x % 0 will throw a divide by 0
exception.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java

    r18291 r18496  
    851851        assertFalse(c.match(OsmUtils.createPrimitive("node name=bar")));
    852852    }
     853
     854    /**
     855     * Non-regression test for JOSM #22156
     856     * x % 0 throws an ArithmeticException
     857     */
     858    @Test
     859    void testNonRegression22156() {
     860        assertThrows(SearchParseError.class, () -> SearchCompiler.compile("nth%: 0"));
     861    }
    853862}
Note: See TracChangeset for help on using the changeset viewer.