Author: dwoods
Date: Tue Oct 26 20:22:27 2010
New Revision: 1027731

URL: http://svn.apache.org/viewvc?rev=1027731&view=rev
Log:
OPENJPA-1311 Incorrect hashcode()/equals() implementation(s).  Contributed by 
Heath Thomann.

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

Modified: 
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java?rev=1027731&r1=1027730&r2=1027731&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java
 (original)
+++ 
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/StoreCacheImpl.java
 Tue Oct 26 20:22:27 2010
@@ -148,15 +148,17 @@ public class StoreCacheImpl 
     }
 
     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 StoreCacheImpl))
+        if ((other == null) || (other.getClass() != this.getClass()))
             return false;
-        return _cache.equals (((StoreCacheImpl) other)._cache);
+        if (_cache == null) 
+            return false;
+      return _cache.equals (((StoreCacheImpl) other)._cache);
        }
 
     @SuppressWarnings("unchecked")


Reply via email to