Op 06-02-2023 om 16:31 schreef Taavi Ilves:
HiI would have submitted the bug to JIRA, but I could not join it: "Your email address ***@***.*** doesn't have access because osgeo-org.atlassian.net has reached its license limit." Anyway, I'm not 100% sure if this had been actionable bug, since `geojson-store` is under `modules/unsupported`, but here is my issue. GeoJSONDataStore dies with StackOverflowError when given this geojson: ``` { "type": "FeatureCollection", "features": [] } ``` AFAIK this is totally legit according to https://www.rfc-editor.org/rfc/rfc7946#section-3.3 :The value of "features" is a JSON array. Each element of the array is a Feature object as defined above. It is possible for this array to be empty.I reproduced with this GeoJSONDataStoreTest test (simplified test from testFeatures() from same file): ``` @Test public void testEmptyFeatures() throws IOException { URL url = TestData.url(GeoJSONDataStore.class, "empty-featureCollection.json"); GeoJSONDataStore fds = new GeoJSONDataStore(url); String type = fds.getNames().get(0).getLocalPart(); fds.getFeatureReader(new Query(type), null); } ``` Code changes and stacktrace is here as well: https://gist.github.com/ilvez/ff4325c0fe8bc67e7b3bb8c3795ca373 Cheers, Taavi
it seems to be bouncing back and forth trying to determine the schema; but that is never going to succeed without any feature so it continues to try until exhaustion.
the reader could short-circuit on an empty collection, but you'd end up without a schema, which is pretty much useless in geotools... personally I'd prefer to fail with an exception early instead.
This could be because the original 2008 geojson spec did not allow an empty array for features.
not sure what you mean with "actionable bug"; this is a community project, basically anyone can propose a solution for this bug
-M _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
