Ticket #1313 (closed defect: fixed)

Opened 18 months ago

Last modified 15 months ago

jdbc: org.postgis.Point.equals() is not reflexive

Reported by: slava Owned by: pramsey
Priority: high Milestone: PostGIS 2.0.0
Component: java Version: 1.5.X
Keywords: Cc:

Description

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?.

Change History

Changed 17 months ago by strk

  • owner changed from pramsey to delawen
  • component changed from postgis to Java bindings

Changed 15 months ago by pramsey

  • owner changed from delawen to pramsey

Trunk at r9211

1.5 branch at r9212

Changed 15 months ago by pramsey

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.