Regression: SHAPE-ZIP output format goes NPE on null geometry values


This is a regression, the old code used to skip features with empty geometries, in a large refactor around 2.9.x this check disappeared, and it's now causing:




Andrea Aime
March 18, 2017, 2:31 PM

I did check, the writer can write null geometries, but I noticed that on read the code tries to create empty, but non null geometries, e.g., a point with all Double.NaN values.
So this change of behavior won't be fully transparent to those using Geotools to read the shapefiles. Still, probably worth implementing anyways with some notice.

Andrea Aime
March 21, 2017, 9:39 AM

I don't remember hearing any complains about the null value skip, and some might be burned by the different behavior. My take: write nulls on master, but skip them on stable and maintenance instead.

Nuno Oliveira
March 22, 2017, 9:20 AM
Jukka Rahkonen
March 22, 2017, 9:39 AM

The change may not be totally safe because all shapefile readers do not necessarily know how to handle null geometries right. Some implementation may skip the geometry but keep the corresponding row from dbf which would be unhappy.
But anyway, if data contains null geometries and WFS sends null geometries as GML I would say the writing null geometries into shp-zip is correct.

+1 for starting to write nulls on master but keep the skip strategy on stable and maintenance.


Nuno Oliveira


Andrea Aime


Fix versions

Affects versions