[Geoserver-devel] [JIRA] (GEOS-7216) WFS GetCapabilities if published layer has no geometry

Stefano Costa created an issue

GeoServer / BugGEOS-7216

WFS GetCapabilities if published layer has no geometry

Issue Type:

BugBug

Affects Versions:

2.8-RC1, 2.7.2

Assignee:

Stefano Costa

Attachments:

geologic_event.zip

Components:

WFS

Created:

25/Sep/15 7:42 PM

Priority:

LowLow

Reporter:

Stefano Costa

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:

  1. 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

  1. 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.

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v7.0.0-OD-06-002#70102-sha1:82bb17d)

Atlassian logo