--- old/src/javax/xml/parsers/DocumentBuilderFactory.java 2012-08-27 21:27:06.380461400 -0700 +++ new/src/javax/xml/parsers/DocumentBuilderFactory.java 2012-08-27 21:27:05.576323100 -0700 @@ -34,7 +34,7 @@ * @author Jeff Suttor * @author Neeraj Bajaj * - * @version $Revision: 1.9 $, $Date: 2010/05/25 16:19:44 $ + * @version $Revision: 1.10 $, $Date: 2010-11-01 04:36:09 $ */ @@ -85,11 +85,13 @@ * of any property in jaxp.properties after it has been read for the first time. * *
META-INF/services/javax.xml.parsers.DocumentBuilderFactory
- * in jars available to the runtime.
+ * Uses the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, to attempt
+ * to locate and load an implementation of the service. If there are providers other than the implementation specific
+ * default located, then the first provider that is not the default is instantiated and returned; Otherwise
+ * the default implementation is returned if it is on the classpath or installed as a module.
+ *
+ * If a misconfigured provider is encountered and {@link java.util.ServiceConfigurationError} is thrown, the error will be wrapped
+ * in a {@link javax.xml.parsers.FactoryConfigurationException}.
* DocumentBuilderFactory
instance.
@@ -117,17 +119,15 @@
* available or cannot be instantiated.
*/
public static DocumentBuilderFactory newInstance() {
- try {
- return (DocumentBuilderFactory) FactoryFinder.find(
- /* The default property name according to the JAXP spec */
- "javax.xml.parsers.DocumentBuilderFactory",
- /* The fallback implementation class name */
- "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
- } catch (FactoryFinder.ConfigurationError e) {
- throw new FactoryConfigurationError(e.getException(),
- e.getMessage());
- }
-
+// try {
+ return (DocumentBuilderFactory) FactoryFinder.find(DocumentBuilderFactory.class,
+ /* The default property name according to the JAXP spec */
+ "javax.xml.parsers.DocumentBuilderFactory",
+ /* The fallback implementation class name */
+ "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
+// } catch (FactoryConfigurationError e) {
+// throw e;
+// }
}
/**
@@ -168,9 +168,8 @@
try {
//do not fallback if given classloader can't find the class, throw exception
return (DocumentBuilderFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false);
- } catch (FactoryFinder.ConfigurationError e) {
- throw new FactoryConfigurationError(e.getException(),
- e.getMessage());
+ } catch (FactoryConfigurationError e) {
+ throw e;
}
}