openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpala...@apache.org
Subject svn commit: r1171918 - /openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
Date Sat, 17 Sep 2011 06:26:59 GMT
Author: rpalache
Date: Sat Sep 17 06:26:59 2011
New Revision: 1171918

URL: http://svn.apache.org/viewvc?rev=1171918&view=rev
Log:
Try current classloader when loading DBDictionary. Applying B.J. Reed's patch to 1.1.x batch.

Modified:
    openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java

Modified: openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java?rev=1171918&r1=1171917&r2=1171918&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
(original)
+++ openjpa/branches/1.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionaryFactory.java
Sat Sep 17 06:26:59 2011
@@ -154,6 +154,18 @@ public class DBDictionaryFactory {
                         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();



Mime
View raw message