Test failures in ext/shaperenderer module when J2SE assertions are enabled
--------------------------------------------------------------------------
Key: GEOT-792
URL: http://jira.codehaus.org/browse/GEOT-792
Project: GeoTools
Type: Bug
Components: shapefilerenderer
Versions: 2.2.M2
Reporter: Martin Desruisseaux
Priority: Minor
The PolygonHandlerTest and Rendering2DTest files try to project coordinates
very far from the map projection area of validity, leading to results 2 million
meters far from the expected values. Those errors were unoticed before because
in our current configuration, Maven 1 do not enable J2SE 1.4 assertions when
running tests (which is quite unfortunate for a test suite). But our Maven 2
build do enable assertions. Consequently, the Maven 2 build reveals some errors
unoticed before. Stack trace below (note: please update to revision 17432 in
order to get the same error message. I tried to make it more explicit):
java.lang.AssertionError: The transform result may be 2,280,332.971 meters away
from the expected position. Are you sure that the input coordinates are inside
this map projection area of validity? The point is located 102°30.9'E away from
the central meridian and 0°00.0'N away from the latitude of origin.
at
org.geotools.referencing.operation.projection.MapProjection.checkTransform(MapProjection.java:503)
at
org.geotools.referencing.operation.projection.MapProjection.transform(MapProjection.java:640)
at
org.geotools.referencing.operation.projection.MapProjection.transform(MapProjection.java:675)
at
org.geotools.referencing.operation.transform.ConcatenatedTransformDirect.transform(ConcatenatedTransformDirect.java:81)
at
org.geotools.renderer.shape.GeometryHandlerUtilities.calculateSpan(GeometryHandlerUtilities.java:101)
at
org.geotools.renderer.shape.PolygonHandler.<init>(PolygonHandler.java:64)
at
org.geotools.data.shapefile.shp.PolygonHandlerTest.testRead(PolygonHandlerTest.java:64)
As the error message say, PolygonHandler tries to project a point very far from
the central meridian (too far for the Transverse Mercator "NAD83 / UTM zone
10N" projection used in this test). I have not checked, but I suspect that it
tries to project the (0,0) coordinates or something close from that. If this
hypothesis is right, than PolygonHandler should make sure that it transforms
only actual coordinates from the polygon, not "empty slot" or "dummy"
coordinates.
TIP 1: if an empty slot (filled with dummy coordinates) is needed in a float[]
or double[] buffer, it should be filled with (NaN,NaN) values instead of (0,0),
which is a valid coordinate. (NaN,NaN) coordinates should not throw any
exception or assertion failure in the referencing module (if it does, then
please let me know and I will fix that bug).
TIP 2: in order to test this issue without Maven 2, try to define the following
environmental variable and run the test suite with Maven 1. I didn't tried, but
it may work.
set MAVEN_OPTS=-ea
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel