Author: kwsutter
Date: Mon Oct 1 14:42:40 2007
New Revision: 581080
URL: http://svn.apache.org/viewvc?rev=581080&view=rev
Log:
OPENJPA-387. Committing the latest patch from Daniel (with slight modifications by me).
Modified:
openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Modified: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?rev=581080&r1=581079&r2=581080&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Mon Oct 1 14:42:40 2007
@@ -181,30 +181,39 @@
Class cls = null;
- // can't have a null reference in the map, so use symbolic
- // constant as key
- Object key = loader == null ? NULL_LOADER : loader;
- Map loaderCache = (Map) _loaders.get(key);
- if (loaderCache == null) { // We don't have a cache for this loader.
- loaderCache = new ConcurrentHashMap();
- _loaders.put(key, loaderCache);
- } else { // We have a cache for this loader.
- cls = (Class) loaderCache.get(clsName);
- }
+ while (cls == null) {
+ // can't have a null reference in the map, so use symbolic
+ // constant as key
+ Object key = loader == null ? NULL_LOADER : loader;
+ Map loaderCache = (Map) _loaders.get(key);
+ if (loaderCache == null) { // We don't have a cache for this loader.
+ loaderCache = new ConcurrentHashMap();
+ _loaders.put(key, loaderCache);
+ } else { // We have a cache for this loader.
+ cls = (Class) loaderCache.get(clsName);
+ }
- if (cls == null) { // we haven't cached this.
- try {
- cls = Strings.toClass(clsName, findDerivedLoader(conf, loader));
- loaderCache.put(clsName, cls);
- } catch (RuntimeException re) {
- if (val != null)
- re = getCreateException(clsName, val, re);
- if (fatal)
- throw re;
- Log log = (conf == null) ? null : conf.getConfigurationLog();
- if (log != null && log.isErrorEnabled())
- log.error(_loc.get("plugin-creation-exception", val), re);
- return null;
+ if (cls == null) {
+ try {
+ cls = Strings.toClass(clsName, findDerivedLoader(conf,
+ loader));
+ loaderCache.put(clsName, cls);
+ } catch (RuntimeException re) {
+ if (loader != null) // Try one more time with loader=null
+ loader = null;
+ else {
+ if (val != null)
+ re = getCreateException(clsName, val, re);
+ if (fatal)
+ throw re;
+ Log log = (conf == null) ? null : conf
+ .getConfigurationLog();
+ if (log != null && log.isErrorEnabled())
+ log.error(_loc
+ .get("plugin-creation-exception", val), re);
+ return null;
+ }
+ }
}
}
|