src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
changeset 47312 d4f959806fe9
parent 47216 71c04702a3d5
child 48412 d4412e380f6b
equal deleted inserted replaced
47311:ff631a3cadbc 47312:d4f959806fe9
    28 import com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory;
    28 import com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory;
    29 import java.io.File;
    29 import java.io.File;
    30 import java.net.URL;
    30 import java.net.URL;
    31 import javax.xml.transform.Source;
    31 import javax.xml.transform.Source;
    32 import javax.xml.transform.stream.StreamSource;
    32 import javax.xml.transform.stream.StreamSource;
       
    33 import jdk.xml.internal.SecuritySupport;
    33 import org.w3c.dom.ls.LSResourceResolver;
    34 import org.w3c.dom.ls.LSResourceResolver;
    34 import org.xml.sax.ErrorHandler;
    35 import org.xml.sax.ErrorHandler;
    35 import org.xml.sax.SAXException;
    36 import org.xml.sax.SAXException;
    36 import org.xml.sax.SAXNotRecognizedException;
    37 import org.xml.sax.SAXNotRecognizedException;
    37 import org.xml.sax.SAXNotSupportedException;
    38 import org.xml.sax.SAXNotSupportedException;
   108  * @author  <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a>
   109  * @author  <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a>
   109  *
   110  *
   110  * @since 1.5
   111  * @since 1.5
   111  */
   112  */
   112 public abstract class SchemaFactory {
   113 public abstract class SchemaFactory {
   113 
       
   114      private static SecuritySupport ss = new SecuritySupport();
       
   115 
   114 
   116     /**
   115     /**
   117      * Constructor for derived classes.
   116      * Constructor for derived classes.
   118      *
   117      *
   119      * <p>The constructor does nothing.
   118      * <p>The constructor does nothing.
   233      *
   232      *
   234      * @see #newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader)
   233      * @see #newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader)
   235      */
   234      */
   236     public static SchemaFactory newInstance(String schemaLanguage) {
   235     public static SchemaFactory newInstance(String schemaLanguage) {
   237         ClassLoader cl;
   236         ClassLoader cl;
   238         cl = ss.getContextClassLoader();
   237         cl = SecuritySupport.getContextClassLoader();
   239 
   238 
   240         if (cl == null) {
   239         if (cl == null) {
   241             //cl = ClassLoader.getSystemClassLoader();
   240             //cl = ClassLoader.getSystemClassLoader();
   242             //use the current class loader
   241             //use the current class loader
   243             cl = SchemaFactory.class.getClassLoader();
   242             cl = SchemaFactory.class.getClassLoader();
   297      */
   296      */
   298     public static SchemaFactory newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader){
   297     public static SchemaFactory newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader){
   299         ClassLoader cl = classLoader;
   298         ClassLoader cl = classLoader;
   300 
   299 
   301         if (cl == null) {
   300         if (cl == null) {
   302             cl = ss.getContextClassLoader();
   301             cl = SecuritySupport.getContextClassLoader();
   303         }
   302         }
   304 
   303 
   305         SchemaFactory f = new SchemaFactoryFinder(cl).createInstance(factoryClassName);
   304         SchemaFactory f = new SchemaFactoryFinder(cl).createInstance(factoryClassName);
   306         if (f == null) {
   305         if (f == null) {
   307             throw new IllegalArgumentException(
   306             throw new IllegalArgumentException(