Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/GeoJSONReader.java
r17185 r17356 45 45 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 46 46 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 47 import org.openstreetmap.josm.tools.CheckParameterUtil; 47 48 import org.openstreetmap.josm.tools.Logging; 48 49 import org.openstreetmap.josm.tools.Utils; … … 85 86 .orElseThrow(() -> new IllegalDataException("No type")).getString()) { 86 87 case "FeatureCollection": 88 JsonValue.ValueType valueType = object.get(FEATURES).getValueType(); 89 CheckParameterUtil.ensureThat(valueType == JsonValue.ValueType.ARRAY, "features must be ARRAY, but is " + valueType); 87 90 parseFeatureCollection(object.getJsonArray(FEATURES)); 88 91 break; -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java
r17275 r17356 216 216 } 217 217 218 /** 219 * Tests error reporting for an invalid FeatureCollection 220 * @throws Exception in case of error 221 */ 222 @Test 223 void testInvalidFeatureCollection() throws Exception { 224 String featureCollection = "{\"type\": \"FeatureCollection\", \"features\": {}}"; 225 try (InputStream in = new ByteArrayInputStream(featureCollection.getBytes(StandardCharsets.UTF_8))) { 226 IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, 227 () -> new GeoJSONReader().doParseDataSet(in, null)); 228 assertEquals("features must be ARRAY, but is OBJECT", exception.getMessage()); 229 } 230 } 231 218 232 }
Note:
See TracChangeset
for help on using the changeset viewer.