7191547: XMLEventFactory.newFactory(String factoryId, ClassLoader loader) does not work as expected
authorjoehw
Fri, 17 Aug 2012 09:49:42 -0700
changeset 13624 56ea3a894b56
parent 13445 b67041a6cb50
child 13625 3f1e7625d0f2
7191547: XMLEventFactory.newFactory(String factoryId, ClassLoader loader) does not work as expected Summary: similar to the patch for 6756677 for XMLInputFactory and XMLOutputFactory, this patch fixes an error in XMLEventFactory where factoryId was taken as factory class. Reviewed-by: lancea
jaxp/src/javax/xml/stream/XMLEventFactory.java
--- a/jaxp/src/javax/xml/stream/XMLEventFactory.java	Wed Jul 05 18:19:33 2017 +0200
+++ b/jaxp/src/javax/xml/stream/XMLEventFactory.java	Fri Aug 17 09:49:42 2012 -0700
@@ -49,6 +49,10 @@
 public abstract class XMLEventFactory {
   protected XMLEventFactory(){}
 
+    static final String JAXPFACTORYID = "javax.xml.stream.XMLEventFactory";
+    static final String DEFAULIMPL = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
+
+
   /**
    * Create a new instance of the factory
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
@@ -57,8 +61,8 @@
     throws FactoryConfigurationError
   {
     return (XMLEventFactory) FactoryFinder.find(
-      "javax.xml.stream.XMLEventFactory",
-      "com.sun.xml.internal.stream.events.XMLEventFactoryImpl");
+      JAXPFACTORYID,
+      DEFAULIMPL);
   }
 
   /**
@@ -90,8 +94,8 @@
     throws FactoryConfigurationError
   {
     return (XMLEventFactory) FactoryFinder.find(
-      "javax.xml.stream.XMLEventFactory",
-      "com.sun.xml.internal.stream.events.XMLEventFactoryImpl");
+      JAXPFACTORYID,
+      DEFAULIMPL);
   }
 
   /**
@@ -114,7 +118,7 @@
           throws FactoryConfigurationError {
       try {
           //do not fallback if given classloader can't find the class, throw exception
-          return (XMLEventFactory) FactoryFinder.newInstance(factoryId, classLoader, false);
+          return (XMLEventFactory) FactoryFinder.find(factoryId, classLoader, null);
       } catch (FactoryFinder.ConfigurationError e) {
           throw new FactoryConfigurationError(e.getException(),
                   e.getMessage());
@@ -141,7 +145,7 @@
           throws FactoryConfigurationError {
       try {
           //do not fallback if given classloader can't find the class, throw exception
-          return (XMLEventFactory) FactoryFinder.newInstance(factoryId, classLoader, false);
+          return (XMLEventFactory) FactoryFinder.find(factoryId, classLoader, null);
       } catch (FactoryFinder.ConfigurationError e) {
           throw new FactoryConfigurationError(e.getException(),
                   e.getMessage());