jaxp/src/java.xml/share/classes/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
changeset 45853 bfa06be36a17
parent 31497 4a6b2e733c0d
equal deleted inserted replaced
45852:aa0a2d22981d 45853:bfa06be36a17
    48 import org.w3c.dom.DOMImplementationList;
    48 import org.w3c.dom.DOMImplementationList;
    49 import org.w3c.dom.DOMImplementation;
    49 import org.w3c.dom.DOMImplementation;
    50 import java.io.InputStream;
    50 import java.io.InputStream;
    51 import java.io.BufferedReader;
    51 import java.io.BufferedReader;
    52 import java.io.InputStreamReader;
    52 import java.io.InputStreamReader;
       
    53 import java.lang.reflect.InvocationTargetException;
    53 import java.security.AccessController;
    54 import java.security.AccessController;
    54 import java.security.PrivilegedAction;
    55 import java.security.PrivilegedAction;
    55 
    56 
    56 /**
    57 /**
    57  * A factory that enables applications to obtain instances of
    58  * A factory that enables applications to obtain instances of
   181                 if (classLoader != null && !internal) {
   182                 if (classLoader != null && !internal) {
   182                     sourceClass = classLoader.loadClass(sourceName);
   183                     sourceClass = classLoader.loadClass(sourceName);
   183                 } else {
   184                 } else {
   184                     sourceClass = Class.forName(sourceName);
   185                     sourceClass = Class.forName(sourceName);
   185                 }
   186                 }
   186                 DOMImplementationSource source =
   187                 try {
   187                     (DOMImplementationSource) sourceClass.newInstance();
   188                     DOMImplementationSource source =
   188                 sources.addElement(source);
   189                         (DOMImplementationSource) sourceClass.getConstructor().newInstance();
       
   190                     sources.addElement(source);
       
   191                 } catch (NoSuchMethodException | InvocationTargetException e) {
       
   192                     throw new InstantiationException(e.getMessage());
       
   193                 }
   189             }
   194             }
   190         }
   195         }
   191         return new DOMImplementationRegistry(sources);
   196         return new DOMImplementationRegistry(sources);
   192     }
   197     }
   193 
   198