src/javax/xml/validation/SchemaFactory.java

Print this page
rev 406 : 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
Summary: This fix replaces manual processing of files under META-INF/services in JAXP factories by calls to java.util.ServiceLoader.
Reviewed-by: alanb, joehw, mchung

*** 1,7 **** /* ! * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 25,43 **** package javax.xml.validation; import java.io.File; import java.net.URL; - import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; - import org.w3c.dom.ls.LSResourceResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; /** * Factory that creates {@link Schema} objects. Entry-point to * the validation API. * --- 25,42 ---- package javax.xml.validation; import java.io.File; import java.net.URL; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import org.w3c.dom.ls.LSResourceResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; + import org.xml.sax.SAXParseException; /** * Factory that creates {@link Schema} objects. Entry-point to * the validation API. *
*** 77,87 **** * <p> * Note that because the XML DTD is strongly tied to the parsing process * and has a significant effect on the parsing process, it is impossible * to define the DTD validation as a process independent from parsing. * For this reason, this specification does not define the semantics for ! * the XML DTD. This doesn't prohibit implentors from implementing it * in a way they see fit, but <em>users are warned that any DTD * validation implemented on this interface necessarily deviate from * the XML DTD semantics as defined in the XML 1.0</em>. * * <table border="1" cellpadding="2"> --- 76,86 ---- * <p> * Note that because the XML DTD is strongly tied to the parsing process * and has a significant effect on the parsing process, it is impossible * to define the DTD validation as a process independent from parsing. * For this reason, this specification does not define the semantics for ! * the XML DTD. This doesn't prohibit implementors from implementing it * in a way they see fit, but <em>users are warned that any DTD * validation implemented on this interface necessarily deviate from * the XML DTD semantics as defined in the XML 1.0</em>. * * <table border="1" cellpadding="2">
*** 145,162 **** * <code>$java.home/lib/jaxp.properties</code> is read and * the value associated with the key being the system property above * is looked for. If present, the value is processed just like above. * </li> * <li> ! * <p>The class loader is asked for service provider provider-configuration files matching ! * <code>javax.xml.validation.SchemaFactory</code> in the resource directory META-INF/services. ! * See the JAR File Specification for file format and parsing rules. ! * Each potential service provider is required to implement the method:</p> ! * <pre> ! * {@link #isSchemaLanguageSupported(String schemaLanguage)} ! * </pre> ! * The first service provider found in class loader order that supports the specified schema language is returned. * </li> * <li> * Platform default <code>SchemaFactory</code> is located * in a implementation specific way. There must be a platform default * <code>SchemaFactory</code> for W3C XML Schema. --- 144,164 ---- * <code>$java.home/lib/jaxp.properties</code> is read and * the value associated with the key being the system property above * is looked for. If present, the value is processed just like above. * </li> * <li> ! * Use the service-provider loading facilities, defined by the ! * {@link java.util.ServiceLoader} class, to attempt to locate and load an ! * implementation of the service.<br> ! * Each potential service provider is required to implement the method ! * {@link #isSchemaLanguageSupported(String schemaLanguage)}. ! * <br> ! * The first service provider found that supports the specified schema ! * language is returned. ! * <br> ! * In case of {@link java.util.ServiceConfigurationError} a ! * {@link SchemaFactoryConfigurationError} will be thrown. * </li> * <li> * Platform default <code>SchemaFactory</code> is located * in a implementation specific way. There must be a platform default * <code>SchemaFactory</code> for W3C XML Schema.
*** 184,197 **** * * @throws IllegalArgumentException * If no implementation of the schema language is available. * @throws NullPointerException * If the <code>schemaLanguage</code> parameter is null. * * @see #newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader) */ ! public static final SchemaFactory newInstance(String schemaLanguage) { ClassLoader cl; cl = ss.getContextClassLoader(); if (cl == null) { //cl = ClassLoader.getSystemClassLoader(); --- 186,201 ---- * * @throws IllegalArgumentException * If no implementation of the schema language is available. * @throws NullPointerException * If the <code>schemaLanguage</code> parameter is null. + * @throws SchemaFactoryConfigurationError + * If a configuration error is encountered. * * @see #newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader) */ ! public static SchemaFactory newInstance(String schemaLanguage) { ClassLoader cl; cl = ss.getContextClassLoader(); if (cl == null) { //cl = ClassLoader.getSystemClassLoader();