Changeset 19646 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmJsonReader.java
r19535 r19646 65 65 66 66 private void parseRoot(JsonObject object) throws IllegalDataException { 67 parseVersion(object.get("version").toString()); 67 JsonValue version = object.get("version"); 68 parseVersion(version != null ? version.toString() : null); 68 69 parseDownloadPolicy("download", object.getString("download", null)); 69 70 parseUploadPolicy("upload", object.getString("upload", null)); -
trunk/test/unit/org/openstreetmap/josm/io/OsmJsonReaderTest.java
r18816 r19646 260 260 } 261 261 262 /** 263 * Non-regression test for ticket #24927. GeoJSON served as {@code application/json} (e.g. by Postpass) 264 * must be reported as illegal data, not crash the reader. 265 */ 266 @Test 267 void testTicket24927() { 268 byte[] geoJson = ("{\"type\": \"FeatureCollection\", \"features\": [{\"type\": \"Feature\", " + 269 "\"geometry\": {\"type\": \"Point\", \"coordinates\": [10.1, 20.2]}, " + 270 "\"properties\": {\"tags\": {\"fixme\": \"yes\"}}}]}").getBytes(StandardCharsets.UTF_8); 271 IllegalDataException exception = assertThrows(IllegalDataException.class, 272 () -> OsmJsonReader.parseDataSet(new ByteArrayInputStream(geoJson), NullProgressMonitor.INSTANCE)); 273 assertEquals("Missing mandatory attribute 'version'.", exception.getMessage()); 274 } 275 262 276 static Stream<Arguments> testException() { 263 277 final byte[] smallJson = "{\"type\", \"node\", \"id\": 1, \"lat\": 1.0, \"lon\": 2.0}".getBytes(StandardCharsets.UTF_8);
Note:
See TracChangeset
for help on using the changeset viewer.
