diff --git a/src/org/openstreetmap/josm/actions/search/SearchCompiler.java b/src/org/openstreetmap/josm/actions/search/SearchCompiler.java index b16ffb3..f9946d3 100644 --- a/src/org/openstreetmap/josm/actions/search/SearchCompiler.java +++ b/src/org/openstreetmap/josm/actions/search/SearchCompiler.java @@ -182,13 +182,14 @@ public class SearchCompiler { long maxDate = rangeA2.isEmpty() ? System.currentTimeMillis() : DateUtils.fromString(rangeA2).getTime(); return new TimestampRange(minDate, maxDate); } else { - // I18n: Don't translate timestamp keyword - throw new ParseError(tr("Expecting min/max after ''timestamp''")); + throw new ParseError("" + tr("Expecting {0} after {1}", "min/max", "timestamp")); } } + } else { + throw new ParseError(tr("" + "Expecting {0} after {1}", ":", "" + keyword + "")); } } - return null; + throw new IllegalStateException("Not expecting keyword " + keyword); } @Override diff --git a/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java b/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java index 9c9463b..2f5a332 100644 --- a/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java +++ b/test/unit/org/openstreetmap/josm/actions/search/SearchCompilerTest.java @@ -1,6 +1,7 @@ // License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.actions.search; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -378,4 +379,14 @@ public class SearchCompilerTest { anonymous.match(anonymous.n1, false); anonymous.match(anonymous.n2, true); } + + @Test + public void testFooTypeBar() throws Exception { + try { + SearchCompiler.compile("foo type bar"); + throw new RuntimeException(); + } catch (ParseError parseError) { + assertEquals("Expecting : after type", parseError.getMessage()); + } + } }