Author: pcl
Date: Tue Aug 21 08:21:50 2007
New Revision: 568164
URL: http://svn.apache.org/viewvc?rev=568164&view=rev
Log:
OPENJPA-256. Applied patch supplied by Bernd.
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?rev=568164&r1=568163&r2=568164&view=diff
==============================================================================
---
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
Tue Aug 21 08:21:50 2007
@@ -26,6 +26,7 @@
import org.apache.openjpa.lib.conf.PluginValue;
import org.apache.openjpa.lib.util.concurrent.ConcurrentMap;
import org.apache.openjpa.lib.util.concurrent.ConcurrentHashMap;
+import org.apache.openjpa.lib.util.ParseException;
import org.apache.openjpa.util.CacheMap;
/**
@@ -58,6 +59,18 @@
try {
map = (Map) super.newInstance(clsName, type, conf, fatal);
+ } catch (ParseException pe) {
+ // 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 ParseException (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);
} catch (IllegalArgumentException iae) {
// OPENJPA256: this class differs from most plugins in that
// the plugin type is the standard java interface Map.class (rather