When trying to create a SLD 1.0.0 style through the REST-API that contains a TextSymbolizer with a PointPlacement having Rotation you get a NullPointerException from the SLDTranslator.
When creating the same SLD through the admin UI it validates fine and a correct style is created.
While debugging I found that it demands an AnchorPoint. If AnchorPoint is provided the transform succeeds. According to the XSD and documentation this should not be needed.
StyledLayerDescriptor.xsd
...
<xsd:element name="PointPlacement">
<xsd:annotation>
<xsd:documentation>
A "PointPlacement" specifies how a text label should be rendered
relative to a geometric point.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="sld:AnchorPoint" minOccurs="0"/>
<xsd:element ref="sld:Displacement" minOccurs="0"/>
<xsd:element ref="sld:Rotation" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
...
Relevant stacktrace:
Caused by: java.io.IOException: Error writing style
at org.geoserver.catalog.SLDHandler.encode10(SLDHandler.java:196)
at org.geoserver.catalog.SLDHandler.encode(SLDHandler.java:182)
at org.geoserver.catalog.ResourcePool.writeStyle(ResourcePool.java:1792)
at org.geoserver.catalog.ResourcePool.writeStyle(ResourcePool.java:1776)
at org.geoserver.catalog.rest.StyleResource.handleObjectPost(StyleResource.java:150)
… 83 more
Caused by: javax.xml.transform.TransformerException: Translator error
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:137)
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:112)
at org.geoserver.catalog.SLDHandler.encode10(SLDHandler.java:193)
… 87 more
Caused by: java.lang.NullPointerException
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:344)
at org.geotools.styling.PointPlacementImpl.accept(PointPlacementImpl.java:130)
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:445)
at org.geotools.styling.TextSymbolizerImpl.accept(TextSymbolizerImpl.java:252)
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:746)
at org.geotools.styling.RuleImpl.accept(RuleImpl.java:312)
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:1085)
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:1042)
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:866)
at org.geotools.styling.SLDTransformer$SLDTranslator.visit(SLDTransformer.java:838)
at org.geotools.styling.StyledLayerDescriptorImpl.accept(StyledLayerDescriptorImpl.java:196)
at org.geotools.styling.SLDTransformer$SLDTranslator.encode(SLDTransformer.java:1220)
at org.geotools.styling.SLDTransformer$SLDTranslator.encode(SLDTransformer.java:1229)
at org.geotools.xml.transform.TransformerBase$XMLReaderSupport.parse(TransformerBase.java:1026)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
at org.geotools.xml.transform.TransformerBase$Task.run(TransformerBase.java:300)
at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:133)
… 89 more
|