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:50:27 UTC

svn commit: r1027984 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java

Author: dwoods
Date: Wed Oct 27 14:50:26 2010
New Revision: 1027984

URL: http://svn.apache.org/viewvc?rev=1027984&view=rev
Log:
OPENJPA-1314 Incorrect hashcode()/equals() implementation(s) in QueryResultCacheImpl.  Patch contributed by Heath Thomann.

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java?rev=1027984&r1=1027983&r2=1027984&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java Wed Oct 27 14:50:26 2010
@@ -90,14 +90,17 @@ public class QueryResultCacheImpl
     }
 
     public int hashCode() {
-        return _cache.hashCode();
+        return (_cache == null) ? 0 : _cache.hashCode();
     }
 
     public boolean equals(Object other) {
         if (other == this)
             return true;
-        if (!(other instanceof QueryResultCacheImpl))
+        if ((other == null) || (other.getClass() != this.getClass()))
             return false;
+        if (_cache == null)
+        	return false;
+        
         return _cache.equals(((QueryResultCacheImpl) other)._cache);
 	}
 }