Ignore:
Timestamp:
2017-01-09T23:57:47+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14217 - replace recursive filter parsing by iterative approach to avoid StackOverflowError for very long filters (~3000 logical operators)

File:
1 edited

Legend:

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

    r11324 r11447  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertFalse;
     6import static org.junit.Assert.assertNotNull;
    67import static org.junit.Assert.assertTrue;
    78import static org.junit.Assert.fail;
    89
     10import java.nio.charset.StandardCharsets;
     11import java.nio.file.Files;
     12import java.nio.file.Paths;
     13
    914import org.junit.Rule;
    1015import org.junit.Test;
     16import org.openstreetmap.josm.TestUtils;
    1117import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
    1218import org.openstreetmap.josm.actions.search.SearchCompiler.Match;
     
    8389    }
    8490
    85     protected OsmPrimitive newPrimitive(String key, String value) {
     91    private static OsmPrimitive newPrimitive(String key, String value) {
    8692        final Node p = new Node();
    8793        p.put(key, value);
     
    466472        SearchCompiler.compile(setting);
    467473    }
     474
     475    /**
     476     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/14217">Bug #14217</a>.
     477     * @throws Exception never
     478     */
     479    @Test
     480    public void testTicket14217() throws Exception {
     481        assertNotNull(SearchCompiler.compile(new String(Files.readAllBytes(
     482                Paths.get(TestUtils.getRegressionDataFile(14217, "filter.txt"))), StandardCharsets.UTF_8)));
     483    }
    468484}
Note: See TracChangeset for help on using the changeset viewer.