Changeset 13336 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r13335 r13336 402 402 */ 403 403 public static String fixQuery(String query) { 404 return query.replaceFirst("out( body| skel| ids)?( id| qt)?;", "out meta$2;"); 404 return query == null ? query : query 405 .replaceFirst("out( body| skel| ids)?( id| qt)?;", "out meta$2;") 406 .replaceFirst("(?s)\\[out:(json|csv)[^\\]]*\\]", "[out:xml]"); 405 407 } 406 408 } -
trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java
r13335 r13336 8 8 import static org.junit.Assert.assertEquals; 9 9 import static org.junit.Assert.assertNotNull; 10 import static org.junit.Assert.assertNull; 10 11 import static org.junit.Assert.assertTrue; 11 12 … … 181 182 @Test 182 183 public void testFixQuery() { 184 assertNull(OverpassDownloadReader.fixQuery(null)); 185 183 186 assertEquals("out meta;", OverpassDownloadReader.fixQuery("out;")); 184 187 assertEquals("out meta;", OverpassDownloadReader.fixQuery("out body;")); … … 196 199 assertEquals("out meta qt;", OverpassDownloadReader.fixQuery("out ids qt;")); 197 200 198 assertEquals("[timeout:25];\n" + 201 assertEquals("[out:xml]", OverpassDownloadReader.fixQuery("[out:json]")); 202 assertEquals("[out:xml]", OverpassDownloadReader.fixQuery("[out:csv(\n" + 203 " ::\"id\", amenity, name, operator, opening_hours, \"contact:website\", \"contact:phone\", brand, dispensing, lastcheck\n" + 204 " )]")); 205 206 assertEquals("[out:xml][timeout:25];\n" + 199 207 "(\n" + 200 208 " node[\"historic\"=\"ringfort\"];\n" + … … 202 210 ");\n" + 203 211 "out meta;", 204 OverpassDownloadReader.fixQuery("[ timeout:25];\n" +212 OverpassDownloadReader.fixQuery("[out:xml][timeout:25];\n" + 205 213 "(\n" + 206 214 " node[\"historic\"=\"ringfort\"];\n" +
Note:
See TracChangeset
for help on using the changeset viewer.