--- old/src/javax/xml/parsers/SAXParserFactory.java 2012-08-27 21:27:11.566589300 -0700 +++ new/src/javax/xml/parsers/SAXParserFactory.java 2012-08-27 21:27:10.778557800 -0700 @@ -26,7 +26,6 @@ package javax.xml.parsers; import javax.xml.validation.Schema; - import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; @@ -38,7 +37,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 $ * */ public abstract class SAXParserFactory { @@ -87,11 +86,13 @@ * of any property in jaxp.properties after it has been read for the first time. * *
  • - * Use the Services API (as detailed in the JAR specification), if - * available, to determine the classname. The Services API will look - * for a classname in the file - * META-INF/services/javax.xml.parsers.SAXParserFactory - * 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}.

    *
  • *
  • * Platform default SAXParserFactory instance. @@ -121,16 +122,16 @@ * not available or cannot be instantiated. */ - public static SAXParserFactory newInstance() { - try { - return (SAXParserFactory) FactoryFinder.find( - /* The default property name according to the JAXP spec */ - "javax.xml.parsers.SAXParserFactory", - /* The fallback implementation class name */ - "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); - } catch (FactoryFinder.ConfigurationError e) { - throw new FactoryConfigurationError(e.getException(), - e.getMessage()); + public static SAXParserFactory newInstance() + { + try{ + return (SAXParserFactory) FactoryFinder.find(SAXParserFactory.class, + /* The default property name according to the JAXP spec */ + "javax.xml.parsers.SAXParserFactory", + /* The fallback implementation class name */ + "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); + } catch (FactoryConfigurationError e) { + throw e; } } @@ -172,9 +173,8 @@ try { //do not fallback if given classloader can't find the class, throw exception return (SAXParserFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); - } catch (FactoryFinder.ConfigurationError e) { - throw new FactoryConfigurationError(e.getException(), - e.getMessage()); + } catch (FactoryConfigurationError e) { + throw e; } }