Skip to main content
1 of 4

Rendering sld style(buffer) SEVERE null java.lang.NegativeArraySizeException

Can somebody help me with this error, it throws it when rendering an object and styling it with use of a buffer (sld style, wkt string). So I suppose that some problem is with buffering but was unable to figure out what is happening to solve it. Buffer values are mostly between -5 and -0.3. Example from sld file is bellow. Is it posible to this happens because of small values of the "Slope"?

SEVERE  null
java.lang.NegativeArraySizeException
    at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75)
    at java.awt.image.Raster.createPackedRaster(Raster.java:467)
    at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
    at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
    at org.geotools.renderer.style.SLDStyleFactory.markToTilableImage(SLDStyleFactory.java:1229)
    at org.geotools.renderer.style.SLDStyleFactory.getTexturePaint(SLDStyleFactory.java:1171)
    at org.geotools.renderer.style.SLDStyleFactory.getPaint(SLDStyleFactory.java:1093)
    at org.geotools.renderer.style.SLDStyleFactory.setPolygonStyleFill(SLDStyleFactory.java:481)
    at org.geotools.renderer.style.SLDStyleFactory.createPolygonStyle(SLDStyleFactory.java:436)
    at org.geotools.renderer.style.SLDStyleFactory.createStyleInternal(SLDStyleFactory.java:375)
    at org.geotools.renderer.style.SLDStyleFactory.createStyle(SLDStyleFactory.java:328)
    at org.geotools.renderer.style.SLDStyleFactory.createStyle(SLDStyleFactory.java:291)
    at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:2569)
    at org.geotools.renderer.lite.StreamingRenderer.processFeature(StreamingRenderer.java:2453)
    at org.geotools.renderer.lite.StreamingRenderer.drawPlain(StreamingRenderer.java:2309)
    at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1930)
    at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:834)
    at org.geotools.swing.RenderingTask.call(RenderingTask.java:106)
    at org.geotools.swing.RenderingTask.call(RenderingTask.java:41)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

Example from sld

<Rule>
    <Name>Public building</Name>
    <Title>g</Title>
    <ogc:Filter> 
        <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>THEME_ID</ogc:PropertyName>
            <ogc:Literal>729</ogc:Literal> 
        </ogc:PropertyIsEqualTo> 
    </ogc:Filter> 
    <PolygonSymbolizer>
        <Geometry>
            <ogc:Function name="buffer">
                <ogc:PropertyName>the_geom</ogc:PropertyName>
                <ogc:PropertyName>Buffer</ogc:PropertyName>
            </ogc:Function>
        </Geometry>  
        <Fill>
            <GraphicFill>
                <Graphic>
                    <Mark>
                        <WellKnownName>wkt://LINESTRING(0 0, ${sin(Slope - 45) * 20000} ${cos(Slope - 45) * 20000} )</WellKnownName>
                        <Stroke>
                            <CssParameter name="stroke">
                                <ogc:PropertyName>COLOR</ogc:PropertyName>
                            </CssParameter>
                            <CssParameter name="stroke-width">2.5</CssParameter>
                        </Stroke>
                    </Mark>
                </Graphic>
            </GraphicFill>
        </Fill>
    </PolygonSymbolizer> 
    <LineSymbolizer>
        <Stroke>
            <CssParameter name="stroke">
                <ogc:PropertyName>COLOR</ogc:PropertyName>
            </CssParameter>
            <CssParameter name="stroke-width">1</CssParameter>
        </Stroke>
    </LineSymbolizer>
</Rule>