Pim de Heer ( 
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=5f75857ab61f66006fff5664
 ) *created* an issue

GeoServer ( 
https://osgeo-org.atlassian.net/browse/GEOS?atlOrigin=eyJpIjoiM2NkMzMzMmMzYWQxNDllYmI4ODYyYzJhZGZkMDU4MDQiLCJwIjoiaiJ9
 ) / Bug ( 
https://osgeo-org.atlassian.net/browse/GEOS-10820?atlOrigin=eyJpIjoiM2NkMzMzMmMzYWQxNDllYmI4ODYyYzJhZGZkMDU4MDQiLCJwIjoiaiJ9
 ) GEOS-10820 ( 
https://osgeo-org.atlassian.net/browse/GEOS-10820?atlOrigin=eyJpIjoiM2NkMzMzMmMzYWQxNDllYmI4ODYyYzJhZGZkMDU4MDQiLCJwIjoiaiJ9
 ) NullPointerException in GetLegendGraphic endpoint for JSON format on a 
TextSymbolizer ( 
https://osgeo-org.atlassian.net/browse/GEOS-10820?atlOrigin=eyJpIjoiM2NkMzMzMmMzYWQxNDllYmI4ODYyYzJhZGZkMDU4MDQiLCJwIjoiaiJ9
 )

Issue Type: Bug Affects Versions: 2.21.0 Assignee: Unassigned Components: WMS 
Created: 12/Jan/23 3:50 PM Priority: Low Reporter: Pim de Heer ( 
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=5f75857ab61f66006fff5664
 )

When requesting the legend graphic in application/json format like this:

wms?service=WMS&version=1.3.0&request=GetLegendGraphic&layer={layername}&format=application/json

A NullPointerException like the one below will appear when the style attached 
to the layer has a TextSymbolizer in one of the rules, where some of the 
default properties are left out (which is allowed, the style does work on the 
getMap requests). This is in SLD style format
When all properties are explicitly put in the style, the endpoint works 
correctly.

Example where it goes wrong:

<se:Rule>
          <se:Name>label</se:Name>
         <se:Description>
           <se:Title>label</se:Title>
         </se:Description>
         <se:TextSymbolizer>
           <se:Label>
             <ogc:PropertyName>spot_number</ogc:PropertyName>
           </se:Label>
           <se:Font>
             <se:SvgParameter name= "font-family" >MS Shell Dlg 
2</se:SvgParameter>
             <se:SvgParameter name= "font-size" >12</se:SvgParameter>
           </se:Font>
           <se:LabelPlacement>
             <se:PointPlacement>
               <se:AnchorPoint>
                 <se:AnchorPointX>0.5</se:AnchorPointX>
                 <se:AnchorPointY>0.5</se:AnchorPointY>
               </se:AnchorPoint>

             </se:PointPlacement>
           </se:LabelPlacement>
                        
         </se:TextSymbolizer>
       </se:Rule>

Example where it goes right:

<se:Rule>
          <se:Name>label</se:Name>
         <se:Description>
           <se:Title>label</se:Title>
         </se:Description>
         <se:TextSymbolizer>
           <se:Label>
             <ogc:PropertyName>spot_number</ogc:PropertyName>
           </se:Label>
           <se:Font>
             <se:SvgParameter name= "font-family" >MS Shell Dlg 
2</se:SvgParameter>
             <se:SvgParameter name= "font-size" >12</se:SvgParameter>
           </se:Font>
           <se:LabelPlacement>
             <se:PointPlacement>
               <se:AnchorPoint>
                 <se:AnchorPointX>0.5</se:AnchorPointX>
                 <se:AnchorPointY>0.5</se:AnchorPointY>
               </se:AnchorPoint>
               <se:Rotation>0</se:Rotation>
             </se:PointPlacement>
           </se:LabelPlacement>
                        <se:Fill>
           <se:CssParameter name= "fill" >#990099</se:CssParameter>
             <se:CssParameter name= "opacity" >1</se:CssParameter>
         </se:Fill>
         </se:TextSymbolizer>
       </se:Rule>

I've seen it happen on <Rotation> and <Fill> -> cssprop fill/<Fill> ->cssprop 
opacity

java.lang.NullPointerException
        at 
org.geoserver.wms.legendgraphic.JSONLegendGraphicBuilder.toJSONValue(JSONLegendGraphicBuilder.java:411)
        at 
org.geoserver.wms.legendgraphic.JSONLegendGraphicBuilder.processTextSymbolizer(JSONLegendGraphicBuilder.java:872)
        at 
org.geoserver.wms.legendgraphic.JSONLegendGraphicBuilder.processSymbolizer(JSONLegendGraphicBuilder.java:809)
        at 
org.geoserver.wms.legendgraphic.JSONLegendGraphicBuilder.buildLegendGraphic(JSONLegendGraphicBuilder.java:359)
        at 
org.geoserver.wms.legendgraphic.JSONLegendGraphicBuilder.buildLegendGraphic(JSONLegendGraphicBuilder.java:81)
        at 
org.geoserver.wms.legendgraphic.JSONLegendOutputFormat.produceLegendGraphic(JSONLegendOutputFormat.java:40)
        at 
org.geoserver.wms.legendgraphic.JSONLegendOutputFormat.produceLegendGraphic(JSONLegendOutputFormat.java:20)

( 
https://osgeo-org.atlassian.net/browse/GEOS-10820#add-comment?atlOrigin=eyJpIjoiM2NkMzMzMmMzYWQxNDllYmI4ODYyYzJhZGZkMDU4MDQiLCJwIjoiaiJ9
 ) Add Comment ( 
https://osgeo-org.atlassian.net/browse/GEOS-10820#add-comment?atlOrigin=eyJpIjoiM2NkMzMzMmMzYWQxNDllYmI4ODYyYzJhZGZkMDU4MDQiLCJwIjoiaiJ9
 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( 
https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail
 ) or iOS ( 
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8
 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100214- 
sha1:b03f6a4 )
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to