8022935: Enhance Apache resolver classes
authorjoehw
Mon, 26 Aug 2013 21:08:58 -0700
changeset 22415 4e3bef0828af
parent 22173 f130ca87de66
child 22416 5473b73ce396
8022935: Enhance Apache resolver classes Reviewed-by: alanb, mchung, skoivu
jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
jaxp/src/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java
jaxp/src/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java
--- a/jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java	Wed Jul 05 19:26:54 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java	Mon Aug 26 21:08:58 2013 -0700
@@ -24,20 +24,17 @@
 package com.sun.org.apache.xml.internal.resolver;
 
 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver;
+import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
 import java.io.InputStream;
-
+import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.MalformedURLException;
-
 import java.util.MissingResourceException;
 import java.util.PropertyResourceBundle;
 import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 import java.util.Vector;
-
-import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
-import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * CatalogManager provides an interface to the catalog properties.
@@ -687,7 +684,7 @@
           catalog = new Catalog();
         } else {
           try {
-            catalog = (Catalog) Class.forName(catalogClassName).newInstance();
+            catalog = (Catalog) ReflectUtil.forName(catalogClassName).newInstance();
           } catch (ClassNotFoundException cnfe) {
             debug.message(1,"Catalog class named '"
                           + catalogClassName
--- a/jaxp/src/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java	Wed Jul 05 19:26:54 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java	Mon Aug 26 21:08:58 2013 -0700
@@ -23,24 +23,21 @@
 
 package com.sun.org.apache.xml.internal.resolver.readers;
 
-import java.util.Hashtable;
+import com.sun.org.apache.xml.internal.resolver.Catalog;
+import com.sun.org.apache.xml.internal.resolver.CatalogException;
+import com.sun.org.apache.xml.internal.resolver.helpers.Namespaces;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
-import java.net.MalformedURLException;
-
+import java.util.Hashtable;
+import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.ParserConfigurationException;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.helpers.Namespaces;
-
+import org.w3c.dom.*;
 import org.xml.sax.SAXException;
-import org.w3c.dom.*;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * A DOM-based CatalogReader.
@@ -199,7 +196,7 @@
     DOMCatalogParser domParser = null;
 
     try {
-      domParser = (DOMCatalogParser) Class.forName(domParserClass).newInstance();
+      domParser = (DOMCatalogParser) ReflectUtil.forName(domParserClass).newInstance();
     } catch (ClassNotFoundException cnfe) {
       catalog.getCatalogManager().debug.message(1, "Cannot load XML Catalog Parser class", domParserClass);
       throw new CatalogException(CatalogException.UNPARSEABLE);
--- a/jaxp/src/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java	Wed Jul 05 19:26:54 2017 +0200
+++ b/jaxp/src/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java	Mon Aug 26 21:08:58 2013 -0700
@@ -23,19 +23,21 @@
 
 package com.sun.org.apache.xml.internal.resolver.readers;
 
-import java.util.Hashtable;
+import com.sun.org.apache.xml.internal.resolver.Catalog;
+import com.sun.org.apache.xml.internal.resolver.CatalogException;
+import com.sun.org.apache.xml.internal.resolver.CatalogManager;
+import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
+import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.FileNotFoundException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
-import java.net.MalformedURLException;
 import java.net.UnknownHostException;
-
+import java.util.Hashtable;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.SAXParser;
-
 import org.xml.sax.AttributeList;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
@@ -45,12 +47,7 @@
 import org.xml.sax.Locator;
 import org.xml.sax.Parser;
 import org.xml.sax.SAXException;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
+import sun.reflect.misc.ReflectUtil;
 
 /**
  * A SAX-based CatalogReader.
@@ -246,7 +243,7 @@
         }
         parser.parse(new InputSource(is), spHandler);
       } else {
-        Parser parser = (Parser) Class.forName(parserClass).newInstance();
+        Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance();
         parser.setDocumentHandler(this);
         if (bResolver != null) {
           parser.setEntityResolver(bResolver);
@@ -352,7 +349,7 @@
 
       try {
         saxParser = (SAXCatalogParser)
-          Class.forName(saxParserClass).newInstance();
+          ReflectUtil.forName(saxParserClass).newInstance();
 
         saxParser.setCatalog(catalog);
         saxParser.startDocument();
@@ -413,7 +410,7 @@
 
       try {
         saxParser = (SAXCatalogParser)
-          Class.forName(saxParserClass).newInstance();
+          ReflectUtil.forName(saxParserClass).newInstance();
 
         saxParser.setCatalog(catalog);
         saxParser.startDocument();