You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by mr...@apache.org on 2005/06/17 21:50:14 UTC
cvs commit: xml-commons/java/external/src/javax/xml/transform FactoryFinder.java
mrglavas 2005/06/17 12:50:14
Modified: java/external/src/javax/xml/parsers FactoryFinder.java
java/external/src/javax/xml/transform FactoryFinder.java
Log:
Merge in a fix from the tck-jaxp-1_2_0 branch:
Under some JDK's (notably both Sun and IBM 1.4.0), getClassLoader(), when invoked
on the JAXP or SAX classes, it returns null. This means that
the fallback mechanism in these APIs may not work correctly: in
particular, when an attempt to invoke an unknown Parser/XMLReader
implementation is made in SAX, a NullPointerException rather than the correct
ClassNotFoundException results. This patch fixes this problem,
by using Class.forName() in the event that the bootstrap
classloader is not returned in this particular situation.
Revision Changes Path
1.14 +7 -2 xml-commons/java/external/src/javax/xml/parsers/FactoryFinder.java
Index: FactoryFinder.java
===================================================================
RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/FactoryFinder.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FactoryFinder.java 17 Jun 2005 19:32:50 -0000 1.13
+++ FactoryFinder.java 17 Jun 2005 19:50:13 -0000 1.14
@@ -105,7 +105,12 @@
if (doFallback) {
// Fall back to current classloader
cl = FactoryFinder.class.getClassLoader();
- providerClass = cl.loadClass(className);
+ if (cl != null) {
+ providerClass = cl.loadClass(className);
+ }
+ else {
+ providerClass = Class.forName(className);
+ }
} else {
throw x;
}
1.11 +7 -2 xml-commons/java/external/src/javax/xml/transform/FactoryFinder.java
Index: FactoryFinder.java
===================================================================
RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/transform/FactoryFinder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FactoryFinder.java 17 Jun 2005 19:32:50 -0000 1.10
+++ FactoryFinder.java 17 Jun 2005 19:50:14 -0000 1.11
@@ -105,7 +105,12 @@
if (doFallback) {
// Fall back to current classloader
cl = FactoryFinder.class.getClassLoader();
- providerClass = cl.loadClass(className);
+ if (cl != null) {
+ providerClass = cl.loadClass(className);
+ }
+ else {
+ providerClass = Class.forName(className);
+ }
} else {
throw x;
}