Author: mikedd
Date: Tue Nov 17 23:03:20 2009
New Revision: 881605
URL: http://svn.apache.org/viewvc?rev=881605&view=rev
Log:
OPENJPA-1384:
Try current classloader when loading DBDictionaries if the first attempt fails.
Submitted By: B.J. Reed
Modified:
openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java?rev=881605&r1=881604&r2=881605&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
Tue Nov 17 23:03:20 2009
@@ -154,6 +154,18 @@
DBDictionary.class)));
dict = (DBDictionary) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c));
+ } catch (ClassNotFoundException cnfe) {
+ // if the dictionary was not found, make another attempt
+ // at loading the dictionary using the current thread.
+ try {
+ Class c = Thread.currentThread().getContextClassLoader().loadClass(dclass);
+ dict = (DBDictionary) AccessController.doPrivileged(
+ J2DoPrivHelper.newInstanceAction(c));
+ } catch (Exception e) {
+ if (e instanceof PrivilegedActionException)
+ e = ((PrivilegedActionException) e).getException();
+ throw new UserException(e).setFatal(true);
+ }
} catch (Exception e) {
if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException) e).getException();
|