openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgras...@apache.org
Subject svn commit: r1642566 - in /openjpa/branches/2.2.x: openjpa-kernel/src/main/java/org/apache/openjpa/util/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/
Date Sun, 30 Nov 2014 17:04:42 GMT
Author: jgrassel
Date: Sun Nov 30 17:04:42 2014
New Revision: 1642566

URL: http://svn.apache.org/r1642566
Log:
OPENJPA-2492: TestConcurrentMap error with Java 8 [JDK8]

Modified:
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestConcurrentMap.java

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java?rev=1642566&r1=1642565&r2=1642566&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
Sun Nov 30 17:04:42 2014
@@ -1313,6 +1313,9 @@ public class ProxyManagerImpl
         Method match;
         Method after;
         for (int i = 0; i < meths.length; i++) {
+            // Java 8 methods with a return type of KeySetView do not need to be proxied
+            if (meths[i].getReturnType().getName().contains("KeySetView")) continue;
+            
             params = toHelperParameters(meths[i].getParameterTypes(), 
                 proxyType);
 

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java?rev=1642566&r1=1642565&r2=1642566&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java
Sun Nov 30 17:04:42 2014
@@ -78,7 +78,8 @@ public class ProxyMaps 
      */
     public static boolean beforeGet(ProxyMap map, Object key) {
         assertAllowedType(key, map.getKeyType());
-        return map.containsKey(key);
+        // Java 8 solution/workaround due to containsKey() calling get!=null, which could
cause infinite loop
+        return map.keySet().contains(key);
     }
 
     /**

Modified: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestConcurrentMap.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestConcurrentMap.java?rev=1642566&r1=1642565&r2=1642566&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestConcurrentMap.java
(original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestConcurrentMap.java
Sun Nov 30 17:04:42 2014
@@ -44,5 +44,8 @@ public class TestConcurrentMap extends S
         right.getLeftEntityMap().put(left.getStrData(), left);
         
         em.getTransaction().commit();
+        
+        assertEquals(1, right.getLeftEntityMap().size());
+        assertEquals(1, right.getLeftEntityMap().get(left.getStrData()).getId());
     }
 }



Mime
View raw message