GeoServer
  1. GeoServer
  2. GEOS-1365

GeoJSON Output format - null pointer error when the geometry property is not required

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0-beta3
    • Fix Version/s: 1.6.0-beta4
    • Component/s: WFS
    • Labels:
      None
    • Environment:
      windows XP - Geoserver.exe installer
    • Number of attachments :
      0

      Description

      The GetFeature method cause a NullPointer exception when the geometry properties is not specified.
      This does happen only with outputFormat=json

      example query based on the included demo (1.6.0-beta3)

      <!-- Performs a between filter to find the states with an area
      between 100,000 and 150,000.
      Also, it just returns the STATE_NAME, LAND_KM, and geometry
      (instead of all the attributes).
      -->
      <wfs:GetFeature service="WFS" version="1.0.0"
      outputFormat="json"
      xmlns:topp="http://www.openplans.org/topp"
      xmlns:wfs="http://www.opengis.net/wfs"
      xmlns:ogc="http://www.opengis.net/ogc"
      xmlns:gml="http://www.opengis.net/gml"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.opengis.net/wfs
      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
      <wfs:Query typeName="topp:states">
      <ogc:PropertyName>topp:STATE_NAME</ogc:PropertyName>
      <ogc:PropertyName>topp:LAND_KM</ogc:PropertyName>
      <ogc:Filter>
      <ogc:PropertyIsBetween>
      <ogc:PropertyName>topp:LAND_KM</ogc:PropertyName>
      <ogc:LowerBoundary><ogc:Literal>100000</ogc:Literal></ogc:LowerBoundary>
      <ogc:UpperBoundary><ogc:Literal>150000</ogc:Literal></ogc:UpperBoundary>
      </ogc:PropertyIsBetween>
      </ogc:Filter>
      </wfs:Query>
      </wfs:GetFeature>

      RESULT:

      <ServiceExceptionReport version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">

      <ServiceException>

      java.lang.NullPointerException
      java.lang.NullPointerException
      </ServiceException>
      </ServiceExceptionReport>

        Activity

        Hide
        claudio silvestri added a comment -

        The only work around I have found is to add (before the filter)

        <ogc:PropertyName>topp:the_geom</ogc:PropertyName>

        but this cause an overhead

        Show
        claudio silvestri added a comment - The only work around I have found is to add (before the filter) <ogc:PropertyName>topp:the_geom</ogc:PropertyName> but this cause an overhead
        Hide
        Chris Holmes added a comment -

        Ok, one more json one. There is some debate on what to do with GeoJSON that doesn't have geometries. But for this case we should do something, either return some degenerate GeoJSON (but valid json), or we should raise an error saying that json doesn't support not returning the geometry property.

        Show
        Chris Holmes added a comment - Ok, one more json one. There is some debate on what to do with GeoJSON that doesn't have geometries. But for this case we should do something, either return some degenerate GeoJSON (but valid json), or we should raise an error saying that json doesn't support not returning the geometry property.
        Hide
        Arne Kepp added a comment -

        After a short discussion we (cholmes, myself) have decided to return 'geometry':null in this case.

        Show
        Arne Kepp added a comment - After a short discussion we (cholmes, myself) have decided to return 'geometry':null in this case.
        Hide
        Arne Kepp added a comment -

        Fixed in revision 7616, does not return 'geometry_name' property when geometry is not specified, and sets 'geometry':null

        Show
        Arne Kepp added a comment - Fixed in revision 7616, does not return 'geometry_name' property when geometry is not specified, and sets 'geometry':null

          People

          • Assignee:
            Arne Kepp
            Reporter:
            claudio silvestri
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: