-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GeoJsonReader to handle empty arrays (#600)
Signed-off-by: Martin Davis <[email protected]>
- Loading branch information
Showing
2 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
modules/io/common/src/test/java/org/locationtech/jts/io/geojson/GeoJsonReaderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2020 Martin Davis. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html | ||
* and the Eclipse Distribution License is available at | ||
* | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
*/ | ||
|
||
package org.locationtech.jts.io.geojson; | ||
|
||
import org.locationtech.jts.geom.Geometry; | ||
import org.locationtech.jts.io.ParseException; | ||
|
||
import test.jts.GeometryTestCase; | ||
|
||
public class GeoJsonReaderTest extends GeometryTestCase { | ||
|
||
public GeoJsonReader geoJsonRdr; | ||
|
||
public GeoJsonReaderTest(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public void setUp() throws Exception { | ||
this.geoJsonRdr = new GeoJsonReader(); | ||
} | ||
|
||
public void testEmptyArray() throws ParseException { | ||
runParseEx("[]"); | ||
} | ||
|
||
public void testEmptyObject() throws ParseException { | ||
runParseEx("{}"); | ||
} | ||
|
||
private void runParseEx(String json) { | ||
try { | ||
Geometry geom = geoJsonRdr.read(json); | ||
} | ||
catch (ParseException ex) { | ||
assertTrue(true); | ||
} | ||
} | ||
|
||
} |