Thanks for the response. Yep, I also would prefer it failing early on over how it dies at the moment. Previously (pre-24.3 or something like that), it failed with NullPointerException. I didn't know about that 2008 spec was explicit about non-empty features array, that probably could be it.
About "actionable bug" I thought that code that fails is under "unmaintained" directory so I didn't know what it means. And whether filing bug, which was my first reaction, would even make sense because it being unmaintained. I could propose change, but I'm not very familiar with Geotools inner architecture to understand where the fix belongs, would it still through error or give some other meaningful result? If someone could point me in right direction with small explanation, it would be helpful. Cheers, Taavi On Tue, Feb 7, 2023 at 9:11 PM mark <mc.pr...@gmail.com> wrote: > > Op 06-02-2023 om 16:31 schreef Taavi Ilves: > > Hi > > > > I 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 > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users _______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users