cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From torehal...@apache.org
Subject svn commit: r592714 - /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
Date Wed, 07 Nov 2007 11:19:58 GMT
Author: torehalset
Date: Wed Nov  7 03:19:57 2007
New Revision: 592714

URL: http://svn.apache.org/viewvc?rev=592714&view=rev
Log:
CAY-914: cdataport classloader trouble
fixed

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java?rev=592714&r1=592713&r2=592714&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
Wed Nov  7 03:19:57 2007
@@ -62,12 +62,19 @@
 
         FileConfiguration configuration = new FileConfiguration(projectFile);
 
+        ClassLoader threadContextClassLoader = Thread.currentThread().getContextClassLoader();
         try {
+            // need to set context class loader so that cayenne can find jdbc driver and
+            // PasswordEncoder
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
             configuration.initialize();
         }
         catch (Exception ex) {
             throw new BuildException("Error loading Cayenne configuration from "
                     + projectFile, ex);
+        } finally {
+            // set back to original ClassLoader
+            Thread.currentThread().setContextClassLoader(threadContextClassLoader);
         }
 
         // perform project validation



Mime
View raw message