openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r562011 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java
Date Thu, 02 Aug 2007 03:51:39 GMT
Author: mprudhom
Date: Wed Aug  1 20:51:38 2007
New Revision: 562011

URL: http://svn.apache.org/viewvc?view=rev&rev=562011
Log:
OPENJPA256 this class differs from most plugins in that the plugin type is the standard java
interface Map.class (rather than an openjpa-specific interface), which means that the ClassLoader
used to load the implementation will be the system class loader; this presents a problem if
OpenJPA is not in the system classpath, so work around the problem by catching the IllegalArgumentException
(which is what we wrap the ClassNotFoundException in) and try again, this time using this
class' ClassLoader.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java?view=diff&rev=562011&r1=562010&r2=562011
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java
Wed Aug  1 20:51:38 2007
@@ -54,7 +54,24 @@
     public Object newInstance(String clsName, Class type,
         Configuration conf, boolean fatal) {
         // make sure map handles concurrency
-        Map map = (Map) super.newInstance(clsName, type, conf, fatal);
+        Map map;
+        
+        try {
+            map = (Map) super.newInstance(clsName, type, conf, fatal);
+        } catch (IllegalArgumentException iae) {
+            // OPENJPA256: this class differs from most plugins in that
+            // the plugin type is the standard java interface Map.class (rather
+            // than an openjpa-specific interface), which means that the
+            // ClassLoader used to load the implementation will be the system
+            // class loader; this presents a problem if OpenJPA is not in the
+            // system classpath, so work around the problem by catching
+            // the IllegalArgumentException (which is what we wrap the
+            // ClassNotFoundException in) and try again, this time using
+            // this class' ClassLoader.
+            map = (Map) super.newInstance(clsName,
+                QueryCompilationCacheValue.class, conf, fatal);
+        }
+
         if (map != null && !(map instanceof Hashtable)
             && !(map instanceof CacheMap)
             && !(map instanceof ConcurrentMap))



Mime
View raw message