JTS.shapeToGeometry ClassCastException typo, fixed with patch attached
----------------------------------------------------------------------

                 Key: GEOT-1813
                 URL: http://jira.codehaus.org/browse/GEOT-1813
             Project: GeoTools
          Issue Type: Bug
          Components: core geometry
            Reporter: Bruce Adam


Versions 2.3.5, 2.4.2 and latest svn trunk (as of 14/05/2008) all contain a 
class cast exception when calling org.geotools.geometry.jts.JTS.shapeToGeometry:

java.lang.ClassCastException: com.vividsolutions.jts.geom.Coordinate cannot be 
cast to [Lcom.vividsolutions.jts.geom.Coordinate;
        at org.geotools.geometry.jts.JTS.shapeToGeometry(JTS.java:451)

The following patch looks to fix the small typo, allowing the shapeToGeometry 
function to work. 

$ svn diff modules/library/api/src/main/java/org/geotools/geometry/jts/JTS.java 
Index: modules/library/api/src/main/java/org/geotools/geometry/jts/JTS.java
===================================================================
--- modules/library/api/src/main/java/org/geotools/geometry/jts/JTS.java        
(revision 30261)
+++ modules/library/api/src/main/java/org/geotools/geometry/jts/JTS.java        
(working copy)
@@ -450,7 +450,7 @@
              */
             case PathIterator.SEG_CLOSE: {
                 if (!coords.isEmpty()) {
-                    coords.add((Coordinate[]) coords.get(0));
+                    coords.add((Coordinate) coords.get(0));
                     lines.add(factory.createLinearRing(
                             (Coordinate[]) coords.toArray(new 
Coordinate[coords.size()])));
                     coords.clear();


-- 
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: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to