-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
x86
-
linux
FULL PRODUCT VERSION :
All
A DESCRIPTION OF THE PROBLEM :
the XPathFactory.newInstance() silently swallows all RuntimeException(s) thrown by the constructor of the factory implementation, and silently defaults to the platform factory.
REPRODUCIBILITY :
This bug can be reproduced often.
CUSTOMER SUBMITTED WORKAROUND :
Apply this partial patch to fix exception thrown by factories configured by META-INF/services/javax.xml.xpath.XPathFactory
diff -U3 -r src/javax/xml/xpath/XPathFactoryFinder.java srcx/javax/xml/xpath/XPathFactoryFinder.java
--- src/javax/xml/xpath/XPathFactoryFinder.java Fri Mar 4 00:26:36 2005
+++ srcx/javax/xml/xpath/XPathFactoryFinder.java Tue Apr 12 22:55:51 2005
@@ -149,7 +149,7 @@
if(sf!=null) return sf;
} else
debugPrintln("The property is undefined.");
- } catch( Throwable t ) {
+ } catch( Exception t ) {
if( debug ) {
debugPrintln("failed to look up system property '"+propertyName+"'" );
t.printStackTrace();
@@ -242,7 +242,9 @@
return (XPathFactory)o;
debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
- } catch( Throwable t ) {
+ } catch( RuntimeException e) {
+ throw e;
+ } catch( Exception t ) {
debugPrintln("failed to instanciate "+className);
if(debug) t.printStackTrace();
}
@@ -294,6 +296,7 @@
*/
private Iterator createServiceFileIterator() {
if (classLoader == null) {
+ debugPrintln("no classloader found to retrieve "+SERVICE_ID);
return new SingleIterator() {
protected Object value() {
ClassLoader classLoader = XPathFactoryFinder.class.getClassLoader();
@@ -303,6 +306,7 @@
};
} else {
try {
+ debugPrintln("using "+classLoader+" to retrieve "+SERVICE_ID);
//final Enumeration e = classLoader.getResources(SERVICE_ID);
final Enumeration e = ss.getResources(classLoader, SERVICE_ID);
if(!e.hasMoreElements()) {
Anyhow, this might happen in other cases even after the patch is applied.
All
A DESCRIPTION OF THE PROBLEM :
the XPathFactory.newInstance() silently swallows all RuntimeException(s) thrown by the constructor of the factory implementation, and silently defaults to the platform factory.
REPRODUCIBILITY :
This bug can be reproduced often.
CUSTOMER SUBMITTED WORKAROUND :
Apply this partial patch to fix exception thrown by factories configured by META-INF/services/javax.xml.xpath.XPathFactory
diff -U3 -r src/javax/xml/xpath/XPathFactoryFinder.java srcx/javax/xml/xpath/XPathFactoryFinder.java
--- src/javax/xml/xpath/XPathFactoryFinder.java Fri Mar 4 00:26:36 2005
+++ srcx/javax/xml/xpath/XPathFactoryFinder.java Tue Apr 12 22:55:51 2005
@@ -149,7 +149,7 @@
if(sf!=null) return sf;
} else
debugPrintln("The property is undefined.");
- } catch( Throwable t ) {
+ } catch( Exception t ) {
if( debug ) {
debugPrintln("failed to look up system property '"+propertyName+"'" );
t.printStackTrace();
@@ -242,7 +242,9 @@
return (XPathFactory)o;
debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
- } catch( Throwable t ) {
+ } catch( RuntimeException e) {
+ throw e;
+ } catch( Exception t ) {
debugPrintln("failed to instanciate "+className);
if(debug) t.printStackTrace();
}
@@ -294,6 +296,7 @@
*/
private Iterator createServiceFileIterator() {
if (classLoader == null) {
+ debugPrintln("no classloader found to retrieve "+SERVICE_ID);
return new SingleIterator() {
protected Object value() {
ClassLoader classLoader = XPathFactoryFinder.class.getClassLoader();
@@ -303,6 +306,7 @@
};
} else {
try {
+ debugPrintln("using "+classLoader+" to retrieve "+SERVICE_ID);
//final Enumeration e = classLoader.getResources(SERVICE_ID);
final Enumeration e = ss.getResources(classLoader, SERVICE_ID);
if(!e.hasMoreElements()) {
Anyhow, this might happen in other cases even after the patch is applied.