UomRescaleStyleVisitor should handle gracefully ConstExpression.NULL

Description

Was testing JAI error logging using ImageLab - and noticed this example is broken:
1. Run ImageLab
2. Fill in raster with natural earth GeoTIFF
3. Fill in shapefile with natural earth countries

The resulting stack trace is:

SEVERE: Invalid empty measure '', was expecting a number, eventually followed by px, m or ft
java.lang.IllegalArgumentException: Invalid empty measure '', was expecting a number, eventually followed by px, m or ft
at org.geotools.styling.visitor.Measure.processLiteralExpression(Measure.java:97)
at org.geotools.styling.visitor.Measure.<init>(Measure.java:63)
at org.geotools.styling.visitor.UomRescaleStyleVisitor.rescale(UomRescaleStyleVisitor.java:92)
at org.geotools.styling.visitor.UomRescaleStyleVisitor.rescale(UomRescaleStyleVisitor.java:170)
at org.geotools.styling.visitor.UomRescaleStyleVisitor.rescaleFill(UomRescaleStyleVisitor.java:211)
at org.geotools.styling.visitor.UomRescaleStyleVisitor.visit(UomRescaleStyleVisitor.java:204)
at org.geotools.styling.PolygonSymbolizerImpl.accept(PolygonSymbolizerImpl.java:140)
at org.geotools.styling.visitor.DuplicatingStyleVisitor.copy(DuplicatingStyleVisitor.java:471)
at org.geotools.styling.visitor.DuplicatingStyleVisitor.visit(DuplicatingStyleVisitor.java:278)
at org.geotools.renderer.lite.StreamingRenderer.rescaleFeatureTypeStyle(StreamingRenderer.java:2281)
at org.geotools.renderer.lite.StreamingRenderer.applyUnitRescale(StreamingRenderer.java:2142)
at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1958)
at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:813)
at org.geotools.swing.RenderingTask.call(RenderingTask.java:106)
at org.geotools.swing.RenderingTask.call(RenderingTask.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:19 PM

CodeHaus Comment From: aaime - Time: Sun, 11 May 2014 10:01:41 -0500
---------------------
The problem style is indeed problem, it has a GraphicFill inside which has a empty, but not null, displacementX/displacementY: it just makes no sense.

What seems to be broken, to me, it's Displacement.NULL, which is the source cause of this issue: it was meant to avoid null checks, it just ends up creating a variant of an NPE.

I'm going to make the style visitor more tolerant to this kind of abuse...

codehaus
April 10, 2015, 3:19 PM

CodeHaus Comment From: jgarnett - Time: Mon, 12 May 2014 12:48:31 -0500
---------------------
I was able to patch locally UomRescaleStyleVisitor with:

codehaus
April 10, 2015, 3:19 PM

CodeHaus Comment From: aaime - Time: Mon, 12 May 2014 12:52:31 -0500
---------------------
Jody, I already committed a fix yesterday?

codehaus
April 10, 2015, 3:19 PM

CodeHaus Comment From: jgarnett - Time: Mon, 12 May 2014 13:08:54 -0500
---------------------
Thanks Andrea, I will update and proceed with my work.

Aside: I was looking at Stroke.DEFAULT and Stroke. NULL, and Fill.DEFAULT vs Fill.NULL - this all seems a bit complicated.

Andrea Aime
February 15, 2017, 11:35 AM

Mass transitioning all resolved issues that have not been updated in the last month to closed state

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Fix versions

Affects versions

Priority

Medium
Configure