[postgis-devel] [PostGIS] #1313: jdbc: org.postgis.Point.equals() is not reflexive

PostGIS trac at osgeo.org
Mon Nov 21 07:23:15 PST 2011


#1313: jdbc: org.postgis.Point.equals() is not reflexive
---------------------+------------------------------------------------------
 Reporter:  slava    |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  high     |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  1.5.X        
 Keywords:           |  
---------------------+------------------------------------------------------
 The following test fails:
 {{{
 > cat test.java
 import org.postgis.Point;

 class test
 {
     public static void main(String[] args)
                 {
                         Point p = new Point(1, 2, Double.NaN);
                         assert p.equals(p) : "Equals must be reflexive";
                         System.out.println("Ok");
                 }
 }

 > javac -classpath postgis-2.0.0SVN.jar test.java && java -classpath
 postgis-2.0.0SVN.jar:. -ea test
 Exception in thread "main" java.lang.AssertionError: Equals must be
 reflexive
         at test.main(test.java:8)

 }}}
 There is a bug in Point.equals definition: it does not work as expected if
 the point contains NaN data field, violating on of the basic equals rule:
 reflexivity.

 The practical implication of the bug is for example eclipse databingins
 going into infinite loop firing notification for such a point ending in
 StackOverflowError.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1313>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list