Error painting LegendGraphic with negative scale

Description

Calling StyledShapePainter.paint for an SLD LegendGraphic element with a negative scale will result in an IllegalArgumentException. This is a problem because GeoServer GetLegendGraphic requests use -1 as the default scale.

This issue is linked to https://jira.codehaus.org/browse/GEOS-6941 - https://jira.codehaus.org/browse/GEOS-6941

A patch with a junit test is attached.

Stack Trace:

java.lang.IllegalArgumentException: Width (-20) and height (-20) must be > 0
at java.awt.image.SampleModel.<init>(SampleModel.java:126)
at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146)
at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
at java.awt.image.Raster.createInterleavedRaster(Raster.java:641)
at java.awt.image.Raster.createInterleavedRaster(Raster.java:278)
at java.awt.image.BufferedImage.<init>(BufferedImage.java:399)
at org.geotools.renderer.lite.StyledShapePainter.paint(StyledShapePainter.java:365)

Environment

None

Assignee

Unassigned

Reporter

Jody Garnett

Triage

None

Components

Fix versions

Priority

Medium
Configure