1

I am using GeoServer 2.15.2. With this as the "ogc:Filter" in my "FeatureTypeStyle" element ...

<ogc:PropertyIsEqualTo>
  <ogc:Function name="PropertyExists">
    <ogc:Literal>foo</ogc:Literal>
  </ogc:Function>
  <ogc:Literal>true</ogc:Literal>
</ogc:PropertyIsEqualTo>

... and GeoServer throws a NullPointerException (NPE):

2019-09-10 14:37:16,615 [http-apr-81-exec-9] ERROR - null [org.geotools.renderer.lite] java.lang.NullPointerException: null at org.geotools.filter.function.PropertyExistsFunction.evaluate(PropertyExistsFunction.java:94) at blah, blah, blah

The error occurs when attempting to view the layer via "Layer Preview" in the GeoServer web app.

Has anyone successfully used this function (lately) and if so can you provide a sample?

I tried a couple different spatial data sources, one being a layer in a GeoPackage and the other a ShapeFile just for kicks. Both result in an NPE.

Update - 2019-09-11:

This is the extent of the stack trace while still in the "geotools" package. The remaining 125 lines are outside of "geotools" in the geoserver, tomcat and spring packages (and I don't think that portion is helpful).

2019-09-10 14:37:16,615 [http-apr-81-exec-9] ERROR - null [org.geotools.renderer.lite] java.lang.NullPointerException: null at org.geotools.filter.function.PropertyExistsFunction.evaluate(PropertyExistsFunction.java:94) at org.geotools.filter.visitor.SimplifyingFilterVisitor.visit(SimplifyingFilterVisitor.java:477) at org.geotools.filter.FunctionExpressionImpl.accept(FunctionExpressionImpl.java:143) at org.geotools.filter.visitor.DuplicatingFilterVisitor.visit(DuplicatingFilterVisitor.java:125) at org.geotools.filter.visitor.DuplicatingFilterVisitor.visit(DuplicatingFilterVisitor.java:170) at org.geotools.filter.visitor.SimplifyingFilterVisitor.visit(SimplifyingFilterVisitor.java:557) at org.geotools.filter.IsEqualsToImpl.accept(IsEqualsToImpl.java:154) at org.geotools.filter.visitor.SimplifyingFilterVisitor.collect(SimplifyingFilterVisitor.java:228) at org.geotools.filter.visitor.SimplifyingFilterVisitor.visit(SimplifyingFilterVisitor.java:160) at org.geotools.filter.AndImpl.accept(AndImpl.java:45) at org.geotools.renderer.lite.StreamingRenderer.getStyleQuery(StreamingRenderer.java:1302) at org.geotools.renderer.lite.StreamingRenderer.getFeatures(StreamingRenderer.java:2192) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:2156) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:892)

Example feature the produces error:

wkt_geom    fid
LineString (-78.20535245444592931 38.73629880547370163, -78.20466261356823168 38.73735892913973089) 1

Full SLD that produces error:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
 xmlns="http://www.opengis.net/sld" 
 xmlns:ogc="http://www.opengis.net/ogc" 
 xmlns:xlink="http://www.w3.org/1999/xlink" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NamedLayer>
    <Name>test line</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
            <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
              <ogc:PropertyIsEqualTo>
                <ogc:Function name="PropertyExists">
                  <ogc:Literal>foo</ogc:Literal>
                </ogc:Function>
                <ogc:Literal>true</ogc:Literal>
              </ogc:PropertyIsEqualTo>
            </ogc:Filter>
            <LineSymbolizer>
              <Stroke>
                <CssParameter name="stroke">#0000FF</CssParameter>
              </Stroke>
            </LineSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

Looking at line 94 of PropertyExistsFunction suggests that your feature is not simple and may well be null.

To be sure of what is happening we need to see the "blah, blah, blah" part of your log and an example feature.

  • I created a two feature, line string layer in a geopackage and was able to produce the the error. I updated my original post, above, with an example of one of the two features. – Bruce Loth Sep 11 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.