You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2007/01/13 07:32:51 UTC

svn commit: r495842 - /jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java

Author: skitching
Date: Fri Jan 12 22:32:49 2007
New Revision: 495842

URL: http://svn.apache.org/viewvc?view=rev&rev=495842
Log:
When useContextClassLoader is false, load classes using the classloader that loaded Betwixt, not the one that loaded Digester.
Normally of course both libs will be loaded via the same classloader, but if they are not then using the Betwixt classloader
seems far more intuitive.

Modified:
    jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java

Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java?view=diff&rev=495842&r1=495841&r2=495842
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java (original)
+++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/XMLIntrospector.java Fri Jan 12 22:32:49 2007
@@ -1244,7 +1244,20 @@
             digester = new XMLBeanInfoDigester();
             digester.setXMLIntrospector( this );
         }
-        digester.setUseContextClassLoader(configuration.isUseContextClassLoader());
+
+	if (configuration.isUseContextClassLoader()) {
+	    // Use the context classloader to find classes.
+	    //
+	    // There is one case in which this gives odd behaviour; with digester <= 1.8 (at least),
+	    // if the context classloader is inaccessable for some reason then Digester will fall
+	    // back to using the same classloader that loaded Digester.
+            digester.setUseContextClassLoader(true);
+	} else {
+            // Use the classloader that loaded this betwixt library, regardless
+	    // of where the Digester class library happens to be.
+	    digester.setClassLoader(this.getClass().getClassLoader());
+	}
+
         digester.setBeanClass( aClass );
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org