The class org.geoserver.wfs.CapabilitiesTransformer assumes that a lat/lon BBOX is always available for a published layer; if by any chance this is not true, a NPE will be thrown at line 1572 (the last line in the snippet below):
Envelope bbox = null;
bbox = featureType.getLatLonBoundingBox();
start("ows:WGS84BoundingBox");
element("ows:LowerCorner", bbox.getMinX() + " " + bbox.getMinY());
One could argue that to publish a layer without defining a bbox is a configuration error. However, there are situations where this could happen with no fault on the user’s side, e.g. when a feature type with no geometry attribute is published through the REST interface.
Steps to reproduce:
- Run the following request cURL command using the attached dataset:
curl -v -u admin:geoserver -XPUT --data-binary @geologic_event.zip -H "Content-Type: application/zip" http://localhost:8080/geoserver/rest/workspaces/cite/datastores/geologic_event/file.properties?configure=all
- Make a WFS GetCapabilities request:
curl -XGET "http://localhost:8080/geoserver/ows?service=wfs&version=1.1.0&request=GetCapabilities"
The outcome will be:
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.io.IOExceptionjava.lang.NullPointerException</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
The NPE could be easily avoided by setting the lat/lon bbox to a reasonable default value, like 0,0,1,1.
|