Changeset 11192 in josm


Ignore:
Timestamp:
2016-10-30T15:25:57+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #13870 - robustness against https://bugs.openjdk.java.net/browse/JI-9044959

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r10919 r11192  
    889889                } catch (PatternSyntaxException e) {
    890890                    throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e);
    891                 } catch (IllegalArgumentException e) {
     891                } catch (IllegalArgumentException | StringIndexOutOfBoundsException e) {
     892                    // StringIndexOutOfBoundsException catched because of https://bugs.openjdk.java.net/browse/JI-9044959
     893                    // See #13870: To remove after we switch to a version of Java which resolves this bug
    892894                    throw new ParseError(tr(rxErrorMsgNoPos, s, e.getMessage()), e);
    893895                }
  • trunk/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java

    r10373 r11192  
    99import org.junit.Rule;
    1010import org.junit.Test;
     11import org.openstreetmap.josm.actions.search.SearchAction.SearchSetting;
    1112import org.openstreetmap.josm.actions.search.SearchCompiler.Match;
    1213import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError;
     
    449450        assertTrue(SearchCompiler.compile(search2).match(tag2));
    450451    }
     452
     453    /**
     454     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13870">Bug #13870</a>.
     455     * @throws ParseError always
     456     */
     457    @Test(expected = ParseError.class)
     458    public void testPattern13870() throws ParseError {
     459        // https://bugs.openjdk.java.net/browse/JI-9044959
     460        SearchSetting setting = new SearchSetting();
     461        setting.regexSearch = true;
     462        setting.text = "[";
     463        SearchCompiler.compile(setting);
     464    }
    451465}
Note: See TracChangeset for help on using the changeset viewer.