From b0cddf4e2d87d5a4f3c19d24cec89c4df4b9660d Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Tue, 21 Aug 2007 15:21:50 +0000 Subject: [PATCH] OPENJPA-256. Applied patch supplied by Bernd. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@568164 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/conf/QueryCompilationCacheValue.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java index bbaebdd82..093a81065 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/QueryCompilationCacheValue.java @@ -26,6 +26,7 @@ import org.apache.openjpa.lib.conf.Configuration; 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 @@ public class QueryCompilationCacheValue 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