You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by dw...@apache.org on 2010/10/27 16:31:24 UTC
svn commit: r1027976 -
/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
Author: dwoods
Date: Wed Oct 27 14:31:24 2010
New Revision: 1027976
URL: http://svn.apache.org/viewvc?rev=1027976&view=rev
Log:
OPENJPA-1312 Incorrect hashcode()/equals() implementation(s) in SelectImpl. Patch contributed by Heath Thomann.
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=1027976&r1=1027975&r2=1027976&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java Wed Oct 27 14:31:24 2010
@@ -2282,10 +2282,10 @@ public class SelectImpl
}
public int hashCode() {
- return _path.hashCode() ^ _key.hashCode();
+ return ((_path == null) ? 0 : _path.hashCode()) ^ ((_key == null) ? 0 : _key.hashCode());
}
- public boolean equals(Object other) {
+ public boolean equals_(Object other) {
if (other == null)
return false;
if (other == this)
@@ -2293,6 +2293,8 @@ public class SelectImpl
if (other.getClass() != getClass())
return false;
Key k = (Key) other;
+ if (k._key == null || k._path == null || _key == null || _path == null)
+ return false;
return k._path.equals(_path) && k._key.equals(_key);
}