Ticket #1313 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.
