8177561: Remove deprecated for removal portions of com.sun.org.apache
authorjoehw
Tue, 20 Jun 2017 14:29:52 -0700
changeset 45593 57ad1ec78a27
parent 45592 30b5d80e718f
child 45594 4d277a7c2e46
child 45733 5ca2a2264c52
8177561: Remove deprecated for removal portions of com.sun.org.apache Reviewed-by: lancea, rriggs
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xerces.internal.util;
-
-import java.io.IOException;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.EntityResolver2;
-
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSResourceResolver;
-
-import javax.xml.parsers.SAXParserFactory;
-
-import com.sun.org.apache.xerces.internal.dom.DOMInputImpl;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-
-import com.sun.org.apache.xerces.internal.xni.XNIException;
-import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
-
-import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
-
-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.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-
-/**
- * <p>The catalog resolver handles the resolution of external
- * identifiers and URI references through XML catalogs. This
- * component supports XML catalogs defined by the
- * <a href="http://www.oasis-open.org/committees/entity/spec.html">
- * OASIS XML Catalogs Specification</a>. It encapsulates the
- * <a href="http://xml.apache.org/commons/">XML Commons</a> resolver.
- * An instance of this class may be registered on the parser
- * as a SAX entity resolver, as a DOM LSResourceResolver or
- * as an XNI entity resolver by setting the property
- * (http://apache.org/xml/properties/internal/entity-resolver).</p>
- *
- * <p>It is intended that this class may be used standalone to perform
- * catalog resolution outside of a parsing context. It may be shared
- * between several parsers and the application.</p>
- *
- * @deprecated This class and the JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API should
- * migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Michael Glavassevich, IBM
- *
- */
-@Deprecated(since="9", forRemoval=true)
-public class XMLCatalogResolver
-    implements XMLEntityResolver, EntityResolver2, LSResourceResolver {
-
-    /** Internal catalog manager for Apache catalogs. **/
-    private CatalogManager fResolverCatalogManager = null;
-
-    /** Internal catalog structure. **/
-    private Catalog fCatalog = null;
-
-    /** An array of catalog URIs. **/
-    private String [] fCatalogsList = null;
-
-    /**
-     * Indicates whether the list of catalogs has
-     * changed since it was processed.
-     */
-    private boolean fCatalogsChanged = true;
-
-    /** Application specified prefer public setting. **/
-    private boolean fPreferPublic = true;
-
-    /**
-     * Indicates whether the application desires that
-     * the parser or some other component performing catalog
-     * resolution should use the literal system identifier
-     * instead of the expanded system identifier.
-     */
-    private boolean fUseLiteralSystemId = true;
-
-    /**
-     * <p>Constructs a catalog resolver with a default configuration.</p>
-     */
-    public XMLCatalogResolver () {
-        this(null, true);
-    }
-
-    /**
-     * <p>Constructs a catalog resolver with the given
-     * list of entry files.</p>
-     *
-     * @param catalogs an ordered array list of absolute URIs
-     */
-    public XMLCatalogResolver (String [] catalogs) {
-        this(catalogs, true);
-    }
-
-    /**
-     * <p>Constructs a catalog resolver with the given
-     * list of entry files and the preference for whether
-     * system or public matches are preferred.</p>
-     *
-     * @param catalogs an ordered array list of absolute URIs
-     * @param preferPublic the prefer public setting
-     */
-    public XMLCatalogResolver (String [] catalogs, boolean preferPublic) {
-        init(catalogs, preferPublic);
-    }
-
-    /**
-     * <p>Returns the initial list of catalog entry files.</p>
-     *
-     * @return the initial list of catalog entry files
-     */
-    public final synchronized String [] getCatalogList () {
-        return (fCatalogsList != null)
-            ? (String[]) fCatalogsList.clone() : null;
-    }
-
-    /**
-     * <p>Sets the initial list of catalog entry files.
-     * If there were any catalog mappings cached from
-     * the previous list they will be replaced by catalog
-     * mappings from the new list the next time the catalog
-     * is queried.</p>
-     *
-     * @param catalogs an ordered array list of absolute URIs
-     */
-    public final synchronized void setCatalogList (String [] catalogs) {
-        fCatalogsChanged = true;
-        fCatalogsList = (catalogs != null)
-            ? (String[]) catalogs.clone() : null;
-    }
-
-    /**
-     * <p>Forces the cache of catalog mappings to be cleared.</p>
-     */
-    public final synchronized void clear () {
-        fCatalog = null;
-    }
-
-    /**
-     * <p>Returns the preference for whether system or public
-     * matches are preferred. This is used in the absence
-     * of any occurence of the <code>prefer</code> attribute
-     * on the <code>catalog</code> entry of a catalog. If this
-     * property has not yet been explicitly set its value is
-     * <code>true</code>.</p>
-     *
-     * @return the prefer public setting
-     */
-    public final boolean getPreferPublic () {
-        return fPreferPublic;
-    }
-
-    /**
-     * <p>Sets the preference for whether system or public
-     * matches are preferred. This is used in the absence
-     * of any occurence of the <code>prefer</code> attribute
-     * on the <code>catalog</code> entry of a catalog.</p>
-     *
-     * @param preferPublic the prefer public setting
-     */
-    public final void setPreferPublic (boolean preferPublic) {
-        fPreferPublic = preferPublic;
-        fResolverCatalogManager.setPreferPublic(preferPublic);
-    }
-
-    /**
-     * <p>Returns the preference for whether the literal system
-     * identifier should be used when resolving system
-     * identifiers when both it and the expanded system
-     * identifier are available. If this property has not yet
-     * been explicitly set its value is <code>true</code>.</p>
-     *
-     * @return the preference for using literal system identifers
-     * for catalog resolution
-     *
-     * @see #setUseLiteralSystemId
-     */
-    public final boolean getUseLiteralSystemId () {
-        return fUseLiteralSystemId;
-    }
-
-    /**
-     * <p>Sets the preference for whether the literal system
-     * identifier should be used when resolving system
-     * identifiers when both it and the expanded system
-     * identifier are available.</p>
-     *
-     * <p>The literal system identifier is the URI as it was
-     * provided before absolutization. It may be embedded within
-     * an entity. It may be provided externally or it may be the
-     * result of redirection. For example, redirection may
-     * have come from the protocol level through HTTP or from
-     * an application's entity resolver.</p>
-     *
-     * <p>The expanded system identifier is an absolute URI
-     * which is the result of resolving the literal system
-     * identifier against a base URI.</p>
-     *
-     * @param useLiteralSystemId the preference for using
-     * literal system identifers for catalog resolution
-     */
-    public final void setUseLiteralSystemId (boolean useLiteralSystemId) {
-        fUseLiteralSystemId = useLiteralSystemId;
-    }
-
-    /**
-     * <p>Resolves an external entity. If the entity cannot be
-     * resolved, this method should return <code>null</code>. This
-     * method returns an input source if an entry was found in the
-     * catalog for the given external identifier. It should be
-     * overrided if other behaviour is required.</p>
-     *
-     * @param publicId the public identifier, or <code>null</code> if none was supplied
-     * @param systemId the system identifier
-     *
-     * @throws SAXException any SAX exception, possibly wrapping another exception
-     * @throws IOException thrown if some i/o error occurs
-     */
-    public InputSource resolveEntity(String publicId, String systemId)
-         throws SAXException, IOException {
-
-        String resolvedId = null;
-        if (publicId != null && systemId != null) {
-            resolvedId = resolvePublic(publicId, systemId);
-        }
-        else if (systemId != null) {
-            resolvedId = resolveSystem(systemId);
-        }
-
-        if (resolvedId != null) {
-            InputSource source = new InputSource(resolvedId);
-            source.setPublicId(publicId);
-            return source;
-        }
-        return null;
-    }
-
-     /**
-      * <p>Resolves an external entity. If the entity cannot be
-      * resolved, this method should return <code>null</code>. This
-      * method returns an input source if an entry was found in the
-      * catalog for the given external identifier. It should be
-      * overrided if other behaviour is required.</p>
-      *
-      * @param name the identifier of the external entity
-      * @param publicId the public identifier, or <code>null</code> if none was supplied
-      * @param baseURI the URI with respect to which relative systemIDs are interpreted.
-      * @param systemId the system identifier
-      *
-      * @throws SAXException any SAX exception, possibly wrapping another exception
-      * @throws IOException thrown if some i/o error occurs
-      */
-     public InputSource resolveEntity(String name, String publicId,
-         String baseURI, String systemId) throws SAXException, IOException {
-
-         String resolvedId = null;
-
-         if (!getUseLiteralSystemId() && baseURI != null) {
-             // Attempt to resolve the system identifier against the base URI.
-             try {
-                 URI uri = new URI(new URI(baseURI), systemId);
-                 systemId = uri.toString();
-             }
-             // Ignore the exception. Fallback to the literal system identifier.
-             catch (URI.MalformedURIException ex) {}
-         }
-
-         if (publicId != null && systemId != null) {
-             resolvedId = resolvePublic(publicId, systemId);
-         }
-         else if (systemId != null) {
-             resolvedId = resolveSystem(systemId);
-         }
-
-         if (resolvedId != null) {
-             InputSource source = new InputSource(resolvedId);
-             source.setPublicId(publicId);
-             return source;
-         }
-         return null;
-    }
-
-     /**
-      * <p>Locates an external subset for documents which do not explicitly
-      * provide one. This method always returns <code>null</code>. It
-      * should be overrided if other behaviour is required.</p>
-      *
-      * @param name the identifier of the document root element
-      * @param baseURI the document's base URI
-      *
-      * @throws SAXException any SAX exception, possibly wrapping another exception
-      * @throws IOException thrown if some i/o error occurs
-      */
-     public InputSource getExternalSubset(String name, String baseURI)
-         throws SAXException, IOException {
-         return null;
-     }
-
-    /**
-     * <p>Resolves a resource using the catalog. This method interprets that
-     * the namespace URI corresponds to uri entries in the catalog.
-     * Where both a namespace and an external identifier exist, the namespace
-     * takes precedence.</p>
-     *
-     * @param type the type of the resource being resolved
-     * @param namespaceURI the namespace of the resource being resolved,
-     * or <code>null</code> if none was supplied
-     * @param publicId the public identifier of the resource being resolved,
-     * or <code>null</code> if none was supplied
-     * @param systemId the system identifier of the resource being resolved,
-     * or <code>null</code> if none was supplied
-     * @param baseURI the absolute base URI of the resource being parsed,
-     * or <code>null</code> if there is no base URI
-     */
-    public LSInput resolveResource(String type, String namespaceURI,
-        String publicId, String systemId, String baseURI) {
-
-        String resolvedId = null;
-
-        try {
-            // The namespace is useful for resolving namespace aware
-            // grammars such as XML schema. Let it take precedence over
-            // the external identifier if one exists.
-            if (namespaceURI != null) {
-                resolvedId = resolveURI(namespaceURI);
-            }
-
-            if (!getUseLiteralSystemId() && baseURI != null) {
-                // Attempt to resolve the system identifier against the base URI.
-                try {
-                    URI uri = new URI(new URI(baseURI), systemId);
-                    systemId = uri.toString();
-                }
-                // Ignore the exception. Fallback to the literal system identifier.
-                catch (URI.MalformedURIException ex) {}
-            }
-
-            // Resolve against an external identifier if one exists. This
-            // is useful for resolving DTD external subsets and other
-            // external entities. For XML schemas if there was no namespace
-            // mapping we might be able to resolve a system identifier
-            // specified as a location hint.
-            if (resolvedId == null) {
-                if (publicId != null && systemId != null) {
-                    resolvedId = resolvePublic(publicId, systemId);
-                }
-                else if (systemId != null) {
-                    resolvedId = resolveSystem(systemId);
-                }
-            }
-        }
-        // Ignore IOException. It cannot be thrown from this method.
-        catch (IOException ex) {}
-
-        if (resolvedId != null) {
-            return new DOMInputImpl(publicId, resolvedId, baseURI);
-        }
-        return null;
-    }
-
-
-    /**
-     * <p>Resolves an external entity. If the entity cannot be
-     * resolved, this method should return <code>null</code>. This
-     * method only calls <code>resolveIdentifier</code> and returns
-     * an input source if an entry was found in the catalog. It
-     * should be overrided if other behaviour is required.</p>
-     *
-     * @param resourceIdentifier location of the XML resource to resolve
-     *
-     * @throws XNIException thrown on general error
-     * @throws IOException thrown if some i/o error occurs
-     */
-    public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
-        throws XNIException, IOException {
-
-        String resolvedId = resolveIdentifier(resourceIdentifier);
-        if (resolvedId != null) {
-            return new XMLInputSource(resourceIdentifier.getPublicId(),
-                    resolvedId, resourceIdentifier.getBaseSystemId(), false);
-        }
-        return null;
-    }
-
-    /**
-     * <p>Resolves an identifier using the catalog. This method interprets that
-     * the namespace of the identifier corresponds to uri entries in the catalog.
-     * Where both a namespace and an external identifier exist, the namespace
-     * takes precedence.</p>
-     *
-     * @param resourceIdentifier the identifier to resolve
-     *
-     * @throws XNIException thrown on general error
-     * @throws IOException thrown if some i/o error occurs
-     */
-    public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier)
-        throws IOException, XNIException {
-
-        String resolvedId = null;
-
-        // The namespace is useful for resolving namespace aware
-        // grammars such as XML schema. Let it take precedence over
-        // the external identifier if one exists.
-        String namespace = resourceIdentifier.getNamespace();
-        if (namespace != null) {
-            resolvedId = resolveURI(namespace);
-        }
-
-        // Resolve against an external identifier if one exists. This
-        // is useful for resolving DTD external subsets and other
-        // external entities. For XML schemas if there was no namespace
-        // mapping we might be able to resolve a system identifier
-        // specified as a location hint.
-        if (resolvedId == null) {
-            String publicId = resourceIdentifier.getPublicId();
-            String systemId = getUseLiteralSystemId()
-                ? resourceIdentifier.getLiteralSystemId()
-                : resourceIdentifier.getExpandedSystemId();
-            if (publicId != null && systemId != null) {
-                resolvedId = resolvePublic(publicId, systemId);
-            }
-            else if (systemId != null) {
-                resolvedId = resolveSystem(systemId);
-            }
-        }
-        return resolvedId;
-    }
-
-    /**
-     * <p>Returns the URI mapping in the catalog for the given
-     * external identifier or <code>null</code> if no mapping
-     * exists. If the system identifier is an URN in the
-     * <code>publicid</code> namespace it is converted into
-     * a public identifier by URN "unwrapping" as specified
-     * in the XML Catalogs specification.</p>
-     *
-     * @param systemId the system identifier to locate in the catalog
-     *
-     * @return the mapped URI or <code>null</code> if no mapping
-     * was found in the catalog
-     *
-     * @throws IOException if an i/o error occurred while reading
-     * the catalog
-     */
-    public final synchronized String resolveSystem (String systemId)
-        throws IOException {
-
-        if (fCatalogsChanged) {
-            parseCatalogs();
-            fCatalogsChanged = false;
-        }
-        return (fCatalog != null)
-            ? fCatalog.resolveSystem(systemId) : null;
-    }
-
-    /**
-     * <p>Returns the URI mapping in the catalog for the given
-     * external identifier or <code>null</code> if no mapping
-     * exists. Public identifiers are normalized before
-     * comparison.</p>
-     *
-     * @param publicId the public identifier to locate in the catalog
-     * @param systemId the system identifier to locate in the catalog
-     *
-     * @return the mapped URI or <code>null</code> if no mapping
-     * was found in the catalog
-     *
-     * @throws IOException if an i/o error occurred while reading
-     * the catalog
-     */
-    public final synchronized String resolvePublic (String publicId, String systemId)
-        throws IOException {
-
-        if (fCatalogsChanged) {
-            parseCatalogs();
-            fCatalogsChanged = false;
-        }
-        return (fCatalog != null)
-            ? fCatalog.resolvePublic(publicId, systemId) : null;
-    }
-
-    /**
-     * <p>Returns the URI mapping in the catalog for the given URI
-     * reference or <code>null</code> if no mapping exists.
-     * URI comparison is case sensitive. If the URI reference
-     * is an URN in the <code>publicid</code> namespace
-     * it is converted into a public identifier by URN "unwrapping"
-     * as specified in the XML Catalogs specification and then
-     * resolution is performed following the semantics of
-     * external identifier resolution.</p>
-     *
-     * @param uri the URI to locate in the catalog
-     *
-     * @return the mapped URI or <code>null</code> if no mapping
-     * was found in the catalog
-     *
-     * @throws IOException if an i/o error occurred while reading
-     * the catalog
-     */
-    public final synchronized String resolveURI (String uri)
-        throws IOException {
-
-        if (fCatalogsChanged) {
-            parseCatalogs();
-            fCatalogsChanged = false;
-        }
-        return (fCatalog != null)
-            ? fCatalog.resolveURI(uri) : null;
-    }
-
-    /**
-     * Initialization. Create a CatalogManager and set all
-     * the properties upfront. This prevents JVM wide system properties
-     * or a property file somewhere in the environment from affecting
-     * the behaviour of this catalog resolver.
-     */
-    private void init (String [] catalogs, boolean preferPublic) {
-        fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
-        fPreferPublic = preferPublic;
-        fResolverCatalogManager = new CatalogManager();
-        fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
-        fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
-        fResolverCatalogManager.setCatalogFiles("");
-        fResolverCatalogManager.setIgnoreMissingProperties(true);
-        fResolverCatalogManager.setPreferPublic(fPreferPublic);
-        fResolverCatalogManager.setRelativeCatalogs(false);
-        fResolverCatalogManager.setUseStaticCatalog(false);
-        fResolverCatalogManager.setVerbosity(0);
-    }
-
-    /**
-     * Instruct the <code>Catalog</code> to parse each of the
-     * catalogs in the list. Only the first catalog will actually be
-     * parsed immediately. The others will be queued and read if
-     * they are needed later.
-     */
-    private void parseCatalogs () throws IOException {
-        if (fCatalogsList != null) {
-            fCatalog = new Catalog(fResolverCatalogManager);
-            attachReaderToCatalog(fCatalog);
-            for (int i = 0; i < fCatalogsList.length; ++i) {
-                String catalog = fCatalogsList[i];
-                if (catalog != null && catalog.length() > 0) {
-                    fCatalog.parseCatalog(catalog);
-                }
-            }
-        }
-        else {
-            fCatalog = null;
-        }
-    }
-
-    /**
-     * Attaches the reader to the catalog.
-     */
-    private void attachReaderToCatalog (Catalog catalog) {
-
-        SAXParserFactory spf = new SAXParserFactoryImpl();
-        spf.setNamespaceAware(true);
-        spf.setValidating(false);
-
-        SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-        saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
-            "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
-        catalog.addReader("application/xml", saxReader);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2258 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
-import java.io.DataInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Vector;
-import javax.xml.parsers.SAXParserFactory;
-
-/**
- * Represents OASIS Open Catalog files.
- *
- * <p>This class implements the semantics of OASIS Open Catalog files
- * (defined by
- * <a href="http://www.oasis-open.org/html/a401.htm">OASIS Technical
- * Resolution 9401:1997 (Amendment 2 to TR 9401)</a>).</p>
- *
- * <p>The primary purpose of the Catalog is to associate resources in the
- * document with local system identifiers. Some entities
- * (document types, XML entities, and notations) have names and all of them
- * can have either public or system identifiers or both. (In XML, only a
- * notation can have a public identifier without a system identifier, but
- * the methods implemented in this class obey the Catalog semantics
- * from the SGML
- * days when system identifiers were optional.)</p>
- *
- * <p>The system identifiers returned by the resolution methods in this
- * class are valid, i.e. usable by, and in fact constructed by, the
- * <tt>java.net.URL</tt> class. Unfortunately, this class seems to behave in
- * somewhat non-standard ways and the system identifiers returned may
- * not be directly usable in a browser or filesystem context.
- *
- * <p>This class recognizes all of the Catalog entries defined in
- * TR9401:1997:</p>
- *
- * <ul>
- * <li><b>BASE</b>
- * changes the base URI for resolving relative system identifiers. The
- * initial base URI is the URI of the location of the catalog (which is,
- * in turn, relative to the location of the current working directory
- * at startup, as returned by the <tt>user.dir</tt> system property).</li>
- * <li><b>CATALOG</b>
- * processes other catalog files. An included catalog occurs logically
- * at the end of the including catalog.</li>
- * <li><b>DELEGATE_PUBLIC</b>
- * specifies alternate catalogs for some public identifiers. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.</li>
- * <li><b>DELEGATE_SYSTEM</b>
- * specifies alternate catalogs for some system identifiers. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.</li>
- * <li><b>DELEGATE_URI</b>
- * specifies alternate catalogs for some URIs. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.</li>
- * <li><b>REWRITE_SYSTEM</b>
- * specifies alternate prefix for a system identifier.</li>
- * <li><b>REWRITE_URI</b>
- * specifies alternate prefix for a URI.</li>
- * <li><b>SYSTEM_SUFFIX</b>
- * maps any system identifier that ends with a particular suffix to another
- * system identifier.</li>
- * <li><b>URI_SUFFIX</b>
- * maps any URI that ends with a particular suffix to another URI.</li>
- * <li><b>DOCTYPE</b>
- * associates the names of root elements with URIs. (In other words, an XML
- * processor might infer the doctype of an XML document that does not include
- * a doctype declaration by looking for the DOCTYPE entry in the
- * catalog which matches the name of the root element of the document.)</li>
- * <li><b>DOCUMENT</b>
- * provides a default document.</li>
- * <li><b>DTDDECL</b>
- * recognized and silently ignored. Not relevant for XML.</li>
- * <li><b>ENTITY</b>
- * associates entity names with URIs.</li>
- * <li><b>LINKTYPE</b>
- * recognized and silently ignored. Not relevant for XML.</li>
- * <li><b>NOTATION</b>
- * associates notation names with URIs.</li>
- * <li><b>OVERRIDE</b>
- * changes the override behavior. Initial behavior is set by the
- * system property <tt>xml.catalog.override</tt>. The default initial
- * behavior is 'YES', that is, entries in the catalog override
- * system identifiers specified in the document.</li>
- * <li><b>PUBLIC</b>
- * maps a public identifier to a system identifier.</li>
- * <li><b>SGMLDECL</b>
- * recognized and silently ignored. Not relevant for XML.</li>
- * <li><b>SYSTEM</b>
- * maps a system identifier to another system identifier.</li>
- * <li><b>URI</b>
- * maps a URI to another URI.</li>
- * </ul>
- *
- * <p>Note that BASE entries are treated as described by RFC2396. In
- * particular, this has the counter-intuitive property that after a BASE
- * entry identifing "http://example.com/a/b/c" as the base URI,
- * the relative URI "foo" is resolved to the absolute URI
- * "http://example.com/a/b/foo". You must provide the trailing slash if
- * you do not want the final component of the path to be discarded as a
- * filename would in a URI for a resource: "http://example.com/a/b/c/".
- * </p>
- *
- * <p>Note that subordinate catalogs (all catalogs except the first,
- * including CATALOG and DELEGATE* catalogs) are only loaded if and when
- * they are required.</p>
- *
- * <p>This class relies on classes which implement the CatalogReader
- * interface to actually load catalog files. This allows the catalog
- * semantics to be implemented for TR9401 text-based catalogs, XML
- * catalogs, or any number of other storage formats.</p>
- *
- * <p>Additional catalogs may also be loaded with the
- * {@link #parseCatalog} method.</p>
- *
- * <p><b>Change Log:</b></p>
- * <dl>
- * <dt>2.0</dt>
- * <dd><p>Rewrite to use CatalogReaders.</p></dd>
- * <dt>1.1</dt>
- * <dd><p>Allow quoted components in <tt>xml.catalog.files</tt>
- * so that URLs containing colons can be used on Unix.
- * The string passed to <tt>xml.catalog.files</tt> can now have the form:</p>
- * <pre>
- * unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars'
- * </pre>
- * <p>(Where ":" is the separater character in this example.)</p>
- * <p>If an unquoted path contains an embedded double or single quote
- * character, no special processig is performed on that character. No
- * path can contain separater characters, double, and single quotes
- * simultaneously.</p>
- * <p>Fix bug in calculation of BASE entries: if
- * a catalog contains multiple BASE entries, each is relative to the preceding
- * base, not the default base URI of the catalog.</p>
- * </dd>
- * <dt>1.0.1</dt>
- * <dd><p>Fixed a bug in the calculation of the list of subordinate catalogs.
- * This bug caused an infinite loop where parsing would alternately process
- * two catalogs indefinitely.</p>
- * </dd>
- * </dl>
- *
- * @see CatalogReader
- * @see CatalogEntry
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- *
- * <p>Derived from public domain code originally published by Arbortext,
- * Inc.</p>
- */
-@Deprecated(since="9", forRemoval=true)
-public class Catalog {
-  /** The BASE Catalog Entry type. */
-  public static final int BASE     = CatalogEntry.addEntryType("BASE", 1);
-
-  /** The CATALOG Catalog Entry type. */
-  public static final int CATALOG  = CatalogEntry.addEntryType("CATALOG", 1);
-
-  /** The DOCUMENT Catalog Entry type. */
-  public static final int DOCUMENT = CatalogEntry.addEntryType("DOCUMENT", 1);
-
-  /** The OVERRIDE Catalog Entry type. */
-  public static final int OVERRIDE = CatalogEntry.addEntryType("OVERRIDE", 1);
-
-  /** The SGMLDECL Catalog Entry type. */
-  public static final int SGMLDECL = CatalogEntry.addEntryType("SGMLDECL", 1);
-
-  /** The DELEGATE_PUBLIC Catalog Entry type. */
-  public static final int DELEGATE_PUBLIC = CatalogEntry.addEntryType("DELEGATE_PUBLIC", 2);
-
-  /** The DELEGATE_SYSTEM Catalog Entry type. */
-  public static final int DELEGATE_SYSTEM = CatalogEntry.addEntryType("DELEGATE_SYSTEM", 2);
-
-  /** The DELEGATE_URI Catalog Entry type. */
-  public static final int DELEGATE_URI = CatalogEntry.addEntryType("DELEGATE_URI", 2);
-
-  /** The DOCTYPE Catalog Entry type. */
-  public static final int DOCTYPE  = CatalogEntry.addEntryType("DOCTYPE", 2);
-
-  /** The DTDDECL Catalog Entry type. */
-  public static final int DTDDECL  = CatalogEntry.addEntryType("DTDDECL", 2);
-
-  /** The ENTITY Catalog Entry type. */
-  public static final int ENTITY   = CatalogEntry.addEntryType("ENTITY", 2);
-
-  /** The LINKTYPE Catalog Entry type. */
-  public static final int LINKTYPE = CatalogEntry.addEntryType("LINKTYPE", 2);
-
-  /** The NOTATION Catalog Entry type. */
-  public static final int NOTATION = CatalogEntry.addEntryType("NOTATION", 2);
-
-  /** The PUBLIC Catalog Entry type. */
-  public static final int PUBLIC   = CatalogEntry.addEntryType("PUBLIC", 2);
-
-  /** The SYSTEM Catalog Entry type. */
-  public static final int SYSTEM   = CatalogEntry.addEntryType("SYSTEM", 2);
-
-  /** The URI Catalog Entry type. */
-  public static final int URI      = CatalogEntry.addEntryType("URI", 2);
-
-  /** The REWRITE_SYSTEM Catalog Entry type. */
-  public static final int REWRITE_SYSTEM = CatalogEntry.addEntryType("REWRITE_SYSTEM", 2);
-
-  /** The REWRITE_URI Catalog Entry type. */
-  public static final int REWRITE_URI = CatalogEntry.addEntryType("REWRITE_URI", 2);
-  /** The SYSTEM_SUFFIX Catalog Entry type. */
-  public static final int SYSTEM_SUFFIX = CatalogEntry.addEntryType("SYSTEM_SUFFIX", 2);
-  /** The URI_SUFFIX Catalog Entry type. */
-  public static final int URI_SUFFIX = CatalogEntry.addEntryType("URI_SUFFIX", 2);
-
-  /**
-   * The base URI for relative system identifiers in the catalog.
-   * This may be changed by BASE entries in the catalog.
-   */
-  protected URL base;
-
-  /** The base URI of the Catalog file currently being parsed. */
-  protected URL catalogCwd;
-
-  /** The catalog entries currently known to the system. */
-  protected Vector catalogEntries = new Vector();
-
-  /** The default initial override setting. */
-  protected boolean default_override = true;
-
-  /** The catalog manager in use for this instance. */
-  protected CatalogManager catalogManager = CatalogManager.getStaticManager();
-
-  /**
-   * A vector of catalog files to be loaded.
-   *
-   * <p>This list is initially established by
-   * <code>loadSystemCatalogs</code> when
-   * it parses the system catalog list, but CATALOG entries may
-   * contribute to it during the course of parsing.</p>
-   *
-   * @see #loadSystemCatalogs
-   * @see #localCatalogFiles
-   */
-  protected Vector catalogFiles = new Vector();
-
-  /**
-   * A vector of catalog files constructed during processing of
-   * CATALOG entries in the current catalog.
-   *
-   * <p>This two-level system is actually necessary to correctly implement
-   * the semantics of the CATALOG entry. If one catalog file includes
-   * another with a CATALOG entry, the included catalog logically
-   * occurs <i>at the end</i> of the including catalog, and after any
-   * preceding CATALOG entries. In other words, the CATALOG entry
-   * cannot insert anything into the middle of a catalog file.</p>
-   *
-   * <p>When processing reaches the end of each catalog files, any
-   * elements on this vector are added to the front of the
-   * <code>catalogFiles</code> vector.</p>
-   *
-   * @see #catalogFiles
-   */
-  protected Vector localCatalogFiles = new Vector();
-
-  /**
-   * A vector of Catalogs.
-   *
-   * <p>The semantics of Catalog resolution are such that each
-   * catalog is effectively a list of Catalogs (in other words,
-   * a recursive list of Catalog instances).</p>
-   *
-   * <p>Catalogs that are processed as the result of CATALOG or
-   * DELEGATE* entries are subordinate to the catalog that contained
-   * them, but they may in turn have subordinate catalogs.</p>
-   *
-   * <p>Catalogs are only loaded when they are needed, so this vector
-   * initially contains a list of Catalog filenames (URLs). If, during
-   * processing, one of these catalogs has to be loaded, the resulting
-   * Catalog object is placed in the vector, effectively caching it
-   * for the next query.</p>
-   */
-  protected Vector catalogs = new Vector();
-
-  /**
-   * A vector of DELEGATE* Catalog entries constructed during
-   * processing of the Catalog.
-   *
-   * <p>This two-level system has two purposes; first, it allows
-   * us to sort the DELEGATE* entries by the length of the partial
-   * public identifier so that a linear search encounters them in
-   * the correct order and second, it puts them all at the end of
-   * the Catalog.</p>
-   *
-   * <p>When processing reaches the end of each catalog file, any
-   * elements on this vector are added to the end of the
-   * <code>catalogEntries</code> vector. This assures that matching
-   * PUBLIC keywords are encountered before DELEGATE* entries.</p>
-   */
-  protected Vector localDelegate = new Vector();
-
-  /**
-   * A hash of CatalogReaders.
-   *
-   * <p>This hash maps MIME types to elements in the readerArr
-   * vector. This allows the Catalog to quickly locate the reader
-   * for a particular MIME type.</p>
-   */
-  protected Map<String, Integer> readerMap = new HashMap<>();
-
-  /**
-   * A vector of CatalogReaders.
-   *
-   * <p>This vector contains all of the readers in the order that they
-   * were added. In the event that a catalog is read from a file, where
-   * the MIME type is unknown, each reader is attempted in turn until
-   * one succeeds.</p>
-   */
-  protected Vector readerArr = new Vector();
-
-  /**
-   * Constructs an empty Catalog.
-   *
-   * <p>The constructor interrogates the relevant system properties
-   * using the default (static) CatalogManager
-   * and initializes the catalog data structures.</p>
-   */
-  public Catalog() {
-    // nop;
-  }
-
-  /**
-   * Constructs an empty Catalog with a specific CatalogManager.
-   *
-   * <p>The constructor interrogates the relevant system properties
-   * using the specified Catalog Manager
-   * and initializes the catalog data structures.</p>
-   */
-  public Catalog(CatalogManager manager) {
-    catalogManager = manager;
-  }
-
-  /**
-   * Return the CatalogManager used by this catalog.
-   *
-   */
-  public CatalogManager getCatalogManager() {
-    return catalogManager;
-  }
-
-  /**
-   * Establish the CatalogManager used by this catalog.
-   *
-   */
-  public void setCatalogManager(CatalogManager manager) {
-    catalogManager = manager;
-  }
-
-  /**
-   * Setup readers.
-   */
-  public void setupReaders() {
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(true);
-    spf.setValidating(false);
-
-    SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-
-    saxReader.setCatalogParser(null, "XMLCatalog",
-                               "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
-
-    saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
-                               "catalog",
-                               "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
-
-    addReader("application/xml", saxReader);
-
-    TR9401CatalogReader textReader = new TR9401CatalogReader();
-    addReader("text/plain", textReader);
-  }
-
-  /**
-   * Add a new CatalogReader to the Catalog.
-   *
-   * <p>This method allows you to add a new CatalogReader to the
-   * catalog. The reader will be associated with the specified mimeType.
-   * You can only have one reader per mimeType.</p>
-   *
-   * <p>In the absence of a mimeType (e.g., when reading a catalog
-   * directly from a file on the local system), the readers are attempted
-   * in the order that you add them to the Catalog.</p>
-   *
-   * <p>Note that subordinate catalogs (created by CATALOG or
-   * DELEGATE* entries) get a copy of the set of readers present in
-   * the primary catalog when they are created. Readers added subsequently
-   * will not be available. For this reason, it is best to add all
-   * of the readers before the first call to parse a catalog.</p>
-   *
-   * @param mimeType The MIME type associated with this reader.
-   * @param reader The CatalogReader to use.
-   */
-  public void addReader(String mimeType, CatalogReader reader) {
-    if (readerMap.containsKey(mimeType)) {
-      Integer pos = readerMap.get(mimeType);
-      readerArr.set(pos, reader);
-    } else {
-      readerArr.add(reader);
-      Integer pos = readerArr.size()-1;
-      readerMap.put(mimeType, pos);
-    }
-  }
-
-  /**
-   * Copies the reader list from the current Catalog to a new Catalog.
-   *
-   * <p>This method is used internally when constructing a new catalog.
-   * It copies the current reader associations over to the new catalog.
-   * </p>
-   *
-   * @param newCatalog The new Catalog.
-   */
-  protected void copyReaders(Catalog newCatalog) {
-    // Have to copy the readers in the right order...convert hash to arr
-    Vector mapArr = new Vector(readerMap.size());
-
-    // Pad the mapArr out to the right length
-    for (int count = 0; count < readerMap.size(); count++) {
-      mapArr.add(null);
-    }
-
-    for (Map.Entry<String, Integer> entry : readerMap.entrySet()) {
-        mapArr.set(entry.getValue().intValue(), entry.getKey());
-    }
-
-    for (int count = 0; count < mapArr.size(); count++) {
-      String mimeType = (String) mapArr.get(count);
-      Integer pos = readerMap.get(mimeType);
-      newCatalog.addReader(mimeType,
-                           (CatalogReader)
-                           readerArr.get(pos.intValue()));
-    }
-  }
-
-  /**
-   * Create a new Catalog object.
-   *
-   * <p>This method constructs a new instance of the running Catalog
-   * class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog).
-   * All new catalogs are managed by the same CatalogManager.
-   * </p>
-   *
-   * <p>N.B. All Catalog subtypes should call newCatalog() to construct
-   * a new Catalog. Do not simply use "new Subclass()" since that will
-   * confuse future subclasses.</p>
-   */
-  protected Catalog newCatalog() {
-    String catalogClass = this.getClass().getName();
-
-    try {
-      Catalog c = (Catalog) (Class.forName(catalogClass).newInstance());
-      c.setCatalogManager(catalogManager);
-      copyReaders(c);
-      return c;
-    } catch (ClassNotFoundException cnfe) {
-      catalogManager.debug.message(1, "Class Not Found Exception: " + catalogClass);
-    } catch (IllegalAccessException iae) {
-      catalogManager.debug.message(1, "Illegal Access Exception: " + catalogClass);
-    } catch (InstantiationException ie) {
-      catalogManager.debug.message(1, "Instantiation Exception: " + catalogClass);
-    } catch (ClassCastException cce) {
-      catalogManager.debug.message(1, "Class Cast Exception: " + catalogClass);
-    } catch (Exception e) {
-      catalogManager.debug.message(1, "Other Exception: " + catalogClass);
-    }
-
-    Catalog c = new Catalog();
-    c.setCatalogManager(catalogManager);
-    copyReaders(c);
-    return c;
-  }
-
-  /**
-   * Returns the current base URI.
-   */
-  public String getCurrentBase() {
-    return base.toString();
-  }
-
-  /**
-   * Returns the default override setting associated with this
-   * catalog.
-   *
-   * <p>All catalog files loaded by this catalog will have the
-   * initial override setting specified by this default.</p>
-   */
-  public String getDefaultOverride() {
-    if (default_override) {
-      return "yes";
-    } else {
-      return "no";
-    }
-  }
-
-  /**
-   * Load the system catalog files.
-   *
-   * <p>The method adds all of the
-   * catalogs specified in the <tt>xml.catalog.files</tt> property
-   * to the Catalog list.</p>
-   *
-   * @throws MalformedURLException  One of the system catalogs is
-   * identified with a filename that is not a valid URL.
-   * @throws IOException One of the system catalogs cannot be read.
-   */
-  public void loadSystemCatalogs()
-    throws MalformedURLException, IOException {
-
-    Vector catalogs = catalogManager.getCatalogFiles();
-    if (catalogs != null) {
-      for (int count = 0; count < catalogs.size(); count++) {
-        catalogFiles.addElement(catalogs.elementAt(count));
-      }
-    }
-
-    if (catalogFiles.size() > 0) {
-      // This is a little odd. The parseCatalog() method expects
-      // a filename, but it adds that name to the end of the
-      // catalogFiles vector, and then processes that vector.
-      // This allows the system to handle CATALOG entries
-      // correctly.
-      //
-      // In this init case, we take the last element off the
-      // catalogFiles vector and pass it to parseCatalog. This
-      // will "do the right thing" in the init case, and allow
-      // parseCatalog() to do the right thing in the non-init
-      // case. Honest.
-      //
-      String catfile = (String) catalogFiles.lastElement();
-      catalogFiles.removeElement(catfile);
-      parseCatalog(catfile);
-    }
-  }
-
-  /**
-   * Parse a catalog file, augmenting internal data structures.
-   *
-   * @param fileName The filename of the catalog file to process
-   *
-   * @throws MalformedURLException The fileName cannot be turned into
-   * a valid URL.
-   * @throws IOException Error reading catalog file.
-   */
-  public synchronized void parseCatalog(String fileName)
-    throws MalformedURLException, IOException {
-
-    default_override = catalogManager.getPreferPublic();
-    catalogManager.debug.message(4, "Parse catalog: " + fileName);
-
-    // Put the file into the list of catalogs to process...
-    // In all cases except the case when initCatalog() is the
-    // caller, this will be the only catalog initially in the list...
-    catalogFiles.addElement(fileName);
-
-    // Now process all the pending catalogs...
-    parsePendingCatalogs();
-  }
-
-  /**
-   * Parse a catalog file, augmenting internal data structures.
-   *
-   * <p>Catalogs retrieved over the net may have an associated MIME type.
-   * The MIME type can be used to select an appropriate reader.</p>
-   *
-   * @param mimeType The MIME type of the catalog file.
-   * @param is The InputStream from which the catalog should be read
-   *
-   * @throws CatalogException Failed to load catalog
-   * mimeType.
-   * @throws IOException Error reading catalog file.
-   */
-  public synchronized void parseCatalog(String mimeType, InputStream is)
-    throws IOException, CatalogException {
-
-    default_override = catalogManager.getPreferPublic();
-    catalogManager.debug.message(4, "Parse " + mimeType + " catalog on input stream");
-
-    CatalogReader reader = null;
-
-    if (readerMap.containsKey(mimeType)) {
-      int arrayPos = ((Integer) readerMap.get(mimeType)).intValue();
-      reader = (CatalogReader) readerArr.get(arrayPos);
-    }
-
-    if (reader == null) {
-      String msg = "No CatalogReader for MIME type: " + mimeType;
-      catalogManager.debug.message(2, msg);
-      throw new CatalogException(CatalogException.UNPARSEABLE, msg);
-    }
-
-    reader.readCatalog(this, is);
-
-    // Now process all the pending catalogs...
-    parsePendingCatalogs();
-  }
-
-  /**
-   * Parse a catalog document, augmenting internal data structures.
-   *
-   * <p>This method supports catalog files stored in jar files: e.g.,
-   * jar:file:///path/to/filename.jar!/path/to/catalog.xml". That URI
-   * doesn't survive transmogrification through the URI processing that
-   * the parseCatalog(String) performs and passing it as an input stream
-   * doesn't set the base URI appropriately.</p>
-   *
-   * <p>Written by Stefan Wachter (2002-09-26)</p>
-   *
-   * @param aUrl The URL of the catalog document to process
-   *
-   * @throws IOException Error reading catalog file.
-   */
-  public synchronized void parseCatalog(URL aUrl) throws IOException {
-    catalogCwd = aUrl;
-    base = aUrl;
-
-    default_override = catalogManager.getPreferPublic();
-    catalogManager.debug.message(4, "Parse catalog: " + aUrl.toString());
-
-    DataInputStream inStream = null;
-    boolean parsed = false;
-
-    for (int count = 0; !parsed && count < readerArr.size(); count++) {
-      CatalogReader reader = (CatalogReader) readerArr.get(count);
-
-      try {
-        inStream = new DataInputStream(aUrl.openStream());
-      } catch (FileNotFoundException fnfe) {
-        // No catalog; give up!
-        break;
-      }
-
-      try {
-        reader.readCatalog(this, inStream);
-        parsed=true;
-      } catch (CatalogException ce) {
-        if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
-          // give up!
-          break;
-        } else {
-          // try again!
-        }
-      }
-
-      try {
-        inStream.close();
-      } catch (IOException e) {
-        //nop
-      }
-    }
-
-    if (parsed) parsePendingCatalogs();
-  }
-
-  /**
-   * Parse all of the pending catalogs.
-   *
-   * <p>Catalogs may refer to other catalogs, this method parses
-   * all of the currently pending catalog files.</p>
-   */
-  protected synchronized void parsePendingCatalogs()
-    throws MalformedURLException, IOException {
-
-    if (!localCatalogFiles.isEmpty()) {
-      // Move all the localCatalogFiles into the front of
-      // the catalogFiles queue
-      Vector newQueue = new Vector();
-      Enumeration q = localCatalogFiles.elements();
-      while (q.hasMoreElements()) {
-        newQueue.addElement(q.nextElement());
-      }
-
-      // Put the rest of the catalogs on the end of the new list
-      for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
-        String catfile = (String) catalogFiles.elementAt(curCat);
-        newQueue.addElement(catfile);
-      }
-
-      catalogFiles = newQueue;
-      localCatalogFiles.clear();
-    }
-
-    // Suppose there are no catalog files to process, but the
-    // single catalog already parsed included some delegate
-    // entries? Make sure they don't get lost.
-    if (catalogFiles.isEmpty() && !localDelegate.isEmpty()) {
-      Enumeration e = localDelegate.elements();
-      while (e.hasMoreElements()) {
-        catalogEntries.addElement(e.nextElement());
-      }
-      localDelegate.clear();
-    }
-
-    // Now process all the files on the catalogFiles vector. This
-    // vector can grow during processing if CATALOG entries are
-    // encountered in the catalog
-    while (!catalogFiles.isEmpty()) {
-      String catfile = (String) catalogFiles.elementAt(0);
-      try {
-        catalogFiles.remove(0);
-      } catch (ArrayIndexOutOfBoundsException e) {
-        // can't happen
-      }
-
-      if (catalogEntries.size() == 0 && catalogs.size() == 0) {
-        // We haven't parsed any catalogs yet, let this
-        // catalog be the first...
-        try {
-          parseCatalogFile(catfile);
-        } catch (CatalogException ce) {
-          System.out.println("FIXME: " + ce.toString());
-        }
-      } else {
-        // This is a subordinate catalog. We save its name,
-        // but don't bother to load it unless it's necessary.
-        catalogs.addElement(catfile);
-      }
-
-      if (!localCatalogFiles.isEmpty()) {
-        // Move all the localCatalogFiles into the front of
-        // the catalogFiles queue
-        Vector newQueue = new Vector();
-        Enumeration q = localCatalogFiles.elements();
-        while (q.hasMoreElements()) {
-          newQueue.addElement(q.nextElement());
-        }
-
-        // Put the rest of the catalogs on the end of the new list
-        for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
-          catfile = (String) catalogFiles.elementAt(curCat);
-          newQueue.addElement(catfile);
-        }
-
-        catalogFiles = newQueue;
-        localCatalogFiles.clear();
-      }
-
-      if (!localDelegate.isEmpty()) {
-        Enumeration e = localDelegate.elements();
-        while (e.hasMoreElements()) {
-          catalogEntries.addElement(e.nextElement());
-        }
-        localDelegate.clear();
-      }
-    }
-
-    // We've parsed them all, reinit the vector...
-    catalogFiles.clear();
-  }
-
-  /**
-   * Parse a single catalog file, augmenting internal data structures.
-   *
-   * @param fileName The filename of the catalog file to process
-   *
-   * @throws MalformedURLException The fileName cannot be turned into
-   * a valid URL.
-   * @throws IOException Error reading catalog file.
-   */
-  protected synchronized void parseCatalogFile(String fileName)
-    throws MalformedURLException, IOException, CatalogException {
-
-    CatalogEntry entry;
-
-    // The base-base is the cwd. If the catalog file is specified
-    // with a relative path, this assures that it gets resolved
-    // properly...
-    try {
-      // tack on a basename because URLs point to files not dirs
-      catalogCwd = FileURL.makeURL("basename");
-    } catch (MalformedURLException e) {
-      catalogManager.debug.message(1, "Malformed URL on cwd", "user.dir");
-      catalogCwd = null;
-    }
-
-    // The initial base URI is the location of the catalog file
-    try {
-      base = new URL(catalogCwd, fixSlashes(fileName));
-    } catch (MalformedURLException e) {
-      try {
-        base = new URL("file:" + fixSlashes(fileName));
-      } catch (MalformedURLException e2) {
-        catalogManager.debug.message(1, "Malformed URL on catalog filename",
-                      fixSlashes(fileName));
-        base = null;
-      }
-    }
-
-    catalogManager.debug.message(2, "Loading catalog", fileName);
-    catalogManager.debug.message(4, "Default BASE", base.toString());
-
-    fileName = base.toString();
-
-    DataInputStream inStream = null;
-    boolean parsed = false;
-    boolean notFound = false;
-
-    for (int count = 0; !parsed && count < readerArr.size(); count++) {
-      CatalogReader reader = (CatalogReader) readerArr.get(count);
-
-      try {
-        notFound = false;
-        inStream = new DataInputStream(base.openStream());
-      } catch (FileNotFoundException fnfe) {
-        // No catalog; give up!
-        notFound = true;
-        break;
-      }
-
-      try {
-        reader.readCatalog(this, inStream);
-        parsed = true;
-      } catch (CatalogException ce) {
-        if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
-          // give up!
-          break;
-        } else {
-          // try again!
-        }
-      }
-
-      try {
-        inStream.close();
-      } catch (IOException e) {
-        //nop
-      }
-    }
-
-    if (!parsed) {
-      if (notFound) {
-        catalogManager.debug.message(3, "Catalog does not exist", fileName);
-      } else {
-        catalogManager.debug.message(1, "Failed to parse catalog", fileName);
-      }
-    }
-  }
-
-  /**
-   * Cleanup and process a Catalog entry.
-   *
-   * <p>This method processes each Catalog entry, changing mapped
-   * relative system identifiers into absolute ones (based on the current
-   * base URI), and maintaining other information about the current
-   * catalog.</p>
-   *
-   * @param entry The CatalogEntry to process.
-   */
-  public void addEntry(CatalogEntry entry) {
-    int type = entry.getEntryType();
-
-    if (type == BASE) {
-      String value = entry.getEntryArg(0);
-      URL newbase = null;
-
-      if (base == null) {
-        catalogManager.debug.message(5, "BASE CUR", "null");
-      } else {
-        catalogManager.debug.message(5, "BASE CUR", base.toString());
-      }
-      catalogManager.debug.message(4, "BASE STR", value);
-
-      try {
-        value = fixSlashes(value);
-        newbase = new URL(base, value);
-      } catch (MalformedURLException e) {
-        try {
-          newbase = new URL("file:" + value);
-        } catch (MalformedURLException e2) {
-          catalogManager.debug.message(1, "Malformed URL on base", value);
-          newbase = null;
-        }
-      }
-
-      if (newbase != null) {
-        base = newbase;
-      }
-
-      catalogManager.debug.message(5, "BASE NEW", base.toString());
-    } else if (type == CATALOG) {
-      String fsi = makeAbsolute(entry.getEntryArg(0));
-
-      catalogManager.debug.message(4, "CATALOG", fsi);
-
-      localCatalogFiles.addElement(fsi);
-    } else if (type == PUBLIC) {
-      String publicid = PublicId.normalize(entry.getEntryArg(0));
-      String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, publicid);
-      entry.setEntryArg(1, systemid);
-
-      catalogManager.debug.message(4, "PUBLIC", publicid, systemid);
-
-      catalogEntries.addElement(entry);
-    } else if (type == SYSTEM) {
-      String systemid = normalizeURI(entry.getEntryArg(0));
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "SYSTEM", systemid, fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == URI) {
-      String uri = normalizeURI(entry.getEntryArg(0));
-      String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(1, altURI);
-
-      catalogManager.debug.message(4, "URI", uri, altURI);
-
-      catalogEntries.addElement(entry);
-    } else if (type == DOCUMENT) {
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
-      entry.setEntryArg(0, fsi);
-
-      catalogManager.debug.message(4, "DOCUMENT", fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == OVERRIDE) {
-      catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0));
-
-      catalogEntries.addElement(entry);
-    } else if (type == SGMLDECL) {
-      // meaningless in XML
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
-      entry.setEntryArg(0, fsi);
-
-      catalogManager.debug.message(4, "SGMLDECL", fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == DELEGATE_PUBLIC) {
-      String ppi = PublicId.normalize(entry.getEntryArg(0));
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, ppi);
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi);
-
-      addDelegate(entry);
-    } else if (type == DELEGATE_SYSTEM) {
-      String psi = normalizeURI(entry.getEntryArg(0));
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, psi);
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi);
-
-      addDelegate(entry);
-    } else if (type == DELEGATE_URI) {
-      String pui = normalizeURI(entry.getEntryArg(0));
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, pui);
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi);
-
-      addDelegate(entry);
-    } else if (type == REWRITE_SYSTEM) {
-      String psi = normalizeURI(entry.getEntryArg(0));
-      String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, psi);
-      entry.setEntryArg(1, rpx);
-
-      catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx);
-
-      catalogEntries.addElement(entry);
-    } else if (type == REWRITE_URI) {
-      String pui = normalizeURI(entry.getEntryArg(0));
-      String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, pui);
-      entry.setEntryArg(1, upx);
-
-      catalogManager.debug.message(4, "REWRITE_URI", pui, upx);
-
-      catalogEntries.addElement(entry);
-    } else if (type == SYSTEM_SUFFIX) {
-      String pui = normalizeURI(entry.getEntryArg(0));
-      String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, pui);
-      entry.setEntryArg(1, upx);
-
-      catalogManager.debug.message(4, "SYSTEM_SUFFIX", pui, upx);
-
-      catalogEntries.addElement(entry);
-    } else if (type == URI_SUFFIX) {
-      String pui = normalizeURI(entry.getEntryArg(0));
-      String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(0, pui);
-      entry.setEntryArg(1, upx);
-
-      catalogManager.debug.message(4, "URI_SUFFIX", pui, upx);
-
-      catalogEntries.addElement(entry);
-    } else if (type == DOCTYPE) {
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == DTDDECL) {
-      // meaningless in XML
-      String fpi = PublicId.normalize(entry.getEntryArg(0));
-      entry.setEntryArg(0, fpi);
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "DTDDECL", fpi, fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == ENTITY) {
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == LINKTYPE) {
-      // meaningless in XML
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi);
-
-      catalogEntries.addElement(entry);
-    } else if (type == NOTATION) {
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi);
-
-      catalogEntries.addElement(entry);
-    } else {
-      catalogEntries.addElement(entry);
-    }
-  }
-
-  /**
-   * Handle unknown CatalogEntry types.
-   *
-   * <p>This method exists to allow subclasses to deal with unknown
-   * entry types.</p>
-   */
-  public void unknownEntry(Vector strings) {
-    if (strings != null && strings.size() > 0) {
-      String keyword = (String) strings.elementAt(0);
-      catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword);
-    }
-  }
-
-  /**
-   * Parse all subordinate catalogs.
-   *
-   * <p>This method recursively parses all of the subordinate catalogs.
-   * If this method does not throw an exception, you can be confident that
-   * no subsequent call to any resolve*() method will either, with two
-   * possible exceptions:</p>
-   *
-   * <ol>
-   * <li><p>Delegated catalogs are re-parsed each time they are needed
-   * (because a variable list of them may be needed in each case,
-   * depending on the length of the matching partial public identifier).</p>
-   * <p>But they are parsed by this method, so as long as they don't
-   * change or disappear while the program is running, they shouldn't
-   * generate errors later if they don't generate errors now.</p>
-   * <li><p>If you add new catalogs with <code>parseCatalog</code>, they
-   * won't be loaded until they are needed or until you call
-   * <code>parseAllCatalogs</code> again.</p>
-   * </ol>
-   *
-   * <p>On the other hand, if you don't call this method, you may
-   * successfully parse documents without having to load all possible
-   * catalogs.</p>
-   *
-   * @throws MalformedURLException The filename (URL) for a
-   * subordinate or delegated catalog is not a valid URL.
-   * @throws IOException Error reading some subordinate or delegated
-   * catalog file.
-   */
-  public void parseAllCatalogs()
-    throws MalformedURLException, IOException {
-
-    // Parse all the subordinate catalogs
-    for (int catPos = 0; catPos < catalogs.size(); catPos++) {
-      Catalog c = null;
-
-      try {
-        c = (Catalog) catalogs.elementAt(catPos);
-      } catch (ClassCastException e) {
-        String catfile = (String) catalogs.elementAt(catPos);
-        c = newCatalog();
-
-        c.parseCatalog(catfile);
-        catalogs.setElementAt(c, catPos);
-        c.parseAllCatalogs();
-      }
-    }
-
-    // Parse all the DELEGATE catalogs
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == DELEGATE_PUBLIC
-          || e.getEntryType() == DELEGATE_SYSTEM
-          || e.getEntryType() == DELEGATE_URI) {
-        Catalog dcat = newCatalog();
-        dcat.parseCatalog(e.getEntryArg(1));
-      }
-    }
-  }
-
-
-  /**
-   * Return the applicable DOCTYPE system identifier.
-   *
-   * @param entityName The name of the entity (element) for which
-   * a doctype is required.
-   * @param publicId The nominal public identifier for the doctype
-   * (as provided in the source document).
-   * @param systemId The nominal system identifier for the doctype
-   * (as provided in the source document).
-   *
-   * @return The system identifier to use for the doctype.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveDoctype(String entityName,
-                               String publicId,
-                               String systemId)
-    throws MalformedURLException, IOException {
-    String resolved = null;
-
-    catalogManager.debug.message(3, "resolveDoctype("
-                  +entityName+","+publicId+","+systemId+")");
-
-    systemId = normalizeURI(systemId);
-
-    if (publicId != null && publicId.startsWith("urn:publicid:")) {
-      publicId = PublicId.decodeURN(publicId);
-    }
-
-    if (systemId != null && systemId.startsWith("urn:publicid:")) {
-      systemId = PublicId.decodeURN(systemId);
-      if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
-      } else {
-        publicId = systemId;
-        systemId = null;
-      }
-    }
-
-    if (systemId != null) {
-      // If there's a SYSTEM entry in this catalog, use it
-      resolved = resolveLocalSystem(systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    if (publicId != null) {
-      // If there's a PUBLIC entry in this catalog, use it
-      resolved = resolveLocalPublic(DOCTYPE,
-                                    entityName,
-                                    publicId,
-                                    systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // If there's a DOCTYPE entry in this catalog, use it
-    boolean over = default_override;
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
-      }
-
-      if (e.getEntryType() == DOCTYPE
-          && e.getEntryArg(0).equals(entityName)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
-      }
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(DOCTYPE,
-                                      entityName,
-                                      publicId,
-                                      systemId);
-  }
-
-  /**
-   * Return the applicable DOCUMENT entry.
-   *
-   * @return The system identifier to use for the doctype.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveDocument()
-    throws MalformedURLException, IOException {
-    // If there's a DOCUMENT entry, return it
-
-    catalogManager.debug.message(3, "resolveDocument");
-
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == DOCUMENT) {
-        return e.getEntryArg(0);
-      }
-    }
-
-    return resolveSubordinateCatalogs(DOCUMENT,
-                                      null, null, null);
-  }
-
-  /**
-   * Return the applicable ENTITY system identifier.
-   *
-   * @param entityName The name of the entity for which
-   * a system identifier is required.
-   * @param publicId The nominal public identifier for the entity
-   * (as provided in the source document).
-   * @param systemId The nominal system identifier for the entity
-   * (as provided in the source document).
-   *
-   * @return The system identifier to use for the entity.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveEntity(String entityName,
-                              String publicId,
-                              String systemId)
-    throws MalformedURLException, IOException {
-    String resolved = null;
-
-    catalogManager.debug.message(3, "resolveEntity("
-                  +entityName+","+publicId+","+systemId+")");
-
-    systemId = normalizeURI(systemId);
-
-    if (publicId != null && publicId.startsWith("urn:publicid:")) {
-      publicId = PublicId.decodeURN(publicId);
-    }
-
-    if (systemId != null && systemId.startsWith("urn:publicid:")) {
-      systemId = PublicId.decodeURN(systemId);
-      if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
-      } else {
-        publicId = systemId;
-        systemId = null;
-      }
-    }
-
-    if (systemId != null) {
-      // If there's a SYSTEM entry in this catalog, use it
-      resolved = resolveLocalSystem(systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    if (publicId != null) {
-      // If there's a PUBLIC entry in this catalog, use it
-      resolved = resolveLocalPublic(ENTITY,
-                                    entityName,
-                                    publicId,
-                                    systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // If there's a ENTITY entry in this catalog, use it
-    boolean over = default_override;
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
-      }
-
-      if (e.getEntryType() == ENTITY
-          && e.getEntryArg(0).equals(entityName)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
-      }
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(ENTITY,
-                                      entityName,
-                                      publicId,
-                                      systemId);
-  }
-
-  /**
-   * Return the applicable NOTATION system identifier.
-   *
-   * @param notationName The name of the notation for which
-   * a doctype is required.
-   * @param publicId The nominal public identifier for the notation
-   * (as provided in the source document).
-   * @param systemId The nominal system identifier for the notation
-   * (as provided in the source document).
-   *
-   * @return The system identifier to use for the notation.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveNotation(String notationName,
-                                String publicId,
-                                String systemId)
-    throws MalformedURLException, IOException {
-    String resolved = null;
-
-    catalogManager.debug.message(3, "resolveNotation("
-                  +notationName+","+publicId+","+systemId+")");
-
-    systemId = normalizeURI(systemId);
-
-    if (publicId != null && publicId.startsWith("urn:publicid:")) {
-      publicId = PublicId.decodeURN(publicId);
-    }
-
-    if (systemId != null && systemId.startsWith("urn:publicid:")) {
-      systemId = PublicId.decodeURN(systemId);
-      if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
-      } else {
-        publicId = systemId;
-        systemId = null;
-      }
-    }
-
-    if (systemId != null) {
-      // If there's a SYSTEM entry in this catalog, use it
-      resolved = resolveLocalSystem(systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    if (publicId != null) {
-      // If there's a PUBLIC entry in this catalog, use it
-      resolved = resolveLocalPublic(NOTATION,
-                                    notationName,
-                                    publicId,
-                                    systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // If there's a NOTATION entry in this catalog, use it
-    boolean over = default_override;
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
-      }
-
-      if (e.getEntryType() == NOTATION
-          && e.getEntryArg(0).equals(notationName)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
-      }
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(NOTATION,
-                                      notationName,
-                                      publicId,
-                                      systemId);
-  }
-
-  /**
-   * Return the applicable PUBLIC or SYSTEM identifier.
-   *
-   * <p>This method searches the Catalog and returns the system
-   * identifier specified for the given system or
-   * public identifiers. If
-   * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
-   * null is returned.</p>
-   *
-   * @param publicId The public identifier to locate in the catalog.
-   * Public identifiers are normalized before comparison.
-   * @param systemId The nominal system identifier for the entity
-   * in question (as provided in the source document).
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   *
-   * @return The system identifier to use.
-   * Note that the nominal system identifier is not returned if a
-   * match is not found in the catalog, instead null is returned
-   * to indicate that no match was found.
-   */
-  public String resolvePublic(String publicId, String systemId)
-    throws MalformedURLException, IOException {
-
-    catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")");
-
-    systemId = normalizeURI(systemId);
-
-    if (publicId != null && publicId.startsWith("urn:publicid:")) {
-      publicId = PublicId.decodeURN(publicId);
-    }
-
-    if (systemId != null && systemId.startsWith("urn:publicid:")) {
-      systemId = PublicId.decodeURN(systemId);
-      if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
-      } else {
-        publicId = systemId;
-        systemId = null;
-      }
-    }
-
-    // If there's a SYSTEM entry in this catalog, use it
-    if (systemId != null) {
-      String resolved = resolveLocalSystem(systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // If there's a PUBLIC entry in this catalog, use it
-    String resolved = resolveLocalPublic(PUBLIC,
-                                         null,
-                                         publicId,
-                                         systemId);
-    if (resolved != null) {
-      return resolved;
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(PUBLIC,
-                                      null,
-                                      publicId,
-                                      systemId);
-  }
-
-  /**
-   * Return the applicable PUBLIC or SYSTEM identifier.
-   *
-   * <p>This method searches the Catalog and returns the system
-   * identifier specified for the given system or public identifiers.
-   * If no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
-   * delegated Catalogs are interrogated.</p>
-   *
-   * <p>There are four possible cases:</p>
-   *
-   * <ul>
-   * <li>If the system identifier provided matches a SYSTEM entry
-   * in the current catalog, the SYSTEM entry is returned.
-   * <li>If the system identifier is not null, the PUBLIC entries
-   * that were encountered when OVERRIDE YES was in effect are
-   * interrogated and the first matching entry is returned.</li>
-   * <li>If the system identifier is null, then all of the PUBLIC
-   * entries are interrogated and the first matching entry
-   * is returned. This may not be the same as the preceding case, if
-   * some PUBLIC entries are encountered when OVERRIDE NO is in effect. In
-   * XML, the only place where a public identifier may occur without
-   * a system identifier is in a notation declaration.</li>
-   * <li>Finally, if the public identifier matches one of the partial
-   * public identifiers specified in a DELEGATE* entry in
-   * the Catalog, the delegated catalog is interrogated. The first
-   * time that the delegated catalog is required, it will be
-   * retrieved and parsed. It is subsequently cached.
-   * </li>
-   * </ul>
-   *
-   * @param entityType The CatalogEntry type for which this query is
-   * being conducted. This is necessary in order to do the approprate
-   * query on a delegated catalog.
-   * @param entityName The name of the entity being searched for, if
-   * appropriate.
-   * @param publicId The public identifier of the entity in question.
-   * @param systemId The nominal system identifier for the entity
-   * in question (as provided in the source document).
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * delegated catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading delegated catalog file.
-   *
-   * @return The system identifier to use.
-   * Note that the nominal system identifier is not returned if a
-   * match is not found in the catalog, instead null is returned
-   * to indicate that no match was found.
-   */
-  protected synchronized String resolveLocalPublic(int entityType,
-                                                   String entityName,
-                                                   String publicId,
-                                                   String systemId)
-    throws MalformedURLException, IOException {
-
-    // Always normalize the public identifier before attempting a match
-    publicId = PublicId.normalize(publicId);
-
-    // If there's a SYSTEM entry in this catalog, use it
-    if (systemId != null) {
-      String resolved = resolveLocalSystem(systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // If there's a PUBLIC entry in this catalog, use it
-    boolean over = default_override;
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
-      }
-
-      if (e.getEntryType() == PUBLIC
-          && e.getEntryArg(0).equals(publicId)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
-      }
-    }
-
-    // If there's a DELEGATE_PUBLIC entry in this catalog, use it
-    over = default_override;
-    en = catalogEntries.elements();
-    Vector delCats = new Vector();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
-      }
-
-      if (e.getEntryType() == DELEGATE_PUBLIC
-          && (over || systemId == null)) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= publicId.length()
-            && p.equals(publicId.substring(0, p.length()))) {
-          // delegate this match to the other catalog
-
-          delCats.addElement(e.getEntryArg(1));
-        }
-      }
-    }
-
-    if (delCats.size() > 0) {
-      Enumeration enCats = delCats.elements();
-
-      if (catalogManager.debug.getDebug() > 1) {
-        catalogManager.debug.message(2, "Switching to delegated catalog(s):");
-        while (enCats.hasMoreElements()) {
-          String delegatedCatalog = (String) enCats.nextElement();
-          catalogManager.debug.message(2, "\t" + delegatedCatalog);
-        }
-      }
-
-      Catalog dcat = newCatalog();
-
-      enCats = delCats.elements();
-      while (enCats.hasMoreElements()) {
-        String delegatedCatalog = (String) enCats.nextElement();
-        dcat.parseCatalog(delegatedCatalog);
-      }
-
-      return dcat.resolvePublic(publicId, null);
-    }
-
-    // Nada!
-    return null;
-  }
-
-  /**
-   * Return the applicable SYSTEM system identifier.
-   *
-   * <p>If a SYSTEM entry exists in the Catalog
-   * for the system ID specified, return the mapped value.</p>
-   *
-   * <p>On Windows-based operating systems, the comparison between
-   * the system identifier provided and the SYSTEM entries in the
-   * Catalog is case-insensitive.</p>
-   *
-   * @param systemId The system ID to locate in the catalog.
-   *
-   * @return The resolved system identifier.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveSystem(String systemId)
-    throws MalformedURLException, IOException {
-
-    catalogManager.debug.message(3, "resolveSystem("+systemId+")");
-
-    systemId = normalizeURI(systemId);
-
-    if (systemId != null && systemId.startsWith("urn:publicid:")) {
-      systemId = PublicId.decodeURN(systemId);
-      return resolvePublic(systemId, null);
-    }
-
-    // If there's a SYSTEM entry in this catalog, use it
-    if (systemId != null) {
-      String resolved = resolveLocalSystem(systemId);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(SYSTEM,
-                                      null,
-                                      null,
-                                      systemId);
-  }
-
-  /**
-   * Return the applicable SYSTEM system identifier in this
-   * catalog.
-   *
-   * <p>If a SYSTEM entry exists in the catalog file
-   * for the system ID specified, return the mapped value.</p>
-   *
-   * @param systemId The system ID to locate in the catalog
-   *
-   * @return The mapped system identifier or null
-   */
-  protected String resolveLocalSystem(String systemId)
-    throws MalformedURLException, IOException {
-
-    String osname = SecuritySupport.getSystemProperty("os.name");
-    boolean windows = (osname.indexOf("Windows") >= 0);
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == SYSTEM
-          && (e.getEntryArg(0).equals(systemId)
-              || (windows
-                  && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
-        return e.getEntryArg(1);
-      }
-    }
-
-    // If there's a REWRITE_SYSTEM entry in this catalog, use it
-    en = catalogEntries.elements();
-    String startString = null;
-    String prefix = null;
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-
-      if (e.getEntryType() == REWRITE_SYSTEM) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= systemId.length()
-            && p.equals(systemId.substring(0, p.length()))) {
-          // Is this the longest prefix?
-          if (startString == null
-              || p.length() > startString.length()) {
-            startString = p;
-            prefix = e.getEntryArg(1);
-          }
-        }
-      }
-    }
-
-    if (prefix != null) {
-      // return the systemId with the new prefix
-      return prefix + systemId.substring(startString.length());
-    }
-
-    // If there's a SYSTEM_SUFFIX entry in this catalog, use it
-    en = catalogEntries.elements();
-    String suffixString = null;
-    String suffixURI = null;
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-
-      if (e.getEntryType() == SYSTEM_SUFFIX) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= systemId.length()
-            && systemId.endsWith(p)) {
-          // Is this the longest prefix?
-          if (suffixString == null
-              || p.length() > suffixString.length()) {
-            suffixString = p;
-            suffixURI = e.getEntryArg(1);
-          }
-        }
-      }
-    }
-
-    if (suffixURI != null) {
-      // return the systemId for the suffix
-      return suffixURI;
-    }
-
-    // If there's a DELEGATE_SYSTEM entry in this catalog, use it
-    en = catalogEntries.elements();
-    Vector delCats = new Vector();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-
-      if (e.getEntryType() == DELEGATE_SYSTEM) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= systemId.length()
-            && p.equals(systemId.substring(0, p.length()))) {
-          // delegate this match to the other catalog
-
-          delCats.addElement(e.getEntryArg(1));
-        }
-      }
-    }
-
-    if (delCats.size() > 0) {
-      Enumeration enCats = delCats.elements();
-
-      if (catalogManager.debug.getDebug() > 1) {
-        catalogManager.debug.message(2, "Switching to delegated catalog(s):");
-        while (enCats.hasMoreElements()) {
-          String delegatedCatalog = (String) enCats.nextElement();
-          catalogManager.debug.message(2, "\t" + delegatedCatalog);
-        }
-      }
-
-      Catalog dcat = newCatalog();
-
-      enCats = delCats.elements();
-      while (enCats.hasMoreElements()) {
-        String delegatedCatalog = (String) enCats.nextElement();
-        dcat.parseCatalog(delegatedCatalog);
-      }
-
-      return dcat.resolveSystem(systemId);
-    }
-
-    return null;
-  }
-
-  /**
-   * Return the applicable URI.
-   *
-   * <p>If a URI entry exists in the Catalog
-   * for the URI specified, return the mapped value.</p>
-   *
-   * <p>URI comparison is case sensitive.</p>
-   *
-   * @param uri The URI to locate in the catalog.
-   *
-   * @return The resolved URI.
-   *
-   * @throws MalformedURLException The system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveURI(String uri)
-    throws MalformedURLException, IOException {
-
-    catalogManager.debug.message(3, "resolveURI("+uri+")");
-
-    uri = normalizeURI(uri);
-
-    if (uri != null && uri.startsWith("urn:publicid:")) {
-      uri = PublicId.decodeURN(uri);
-      return resolvePublic(uri, null);
-    }
-
-    // If there's a URI entry in this catalog, use it
-    if (uri != null) {
-      String resolved = resolveLocalURI(uri);
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(URI,
-                                      null,
-                                      null,
-                                      uri);
-  }
-
-  /**
-   * Return the applicable URI in this catalog.
-   *
-   * <p>If a URI entry exists in the catalog file
-   * for the URI specified, return the mapped value.</p>
-   *
-   * @param uri The URI to locate in the catalog
-   *
-   * @return The mapped URI or null
-   */
-  protected String resolveLocalURI(String uri)
-    throws MalformedURLException, IOException {
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == URI
-          && (e.getEntryArg(0).equals(uri))) {
-        return e.getEntryArg(1);
-      }
-    }
-
-    // If there's a REWRITE_URI entry in this catalog, use it
-    en = catalogEntries.elements();
-    String startString = null;
-    String prefix = null;
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-
-      if (e.getEntryType() == REWRITE_URI) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= uri.length()
-            && p.equals(uri.substring(0, p.length()))) {
-          // Is this the longest prefix?
-          if (startString == null
-              || p.length() > startString.length()) {
-            startString = p;
-            prefix = e.getEntryArg(1);
-          }
-        }
-      }
-    }
-
-    if (prefix != null) {
-      // return the uri with the new prefix
-      return prefix + uri.substring(startString.length());
-    }
-
-    // If there's a URI_SUFFIX entry in this catalog, use it
-    en = catalogEntries.elements();
-    String suffixString = null;
-    String suffixURI = null;
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-
-      if (e.getEntryType() == URI_SUFFIX) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= uri.length()
-            && uri.endsWith(p)) {
-          // Is this the longest prefix?
-          if (suffixString == null
-              || p.length() > suffixString.length()) {
-            suffixString = p;
-            suffixURI = e.getEntryArg(1);
-          }
-        }
-      }
-    }
-
-    if (suffixURI != null) {
-      // return the uri for the suffix
-      return suffixURI;
-    }
-
-    // If there's a DELEGATE_URI entry in this catalog, use it
-    en = catalogEntries.elements();
-    Vector delCats = new Vector();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-
-      if (e.getEntryType() == DELEGATE_URI) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= uri.length()
-            && p.equals(uri.substring(0, p.length()))) {
-          // delegate this match to the other catalog
-
-          delCats.addElement(e.getEntryArg(1));
-        }
-      }
-    }
-
-    if (delCats.size() > 0) {
-      Enumeration enCats = delCats.elements();
-
-      if (catalogManager.debug.getDebug() > 1) {
-        catalogManager.debug.message(2, "Switching to delegated catalog(s):");
-        while (enCats.hasMoreElements()) {
-          String delegatedCatalog = (String) enCats.nextElement();
-          catalogManager.debug.message(2, "\t" + delegatedCatalog);
-        }
-      }
-
-      Catalog dcat = newCatalog();
-
-      enCats = delCats.elements();
-      while (enCats.hasMoreElements()) {
-        String delegatedCatalog = (String) enCats.nextElement();
-        dcat.parseCatalog(delegatedCatalog);
-      }
-
-      return dcat.resolveURI(uri);
-    }
-
-    return null;
-  }
-
-  /**
-   * Search the subordinate catalogs, in order, looking for a match.
-   *
-   * <p>This method searches the Catalog and returns the system
-   * identifier specified for the given entity type with the given
-   * name, public, and system identifiers. In some contexts, these
-   * may be null.</p>
-   *
-   * @param entityType The CatalogEntry type for which this query is
-   * being conducted. This is necessary in order to do the approprate
-   * query on a subordinate catalog.
-   * @param entityName The name of the entity being searched for, if
-   * appropriate.
-   * @param publicId The public identifier of the entity in question
-   * (as provided in the source document).
-   * @param systemId The nominal system identifier for the entity
-   * in question (as provided in the source document). This parameter is
-   * overloaded for the URI entry type.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * delegated catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading delegated catalog file.
-   *
-   * @return The system identifier to use.
-   * Note that the nominal system identifier is not returned if a
-   * match is not found in the catalog, instead null is returned
-   * to indicate that no match was found.
-   */
-  protected synchronized String resolveSubordinateCatalogs(int entityType,
-                                                           String entityName,
-                                                           String publicId,
-                                                           String systemId)
-    throws MalformedURLException, IOException {
-
-    for (int catPos = 0; catPos < catalogs.size(); catPos++) {
-      Catalog c = null;
-
-      try {
-        c = (Catalog) catalogs.elementAt(catPos);
-      } catch (ClassCastException e) {
-        String catfile = (String) catalogs.elementAt(catPos);
-        c = newCatalog();
-
-        try {
-          c.parseCatalog(catfile);
-        } catch (MalformedURLException mue) {
-          catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
-        } catch (FileNotFoundException fnfe) {
-          catalogManager.debug.message(1, "Failed to load catalog, file not found",
-                        catfile);
-        } catch (IOException ioe) {
-          catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
-        }
-
-        catalogs.setElementAt(c, catPos);
-      }
-
-      String resolved = null;
-
-      // Ok, now what are we supposed to call here?
-      if (entityType == DOCTYPE) {
-        resolved = c.resolveDoctype(entityName,
-                                    publicId,
-                                    systemId);
-      } else if (entityType == DOCUMENT) {
-        resolved = c.resolveDocument();
-      } else if (entityType == ENTITY) {
-        resolved = c.resolveEntity(entityName,
-                                   publicId,
-                                   systemId);
-      } else if (entityType == NOTATION) {
-        resolved = c.resolveNotation(entityName,
-                                     publicId,
-                                     systemId);
-      } else if (entityType == PUBLIC) {
-        resolved = c.resolvePublic(publicId, systemId);
-      } else if (entityType == SYSTEM) {
-        resolved = c.resolveSystem(systemId);
-      } else if (entityType == URI) {
-        resolved = c.resolveURI(systemId);
-      }
-
-      if (resolved != null) {
-        return resolved;
-      }
-    }
-
-    return null;
-  }
-
-  // -----------------------------------------------------------------
-
-  /**
-   * Replace backslashes with forward slashes. (URLs always use
-   * forward slashes.)
-   *
-   * @param sysid The input system identifier.
-   * @return The same system identifier with backslashes turned into
-   * forward slashes.
-   */
-  protected String fixSlashes (String sysid) {
-    return sysid.replace('\\', '/');
-  }
-
-  /**
-   * Construct an absolute URI from a relative one, using the current
-   * base URI.
-   *
-   * @param sysid The (possibly relative) system identifier
-   * @return The system identifier made absolute with respect to the
-   * current {@link #base}.
-   */
-  protected String makeAbsolute(String sysid) {
-    URL local = null;
-
-    sysid = fixSlashes(sysid);
-
-    try {
-      local = new URL(base, sysid);
-    } catch (MalformedURLException e) {
-      catalogManager.debug.message(1, "Malformed URL on system identifier", sysid);
-    }
-
-    if (local != null) {
-      return local.toString();
-    } else {
-      return sysid;
-    }
-  }
-
-
-    /**
-     * Perform character normalization on a URI reference.
-     *
-     * @param uriref The URI reference
-     * @return The normalized URI reference.
-     */
-    protected String normalizeURI(String uriref) {
-        if (uriref == null) {
-            return null;
-        }
-        final int length = uriref.length();
-        for (int i = 0; i < length; ++i) {
-            char c = uriref.charAt(i);
-            if ((c <= 0x20)    // ctrl
-                    || (c > 0x7F)  // high ascii
-                    || (c == 0x22) // "
-                    || (c == 0x3C) // <
-                    || (c == 0x3E) // >
-                    || (c == 0x5C) // \
-                    || (c == 0x5E) // ^
-                    || (c == 0x60) // `
-                    || (c == 0x7B) // {
-                    || (c == 0x7C) // |
-                    || (c == 0x7D) // }
-                    || (c == 0x7F)) {
-                return normalizeURI(uriref, i);
-            }
-        }
-        return uriref;
-    }
-
-    /**
-     * Perform character normalization on a URI reference.
-     *
-     * @param uriref The URI reference
-     * @param index The index of the first character which requires escaping.
-     * @return The normalized URI reference.
-     */
-    private String normalizeURI(String uriref, int index) {
-        final StringBuilder buffer = new StringBuilder();
-        for (int i = 0; i < index; ++i) {
-            buffer.append(uriref.charAt(i));
-        }
-        final byte[] bytes;
-        try {
-            bytes = uriref.substring(index).getBytes("UTF-8");
-        }
-        catch (UnsupportedEncodingException uee) {
-            // this can't happen
-            catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
-            return uriref;
-        }
-        for (int count = 0; count < bytes.length; ++count) {
-            int ch = bytes[count] & 0xFF;
-            if ((ch <= 0x20)    // ctrl
-                    || (ch > 0x7F)  // high ascii
-                    || (ch == 0x22) // "
-                    || (ch == 0x3C) // <
-                    || (ch == 0x3E) // >
-                    || (ch == 0x5C) // \
-                    || (ch == 0x5E) // ^
-                    || (ch == 0x60) // `
-                    || (ch == 0x7B) // {
-                    || (ch == 0x7C) // |
-                    || (ch == 0x7D) // }
-                    || (ch == 0x7F)) {
-                writeEncodedByte(ch, buffer);
-            }
-            else {
-                buffer.append((char) bytes[count]);
-            }
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * Perform %-encoding on a single byte.
-     *
-     * @param b The 8-bit integer that represents the byte. (Bytes are signed
-     *          but encoding needs to look at the bytes unsigned.)
-     * @return The %-encoded string for the byte in question.
-     */
-    protected String encodedByte(int b) {
-        StringBuilder buffer = new StringBuilder(3);
-        writeEncodedByte(b, buffer);
-        return buffer.toString();
-    }
-
-    /**
-     * Perform %-encoding on a single byte.
-     *
-     * @param b The 8-bit integer that represents the byte. (Bytes are signed
-     *          but encoding needs to look at the bytes unsigned.)
-     * @param buffer The target for the %-encoded string for the byte in question.
-     */
-    private void writeEncodedByte(int b, StringBuilder buffer) {
-        String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH);
-        if (hex.length() < 2) {
-            buffer.append("%0");
-            buffer.append(hex);
-        }
-        else {
-            buffer.append('%');
-            buffer.append(hex);
-        }
-    }
-
-  // -----------------------------------------------------------------
-
-  /**
-   * Add to the current list of delegated catalogs.
-   *
-   * <p>This method always constructs the {@link #localDelegate}
-   * vector so that it is ordered by length of partial
-   * public identifier.</p>
-   *
-   * @param entry The DELEGATE catalog entry
-   */
-  protected void addDelegate(CatalogEntry entry) {
-    int pos = 0;
-    String partial = entry.getEntryArg(0);
-
-    Enumeration local = localDelegate.elements();
-    while (local.hasMoreElements()) {
-      CatalogEntry dpe = (CatalogEntry) local.nextElement();
-      String dp = dpe.getEntryArg(0);
-      if (dp.equals(partial)) {
-        // we already have this prefix
-        return;
-      }
-      if (dp.length() > partial.length()) {
-        pos++;
-      }
-      if (dp.length() < partial.length()) {
-        break;
-      }
-    }
-
-    // now insert partial into the vector at [pos]
-    if (localDelegate.size() == 0) {
-      localDelegate.addElement(entry);
-    } else {
-      localDelegate.insertElementAt(entry, pos);
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Represents a Catalog entry.
- *
- * <p>Instances of this class represent individual entries
- * in a Catalog.</p>
- *
- * <p>Each catalog entry has a unique name and is associated with
- * an arbitrary number of arguments (all strings). For example, the
- * TR9401 catalog entry "PUBLIC" has two arguments, a public identifier
- * and a system identifier. Each entry has a unique numeric type,
- * assigned automatically when the entry type is created.</p>
- *
- * <p>The number and type of catalog entries is maintained
- * <em>statically</em>. Catalog classes, or their subclasses, can add
- * new entry types, but all Catalog objects share the same global pool
- * of types.</p>
- *
- * <p>Initially there are no valid entries.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class CatalogEntry {
-  /** The nextEntry is the ordinal number of the next entry type. */
-  static AtomicInteger nextEntry = new AtomicInteger(0);
-
-  /**
-   * The entryTypes vector maps catalog entry names
-   * (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.).
-   * Names are case sensitive.
-   */
-  static final Map<String, Integer> entryTypes = new ConcurrentHashMap<>();
-
-  /** The entryTypes vector maps catalog entry types to the
-      number of arguments they're required to have. */
-  static final Vector entryArgs = new Vector();
-
-  /**
-   * Adds a new catalog entry type.
-   *
-   * @param name The name of the catalog entry type. This must be
-   * unique among all types and is case-sensitive. (Adding a duplicate
-   * name effectively replaces the old type with the new type.)
-   * @param numArgs The number of arguments that this entry type
-   * is required to have. There is no provision for variable numbers
-   * of arguments.
-   * @return The type for the new entry.
-   */
-  static int addEntryType(String name, int numArgs) {
-    final int index = nextEntry.getAndIncrement();
-    entryTypes.put(name, index);
-    entryArgs.add(index, numArgs);
-
-    return index;
-  }
-
-  /**
-   * Lookup an entry type
-   *
-   * @param name The name of the catalog entry type.
-   * @return The type of the catalog entry with the specified name.
-   * @throws InvalidCatalogEntryTypeException if no entry has the
-   * specified name.
-   */
-  public static int getEntryType(String name)
-    throws CatalogException {
-    if (!entryTypes.containsKey(name)) {
-      throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
-    }
-
-    Integer iType = entryTypes.get(name);
-
-    if (iType == null) {
-      throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
-    }
-
-    return iType;
-  }
-
-  /**
-   * Find out how many arguments an entry is required to have.
-   *
-   * @param name The name of the catalog entry type.
-   * @return The number of arguments that entry type is required to have.
-   * @throws InvalidCatalogEntryTypeException if no entry has the
-   * specified name.
-   */
-  public static int getEntryArgCount(String name)
-    throws CatalogException {
-    return getEntryArgCount(getEntryType(name));
-  }
-
-  /**
-   * Find out how many arguments an entry is required to have.
-   *
-   * @param type A valid catalog entry type.
-   * @return The number of arguments that entry type is required to have.
-   * @throws InvalidCatalogEntryTypeException if the type is invalid.
-   */
-  public static int getEntryArgCount(int type)
-    throws CatalogException {
-    try {
-      Integer iArgs = (Integer) entryArgs.get(type);
-      return iArgs.intValue();
-    } catch (ArrayIndexOutOfBoundsException e) {
-      throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
-    }
-  }
-
-  /** The entry type of this entry */
-  protected int entryType = 0;
-
-  /** The arguments associated with this entry */
-  protected Vector args = null;
-
-  /**
-   * Null constructor; something for subclasses to call.
-   */
-  public CatalogEntry() {}
-
-  /**
-   * Construct a catalog entry of the specified type.
-   *
-   * @param name The name of the entry type
-   * @param args A String Vector of arguments
-   * @throws InvalidCatalogEntryTypeException if no such entry type
-   * exists.
-   * @throws InvalidCatalogEntryException if the wrong number of arguments
-   * is passed.
-   */
-  public CatalogEntry(String name, Vector args)
-    throws CatalogException {
-    Integer iType = entryTypes.get(name);
-
-    if (iType == null) {
-      throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
-    }
-
-    int type = iType;
-
-    try {
-      Integer iArgs = (Integer) entryArgs.get(type);
-      if (iArgs.intValue() != args.size()) {
-        throw new CatalogException(CatalogException.INVALID_ENTRY);
-      }
-    } catch (ArrayIndexOutOfBoundsException e) {
-      throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
-    }
-
-    entryType = type;
-    this.args = args;
-  }
-
-  /**
-   * Construct a catalog entry of the specified type.
-   *
-   * @param type The entry type
-   * @param args A String Vector of arguments
-   * @throws InvalidCatalogEntryTypeException if no such entry type
-   * exists.
-   * @throws InvalidCatalogEntryException if the wrong number of arguments
-   * is passed.
-   */
-  public CatalogEntry(int type, Vector args)
-    throws CatalogException {
-    try {
-      Integer iArgs = (Integer) entryArgs.get(type);
-      if (iArgs.intValue() != args.size()) {
-        throw new CatalogException(CatalogException.INVALID_ENTRY);
-      }
-    } catch (ArrayIndexOutOfBoundsException e) {
-      throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
-    }
-
-    entryType = type;
-    this.args = args;
-  }
-
-  /**
-   * Get the entry type.
-   *
-   * @return The entry type of the CatalogEntry
-   */
-  public int getEntryType() {
-    return entryType;
-  }
-
-  /**
-   * Get an entry argument.
-   *
-   * @param argNum The argument number (arguments are numbered from 0).
-   * @return The specified argument or null if an invalid argNum is
-   * provided.
-   */
-  public String getEntryArg(int argNum) {
-    try {
-      String arg = (String) args.get(argNum);
-      return arg;
-    } catch (ArrayIndexOutOfBoundsException e) {
-      return null;
-    }
-  }
-
-  /**
-   * Set an entry argument.
-   *
-   * <p>Catalogs sometimes need to adjust the catlog entry parameters,
-   * for example to make a relative URI absolute with respect to the
-   * current base URI. But in general, this function should only be
-   * called shortly after object creation to do some sort of cleanup.
-   * Catalog entries should not mutate over time.</p>
-   *
-   * @param argNum The argument number (arguments are numbered from 0).
-   * @throws ArrayIndexOutOfBoundsException if an invalid argument
-   * number is provided.
-   */
-  public void setEntryArg(int argNum, String newspec)
-    throws ArrayIndexOutOfBoundsException {
-    args.set(argNum, newspec);
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-/**
- * Signal Catalog exception.
- *
- * <p>This exception is thrown if an error occurs loading a
- * catalog file.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class CatalogException extends Exception {
-
-  private static final long serialVersionUID = 4007157171817798450L;
-
-  /** A wrapper around another exception */
-  public static final int WRAPPER = 1;
-  /** An invalid entry */
-  public static final int INVALID_ENTRY = 2;
-  /** An invalid entry type */
-  public static final int INVALID_ENTRY_TYPE = 3;
-  /** Could not instantiate an XML parser */
-  public static final int NO_XML_PARSER = 4;
-  /** Unknown XML format */
-  public static final int UNKNOWN_FORMAT = 5;
-  /** Unparseable XML catalog (not XML)*/
-  public static final int UNPARSEABLE = 6;
-  /** XML but parse failed */
-  public static final int PARSE_FAILED = 7;
-  /** Text catalog ended in mid-comment */
-  public static final int UNENDED_COMMENT = 8;
-
-  /**
-   * The embedded exception if tunnelling, or null.
-   */
-  private final Exception exception;
-  private final int exceptionType;
-
-  /**
-   * Create a new CatalogException.
-   *
-   * @param type The exception type
-   * @param message The error or warning message.
-   */
-  public CatalogException (int type, String message) {
-    super(message);
-    this.exceptionType = type;
-    this.exception = null;
-  }
-
-  /**
-   * Create a new CatalogException.
-   *
-   * @param type The exception type
-   */
-  public CatalogException (int type) {
-    super("Catalog Exception " + type);
-    this.exceptionType = type;
-    this.exception = null;
-  }
-
-  /**
-   * Create a new CatalogException wrapping an existing exception.
-   *
-   * <p>The existing exception will be embedded in the new
-   * one, and its message will become the default message for
-   * the CatalogException.</p>
-   *
-   * @param e The exception to be wrapped in a CatalogException.
-   */
-  public CatalogException (Exception e) {
-    super();
-    this.exceptionType = WRAPPER;
-    this.exception = e;
-  }
-
-  /**
-   * Create a new CatalogException from an existing exception.
-   *
-   * <p>The existing exception will be embedded in the new
-   * one, but the new exception will have its own message.</p>
-   *
-   * @param message The detail message.
-   * @param e The exception to be wrapped in a CatalogException.
-   */
-  public CatalogException (String message, Exception e) {
-    super(message);
-    this.exceptionType = WRAPPER;
-    this.exception = e;
-  }
-
-  /**
-   * Return a detail message for this exception.
-   *
-   * <p>If there is an embedded exception, and if the CatalogException
-   * has no detail message of its own, this method will return
-   * the detail message from the embedded exception.</p>
-   *
-   * @return The error or warning message.
-   */
-  public String getMessage ()
-  {
-    String message = super.getMessage();
-
-    if (message == null && exception != null) {
-      return exception.getMessage();
-    } else {
-      return message;
-    }
-  }
-
-  /**
-   * Return the embedded exception, if any.
-   *
-   * @return The embedded exception, or null if there is none.
-   */
-  public Exception getException ()
-  {
-    return exception;
-  }
-
-  /**
-   * Return the exception type
-   *
-   * @return The exception type
-   */
-  public int getExceptionType ()
-  {
-    return exceptionType;
-  }
-
-  /**
-   * Override toString to pick up any embedded exception.
-   *
-   * @return A string representation of this exception.
-   */
-  public String toString ()
-  {
-    if (exception != null) {
-      return exception.toString();
-    } else {
-      return super.toString();
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,870 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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.util.MissingResourceException;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * CatalogManager provides an interface to the catalog properties.
- *
- * <p>Properties can come from two places: from system properties or
- * from a <i>CatalogManager.properties</i> file. This class provides a transparent
- * interface to both, with system properties preferred over property file values.</p>
- *
- * <p>The following table summarizes the properties:</p>
- *
- * <table border="1">
- * <thead>
- * <tr>
- * <td>System Property</td>
- * <td>CatalogManager.properties<br/>Property</td>
- * <td>Description</td>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
- * <td>xml.catalog.ignoreMissing</td>
- * <td>&#160;</td>
- * <td>If true, a missing <i>CatalogManager.properties</i> file or missing properties
- * within that file will not generate warning messages. See also the
- * <i>ignoreMissingProperties</i> method.</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.files</td>
- * <td>catalogs</td>
- * <td>The <emph>semicolon-delimited</emph> list of catalog files.</td>
- * </tr>
- *
- * <tr>
- * <td>&#160;</td>
- * <td>relative-catalogs</td>
- * <td>If false, relative catalog URIs are made absolute with respect to the base URI of
- * the <i>CatalogManager.properties</i> file. This setting only applies to catalog
- * URIs obtained from the <i>catalogs</i> property <emph>in the</emph>
- * <i>CatalogManager.properties</i> file</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.verbosity</td>
- * <td>verbosity</td>
- * <td>If non-zero, the Catalog classes will print informative and debugging messages.
- * The higher the number, the more messages.</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.prefer</td>
- * <td>prefer</td>
- * <td>Which identifier is preferred, "public" or "system"?</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.staticCatalog</td>
- * <td>static-catalog</td>
- * <td>Should a single catalog be constructed for all parsing, or should a different
- * catalog be created for each parser?</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.allowPI</td>
- * <td>allow-oasis-xml-catalog-pi</td>
- * <td>If the source document contains "oasis-xml-catalog" processing instructions,
- * should they be used?</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.className</td>
- * <td>catalog-class-name</td>
- * <td>If you're using the convenience classes
- * <tt>com.sun.org.apache.xml.internal.resolver.tools.*</tt>), this setting
- * allows you to specify an alternate class name to use for the underlying
- * catalog.</td>
- * </tr>
- * </tbody>
- * </table>
- *
- * @see Catalog
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogManager {
-    private static final String pFiles         = "xml.catalog.files";
-    private static final String pVerbosity     = "xml.catalog.verbosity";
-    private static final String pPrefer        = "xml.catalog.prefer";
-    private static final String pStatic        = "xml.catalog.staticCatalog";
-    private static final String pAllowPI       = "xml.catalog.allowPI";
-    private static final String pClassname     = "xml.catalog.className";
-    private static final String pIgnoreMissing = "xml.catalog.ignoreMissing";
-
-    /** A static CatalogManager instance for sharing */
-    private static final CatalogManager staticManager = new CatalogManager();
-
-    /** The bootstrap resolver to use when loading XML Catalogs. */
-    private BootstrapResolver bResolver = new BootstrapResolver();
-
-    /** Flag to ignore missing property files and/or properties */
-    private boolean ignoreMissingProperties
-    = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
-    || SecuritySupport.getSystemProperty(pFiles) != null);
-
-    /** Holds the resources after they are loaded from the file. */
-    private ResourceBundle resources;
-
-    /** The name of the CatalogManager properties file. */
-    private String propertyFile = "CatalogManager.properties";
-
-    /** The location of the propertyFile */
-    private URL propertyFileURI = null;
-
-    /** Default catalog files list. */
-    private String defaultCatalogFiles = "./xcatalog";
-
-    /** Current catalog files list. */
-    private String catalogFiles = null;
-
-    /** Did the catalogFiles come from the properties file? */
-    private boolean fromPropertiesFile = false;
-
-    /** Default verbosity level if there is no property setting for it. */
-    private int defaultVerbosity = 1;
-
-    /** Current verbosity level. */
-    private Integer verbosity = null;
-
-    /** Default preference setting. */
-    private boolean defaultPreferPublic = true;
-
-    /** Current preference setting. */
-    private Boolean preferPublic = null;
-
-    /** Default setting of the static catalog flag. */
-    private boolean defaultUseStaticCatalog = true;
-
-    /** Current setting of the static catalog flag. */
-    private Boolean useStaticCatalog = null;
-
-    /** The static catalog used by this manager. */
-    private static volatile Catalog staticCatalog = null;
-
-    /** Default setting of the oasisXMLCatalogPI flag. */
-    private boolean defaultOasisXMLCatalogPI = true;
-
-    /** Current setting of the oasisXMLCatalogPI flag. */
-    private Boolean oasisXMLCatalogPI = null;
-
-    /** Default setting of the relativeCatalogs flag. */
-    private boolean defaultRelativeCatalogs = true;
-
-    /** Current setting of the relativeCatalogs flag. */
-    private Boolean relativeCatalogs = null;
-
-    /** Current catalog class name. */
-    private String catalogClassName = null;
-    /**
-     * Indicates whether implementation parts should use
-     *   service loader (or similar).
-     * Note the default value (false) is the safe option..
-     */
-    private boolean useServicesMechanism;
-
-    /** The manager's debug object. Used for printing debugging messages.
-     *
-     * <p>This field is public so that objects that have access to this
-     * CatalogManager can use this debug object.</p>
-     */
-    public Debug debug = null;
-
-    /** Constructor. */
-    public CatalogManager() {
-        init();
-    }
-
-    /** Constructor that specifies an explicit property file. */
-    public CatalogManager(String propertyFile) {
-        this.propertyFile = propertyFile;
-        init();
-  }
-
-  private void init() {
-        debug = new Debug();
-    // Note that we don't setDebug() here; we do that lazily. Either the
-    // user will set it explicitly, or we'll do it automagically if they
-    // read from the propertyFile for some other reason. That way, there's
-    // no attempt to read from the file before the caller has had a chance
-    // to avoid it.
-    if (System.getSecurityManager() == null) {
-        useServicesMechanism = true;
-    }
-        // Make sure verbosity is set by xml.catalog.verbosity sysprop
-        // setting, if defined.
-        queryVerbosityFromSysProp();
-    }
-
-    /** Set the bootstrap resolver
-     * @param resolver the bootstrap resolver
-     */
-    public void setBootstrapResolver(BootstrapResolver resolver) {
-        bResolver = resolver;
-    }
-
-    /** Get the bootstrap resolver
-     * @return the bootstrap resolver
-     */
-    public BootstrapResolver getBootstrapResolver() {
-        return bResolver;
-    }
-
-    /** Query system property for verbosity level. */
-    private void queryVerbosityFromSysProp() {
-        String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
-        if (verbStr != null) {
-            try {
-                int verb = Integer.parseInt(verbStr.trim());
-                verbosity = new Integer(verb);
-                debug.setDebug(verb);
-            } catch (Exception e) {
-                System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
-            }
-        }
-    }
-
-    /**
-     * Load the properties from the propertyFile and build the
-     * resources from it.
-     */
-    private synchronized void readProperties() {
-        try {
-            propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
-            InputStream in =
-                    CatalogManager.class.getResourceAsStream("/"+propertyFile);
-            if (in==null) {
-                if (!ignoreMissingProperties) {
-                    System.err.println("Cannot find "+propertyFile);
-                    // there's no reason to give this warning more than once
-                    ignoreMissingProperties = true;
-                }
-                return;
-            }
-            resources = new PropertyResourceBundle(in);
-        } catch (MissingResourceException mre) {
-            if (!ignoreMissingProperties) {
-                System.err.println("Cannot read "+propertyFile);
-            }
-        } catch (java.io.IOException e) {
-            if (!ignoreMissingProperties) {
-                System.err.println("Failure trying to read "+propertyFile);
-            }
-        }
-
-        // This is a bit of a hack. After we've successfully read the properties,
-        // use them to set the default debug level, if the user hasn't already set
-        // the default debug level.
-        if (verbosity == null) {
-            try {
-                String verbStr = resources.getString("verbosity");
-                int verb = Integer.parseInt(verbStr.trim());
-                debug.setDebug(verb);
-                verbosity = new Integer(verb);
-            } catch (Exception e) {
-                // nop
-            }
-        }
-    }
-
-    /**
-     * Allow access to the static CatalogManager
-     */
-    public static CatalogManager getStaticManager() {
-        return staticManager;
-    }
-
-    /**
-     * How are missing properties handled?
-     *
-     * <p>If true, missing or unreadable property files will
-     * not be reported. Otherwise, a message will be sent to System.err.
-     * </p>
-     */
-    public boolean getIgnoreMissingProperties() {
-        return ignoreMissingProperties;
-    }
-
-    /**
-     * How should missing properties be handled?
-     *
-     * <p>If ignore is true, missing or unreadable property files will
-     * not be reported. Otherwise, a message will be sent to System.err.
-     * </p>
-     */
-    public void setIgnoreMissingProperties(boolean ignore) {
-        ignoreMissingProperties = ignore;
-    }
-
-    /**
-     * How are missing properties handled?
-     *
-     * <p>If ignore is true, missing or unreadable property files will
-     * not be reported. Otherwise, a message will be sent to System.err.
-     * </p>
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public void ignoreMissingProperties(boolean ignore) {
-        setIgnoreMissingProperties(ignore);
-    }
-
-    /**
-     * Obtain the verbosity setting from the properties.
-     *
-     * @return The verbosity level from the propertyFile or the
-     * defaultVerbosity.
-     */
-    private int queryVerbosity () {
-        String defaultVerbStr = Integer.toString(defaultVerbosity);
-
-        String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
-
-        if (verbStr == null) {
-            if (resources==null) readProperties();
-            if (resources != null) {
-                try {
-                    verbStr = resources.getString("verbosity");
-                } catch (MissingResourceException e) {
-                    verbStr = defaultVerbStr;
-                }
-            } else {
-                verbStr = defaultVerbStr;
-            }
-        }
-
-        int verb = defaultVerbosity;
-
-        try {
-            verb = Integer.parseInt(verbStr.trim());
-        } catch (Exception e) {
-            System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
-        }
-
-        // This is a bit of a hack. After we've successfully got the verbosity,
-        // we have to use it to set the default debug level,
-        // if the user hasn't already set the default debug level.
-        if (verbosity == null) {
-            debug.setDebug(verb);
-            verbosity = new Integer(verb);
-        }
-
-        return verb;
-    }
-
-    /**
-     * What is the current verbosity?
-     */
-    public int getVerbosity() {
-        if (verbosity == null) {
-            verbosity = new Integer(queryVerbosity());
-        }
-
-        return verbosity.intValue();
-    }
-
-    /**
-     * Set the current verbosity.
-     */
-    public void setVerbosity (int verbosity) {
-        this.verbosity = new Integer(verbosity);
-        debug.setDebug(verbosity);
-    }
-
-    /**
-     * What is the current verbosity?
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public int verbosity () {
-        return getVerbosity();
-    }
-
-    /**
-     * Obtain the relativeCatalogs setting from the properties.
-     *
-     * @return The relativeCatalogs setting from the propertyFile or the
-     * defaultRelativeCatalogs.
-     */
-    private boolean queryRelativeCatalogs () {
-        if (resources==null) readProperties();
-
-        if (resources==null) return defaultRelativeCatalogs;
-
-        try {
-            String allow = resources.getString("relative-catalogs");
-            return (allow.equalsIgnoreCase("true")
-                    || allow.equalsIgnoreCase("yes")
-                    || allow.equalsIgnoreCase("1"));
-        } catch (MissingResourceException e) {
-            return defaultRelativeCatalogs;
-        }
-    }
-
-    /**
-     * Get the relativeCatalogs setting.
-     *
-     * <p>This property is used when the catalogFiles property is
-     * interrogated. If true, then relative catalog entry file names
-     * are returned. If false, relative catalog entry file names are
-     * made absolute with respect to the properties file before returning
-     * them.</p>
-     *
-     * <p>This property <emph>only applies</emph> when the catalog files
-     * come from a properties file. If they come from a system property or
-     * the default list, they are never considered relative. (What would
-     * they be relative to?)</p>
-     *
-     * <p>In the properties, a value of 'yes', 'true', or '1' is considered
-     * true, anything else is false.</p>
-     *
-     * @return The relativeCatalogs setting from the propertyFile or the
-     * defaultRelativeCatalogs.
-     */
-    public boolean getRelativeCatalogs () {
-        if (relativeCatalogs == null) {
-            relativeCatalogs = queryRelativeCatalogs() ? Boolean.TRUE : Boolean.FALSE;
-        }
-
-        return relativeCatalogs.booleanValue();
-    }
-
-    /**
-     * Set the relativeCatalogs setting.
-     *
-     * @see #getRelativeCatalogs()
-     */
-    public void setRelativeCatalogs (boolean relative) {
-        relativeCatalogs = relative ? Boolean.TRUE : Boolean.FALSE;
-    }
-
-    /**
-     * Get the relativeCatalogs setting.
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public boolean relativeCatalogs () {
-        return getRelativeCatalogs();
-    }
-
-    /**
-     * Obtain the list of catalog files from the properties.
-     *
-     * @return A semicolon delimited list of catlog file URIs
-     */
-    private String queryCatalogFiles () {
-        String catalogList = SecuritySupport.getSystemProperty(pFiles);
-        fromPropertiesFile = false;
-
-        if (catalogList == null) {
-            if (resources == null) readProperties();
-            if (resources != null) {
-                try {
-                    catalogList = resources.getString("catalogs");
-                    fromPropertiesFile = true;
-                } catch (MissingResourceException e) {
-                    System.err.println(propertyFile + ": catalogs not found.");
-                    catalogList = null;
-                }
-            }
-        }
-
-        if (catalogList == null) {
-            catalogList = defaultCatalogFiles;
-        }
-
-        return catalogList;
-    }
-
-    /**
-     * Return the current list of catalog files.
-     *
-     * @return A vector of the catalog file names or null if no catalogs
-     * are available in the properties.
-     */
-    public Vector getCatalogFiles() {
-        if (catalogFiles == null) {
-            catalogFiles = queryCatalogFiles();
-        }
-
-        StringTokenizer files = new StringTokenizer(catalogFiles, ";");
-        Vector catalogs = new Vector();
-        while (files.hasMoreTokens()) {
-            String catalogFile = files.nextToken();
-            URL absURI = null;
-
-            if (fromPropertiesFile && !relativeCatalogs()) {
-                try {
-                    absURI = new URL(propertyFileURI, catalogFile);
-                    catalogFile = absURI.toString();
-                } catch (MalformedURLException mue) {
-                    absURI = null;
-                }
-            }
-
-            catalogs.add(catalogFile);
-        }
-
-        return catalogs;
-    }
-
-    /**
-     * Set the list of catalog files.
-     */
-    public void setCatalogFiles(String fileList) {
-        catalogFiles = fileList;
-        fromPropertiesFile = false;
-    }
-
-    /**
-     * Return the current list of catalog files.
-     *
-     * @return A vector of the catalog file names or null if no catalogs
-     * are available in the properties.
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public Vector catalogFiles() {
-        return getCatalogFiles();
-    }
-
-    /**
-     * Obtain the preferPublic setting from the properties.
-     *
-     * <p>In the properties, a value of 'public' is true,
-     * anything else is false.</p>
-     *
-     * @return True if prefer is public or the
-     * defaultPreferSetting.
-     */
-    private boolean queryPreferPublic () {
-        String prefer = SecuritySupport.getSystemProperty(pPrefer);
-
-        if (prefer == null) {
-            if (resources==null) readProperties();
-            if (resources==null) return defaultPreferPublic;
-            try {
-                prefer = resources.getString("prefer");
-            } catch (MissingResourceException e) {
-                return defaultPreferPublic;
-            }
-        }
-
-        if (prefer == null) {
-            return defaultPreferPublic;
-        }
-
-        return (prefer.equalsIgnoreCase("public"));
-    }
-
-    /**
-     * Return the current prefer public setting.
-     *
-     * @return True if public identifiers are preferred.
-     */
-    public boolean getPreferPublic () {
-        if (preferPublic == null) {
-            preferPublic = queryPreferPublic() ? Boolean.TRUE : Boolean.FALSE;
-        }
-        return preferPublic.booleanValue();
-    }
-
-    /**
-     * Set the prefer public setting.
-     */
-    public void setPreferPublic (boolean preferPublic) {
-        this.preferPublic = preferPublic ? Boolean.TRUE : Boolean.FALSE;
-    }
-
-    /**
-     * Return the current prefer public setting.
-     *
-     * @return True if public identifiers are preferred.
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public boolean preferPublic () {
-        return getPreferPublic();
-    }
-
-    /**
-     * Obtain the static-catalog setting from the properties.
-     *
-     * <p>In the properties, a value of 'yes', 'true', or '1' is considered
-     * true, anything else is false.</p>
-     *
-     * @return The static-catalog setting from the propertyFile or the
-     * defaultUseStaticCatalog.
-     */
-    private boolean queryUseStaticCatalog () {
-        String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
-
-        if (staticCatalog == null) {
-            if (resources==null) readProperties();
-            if (resources==null) return defaultUseStaticCatalog;
-            try {
-                staticCatalog = resources.getString("static-catalog");
-            } catch (MissingResourceException e) {
-                return defaultUseStaticCatalog;
-            }
-        }
-
-        if (staticCatalog == null) {
-            return defaultUseStaticCatalog;
-        }
-
-        return (staticCatalog.equalsIgnoreCase("true")
-                || staticCatalog.equalsIgnoreCase("yes")
-                || staticCatalog.equalsIgnoreCase("1"));
-    }
-
-    /**
-     * Get the current use static catalog setting.
-     */
-    public boolean getUseStaticCatalog() {
-        if (useStaticCatalog == null) {
-            useStaticCatalog = queryUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
-        }
-
-        return useStaticCatalog.booleanValue();
-    }
-
-    /**
-     * Set the use static catalog setting.
-     */
-    public void setUseStaticCatalog(boolean useStatic) {
-        useStaticCatalog = useStatic ? Boolean.TRUE : Boolean.FALSE;
-    }
-
-    /**
-     * Get the current use static catalog setting.
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public boolean staticCatalog() {
-        return getUseStaticCatalog();
-    }
-
-    /**
-     * Get a new catalog instance.
-     *
-     * This method always returns a new instance of the underlying catalog class.
-     */
-    public Catalog getPrivateCatalog() {
-        Catalog catalog = staticCatalog;
-
-        if (useStaticCatalog == null) {
-            useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
-        }
-
-        if (catalog == null || !useStaticCatalog.booleanValue()) {
-
-            try {
-                String catalogClassName = getCatalogClassName();
-
-                if (catalogClassName == null) {
-                    catalog = new Catalog();
-                } else {
-                    try {
-                        catalog = (Catalog) ReflectUtil.forName(catalogClassName).newInstance();
-                    } catch (ClassNotFoundException cnfe) {
-                        debug.message(1,"Catalog class named '"
-                                + catalogClassName
-                                + "' could not be found. Using default.");
-                        catalog = new Catalog();
-                    } catch (ClassCastException cnfe) {
-                        debug.message(1,"Class named '"
-                                + catalogClassName
-                                + "' is not a Catalog. Using default.");
-                        catalog = new Catalog();
-                    }
-                }
-
-                catalog.setCatalogManager(this);
-                catalog.setupReaders();
-                catalog.loadSystemCatalogs();
-            } catch (Exception ex) {
-                ex.printStackTrace();
-            }
-
-            if (useStaticCatalog.booleanValue()) {
-                staticCatalog = catalog;
-            }
-        }
-
-        return catalog;
-    }
-
-    /**
-     * Get a catalog instance.
-     *
-     * If this manager uses static catalogs, the same static catalog will
-     * always be returned. Otherwise a new catalog will be returned.
-     */
-    public Catalog getCatalog() {
-        Catalog catalog = staticCatalog;
-
-        if (useStaticCatalog == null) {
-            useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
-        }
-
-        if (catalog == null || !useStaticCatalog.booleanValue()) {
-            catalog = getPrivateCatalog();
-            if (useStaticCatalog.booleanValue()) {
-                staticCatalog = catalog;
-            }
-        }
-
-        return catalog;
-    }
-
-    /**
-     * <p>Obtain the oasisXMLCatalogPI setting from the properties.</p>
-     *
-     * <p>In the properties, a value of 'yes', 'true', or '1' is considered
-     * true, anything else is false.</p>
-     *
-     * @return The oasisXMLCatalogPI setting from the propertyFile or the
-     * defaultOasisXMLCatalogPI.
-     */
-    public boolean queryAllowOasisXMLCatalogPI () {
-        String allow = SecuritySupport.getSystemProperty(pAllowPI);
-
-        if (allow == null) {
-            if (resources==null) readProperties();
-            if (resources==null) return defaultOasisXMLCatalogPI;
-            try {
-                allow = resources.getString("allow-oasis-xml-catalog-pi");
-            } catch (MissingResourceException e) {
-                return defaultOasisXMLCatalogPI;
-            }
-        }
-
-        if (allow == null) {
-            return defaultOasisXMLCatalogPI;
-        }
-
-        return (allow.equalsIgnoreCase("true")
-                || allow.equalsIgnoreCase("yes")
-                || allow.equalsIgnoreCase("1"));
-    }
-
-    /**
-     * Get the current XML Catalog PI setting.
-     */
-    public boolean getAllowOasisXMLCatalogPI () {
-        if (oasisXMLCatalogPI == null) {
-            oasisXMLCatalogPI = queryAllowOasisXMLCatalogPI() ? Boolean.TRUE : Boolean.FALSE;
-        }
-
-        return oasisXMLCatalogPI.booleanValue();
-    }
-
-    public boolean useServicesMechanism() {
-        return useServicesMechanism;
-    }
-    /**
-     * Set the XML Catalog PI setting
-     */
-    public void setAllowOasisXMLCatalogPI(boolean allowPI) {
-        oasisXMLCatalogPI = allowPI ? Boolean.TRUE : Boolean.FALSE;
-    }
-
-    /**
-     * Get the current XML Catalog PI setting.
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public boolean allowOasisXMLCatalogPI() {
-        return getAllowOasisXMLCatalogPI();
-    }
-
-    /**
-     * Obtain the Catalog class name setting from the properties.
-     *
-     */
-    public String queryCatalogClassName () {
-        String className = SecuritySupport.getSystemProperty(pClassname);
-
-        if (className == null) {
-            if (resources==null) readProperties();
-            if (resources==null) return null;
-            try {
-                return resources.getString("catalog-class-name");
-            } catch (MissingResourceException e) {
-                return null;
-            }
-        }
-
-        return className;
-    }
-
-    /**
-     * Get the current Catalog class name.
-     */
-    public String getCatalogClassName() {
-        if (catalogClassName == null) {
-            catalogClassName = queryCatalogClassName();
-        }
-
-        return catalogClassName;
-    }
-
-    /**
-     * Set the Catalog class name.
-     */
-    public void setCatalogClassName(String className) {
-        catalogClassName = className;
-    }
-
-    /**
-     * Get the current Catalog class name.
-     *
-     * @deprecated No longer static; use get/set methods.
-     */
-    public String catalogClassName() {
-        return getCatalogClassName();
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,697 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.FileNotFoundException;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.MalformedURLException;
-import javax.xml.parsers.SAXParserFactory;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
-
-/**
- * An extension to OASIS Open Catalog files, this class supports
- * suffix-based matching and an external RFC2483 resolver.
- *
- * @see Catalog
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class Resolver extends Catalog {
-  /**
-   * The URISUFFIX Catalog Entry type.
-   *
-   * <p>URI suffix entries match URIs that end in a specified suffix.</p>
-   */
-  public static final int URISUFFIX = CatalogEntry.addEntryType("URISUFFIX", 2);
-
-  /**
-   * The SYSTEMSUFFIX Catalog Entry type.
-   *
-   * <p>System suffix entries match system identifiers that end in a
-   * specified suffix.</p>
-   */
-  public static final int SYSTEMSUFFIX = CatalogEntry.addEntryType("SYSTEMSUFFIX", 2);
-
-  /**
-   * The RESOLVER Catalog Entry type.
-   *
-   * <p>A hook for providing support for web-based backup resolvers.</p>
-   */
-  public static final int RESOLVER = CatalogEntry.addEntryType("RESOLVER", 1);
-
-  /**
-   * The SYSTEMREVERSE Catalog Entry type.
-   *
-   * <p>This is a bit of a hack. There's no actual SYSTEMREVERSE entry,
-   * but this entry type is used to indicate that a reverse lookup is
-   * being performed. (This allows the Resolver to implement
-   * RFC2483 I2N and I2NS.)
-   */
-  public static final int SYSTEMREVERSE
-    = CatalogEntry.addEntryType("SYSTEMREVERSE", 1);
-
-  /**
-   * Setup readers.
-   */
-  public void setupReaders() {
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(true);
-    spf.setValidating(false);
-
-    SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-
-    saxReader.setCatalogParser(null, "XCatalog",
-                               "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
-
-    saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
-                               "catalog",
-                               "com.sun.org.apache.xml.internal.resolver.readers.ExtendedXMLCatalogReader");
-
-    addReader("application/xml", saxReader);
-
-    TR9401CatalogReader textReader = new TR9401CatalogReader();
-    addReader("text/plain", textReader);
-  }
-
-  /**
-   * Cleanup and process a Catalog entry.
-   *
-   * <p>This method processes each Catalog entry, changing mapped
-   * relative system identifiers into absolute ones (based on the current
-   * base URI), and maintaining other information about the current
-   * catalog.</p>
-   *
-   * @param entry The CatalogEntry to process.
-   */
-  public void addEntry(CatalogEntry entry) {
-    int type = entry.getEntryType();
-
-    if (type == URISUFFIX) {
-      String suffix = normalizeURI(entry.getEntryArg(0));
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "URISUFFIX", suffix, fsi);
-    } else if (type == SYSTEMSUFFIX) {
-      String suffix = normalizeURI(entry.getEntryArg(0));
-      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
-      entry.setEntryArg(1, fsi);
-
-      catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi);
-    }
-
-    super.addEntry(entry);
-  }
-
-  /**
-   * Return the applicable URI.
-   *
-   * <p>If a URI entry exists in the Catalog
-   * for the URI specified, return the mapped value.</p>
-   *
-   * <p>In the Resolver (as opposed to the Catalog) class, if the
-   * URI isn't found by the usual algorithm, URISUFFIX entries are
-   * considered.</p>
-   *
-   * <p>URI comparison is case sensitive.</p>
-   *
-   * @param uri The URI to locate in the catalog.
-   *
-   * @return The resolved URI.
-   *
-   * @throws MalformedURLException The system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveURI(String uri)
-    throws MalformedURLException, IOException {
-
-    String resolved = super.resolveURI(uri);
-    if (resolved != null) {
-      return resolved;
-    }
-
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == RESOLVER) {
-        resolved = resolveExternalSystem(uri, e.getEntryArg(0));
-        if (resolved != null) {
-          return resolved;
-        }
-      } else if (e.getEntryType() == URISUFFIX) {
-        String suffix = e.getEntryArg(0);
-        String result = e.getEntryArg(1);
-
-        if (suffix.length() <= uri.length()
-            && uri.substring(uri.length()-suffix.length()).equals(suffix)) {
-          return result;
-        }
-      }
-    }
-
-    // Otherwise, look in the subordinate catalogs
-    return resolveSubordinateCatalogs(Catalog.URI,
-                                      null,
-                                      null,
-                                      uri);
-  }
-
-  /**
-   * Return the applicable SYSTEM system identifier, resorting
-   * to external RESOLVERs if necessary.
-   *
-   * <p>If a SYSTEM entry exists in the Catalog
-   * for the system ID specified, return the mapped value.</p>
-   *
-   * <p>In the Resolver (as opposed to the Catalog) class, if the
-   * URI isn't found by the usual algorithm, SYSTEMSUFFIX entries are
-   * considered.</p>
-   *
-   * <p>On Windows-based operating systems, the comparison between
-   * the system identifier provided and the SYSTEM entries in the
-   * Catalog is case-insensitive.</p>
-   *
-   * @param systemId The system ID to locate in the catalog.
-   *
-   * @return The system identifier to use for systemId.
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   */
-  public String resolveSystem(String systemId)
-    throws MalformedURLException, IOException {
-
-    String resolved = super.resolveSystem(systemId);
-    if (resolved != null) {
-      return resolved;
-    }
-
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == RESOLVER) {
-        resolved = resolveExternalSystem(systemId, e.getEntryArg(0));
-        if (resolved != null) {
-          return resolved;
-        }
-      } else if (e.getEntryType() == SYSTEMSUFFIX) {
-        String suffix = e.getEntryArg(0);
-        String result = e.getEntryArg(1);
-
-        if (suffix.length() <= systemId.length()
-            && systemId.substring(systemId.length()-suffix.length()).equals(suffix)) {
-          return result;
-        }
-      }
-    }
-
-    return resolveSubordinateCatalogs(Catalog.SYSTEM,
-                                      null,
-                                      null,
-                                      systemId);
-  }
-
-  /**
-   * Return the applicable PUBLIC or SYSTEM identifier, resorting
-   * to external resolvers if necessary.
-   *
-   * <p>This method searches the Catalog and returns the system
-   * identifier specified for the given system or
-   * public identifiers. If
-   * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
-   * null is returned.</p>
-   *
-   * <p>Note that a system or public identifier in the current catalog
-   * (or subordinate catalogs) will be used in preference to an
-   * external resolver. Further, if a systemId is present, the external
-   * resolver(s) will be queried for that before the publicId.</p>
-   *
-   * @param publicId The public identifier to locate in the catalog.
-   * Public identifiers are normalized before comparison.
-   * @param systemId The nominal system identifier for the entity
-   * in question (as provided in the source document).
-   *
-   * @throws MalformedURLException The formal system identifier of a
-   * subordinate catalog cannot be turned into a valid URL.
-   * @throws IOException Error reading subordinate catalog file.
-   *
-   * @return The system identifier to use.
-   * Note that the nominal system identifier is not returned if a
-   * match is not found in the catalog, instead null is returned
-   * to indicate that no match was found.
-   */
-  public String resolvePublic(String publicId, String systemId)
-    throws MalformedURLException, IOException {
-
-    String resolved = super.resolvePublic(publicId, systemId);
-    if (resolved != null) {
-      return resolved;
-    }
-
-    Enumeration en = catalogEntries.elements();
-    while (en.hasMoreElements()) {
-      CatalogEntry e = (CatalogEntry) en.nextElement();
-      if (e.getEntryType() == RESOLVER) {
-        if (systemId != null) {
-          resolved = resolveExternalSystem(systemId,
-                                           e.getEntryArg(0));
-          if (resolved != null) {
-            return resolved;
-          }
-        }
-        resolved = resolveExternalPublic(publicId, e.getEntryArg(0));
-        if (resolved != null) {
-          return resolved;
-        }
-      }
-    }
-
-    return resolveSubordinateCatalogs(Catalog.PUBLIC,
-                                      null,
-                                      publicId,
-                                      systemId);
-  }
-
-    /**
-     * Query an external RFC2483 resolver for a system identifier.
-     *
-     * @param systemId The system ID to locate.
-     * @param resolver The name of the resolver to use.
-     *
-     * @return The system identifier to use for the systemId.
-     */
-    protected String resolveExternalSystem(String systemId, String resolver)
-        throws MalformedURLException, IOException {
-        Resolver r = queryResolver(resolver, "i2l", systemId, null);
-        if (r != null) {
-            return r.resolveSystem(systemId);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Query an external RFC2483 resolver for a public identifier.
-     *
-     * @param publicId The system ID to locate.
-     * @param resolver The name of the resolver to use.
-     *
-     * @return The system identifier to use for the systemId.
-     */
-    protected String resolveExternalPublic(String publicId, String resolver)
-        throws MalformedURLException, IOException {
-        Resolver r = queryResolver(resolver, "fpi2l", publicId, null);
-        if (r != null) {
-            return r.resolvePublic(publicId, null);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Query an external RFC2483 resolver.
-     *
-     * @param resolver The URL of the RFC2483 resolver.
-     * @param command The command to send the resolver.
-     * @param arg1 The first argument to the resolver.
-     * @param arg2 The second argument to the resolver, usually null.
-     *
-     * @return The Resolver constructed.
-     */
-    protected Resolver queryResolver(String resolver,
-                                     String command,
-                                     String arg1,
-                                     String arg2) {
-        InputStream iStream = null;
-        String RFC2483 = resolver + "?command=" + command
-            + "&format=tr9401&uri=" + arg1
-            + "&uri2=" + arg2;
-        String line = null;
-
-        try {
-            URL url = new URL(RFC2483);
-
-            URLConnection urlCon = url.openConnection();
-
-            urlCon.setUseCaches(false);
-
-            Resolver r = (Resolver) newCatalog();
-
-            String cType = urlCon.getContentType();
-
-            // I don't care about the character set or subtype
-            if (cType.indexOf(";") > 0) {
-                cType = cType.substring(0, cType.indexOf(";"));
-            }
-
-            r.parseCatalog(cType, urlCon.getInputStream());
-
-            return r;
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.UNPARSEABLE) {
-            catalogManager.debug.message(1, "Unparseable catalog: " + RFC2483);
-          } else if (cex.getExceptionType()
-                     == CatalogException.UNKNOWN_FORMAT) {
-            catalogManager.debug.message(1, "Unknown catalog format: " + RFC2483);
-          }
-          return null;
-        } catch (MalformedURLException mue) {
-            catalogManager.debug.message(1, "Malformed resolver URL: " + RFC2483);
-            return null;
-        } catch (IOException ie) {
-            catalogManager.debug.message(1, "I/O Exception opening resolver: " + RFC2483);
-            return null;
-        }
-    }
-
-    /**
-     * Append two vectors, returning the result.
-     *
-     * @param vec The first vector
-     * @param appvec The vector to be appended
-     * @return The vector vec, with appvec's elements appended to it
-     */
-    private Vector appendVector(Vector vec, Vector appvec) {
-        if (appvec != null) {
-            for (int count = 0; count < appvec.size(); count++) {
-                vec.addElement(appvec.elementAt(count));
-            }
-        }
-        return vec;
-    }
-
-    /**
-     * Find the URNs for a given system identifier in all catalogs.
-     *
-     * @param systemId The system ID to locate.
-     *
-     * @return A vector of URNs that map to the systemId.
-     */
-    public Vector resolveAllSystemReverse(String systemId)
-        throws MalformedURLException, IOException {
-        Vector resolved = new Vector();
-
-        // If there's a SYSTEM entry in this catalog, use it
-        if (systemId != null) {
-            Vector localResolved = resolveLocalSystemReverse(systemId);
-            resolved = appendVector(resolved, localResolved);
-        }
-
-        // Otherwise, look in the subordinate catalogs
-        Vector subResolved = resolveAllSubordinateCatalogs(SYSTEMREVERSE,
-                                                           null,
-                                                           null,
-                                                           systemId);
-
-        return appendVector(resolved, subResolved);
-    }
-
-    /**
-     * Find the URN for a given system identifier.
-     *
-     * @param systemId The system ID to locate.
-     *
-     * @return A (single) URN that maps to the systemId.
-     */
-    public String resolveSystemReverse(String systemId)
-        throws MalformedURLException, IOException {
-        Vector resolved = resolveAllSystemReverse(systemId);
-        if (resolved != null && resolved.size() > 0) {
-            return (String) resolved.elementAt(0);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Return the applicable SYSTEM system identifiers.
-     *
-     * <p>If one or more SYSTEM entries exists in the Catalog
-     * for the system ID specified, return the mapped values.</p>
-     *
-     * <p>The caller is responsible for doing any necessary
-     * normalization of the system identifier before calling
-     * this method. For example, a relative system identifier in
-     * a document might be converted to an absolute system identifier
-     * before attempting to resolve it.</p>
-     *
-     * <p>Note that this function will force all subordinate catalogs
-     * to be loaded.</p>
-     *
-     * <p>On Windows-based operating systems, the comparison between
-     * the system identifier provided and the SYSTEM entries in the
-     * Catalog is case-insensitive.</p>
-     *
-     * @param systemId The system ID to locate in the catalog.
-     *
-     * @return The system identifier to use for the notation.
-     *
-     * @throws MalformedURLException The formal system identifier of a
-     * subordinate catalog cannot be turned into a valid URL.
-     * @throws IOException Error reading subordinate catalog file.
-     */
-    public Vector resolveAllSystem(String systemId)
-        throws MalformedURLException, IOException {
-        Vector resolutions = new Vector();
-
-        // If there are SYSTEM entries in this catalog, start with them
-        if (systemId != null) {
-            Vector localResolutions = resolveAllLocalSystem(systemId);
-            resolutions = appendVector(resolutions, localResolutions);
-        }
-
-        // Then look in the subordinate catalogs
-        Vector subResolutions = resolveAllSubordinateCatalogs(SYSTEM,
-                                                              null,
-                                                              null,
-                                                              systemId);
-        resolutions = appendVector(resolutions, subResolutions);
-
-        if (resolutions.size() > 0) {
-            return resolutions;
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Return all applicable SYSTEM system identifiers in this
-     * catalog.
-     *
-     * <p>If one or more SYSTEM entries exists in the catalog file
-     * for the system ID specified, return the mapped values.</p>
-     *
-     * @param systemId The system ID to locate in the catalog
-     *
-     * @return A vector of the mapped system identifiers or null
-     */
-    private Vector resolveAllLocalSystem(String systemId) {
-        Vector map = new Vector();
-        String osname = SecuritySupport.getSystemProperty("os.name");
-        boolean windows = (osname.indexOf("Windows") >= 0);
-        Enumeration en = catalogEntries.elements();
-        while (en.hasMoreElements()) {
-            CatalogEntry e = (CatalogEntry) en.nextElement();
-            if (e.getEntryType() == SYSTEM
-                && (e.getEntryArg(0).equals(systemId)
-                    || (windows
-                        && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
-                map.addElement(e.getEntryArg(1));
-            }
-        }
-        if (map.size() == 0) {
-            return null;
-        } else {
-            return map;
-        }
-    }
-
-    /**
-     * Find the URNs for a given system identifier in the current catalog.
-     *
-     * @param systemId The system ID to locate.
-     *
-     * @return A vector of URNs that map to the systemId.
-     */
-    private Vector resolveLocalSystemReverse(String systemId) {
-        Vector map = new Vector();
-        String osname = SecuritySupport.getSystemProperty("os.name");
-        boolean windows = (osname.indexOf("Windows") >= 0);
-        Enumeration en = catalogEntries.elements();
-        while (en.hasMoreElements()) {
-            CatalogEntry e = (CatalogEntry) en.nextElement();
-            if (e.getEntryType() == SYSTEM
-                && (e.getEntryArg(1).equals(systemId)
-                    || (windows
-                        && e.getEntryArg(1).equalsIgnoreCase(systemId)))) {
-                map.addElement(e.getEntryArg(0));
-            }
-        }
-        if (map.size() == 0) {
-            return null;
-        } else {
-            return map;
-        }
-    }
-
-    /**
-     * Search the subordinate catalogs, in order, looking for all
-     * match.
-     *
-     * <p>This method searches the Catalog and returns all of the system
-     * identifiers specified for the given entity type with the given
-     * name, public, and system identifiers. In some contexts, these
-     * may be null.</p>
-     *
-     * @param entityType The CatalogEntry type for which this query is
-     * being conducted. This is necessary in order to do the approprate
-     * query on a subordinate catalog.
-     * @param entityName The name of the entity being searched for, if
-     * appropriate.
-     * @param publicId The public identifier of the entity in question
-     * (as provided in the source document).
-     * @param systemId The nominal system identifier for the entity
-     * in question (as provided in the source document).
-     *
-     * @throws MalformedURLException The formal system identifier of a
-     * delegated catalog cannot be turned into a valid URL.
-     * @throws IOException Error reading delegated catalog file.
-     *
-     * @return The system identifier to use.
-     * Note that the nominal system identifier is not returned if a
-     * match is not found in the catalog, instead null is returned
-     * to indicate that no match was found.
-     */
-    private synchronized Vector resolveAllSubordinateCatalogs(int entityType,
-                                              String entityName,
-                                              String publicId,
-                                              String systemId)
-        throws MalformedURLException, IOException {
-
-        Vector resolutions = new Vector();
-
-        for (int catPos = 0; catPos < catalogs.size(); catPos++) {
-            Resolver c = null;
-
-            try {
-                c = (Resolver) catalogs.elementAt(catPos);
-            } catch (ClassCastException e) {
-                String catfile = (String) catalogs.elementAt(catPos);
-                c = (Resolver) newCatalog();
-
-                try {
-                    c.parseCatalog(catfile);
-                } catch (MalformedURLException mue) {
-                    catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
-                } catch (FileNotFoundException fnfe) {
-                    catalogManager.debug.message(1, "Failed to load catalog, file not found",
-                          catfile);
-                } catch (IOException ioe) {
-                    catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
-                }
-
-                catalogs.setElementAt(c, catPos);
-            }
-
-            String resolved = null;
-
-            // Ok, now what are we supposed to call here?
-            if (entityType == DOCTYPE) {
-                resolved = c.resolveDoctype(entityName,
-                                            publicId,
-                                            systemId);
-                if (resolved != null) {
-                    // Only find one DOCTYPE resolution
-                    resolutions.addElement(resolved);
-                    return resolutions;
-                }
-            } else if (entityType == DOCUMENT) {
-                resolved = c.resolveDocument();
-                if (resolved != null) {
-                    // Only find one DOCUMENT resolution
-                    resolutions.addElement(resolved);
-                    return resolutions;
-                }
-            } else if (entityType == ENTITY) {
-                resolved = c.resolveEntity(entityName,
-                                           publicId,
-                                           systemId);
-                if (resolved != null) {
-                    // Only find one ENTITY resolution
-                    resolutions.addElement(resolved);
-                    return resolutions;
-                }
-            } else if (entityType == NOTATION) {
-                resolved = c.resolveNotation(entityName,
-                                             publicId,
-                                             systemId);
-                if (resolved != null) {
-                    // Only find one NOTATION resolution
-                    resolutions.addElement(resolved);
-                    return resolutions;
-                }
-            } else if (entityType == PUBLIC) {
-                resolved = c.resolvePublic(publicId, systemId);
-                if (resolved != null) {
-                    // Only find one PUBLIC resolution
-                    resolutions.addElement(resolved);
-                    return resolutions;
-                }
-            } else if (entityType == SYSTEM) {
-                Vector localResolutions = c.resolveAllSystem(systemId);
-                resolutions = appendVector(resolutions, localResolutions);
-                break;
-            } else if (entityType == SYSTEMREVERSE) {
-                Vector localResolutions = c.resolveAllSystemReverse(systemId);
-                resolutions = appendVector(resolutions, localResolutions);
-            }
-        }
-
-        if (resolutions != null) {
-            return resolutions;
-        } else {
-            return null;
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.SAXSource;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-/**
- * A simple bootstrapping resolver.
- *
- * <p>This class is used as the entity resolver when reading XML Catalogs.
- * It searches for the OASIS XML Catalog DTD, Relax NG Grammar and W3C XML Schema
- * as resources (e.g., in the resolver jar file).</p>
- *
- * <p>If you have your own DTDs or schemas, you can extend this class and
- * set the BootstrapResolver in your CatalogManager.</p>
- *
- * @see com.sun.org.apache.xml.internal.resolver.CatalogManager
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class BootstrapResolver implements EntityResolver, URIResolver {
-  /** URI of the W3C XML Schema for OASIS XML Catalog files. */
-  public static final String xmlCatalogXSD = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.xsd";
-
-  /** URI of the RELAX NG Grammar for OASIS XML Catalog files. */
-  public static final String xmlCatalogRNG = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.rng";
-
-  /** Public identifier for OASIS XML Catalog files. */
-  public static final String xmlCatalogPubId = "-//OASIS//DTD XML Catalogs V1.0//EN";
-
-  /** System identifier for OASIS XML Catalog files. */
-  public static final String xmlCatalogSysId = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";
-
-  /** Public identifier for legacy Apache XCatalog files.  There is no official system identifier for XCatalog files. */
-  public static final String xCatalogPubId = "-//DTD XCatalog//EN";
-
-  /** Private hash used for public identifiers. */
-  private final Map<String, String> publicMap = new HashMap<>();
-
-  /** Private hash used for system identifiers. */
-  private final Map<String, String> systemMap = new HashMap<>();
-
-  /** Private hash used for URIs. */
-  private final Map<String, String> uriMap = new HashMap<>();
-
-  /** Constructor. */
-  public BootstrapResolver() {
-    URL url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.dtd");
-    if (url != null) {
-      publicMap.put(xmlCatalogPubId, url.toString());
-      systemMap.put(xmlCatalogSysId, url.toString());
-    }
-
-    url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.rng");
-    if (url != null) {
-      uriMap.put(xmlCatalogRNG, url.toString());
-    }
-
-    url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.xsd");
-    if (url != null) {
-      uriMap.put(xmlCatalogXSD, url.toString());
-    }
-
-    url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/xcatalog.dtd");
-    if (url != null) {
-      publicMap.put(xCatalogPubId, url.toString());
-    }
-  }
-
-  /** SAX resolveEntity API. */
-  public InputSource resolveEntity (String publicId, String systemId) {
-    String resolved = null;
-
-    if (systemId != null && systemMap.containsKey(systemId)) {
-      resolved = systemMap.get(systemId);
-    } else if (publicId != null && publicMap.containsKey(publicId)) {
-      resolved = publicMap.get(publicId);
-    }
-
-    if (resolved != null) {
-      try {
-        InputSource iSource = new InputSource(resolved);
-        iSource.setPublicId(publicId);
-
-        // Ideally this method would not attempt to open the
-        // InputStream, but there is a bug (in Xerces, at least)
-        // that causes the parser to mistakenly open the wrong
-        // system identifier if the returned InputSource does
-        // not have a byteStream.
-        //
-        // It could be argued that we still shouldn't do this here,
-        // but since the purpose of calling the entityResolver is
-        // almost certainly to open the input stream, it seems to
-        // do little harm.
-        //
-        URL url = new URL(resolved);
-        InputStream iStream = url.openStream();
-        iSource.setByteStream(iStream);
-
-        return iSource;
-      } catch (Exception e) {
-        // FIXME: silently fail?
-        return null;
-      }
-    }
-
-    return null;
-  }
-
-  /** Transformer resolve API. */
-  public Source resolve(String href, String base)
-    throws TransformerException {
-
-    String uri = href;
-    String fragment = null;
-    int hashPos = href.indexOf("#");
-    if (hashPos >= 0) {
-      uri = href.substring(0, hashPos);
-      fragment = href.substring(hashPos+1);
-    }
-
-    String result = null;
-    if (href != null && uriMap.containsKey(href)) {
-      result = uriMap.get(href);
-    }
-
-    if (result == null) {
-      try {
-        URL url = null;
-
-        if (base==null) {
-          url = new URL(uri);
-          result = url.toString();
-        } else {
-          URL baseURL = new URL(base);
-          url = (href.length()==0 ? baseURL : new URL(baseURL, uri));
-          result = url.toString();
-        }
-      } catch (java.net.MalformedURLException mue) {
-        // try to make an absolute URI from the current base
-        String absBase = makeAbsolute(base);
-        if (!absBase.equals(base)) {
-          // don't bother if the absBase isn't different!
-          return resolve(href, absBase);
-        } else {
-          throw new TransformerException("Malformed URL "
-                                         + href + "(base " + base + ")",
-                                         mue);
-        }
-      }
-    }
-
-    SAXSource source = new SAXSource();
-    source.setInputSource(new InputSource(result));
-    return source;
-  }
-
-  /** Attempt to construct an absolute URI */
-  private String makeAbsolute(String uri) {
-    if (uri == null) {
-      uri = "";
-    }
-
-    try {
-      URL url = new URL(uri);
-      return url.toString();
-    } catch (MalformedURLException mue) {
-      try {
-        URL fileURL = FileURL.makeURL(uri);
-        return fileURL.toString();
-      } catch (MalformedURLException mue2) {
-        // bail
-        return uri;
-      }
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-/**
- * Static debugging/messaging class for Catalogs.
- *
- * <p>This class defines a set of static methods that can be called
- * to produce debugging messages. Messages have an associated "debug
- * level" and messages below the current setting are not displayed.</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class Debug {
-  /** The internal debug level. */
-  protected int debug = 0;
-
-  /** Constructor */
-  public Debug() {
-    // nop
-  }
-
-  /** Set the debug level for future messages. */
-  public void setDebug(int newDebug) {
-    debug = newDebug;
-  }
-
-  /** Get the current debug level. */
-  public int getDebug() {
-    return debug;
-  }
-
-  /**
-   * Print debug message (if the debug level is high enough).
-   *
-   * <p>Prints "the message"</p>
-   *
-   * @param level The debug level of this message. This message
-   * will only be
-   * displayed if the current debug level is at least equal to this
-   * value.
-   * @param message The text of the message.
-   */
-  public void message(int level, String message) {
-    if (debug >= level) {
-      System.out.println(message);
-    }
-  }
-
-  /**
-   * Print debug message (if the debug level is high enough).
-   *
-   * <p>Prints "the message: spec"</p>
-   *
-   * @param level The debug level of this message. This message
-   * will only be
-   * displayed if the current debug level is at least equal to this
-   * value.
-   * @param message The text of the message.
-   * @param spec An argument to the message.
-   */
-  public void message(int level, String message, String spec) {
-    if (debug >= level) {
-      System.out.println(message + ": " + spec);
-    }
-  }
-
-  /**
-   * Print debug message (if the debug level is high enough).
-   *
-   * <p>Prints "the message: spec1" and "spec2" indented on the next line.</p>
-   *
-   * @param level The debug level of this message. This message
-   * will only be
-   * displayed if the current debug level is at least equal to this
-   * value.
-   * @param message The text of the message.
-   * @param spec1 An argument to the message.
-   * @param spec2 Another argument to the message.
-   */
-  public void message(int level, String message,
-                             String spec1, String spec2) {
-    if (debug >= level) {
-      System.out.println(message + ": " + spec1);
-      System.out.println("\t" + spec2);
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.io.File;
-
-/**
- * Static method for dealing with file: URLs.
- *
- * <p>This class defines a static method that can be used to construct
- * an appropriate file: URL from parts. It's defined here so that it
- * can be reused throught the resolver.</p>
- *
- * <p>(Yes, I'd rather have called this class FileUR<b>I</b>, but
- * given that a jave.net.URL is returned, it seemed...even more
- * confusing.)</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public abstract class FileURL {
-  protected FileURL() { }
-
-  /**
-   * Construct a file: URL for a path name.
-   *
-   * <p>URLs in the file: scheme can be constructed for paths on
-   * the local file system. Several possibilities need to be considered:
-   * </p>
-   *
-   * <ul>
-   * <li>If the path does not begin with a slash, then it is assumed
-   * to reside in the users current working directory
-   * (System.getProperty("user.dir")).</li>
-   * <li>On Windows machines, the current working directory uses
-   * backslashes (\\, instead of /).</li>
-   * <li>If the current working directory is "/", don't add an extra
-   * slash before the base name.</li>
-   * </ul>
-   *
-   * <p>This method is declared static so that other classes
-   * can use it directly.</p>
-   *
-   * @param pathname The path name component for which to construct a URL.
-   *
-   * @return The appropriate file: URL.
-   *
-   * @throws MalformedURLException if the pathname can't be turned into
-   *         a proper URL.
-   */
-  public static URL makeURL(String pathname) throws MalformedURLException {
-    /*if (pathname.startsWith("/")) {
-      return new URL("file://" + pathname);
-    }
-
-    String userdir = System.getProperty("user.dir");
-    userdir.replace('\\', '/');
-
-    if (userdir.endsWith("/")) {
-      return new URL("file:///" + userdir + pathname);
-    } else {
-      return new URL("file:///" + userdir + "/" + pathname);
-    }
-     */
-      File file = new File(pathname);
-      return file.toURI().toURL();
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-import org.w3c.dom.*;
-
-/**
- * Static Namespace query methods.
- *
- * <p>This class defines a set of static methods that can be called
- * to analyze the namespace properties of DOM nodes.</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class Namespaces {
-    /**
-     * Returns the "prefix" part of a QName or the empty string (not
-     * null) if the name has no prefix.
-     *
-     * @param element The QName of an element.
-     * @return The prefix part of the element name.
-     */
-    public static String getPrefix(Element element) {
-        String name = element.getTagName();
-        String prefix = "";
-
-        final int indexOfColon = name.indexOf(':');
-        if (indexOfColon > 0) {
-            prefix = name.substring(0, indexOfColon);
-        }
-
-        return prefix;
-    }
-
-    /**
-     * Returns the "localname" part of a QName, which is the whole
-     * name if it has no prefix.
-     *
-     * @param element The QName of an element.
-     * @return The local part of a QName.
-     */
-    public static String getLocalName(Element element) {
-        String name = element.getTagName();
-
-        final int indexOfColon = name.indexOf(':');
-        if (indexOfColon > 0) {
-            name = name.substring(indexOfColon + 1);
-        }
-
-        return name;
-    }
-
-    /**
-     * Returns the namespace URI for the specified prefix at the
-     * specified context node.
-     *
-     * @param node The context node.
-     * @param prefix The prefix.
-     * @return The namespace URI associated with the prefix, or
-     * null if no namespace declaration exists for the prefix.
-     */
-    public static String getNamespaceURI(Node node, String prefix) {
-        if (node == null || node.getNodeType() != Node.ELEMENT_NODE) {
-            return null;
-        }
-
-        if (prefix.length() == 0) {
-            if (((Element) node).hasAttribute("xmlns")) {
-                return ((Element) node).getAttribute("xmlns");
-            }
-        } else {
-            String nsattr = "xmlns:" + prefix;
-            if (((Element) node).hasAttribute(nsattr)) {
-                return ((Element) node).getAttribute(nsattr);
-            }
-        }
-
-        return getNamespaceURI(node.getParentNode(), prefix);
-    }
-
-    /**
-     * Returns the namespace URI for the namespace to which the
-     * element belongs.
-     *
-     * @param element The element.
-     * @return The namespace URI associated with the namespace of the
-     * element, or null if no namespace declaration exists for it.
-     */
-    public static String getNamespaceURI(Element element) {
-        String prefix = getPrefix(element);
-        return getNamespaceURI(element, prefix);
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-/**
- * Static methods for dealing with public identifiers.
- *
- * <p>This class defines a set of static methods that can be called
- * to handle public identifiers.</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public abstract class PublicId {
-
-  protected PublicId() {}
-
-  /**
-   * Normalize a public identifier.
-   *
-   * <p>Public identifiers must be normalized according to the following
-   * rules before comparisons between them can be made:</p>
-   *
-   * <ul>
-   * <li>Whitespace characters are normalized to spaces (e.g., line feeds,
-   * tabs, etc. become spaces).</li>
-   * <li>Leading and trailing whitespace is removed.</li>
-   * <li>Multiple internal whitespaces are normalized to a single
-   * space.</li>
-   * </ul>
-   *
-   * <p>This method is declared static so that other classes
-   * can use it directly.</p>
-   *
-   * @param publicId The unnormalized public identifier.
-   *
-   * @return The normalized identifier.
-   */
-  public static String normalize(String publicId) {
-      String normal = publicId.replace('\t', ' ');
-      normal = normal.replace('\r', ' ');
-      normal = normal.replace('\n', ' ');
-      normal = normal.trim();
-
-      int pos;
-
-      while ((pos = normal.indexOf("  ")) >= 0) {
-          normal = normal.substring(0, pos) + normal.substring(pos+1);
-      }
-      return normal;
-  }
-
-  /**
-   * Encode a public identifier as a "publicid" URN.
-   *
-   * <p>This method is declared static so that other classes
-   * can use it directly.</p>
-   *
-   * @param publicId The unnormalized public identifier.
-   *
-   * @return The normalized identifier.
-   */
-  public static String encodeURN(String publicId) {
-      String urn = PublicId.normalize(publicId);
-
-      urn = PublicId.stringReplace(urn, "%", "%25");
-      urn = PublicId.stringReplace(urn, ";", "%3B");
-      urn = PublicId.stringReplace(urn, "'", "%27");
-      urn = PublicId.stringReplace(urn, "?", "%3F");
-      urn = PublicId.stringReplace(urn, "#", "%23");
-      urn = PublicId.stringReplace(urn, "+", "%2B");
-      urn = PublicId.stringReplace(urn, " ", "+");
-      urn = PublicId.stringReplace(urn, "::", ";");
-      urn = PublicId.stringReplace(urn, ":", "%3A");
-      urn = PublicId.stringReplace(urn, "//", ":");
-      urn = PublicId.stringReplace(urn, "/", "%2F");
-
-      StringBuilder buffer = new StringBuilder(13 + urn.length());
-      buffer.append("urn:publicid:");
-      buffer.append(urn);
-      return buffer.toString();
-  }
-
-  /**
-   * Decode a "publicid" URN into a public identifier.
-   *
-   * <p>This method is declared static so that other classes
-   * can use it directly.</p>
-   *
-   * @param urn The urn:publicid: URN
-   *
-   * @return The normalized identifier.
-   */
-  public static String decodeURN(String urn) {
-      String publicId;
-      if (urn.startsWith("urn:publicid:")) {
-          publicId = urn.substring(13);
-      }
-      else {
-          return urn;
-      }
-
-      final boolean hasEscape = (publicId.indexOf('%') >= 0);
-      if (hasEscape) {
-          publicId = PublicId.stringReplace(publicId, "%2F", "/");
-      }
-      publicId = PublicId.stringReplace(publicId, ":", "//");
-      if (hasEscape) {
-          publicId = PublicId.stringReplace(publicId, "%3A", ":");
-      }
-      publicId = PublicId.stringReplace(publicId, ";", "::");
-      publicId = PublicId.stringReplace(publicId, "+", " ");
-      if (hasEscape) {
-          publicId = PublicId.stringReplace(publicId, "%2B", "+");
-          publicId = PublicId.stringReplace(publicId, "%23", "#");
-          publicId = PublicId.stringReplace(publicId, "%3F", "?");
-          publicId = PublicId.stringReplace(publicId, "%27", "'");
-          publicId = PublicId.stringReplace(publicId, "%3B", ";");
-          publicId = PublicId.stringReplace(publicId, "%25", "%");
-      }
-
-      return publicId;
-  }
-
-  /**
-   * Replace one string with another.
-   */
-  private static String stringReplace(String str,
-          String oldStr,
-          String newStr) {
-      int pos = str.indexOf(oldStr);
-      if (pos >= 0) {
-          final StringBuilder buffer = new StringBuilder();
-          final int oldStrLength = oldStr.length();
-          int start = 0;
-          do {
-              for (int i = start; i < pos; ++i) {
-                  buffer.append(str.charAt(i));
-              }
-              buffer.append(newStr);
-              start = pos + oldStrLength;
-              pos = str.indexOf(oldStr, start);
-          }
-          while (pos >= 0);
-          final int strLength = str.length();
-          for (int i = start; i < strLength; ++i) {
-              buffer.append(str.charAt(i));
-          }
-          return buffer.toString();
-      }
-      return str;
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-
-import java.io.InputStream;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-
-/**
- * The CatalogReader interface.
- *
- * <p>The Catalog class requires that classes implement this interface
- * in order to be used to read catalogs. Examples of CatalogReaders
- * include the TextCatalogReader, the SAXCatalogReader, and the
- * DOMCatalogReader.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public interface CatalogReader {
-    /**
-     * Read a catalog from a file.
-     *
-     * <p>This class reads a catalog from a URL.</p>
-     *
-     * @param catalog The catalog for which this reader is called.
-     * @param fileUrl The URL of a document to be read.
-     * @throws MalformedURLException if the specified URL cannot be
-     * turned into a URL object.
-     * @throws IOException if the URL cannot be read.
-     * @throws UnknownCatalogFormatException if the catalog format is
-     * not recognized.
-     * @throws UnparseableCatalogException if the catalog cannot be parsed.
-     * (For example, if it is supposed to be XML and isn't well-formed.)
-     */
-    public void readCatalog(Catalog catalog, String fileUrl)
-      throws MalformedURLException, IOException, CatalogException;
-
-    /**
-     * Read a catalog from an input stream.
-     *
-     * <p>This class reads a catalog from an input stream.</p>
-     *
-     * @param catalog The catalog for which this reader is called.
-     * @param is The input stream that is to be read.
-     * @throws IOException if the URL cannot be read.
-     * @throws UnknownCatalogFormatException if the catalog format is
-     * not recognized.
-     * @throws UnparseableCatalogException if the catalog cannot be parsed.
-     * (For example, if it is supposed to be XML and isn't well-formed.)
-     */
-    public void readCatalog(Catalog catalog, InputStream is)
-        throws IOException, CatalogException;
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import org.w3c.dom.Node;
-
-/**
- * The DOMCatalogParser interface.
- *
- * <p>This interface must be implemented in order for a class to
- * participate as a parser for the DOMCatalogReader.
- *
- * @see Catalog
- * @see DOMCatalogReader
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public interface DOMCatalogParser {
-    /**
-     * Parse a DOM node as a catalog entry.
-     *
-     * <p>This method is expected to analyze the specified node and
-     * construct appropriate catalog entry(ies) from it.</p>
-     *
-     * @param catalog The catalog for which this node is being considered.
-     * @param node The DOM Node from the catalog.
-     */
-    public void parseCatalogEntry(Catalog catalog, Node node);
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-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.util.HashMap;
-import java.util.Map;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.w3c.dom.*;
-import org.xml.sax.SAXException;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * A DOM-based CatalogReader.
- *
- * <p>This class is used to read XML Catalogs using the DOM. This reader
- * has an advantage over the SAX-based reader that it can analyze the
- * DOM tree rather than simply a series of SAX events. It has the disadvantage
- * that it requires all of the code necessary to build and walk a DOM
- * tree.</p>
- *
- * <p>Since the choice of CatalogReaders (in the InputStream case) can only
- * be made on the basis of MIME type, the following problem occurs: only
- * one CatalogReader can exist for all XML mime types. In order to get
- * around this problem, the DOMCatalogReader relies on a set of external
- * CatalogParsers to actually build the catalog.</p>
- *
- * <p>The selection of CatalogParsers is made on the basis of the QName
- * of the root element of the document.</p>
- *
- *
- * @see Catalog
- * @see CatalogReader
- * @see SAXCatalogReader
- * @see TextCatalogReader
- * @see DOMCatalogParser
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class DOMCatalogReader implements CatalogReader {
-  /**
-   * Mapping table from QNames to CatalogParser classes.
-   *
-   * <p>Each key in this hash table has the form "elementname"
-   * or "{namespaceuri}elementname". The former is used if the
-   * namespace URI is null.</p>
-   */
-  protected Map<String, String> namespaceMap = new HashMap<>();
-
-  /**
-   * Add a new parser to the reader.
-   *
-   * <p>This method associates the specified parserClass with the
-   * namespaceURI/rootElement names specified.</p>
-   *
-   * @param namespaceURI The namespace URI. <em>Not</em> the prefix.
-   * @param rootElement The name of the root element.
-   * @param parserClass The name of the parserClass to instantiate
-   * for this kind of catalog.
-   */
-  public void setCatalogParser(String namespaceURI,
-                               String rootElement,
-                               String parserClass) {
-    if (namespaceURI == null) {
-      namespaceMap.put(rootElement, parserClass);
-    } else {
-      namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
-    }
-  }
-
-  /**
-   * Get the name of the parser class for a given catalog type.
-   *
-   * <p>This method returns the parserClass associated with the
-   * namespaceURI/rootElement names specified.</p>
-   *
-   * @param namespaceURI The namespace URI. <em>Not</em> the prefix.
-   * @param rootElement The name of the root element.
-   * @return The parser class.
-   */
-  public String getCatalogParser(String namespaceURI,
-                                 String rootElement) {
-    if (namespaceURI == null) {
-      return namespaceMap.get(rootElement);
-    } else {
-      return namespaceMap.get("{"+namespaceURI+"}"+rootElement);
-    }
-  }
-
-  /**
-   * Null constructor; something for subclasses to call.
-   */
-  public DOMCatalogReader() { }
-
-  /**
-   * Read a catalog from an input stream.
-   *
-   * <p>This class reads a catalog from an input stream:</p>
-   *
-   * <ul>
-   * <li>Based on the QName of the root element, it determines which
-   * parser to instantiate for this catalog.</li>
-   * <li>It constructs a DOM Document from the catalog and</li>
-   * <li>For each child of the root node, it calls the parser's
-   * parseCatalogEntry method. This method is expected to make
-   * appropriate calls back into the catalog to add entries for the
-   * entries in the catalog. It is free to do this in whatever manner
-   * is appropriate (perhaps using just the node passed in, perhaps
-   * wandering arbitrarily throughout the tree).</li>
-   * </ul>
-   *
-   * @param catalog The catalog for which this reader is called.
-   * @param is The input stream that is to be read.
-   * @throws IOException if the URL cannot be read.
-   * @throws UnknownCatalogFormatException if the catalog format is
-   * not recognized.
-   * @throws UnparseableCatalogException if the catalog cannot be parsed.
-   * (For example, if it is supposed to be XML and isn't well-formed or
-   * if the parser class cannot be instantiated.)
-   */
-  public void readCatalog(Catalog catalog, InputStream is)
-    throws IOException, CatalogException {
-
-    DocumentBuilderFactory factory = null;
-    DocumentBuilder builder = null;
-
-    factory = DocumentBuilderFactory.newInstance();
-    factory.setNamespaceAware(false);
-    factory.setValidating(false);
-    try {
-      builder = factory.newDocumentBuilder();
-    } catch (ParserConfigurationException pce) {
-      throw new CatalogException(CatalogException.UNPARSEABLE);
-    }
-
-    Document doc = null;
-
-    try {
-      doc = builder.parse(is);
-    } catch (SAXException se) {
-      throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
-    }
-
-    Element root = doc.getDocumentElement();
-
-    String namespaceURI = Namespaces.getNamespaceURI(root);
-    String localName    = Namespaces.getLocalName(root);
-
-    String domParserClass = getCatalogParser(namespaceURI,
-                                             localName);
-
-    if (domParserClass == null) {
-      if (namespaceURI == null) {
-        catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
-                                                  + localName);
-      } else {
-        catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
-                                                  + "{" + namespaceURI + "}"
-                                                  + localName);
-      }
-      return;
-    }
-
-    DOMCatalogParser domParser = null;
-
-    try {
-      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);
-    } catch (InstantiationException ie) {
-      catalog.getCatalogManager().debug.message(1, "Cannot instantiate XML Catalog Parser class", domParserClass);
-      throw new CatalogException(CatalogException.UNPARSEABLE);
-    } catch (IllegalAccessException iae) {
-      catalog.getCatalogManager().debug.message(1, "Cannot access XML Catalog Parser class", domParserClass);
-      throw new CatalogException(CatalogException.UNPARSEABLE);
-    } catch (ClassCastException cce ) {
-      catalog.getCatalogManager().debug.message(1, "Cannot cast XML Catalog Parser class", domParserClass);
-      throw new CatalogException(CatalogException.UNPARSEABLE);
-    }
-
-    Node node = root.getFirstChild();
-    while (node != null) {
-      domParser.parseCatalogEntry(catalog, node);
-      node = node.getNextSibling();
-    }
-  }
-
-  /**
-   * Read the catalog behind the specified URL.
-   *
-   * @see #readCatalog(Catalog, InputStream)
-   *
-   * @param catalog The catalog for which we are reading.
-   * @param fileUrl The URL of the document that should be read.
-   *
-   * @throws MalformedURLException if the specified URL cannot be
-   * turned into a URL object.
-   * @throws IOException if the URL cannot be read.
-   * @throws UnknownCatalogFormatException if the catalog format is
-   * not recognized.
-   * @throws UnparseableCatalogException if the catalog cannot be parsed.
-   * (For example, if it is supposed to be XML and isn't well-formed.)
-   */
-  public void readCatalog(Catalog catalog, String fileUrl)
-    throws MalformedURLException, IOException, CatalogException {
-    URL url = new URL(fileUrl);
-    URLConnection urlCon = url.openConnection();
-    readCatalog(catalog, urlCon.getInputStream());
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.Resolver;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-
-import org.xml.sax.*;
-import org.w3c.dom.*;
-
-/**
- * Parse Extended OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
-  /** The namespace name of extended catalog elements */
-  public static final String extendedNamespaceName = "http://nwalsh.com/xcatalog/1.0";
-
-  /**
-   * The SAX <code>startElement</code> method recognizes elements
-   * from the plain catalog format and instantiates CatalogEntry
-   * objects for them.
-   *
-   * @param namespaceURI The namespace name of the element.
-   * @param localName The local name of the element.
-   * @param qName The QName of the element.
-   * @param atts The list of attributes on the element.
-   *
-   * @see CatalogEntry
-   */
-  public void startElement (String namespaceURI,
-                            String localName,
-                            String qName,
-                            Attributes atts)
-    throws SAXException {
-
-    // Check before calling the super because super will report our
-    // namespace as an extension namespace, but that doesn't count
-    // for this element.
-    boolean inExtension = inExtensionNamespace();
-
-    super.startElement(namespaceURI, localName, qName, atts);
-
-    int entryType = -1;
-    Vector entryArgs = new Vector();
-
-    if (namespaceURI != null && extendedNamespaceName.equals(namespaceURI)
-        && !inExtension) {
-      // This is an Extended XML Catalog entry
-
-      if (atts.getValue("xml:base") != null) {
-        String baseURI = atts.getValue("xml:base");
-        entryType = Catalog.BASE;
-        entryArgs.add(baseURI);
-        baseURIStack.push(baseURI);
-
-        debug.message(4, "xml:base", baseURI);
-
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry (base)", localName);
-          }
-        }
-
-        entryType = -1;
-        entryArgs = new Vector();
-      } else {
-        baseURIStack.push(baseURIStack.peek());
-      }
-
-      if (localName.equals("uriSuffix")) {
-        if (checkAttributes(atts, "suffix", "uri")) {
-          entryType = Resolver.URISUFFIX;
-          entryArgs.add(atts.getValue("suffix"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "uriSuffix",
-                        atts.getValue("suffix"),
-                        atts.getValue("uri"));
-        }
-      } else if (localName.equals("systemSuffix")) {
-        if (checkAttributes(atts, "suffix", "uri")) {
-          entryType = Resolver.SYSTEMSUFFIX;
-          entryArgs.add(atts.getValue("suffix"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "systemSuffix",
-                        atts.getValue("suffix"),
-                        atts.getValue("uri"));
-        }
-      } else {
-        // This is equivalent to an invalid catalog entry type
-        debug.message(1, "Invalid catalog entry type", localName);
-      }
-
-      if (entryType >= 0) {
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry", localName);
-          }
-        }
-      }
-    }
-  }
-
-  /** The SAX <code>endElement</code> method does nothing. */
-  public void endElement (String namespaceURI,
-                          String localName,
-                          String qName)
-    throws SAXException {
-
-    super.endElement(namespaceURI, localName, qName);
-
-    // Check after popping the stack so we don't erroneously think we
-    // are our own extension namespace...
-    boolean inExtension = inExtensionNamespace();
-
-    int entryType = -1;
-    Vector entryArgs = new Vector();
-
-    if (namespaceURI != null
-        && (extendedNamespaceName.equals(namespaceURI))
-        && !inExtension) {
-
-      String popURI = (String) baseURIStack.pop();
-      String baseURI = (String) baseURIStack.peek();
-
-      if (!baseURI.equals(popURI)) {
-        entryType = Catalog.BASE;
-        entryArgs.add(baseURI);
-
-        debug.message(4, "(reset) xml:base", baseURI);
-
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry (rbase)", localName);
-          }
-        }
-      }
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,546 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import java.util.Enumeration;
-import java.util.Stack;
-import java.util.Vector;
-import javax.xml.parsers.SAXParserFactory;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-/**
- * Parse OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
-  /** The catalog object needs to be stored by the object so that
-   * SAX callbacks can use it.
-   */
-  protected Catalog catalog = null;
-
-  /** The namespace name of OASIS ERTC catalogs */
-  public static final String namespaceName = "urn:oasis:names:tc:entity:xmlns:xml:catalog";
-
-  /** The namespace name of OASIS ERTC TR9401 catalog extension */
-  public static final String tr9401NamespaceName = "urn:oasis:names:tc:entity:xmlns:tr9401:catalog";
-
-  protected Stack baseURIStack = new Stack();
-  protected Stack overrideStack = new Stack();
-  protected Stack namespaceStack = new Stack();
-
-  /** Set the current catalog. */
-  public void setCatalog (Catalog catalog) {
-    this.catalog = catalog;
-    debug = catalog.getCatalogManager().debug;
-  }
-
-  /** Get the current catalog. */
-  public Catalog getCatalog () {
-    return catalog;
-  }
-
-  /** Default constructor */
-  public OASISXMLCatalogReader() {
-    super();
-  }
-
-  /** Constructor allowing for providing custom SAX parser factory */
-  public OASISXMLCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
-    super(parserFactory);
-    setCatalog(catalog);
-  }
-
-  /**
-   * Are we in an extension namespace?
-   *
-   * @return true if the current stack of open namespaces includes
-   *               an extension namespace.
-   */
-  protected boolean inExtensionNamespace() {
-    boolean inExtension = false;
-
-    Enumeration elements = namespaceStack.elements();
-    while (!inExtension && elements.hasMoreElements()) {
-      String ns = (String) elements.nextElement();
-      if (ns == null) {
-        inExtension = true;
-      } else {
-        inExtension = (!ns.equals(tr9401NamespaceName)
-                       && !ns.equals(namespaceName));
-      }
-    }
-
-    return inExtension;
-  }
-
-  // ----------------------------------------------------------------------
-  // Implement the SAX ContentHandler interface
-
-  /** The SAX <code>setDocumentLocator</code> method does nothing. */
-  public void setDocumentLocator (Locator locator) {
-    return;
-  }
-
-  /** The SAX <code>startDocument</code> */
-  public void startDocument ()
-    throws SAXException {
-    baseURIStack.push(catalog.getCurrentBase());
-    overrideStack.push(catalog.getDefaultOverride());
-    return;
-  }
-
-  /** The SAX <code>endDocument</code> method does nothing. */
-  public void endDocument ()
-    throws SAXException {
-    return;
-  }
-
-  /**
-   * The SAX <code>startElement</code> method recognizes elements
-   * from the plain catalog format and instantiates CatalogEntry
-   * objects for them.
-   *
-   * @param namespaceURI The namespace name of the element.
-   * @param localName The local name of the element.
-   * @param qName The QName of the element.
-   * @param atts The list of attributes on the element.
-   *
-   * @see CatalogEntry
-   */
-  public void startElement (String namespaceURI,
-                            String localName,
-                            String qName,
-                            Attributes atts)
-    throws SAXException {
-
-    int entryType = -1;
-    Vector entryArgs = new Vector();
-
-    namespaceStack.push(namespaceURI);
-
-    boolean inExtension = inExtensionNamespace();
-
-    if (namespaceURI != null && namespaceName.equals(namespaceURI)
-        && !inExtension) {
-      // This is an XML Catalog entry
-
-      if (atts.getValue("xml:base") != null) {
-        String baseURI = atts.getValue("xml:base");
-        entryType = Catalog.BASE;
-        entryArgs.add(baseURI);
-        baseURIStack.push(baseURI);
-
-        debug.message(4, "xml:base", baseURI);
-
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry (base)", localName);
-          }
-        }
-
-        entryType = -1;
-        entryArgs = new Vector();
-
-      } else {
-        baseURIStack.push(baseURIStack.peek());
-      }
-
-      if ((localName.equals("catalog") || localName.equals("group"))
-          && atts.getValue("prefer") != null) {
-        String override = atts.getValue("prefer");
-
-        if (override.equals("public")) {
-          override = "yes";
-        } else if (override.equals("system")) {
-          override = "no";
-        } else {
-          debug.message(1,
-                        "Invalid prefer: must be 'system' or 'public'",
-                        localName);
-          override = catalog.getDefaultOverride();
-        }
-
-        entryType = Catalog.OVERRIDE;
-        entryArgs.add(override);
-        overrideStack.push(override);
-
-        debug.message(4, "override", override);
-
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry (override)", localName);
-          }
-        }
-
-        entryType = -1;
-        entryArgs = new Vector();
-
-      } else {
-        overrideStack.push(overrideStack.peek());
-      }
-
-      if (localName.equals("delegatePublic")) {
-        if (checkAttributes(atts, "publicIdStartString", "catalog")) {
-          entryType = Catalog.DELEGATE_PUBLIC;
-          entryArgs.add(atts.getValue("publicIdStartString"));
-          entryArgs.add(atts.getValue("catalog"));
-
-          debug.message(4, "delegatePublic",
-                        PublicId.normalize(atts.getValue("publicIdStartString")),
-                        atts.getValue("catalog"));
-        }
-      } else if (localName.equals("delegateSystem")) {
-        if (checkAttributes(atts, "systemIdStartString", "catalog")) {
-          entryType = Catalog.DELEGATE_SYSTEM;
-          entryArgs.add(atts.getValue("systemIdStartString"));
-          entryArgs.add(atts.getValue("catalog"));
-
-          debug.message(4, "delegateSystem",
-                        atts.getValue("systemIdStartString"),
-                        atts.getValue("catalog"));
-        }
-      } else if (localName.equals("delegateURI")) {
-        if (checkAttributes(atts, "uriStartString", "catalog")) {
-          entryType = Catalog.DELEGATE_URI;
-          entryArgs.add(atts.getValue("uriStartString"));
-          entryArgs.add(atts.getValue("catalog"));
-
-          debug.message(4, "delegateURI",
-                        atts.getValue("uriStartString"),
-                        atts.getValue("catalog"));
-        }
-      } else if (localName.equals("rewriteSystem")) {
-        if (checkAttributes(atts, "systemIdStartString", "rewritePrefix")) {
-          entryType = Catalog.REWRITE_SYSTEM;
-          entryArgs.add(atts.getValue("systemIdStartString"));
-          entryArgs.add(atts.getValue("rewritePrefix"));
-
-          debug.message(4, "rewriteSystem",
-                        atts.getValue("systemIdStartString"),
-                        atts.getValue("rewritePrefix"));
-        }
-      } else if (localName.equals("systemSuffix")) {
-        if (checkAttributes(atts, "systemIdSuffix", "uri")) {
-          entryType = Catalog.SYSTEM_SUFFIX;
-          entryArgs.add(atts.getValue("systemIdSuffix"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "systemSuffix",
-                        atts.getValue("systemIdSuffix"),
-                        atts.getValue("uri"));
-        }
-      } else if (localName.equals("rewriteURI")) {
-        if (checkAttributes(atts, "uriStartString", "rewritePrefix")) {
-          entryType = Catalog.REWRITE_URI;
-          entryArgs.add(atts.getValue("uriStartString"));
-          entryArgs.add(atts.getValue("rewritePrefix"));
-
-          debug.message(4, "rewriteURI",
-                        atts.getValue("uriStartString"),
-                        atts.getValue("rewritePrefix"));
-        }
-      } else if (localName.equals("uriSuffix")) {
-        if (checkAttributes(atts, "uriSuffix", "uri")) {
-          entryType = Catalog.URI_SUFFIX;
-          entryArgs.add(atts.getValue("uriSuffix"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "uriSuffix",
-                        atts.getValue("uriSuffix"),
-                        atts.getValue("uri"));
-        }
-      } else if (localName.equals("nextCatalog")) {
-        if (checkAttributes(atts, "catalog")) {
-          entryType = Catalog.CATALOG;
-          entryArgs.add(atts.getValue("catalog"));
-
-          debug.message(4, "nextCatalog", atts.getValue("catalog"));
-        }
-      } else if (localName.equals("public")) {
-        if (checkAttributes(atts, "publicId", "uri")) {
-          entryType = Catalog.PUBLIC;
-          entryArgs.add(atts.getValue("publicId"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "public",
-                        PublicId.normalize(atts.getValue("publicId")),
-                        atts.getValue("uri"));
-        }
-      } else if (localName.equals("system")) {
-        if (checkAttributes(atts, "systemId", "uri")) {
-          entryType = Catalog.SYSTEM;
-          entryArgs.add(atts.getValue("systemId"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "system",
-                        atts.getValue("systemId"),
-                        atts.getValue("uri"));
-        }
-      } else if (localName.equals("uri")) {
-        if (checkAttributes(atts, "name", "uri")) {
-          entryType = Catalog.URI;
-          entryArgs.add(atts.getValue("name"));
-          entryArgs.add(atts.getValue("uri"));
-
-          debug.message(4, "uri",
-                        atts.getValue("name"),
-                        atts.getValue("uri"));
-        }
-      } else if (localName.equals("catalog")) {
-        // nop, start of catalog
-      } else if (localName.equals("group")) {
-        // nop, a group
-      } else {
-        // This is equivalent to an invalid catalog entry type
-        debug.message(1, "Invalid catalog entry type", localName);
-      }
-
-      if (entryType >= 0) {
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry", localName);
-          }
-        }
-      }
-    }
-
-    if (namespaceURI != null && tr9401NamespaceName.equals(namespaceURI)
-        && !inExtension) {
-      // This is a TR9401 Catalog entry
-
-      if (atts.getValue("xml:base") != null) {
-        String baseURI = atts.getValue("xml:base");
-        entryType = Catalog.BASE;
-        entryArgs.add(baseURI);
-        baseURIStack.push(baseURI);
-
-        debug.message(4, "xml:base", baseURI);
-
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry (base)", localName);
-          }
-        }
-
-        entryType = -1;
-        entryArgs = new Vector();
-
-      } else {
-        baseURIStack.push(baseURIStack.peek());
-      }
-
-      if (localName.equals("doctype")) {
-        entryType = Catalog.DOCTYPE;
-        entryArgs.add(atts.getValue("name"));
-        entryArgs.add(atts.getValue("uri"));
-      } else if (localName.equals("document")) {
-        entryType = Catalog.DOCUMENT;
-        entryArgs.add(atts.getValue("uri"));
-      } else if (localName.equals("dtddecl")) {
-        entryType = Catalog.DTDDECL;
-        entryArgs.add(atts.getValue("publicId"));
-        entryArgs.add(atts.getValue("uri"));
-      } else if (localName.equals("entity")) {
-        entryType = Catalog.ENTITY;
-        entryArgs.add(atts.getValue("name"));
-        entryArgs.add(atts.getValue("uri"));
-      } else if (localName.equals("linktype")) {
-        entryType = Catalog.LINKTYPE;
-        entryArgs.add(atts.getValue("name"));
-        entryArgs.add(atts.getValue("uri"));
-      } else if (localName.equals("notation")) {
-        entryType = Catalog.NOTATION;
-        entryArgs.add(atts.getValue("name"));
-        entryArgs.add(atts.getValue("uri"));
-      } else if (localName.equals("sgmldecl")) {
-        entryType = Catalog.SGMLDECL;
-        entryArgs.add(atts.getValue("uri"));
-      } else {
-        // This is equivalent to an invalid catalog entry type
-        debug.message(1, "Invalid catalog entry type", localName);
-      }
-
-      if (entryType >= 0) {
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry", localName);
-          }
-        }
-      }
-    }
-  }
-
-  public boolean checkAttributes (Attributes atts, String attName) {
-    if (atts.getValue(attName) == null) {
-      debug.message(1, "Error: required attribute " + attName + " missing.");
-      return false;
-    } else {
-      return true;
-    }
-  }
-
-  public boolean checkAttributes (Attributes atts,
-                                  String attName1,
-                                  String attName2) {
-    return checkAttributes(atts, attName1)
-      && checkAttributes(atts, attName2);
-  }
-
-  /** The SAX <code>endElement</code> */
-  public void endElement (String namespaceURI,
-                          String localName,
-                          String qName)
-    throws SAXException {
-
-    int entryType = -1;
-    Vector entryArgs = new Vector();
-
-    boolean inExtension = inExtensionNamespace();
-
-    if (namespaceURI != null
-        && !inExtension
-        && (namespaceName.equals(namespaceURI)
-            || tr9401NamespaceName.equals(namespaceURI))) {
-
-      String popURI = (String) baseURIStack.pop();
-      String baseURI = (String) baseURIStack.peek();
-
-      if (!baseURI.equals(popURI)) {
-        entryType = Catalog.BASE;
-        entryArgs.add(baseURI);
-
-        debug.message(4, "(reset) xml:base", baseURI);
-
-        try {
-          CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-          catalog.addEntry(ce);
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            debug.message(1, "Invalid catalog entry type", localName);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            debug.message(1, "Invalid catalog entry (rbase)", localName);
-          }
-        }
-      }
-    }
-
-    if (namespaceURI != null && namespaceName.equals(namespaceURI)
-        && !inExtension) {
-      if (localName.equals("catalog") || localName.equals("group")) {
-        String popOverride = (String) overrideStack.pop();
-        String override = (String) overrideStack.peek();
-
-        if (!override.equals(popOverride)) {
-          entryType = Catalog.OVERRIDE;
-          entryArgs.add(override);
-          overrideStack.push(override);
-
-          debug.message(4, "(reset) override", override);
-
-          try {
-            CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-            catalog.addEntry(ce);
-          } catch (CatalogException cex) {
-            if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-              debug.message(1, "Invalid catalog entry type", localName);
-            } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-              debug.message(1, "Invalid catalog entry (roverride)", localName);
-            }
-          }
-        }
-      }
-    }
-
-    namespaceStack.pop();
-
-    return;
-  }
-
-  /** The SAX <code>characters</code> method does nothing. */
-  public void characters (char ch[], int start, int length)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>ignorableWhitespace</code> method does nothing. */
-  public void ignorableWhitespace (char ch[], int start, int length)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>processingInstruction</code> method does nothing. */
-  public void processingInstruction (String target, String data)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>skippedEntity</code> method does nothing. */
-  public void skippedEntity (String name)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>startPrefixMapping</code> method does nothing. */
-  public void startPrefixMapping(String prefix, String uri)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>endPrefixMapping</code> method does nothing. */
-  public void endPrefixMapping(String prefix)
-    throws SAXException {
-    return;
-  }
-
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import org.xml.sax.*;
-
-/**
- * The SAXCatalogParser interface.
- *
- * <p>This interface must be implemented in order for a class to
- * participate as a parser for the SAXCatalogReader.
- *
- * @see Catalog
- * @see SAXCatalogReader
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public interface SAXCatalogParser extends ContentHandler, DocumentHandler {
-    /** Set the Catalog for which parsing is being performed. */
-    public void setCatalog(Catalog catalog);
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-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.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * A SAX-based CatalogReader.
- *
- * <p>This class is used to read XML Catalogs using the SAX. This reader
- * has an advantage over the DOM-based reader in that it functions on
- * the stream of SAX events. It has the disadvantage
- * that it cannot look around in the tree.</p>
- *
- * <p>Since the choice of CatalogReaders (in the InputStream case) can only
- * be made on the basis of MIME type, the following problem occurs: only
- * one CatalogReader can exist for all XML mime types. In order to get
- * around this problem, the SAXCatalogReader relies on a set of external
- * CatalogParsers to actually build the catalog.</p>
- *
- * <p>The selection of CatalogParsers is made on the basis of the QName
- * of the root element of the document.</p>
- *
- * @see Catalog
- * @see CatalogReader
- * @see SAXCatalogReader
- * @see TextCatalogReader
- * @see DOMCatalogParser
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class SAXCatalogReader implements CatalogReader, ContentHandler, DocumentHandler {
-    /** The SAX Parser Factory */
-    protected SAXParserFactory parserFactory = null;
-
-    /** The SAX Parser Class */
-    protected String parserClass = null;
-
-    /**
-     * Mapping table from QNames to CatalogParser classes.
-     *
-     * <p>Each key in this hash table has the form "elementname"
-     * or "{namespaceuri}elementname". The former is used if the
-     * namespace URI is null.</p>
-     */
-    protected Map<String, String> namespaceMap = new HashMap<>();
-
-    /** The parser in use for the current catalog. */
-    private SAXCatalogParser saxParser = null;
-
-    /** Set if something goes horribly wrong. It allows the class to
-     * ignore the rest of the events that are received.
-     */
-    private boolean abandonHope = false;
-
-    /** The Catalog that we're working for. */
-    private Catalog catalog;
-
-    /** Set the XML SAX Parser Factory.
-     */
-    public void setParserFactory(SAXParserFactory parserFactory) {
-        this.parserFactory = parserFactory;
-    }
-
-    /** Set the XML SAX Parser Class
-     */
-    public void setParserClass(String parserClass) {
-        this.parserClass = parserClass;
-    }
-
-    /** Get the parser factory currently in use. */
-    public SAXParserFactory getParserFactory() {
-        return parserFactory;
-    }
-
-    /** Get the parser class currently in use. */
-    public String getParserClass() {
-        return parserClass;
-    }
-
-    /** The debug class to use for this reader.
-     *
-     * This is a bit of a hack. Anyway, whenever we read for a catalog,
-     * we extract the debug object
-     * from the catalog's manager so that we can use it to print messages.
-     *
-     * In production, we don't really expect any messages so it doesn't
-     * really matter. But it's still a bit of a hack.
-     */
-    protected Debug debug = CatalogManager.getStaticManager().debug;
-
-    /** The constructor */
-    public SAXCatalogReader() {
-        parserFactory = null;
-        parserClass = null;
-    }
-
-    /** The constructor */
-    public SAXCatalogReader(SAXParserFactory parserFactory) {
-        this.parserFactory = parserFactory;
-    }
-
-    /** The constructor */
-    public SAXCatalogReader(String parserClass) {
-        this.parserClass = parserClass;
-    }
-
-    /**
-     * Set the SAXCatalogParser class for the given namespace/root
-     * element type.
-     */
-    public void setCatalogParser(String namespaceURI,
-            String rootElement,
-            String parserClass) {
-        namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
-        namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
-    }
-
-    /**
-     * Get the SAXCatalogParser class for the given namespace/root
-     * element type.
-     */
-    public String getCatalogParser(String namespaceURI,
-            String rootElement) {
-        namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
-        return namespaceMap.get("{"+namespaceURI+"}"+rootElement);
-    }
-
-    /**
-     * Parse an XML Catalog file.
-     *
-     * @param catalog The catalog to which this catalog file belongs
-     * @param fileUrl The URL or filename of the catalog file to process
-     *
-     * @throws MalformedURLException Improper fileUrl
-     * @throws IOException Error reading catalog file
-     */
-    public void readCatalog(Catalog catalog, String fileUrl)
-            throws MalformedURLException, IOException,
-            CatalogException {
-
-        URL url = null;
-
-        try {
-            url = new URL(fileUrl);
-        } catch (MalformedURLException e) {
-            url = new URL("file:///" + fileUrl);
-        }
-
-        debug = catalog.getCatalogManager().debug;
-
-        try {
-            URLConnection urlCon = url.openConnection();
-            readCatalog(catalog, urlCon.getInputStream());
-        } catch (FileNotFoundException e) {
-            catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found",
-                    url.toString());
-        }
-    }
-
-    /**
-     * Parse an XML Catalog stream.
-     *
-     * @param catalog The catalog to which this catalog file belongs
-     * @param is The input stream from which the catalog will be read
-     *
-     * @throws MalformedURLException Improper fileUrl
-     * @throws IOException Error reading catalog file
-     * @throws CatalogException A Catalog exception
-     */
-    public void readCatalog(Catalog catalog, InputStream is)
-            throws IOException, CatalogException {
-
-        // Create an instance of the parser
-        if (parserFactory == null && parserClass == null) {
-            debug.message(1, "Cannot read SAX catalog without a parser");
-            throw new CatalogException(CatalogException.UNPARSEABLE);
-        }
-
-        debug = catalog.getCatalogManager().debug;
-        EntityResolver bResolver = catalog.getCatalogManager().getBootstrapResolver();
-
-        this.catalog = catalog;
-
-        try {
-            if (parserFactory != null) {
-                SAXParser parser = parserFactory.newSAXParser();
-                SAXParserHandler spHandler = new SAXParserHandler();
-                spHandler.setContentHandler(this);
-                if (bResolver != null) {
-                    spHandler.setEntityResolver(bResolver);
-                }
-                parser.parse(new InputSource(is), spHandler);
-            } else {
-                Class<?> c =  ReflectUtil.forName(parserClass);
-                if (!Parser.class.isAssignableFrom(c)) {
-                    throw new ClassCastException(parserClass
-                                + " cannot be cast to "
-                                + Parser.class.getName());
-                }
-                Parser parser = (Parser) c.newInstance();
-                parser.setDocumentHandler(this);
-                if (bResolver != null) {
-                    parser.setEntityResolver(bResolver);
-                }
-                parser.parse(new InputSource(is));
-            }
-        } catch (ClassNotFoundException cnfe) {
-            throw new CatalogException(CatalogException.UNPARSEABLE);
-        } catch (IllegalAccessException iae) {
-            throw new CatalogException(CatalogException.UNPARSEABLE);
-        } catch (InstantiationException ie) {
-            throw new CatalogException(CatalogException.UNPARSEABLE);
-        } catch (ParserConfigurationException pce) {
-            throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
-        } catch (SAXException se) {
-            Exception e = se.getException();
-            // FIXME: there must be a better way
-            UnknownHostException uhe = new UnknownHostException();
-            FileNotFoundException fnfe = new FileNotFoundException();
-            if (e != null) {
-                if (e.getClass() == uhe.getClass()) {
-                    throw new CatalogException(CatalogException.PARSE_FAILED,
-                            e.toString());
-                } else if (e.getClass() == fnfe.getClass()) {
-                    throw new CatalogException(CatalogException.PARSE_FAILED,
-                            e.toString());
-                }
-            }
-            throw new CatalogException(se);
-        }
-    }
-
-    // ----------------------------------------------------------------------
-    // Implement the SAX ContentHandler interface
-
-    /** The SAX <code>setDocumentLocator</code> method. Does nothing. */
-    public void setDocumentLocator (Locator locator) {
-        if (saxParser != null) {
-            saxParser.setDocumentLocator(locator);
-        }
-    }
-
-    /** The SAX <code>startDocument</code> method. Does nothing. */
-    public void startDocument () throws SAXException {
-        saxParser = null;
-        abandonHope = false;
-        return;
-    }
-
-    /** The SAX <code>endDocument</code> method. Does nothing. */
-    public void endDocument ()throws SAXException {
-        if (saxParser != null) {
-            saxParser.endDocument();
-        }
-    }
-
-    /**
-     * The SAX <code>startElement</code> method.
-     *
-     * <p>The catalog parser is selected based on the namespace of the
-     * first element encountered in the catalog.</p>
-     */
-    public void startElement (String name,
-            AttributeList atts)
-                    throws SAXException {
-
-        if (abandonHope) {
-            return;
-        }
-
-        if (saxParser == null) {
-            String prefix = "";
-            if (name.indexOf(':') > 0) {
-                prefix = name.substring(0, name.indexOf(':'));
-            }
-
-            String localName = name;
-            if (localName.indexOf(':') > 0) {
-                localName = localName.substring(localName.indexOf(':')+1);
-            }
-
-            String namespaceURI = null;
-            if (prefix.length() == 0) {
-                namespaceURI = atts.getValue("xmlns");
-            } else {
-                namespaceURI = atts.getValue("xmlns:" + prefix);
-            }
-
-            String saxParserClass = getCatalogParser(namespaceURI,
-                    localName);
-
-            if (saxParserClass == null) {
-                abandonHope = true;
-                if (namespaceURI == null) {
-                    debug.message(2, "No Catalog parser for " + name);
-                } else {
-                    debug.message(2, "No Catalog parser for "
-                            + "{" + namespaceURI + "}"
-                            + name);
-                }
-                return;
-            }
-
-            try {
-                saxParser = (SAXCatalogParser)
-                        ReflectUtil.forName(saxParserClass).newInstance();
-
-                saxParser.setCatalog(catalog);
-                saxParser.startDocument();
-                saxParser.startElement(name, atts);
-            } catch (ClassNotFoundException cnfe) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, cnfe.toString());
-            } catch (InstantiationException ie) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, ie.toString());
-            } catch (IllegalAccessException iae) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, iae.toString());
-            } catch (ClassCastException cce ) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, cce.toString());
-            }
-        } else {
-            saxParser.startElement(name, atts);
-        }
-    }
-
-    /**
-     * The SAX2 <code>startElement</code> method.
-     *
-     * <p>The catalog parser is selected based on the namespace of the
-     * first element encountered in the catalog.</p>
-     */
-    public void startElement (String namespaceURI,
-            String localName,
-            String qName,
-            Attributes atts)
-                    throws SAXException {
-
-        if (abandonHope) {
-            return;
-        }
-
-        if (saxParser == null) {
-            String saxParserClass = getCatalogParser(namespaceURI,
-                    localName);
-
-            if (saxParserClass == null) {
-                abandonHope = true;
-                if (namespaceURI == null) {
-                    debug.message(2, "No Catalog parser for " + localName);
-                } else {
-                    debug.message(2, "No Catalog parser for "
-                            + "{" + namespaceURI + "}"
-                            + localName);
-                }
-                return;
-            }
-
-            try {
-                saxParser = (SAXCatalogParser)
-                        ReflectUtil.forName(saxParserClass).newInstance();
-
-                saxParser.setCatalog(catalog);
-                saxParser.startDocument();
-                saxParser.startElement(namespaceURI, localName, qName, atts);
-            } catch (ClassNotFoundException cnfe) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, cnfe.toString());
-            } catch (InstantiationException ie) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, ie.toString());
-            } catch (IllegalAccessException iae) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, iae.toString());
-            } catch (ClassCastException cce ) {
-                saxParser = null;
-                abandonHope = true;
-                debug.message(2, cce.toString());
-            }
-        } else {
-            saxParser.startElement(namespaceURI, localName, qName, atts);
-        }
-    }
-
-    /** The SAX <code>endElement</code> method. Does nothing. */
-    public void endElement (String name) throws SAXException {
-        if (saxParser != null) {
-            saxParser.endElement(name);
-        }
-    }
-
-    /** The SAX2 <code>endElement</code> method. Does nothing. */
-    public void endElement (String namespaceURI,
-            String localName,
-            String qName) throws SAXException {
-        if (saxParser != null) {
-            saxParser.endElement(namespaceURI, localName, qName);
-        }
-    }
-
-    /** The SAX <code>characters</code> method. Does nothing. */
-    public void characters (char ch[], int start, int length)
-            throws SAXException {
-        if (saxParser != null) {
-            saxParser.characters(ch, start, length);
-        }
-    }
-
-    /** The SAX <code>ignorableWhitespace</code> method. Does nothing. */
-    public void ignorableWhitespace (char ch[], int start, int length)
-            throws SAXException {
-        if (saxParser != null) {
-            saxParser.ignorableWhitespace(ch, start, length);
-        }
-    }
-
-    /** The SAX <code>processingInstruction</code> method. Does nothing. */
-    public void processingInstruction (String target, String data)
-            throws SAXException {
-        if (saxParser != null) {
-            saxParser.processingInstruction(target, data);
-        }
-    }
-
-    /** The SAX <code>startPrefixMapping</code> method. Does nothing. */
-    public void startPrefixMapping (String prefix, String uri)
-            throws SAXException {
-        if (saxParser != null) {
-            saxParser.startPrefixMapping (prefix, uri);
-        }
-    }
-
-    /** The SAX <code>endPrefixMapping</code> method. Does nothing. */
-    public void endPrefixMapping (String prefix)
-            throws SAXException {
-        if (saxParser != null) {
-            saxParser.endPrefixMapping (prefix);
-        }
-    }
-
-    /** The SAX <code>skippedentity</code> method. Does nothing. */
-    public void skippedEntity (String name)
-            throws SAXException {
-        if (saxParser != null) {
-            saxParser.skippedEntity(name);
-        }
-    }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.io.IOException;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * An entity-resolving DefaultHandler.
- *
- * <p>This class provides a SAXParser DefaultHandler that performs
- * entity resolution.
- * </p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- */
-public class SAXParserHandler extends DefaultHandler {
-  private EntityResolver er = null;
-  private ContentHandler ch = null;
-
-  public SAXParserHandler() {
-    super();
-  }
-
-  public void setEntityResolver(EntityResolver er) {
-    this.er = er;
-  }
-
-  public void setContentHandler(ContentHandler ch) {
-    this.ch = ch;
-  }
-
-  // Entity Resolver
-  public InputSource resolveEntity(String publicId, String systemId)
-    throws SAXException {
-
-    if (er != null) {
-      try {
-        return er.resolveEntity(publicId, systemId);
-      } catch (IOException e) {
-          System.out.println("resolveEntity threw IOException!");
-          return null;
-      }
-    } else {
-      return null;
-    }
-  }
-
-  // Content Handler
-  public void characters(char[] ch, int start, int length)
-    throws SAXException {
-    if (this.ch != null) {
-      this.ch.characters(ch, start, length);
-    }
-  }
-
-  public void endDocument()
-    throws SAXException {
-    if (ch != null) {
-      ch.endDocument();
-    }
-  }
-
-  public void endElement(String namespaceURI, String localName, String qName)
-    throws SAXException {
-    if (ch != null) {
-      ch.endElement(namespaceURI, localName, qName);
-    }
-  }
-
-  public void endPrefixMapping(String prefix)
-    throws SAXException {
-    if (ch != null) {
-      ch.endPrefixMapping(prefix);
-    }
-  }
-
-  public void ignorableWhitespace(char[] ch, int start, int length)
-    throws SAXException {
-    if (this.ch != null) {
-      this.ch.ignorableWhitespace(ch, start, length);
-    }
-  }
-
-  public void processingInstruction(String target, String data)
-    throws SAXException {
-    if (ch != null) {
-      ch.processingInstruction(target, data);
-    }
-  }
-
-  public void setDocumentLocator(Locator locator) {
-    if (ch != null) {
-      ch.setDocumentLocator(locator);
-    }
-  }
-
-  public void skippedEntity(String name)
-    throws SAXException {
-    if (ch != null) {
-      ch.skippedEntity(name);
-    }
-  }
-
-  public void startDocument()
-    throws SAXException {
-    if (ch != null) {
-      ch.startDocument();
-    }
-  }
-
-  public void startElement(String namespaceURI, String localName,
-                           String qName, Attributes atts)
-    throws SAXException {
-    if (ch != null) {
-      ch.startElement(namespaceURI, localName, qName, atts);
-    }
-  }
-
-  public void startPrefixMapping(String prefix, String uri)
-    throws SAXException {
-    if (ch != null) {
-      ch.startPrefixMapping(prefix, uri);
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.Locale;
-import java.util.Vector;
-
-/**
- * Parses OASIS Open Catalog files.
- *
- * <p>This class reads OASIS Open Catalog files, returning a stream
- * of tokens.</p>
- *
- * <p>This code interrogates the following non-standard system properties:</p>
- *
- * <dl>
- * <dt><b>xml.catalog.debug</b></dt>
- * <dd><p>Sets the debug level. A value of 0 is assumed if the
- * property is not set or is not a number.</p></dd>
- * </dl>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class TR9401CatalogReader extends TextCatalogReader {
-
-  /**
-   * Start parsing an OASIS TR9401 Open Catalog file. The file is
-   * actually read and parsed
-   * as needed by <code>nextEntry</code>.
-   *
-   * <p>In a TR9401 Catalog the 'DELEGATE' entry delegates public
-   * identifiers. There is no delegate entry for system identifiers
-   * or URIs.</p>
-   *
-   * @param catalog The Catalog to populate
-   * @param is The input stream from which to read the TR9401 Catalog
-   *
-   * @throws MalformedURLException Improper fileUrl
-   * @throws IOException Error reading catalog file
-   */
-  public void readCatalog(Catalog catalog, InputStream is)
-    throws MalformedURLException, IOException {
-
-    catfile = is;
-
-    if (catfile == null) {
-      return;
-    }
-
-    Vector unknownEntry = null;
-
-    try {
-      while (true) {
-        String token = nextToken();
-
-        if (token == null) {
-          if (unknownEntry != null) {
-            catalog.unknownEntry(unknownEntry);
-            unknownEntry = null;
-          }
-          catfile.close();
-          catfile = null;
-          return;
-        }
-
-        String entryToken = null;
-        if (caseSensitive) {
-          entryToken = token;
-        } else {
-          entryToken = token.toUpperCase(Locale.ENGLISH);
-        }
-
-        if (entryToken.equals("DELEGATE")) {
-          entryToken = "DELEGATE_PUBLIC";
-        }
-
-        try {
-          int type = CatalogEntry.getEntryType(entryToken);
-          int numArgs = CatalogEntry.getEntryArgCount(type);
-          Vector args = new Vector();
-
-          if (unknownEntry != null) {
-            catalog.unknownEntry(unknownEntry);
-            unknownEntry = null;
-          }
-
-          for (int count = 0; count < numArgs; count++) {
-            args.addElement(nextToken());
-          }
-
-          catalog.addEntry(new CatalogEntry(entryToken, args));
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            if (unknownEntry == null) {
-              unknownEntry = new Vector();
-            }
-            unknownEntry.addElement(token);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
-            unknownEntry = null;
-          } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
-            catalog.getCatalogManager().debug.message(1, cex.getMessage());
-          }
-        }
-      }
-    } catch (CatalogException cex2) {
-      if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
-        catalog.getCatalogManager().debug.message(1, cex2.getMessage());
-      }
-    }
-
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Locale;
-import java.util.Stack;
-import java.util.Vector;
-
-/**
- * Parses plain text Catalog files.
- *
- * <p>This class reads plain text Open Catalog files.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class TextCatalogReader implements CatalogReader {
-  /** The input stream used to read the catalog */
-  protected InputStream catfile = null;
-
-  /**
-   * Character lookahead stack. Reading a catalog sometimes requires
-   * up to two characters of lookahead.
-   */
-  protected int[] stack = new int[3];
-
-  /**
-   * Token stack. Recognizing an unexpected catalog entry requires
-   * the ability to "push back" a token.
-   */
-  protected Stack tokenStack = new Stack();
-
-  /** The current position on the lookahead stack */
-  protected int top = -1;
-
-  /** Are keywords in the catalog case sensitive? */
-  protected boolean caseSensitive = false;
-
-  /**
-   * Construct a CatalogReader object.
-   */
-  public TextCatalogReader() { }
-
-  public void setCaseSensitive(boolean isCaseSensitive) {
-    caseSensitive = isCaseSensitive;
-  }
-
-  public boolean getCaseSensitive() {
-    return caseSensitive;
-  }
-
-  /**
-   * Start parsing a text catalog file. The file is
-   * actually read and parsed
-   * as needed by <code>nextEntry</code>.</p>
-   *
-   * @param fileUrl  The URL or filename of the catalog file to process
-   *
-   * @throws MalformedURLException Improper fileUrl
-   * @throws IOException Error reading catalog file
-   */
-  public void readCatalog(Catalog catalog, String fileUrl)
-    throws MalformedURLException, IOException {
-    URL catURL = null;
-
-    try {
-      catURL = new URL(fileUrl);
-    } catch (MalformedURLException e) {
-      catURL = new URL("file:///" + fileUrl);
-    }
-
-    URLConnection urlCon = catURL.openConnection();
-    try {
-      readCatalog(catalog, urlCon.getInputStream());
-    } catch (FileNotFoundException e) {
-      catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found",
-                                                catURL.toString());
-    }
-  }
-
-  public void readCatalog(Catalog catalog, InputStream is)
-    throws MalformedURLException, IOException {
-
-    catfile = is;
-
-    if (catfile == null) {
-      return;
-    }
-
-    Vector unknownEntry = null;
-
-    try {
-      while (true) {
-        String token = nextToken();
-
-        if (token == null) {
-          if (unknownEntry != null) {
-            catalog.unknownEntry(unknownEntry);
-            unknownEntry = null;
-          }
-          catfile.close();
-          catfile = null;
-          return;
-        }
-
-        String entryToken = null;
-        if (caseSensitive) {
-          entryToken = token;
-        } else {
-          entryToken = token.toUpperCase(Locale.ENGLISH);
-        }
-
-        try {
-          int type = CatalogEntry.getEntryType(entryToken);
-          int numArgs = CatalogEntry.getEntryArgCount(type);
-          Vector args = new Vector();
-
-          if (unknownEntry != null) {
-            catalog.unknownEntry(unknownEntry);
-            unknownEntry = null;
-          }
-
-          for (int count = 0; count < numArgs; count++) {
-            args.addElement(nextToken());
-          }
-
-          catalog.addEntry(new CatalogEntry(entryToken, args));
-        } catch (CatalogException cex) {
-          if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-            if (unknownEntry == null) {
-              unknownEntry = new Vector();
-            }
-            unknownEntry.addElement(token);
-          } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-            catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
-            unknownEntry = null;
-          } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
-            catalog.getCatalogManager().debug.message(1, cex.getMessage());
-          }
-        }
-      }
-    } catch (CatalogException cex2) {
-      if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
-        catalog.getCatalogManager().debug.message(1, cex2.getMessage());
-      }
-    }
-  }
-
-  /**
-     * The destructor.
-     *
-     * <p>Makes sure the catalog file is closed.</p>
-     */
-  protected void finalize() {
-    if (catfile != null) {
-      try {
-        catfile.close();
-      } catch (IOException e) {
-        // whatever...
-      }
-    }
-    catfile = null;
-  }
-
-  // -----------------------------------------------------------------
-
-    /**
-     * Return the next token in the catalog file.
-     *
-     * <p>FYI: This code does not throw any sort of exception for
-     * a file that contains an n
-     *
-     * @return The Catalog file token from the input stream.
-     * @throws IOException If an error occurs reading from the stream.
-     */
-  protected String nextToken() throws IOException, CatalogException {
-    String token = "";
-    int ch, nextch;
-
-    if (!tokenStack.empty()) {
-      return (String) tokenStack.pop();
-    }
-
-    // Skip over leading whitespace and comments
-    while (true) {
-      // skip leading whitespace
-      ch = catfile.read();
-      while (ch <= ' ') {      // all ctrls are whitespace
-        ch = catfile.read();
-        if (ch < 0) {
-          return null;
-        }
-      }
-
-      // now 'ch' is the current char from the file
-      nextch = catfile.read();
-      if (nextch < 0) {
-        return null;
-      }
-
-      if (ch == '-' && nextch == '-') {
-        // we've found a comment, skip it...
-        ch = ' ';
-        nextch = nextChar();
-        while ((ch != '-' || nextch != '-') && nextch > 0) {
-          ch = nextch;
-          nextch = nextChar();
-        }
-
-        if (nextch < 0) {
-          throw new CatalogException(CatalogException.UNENDED_COMMENT,
-                                     "Unterminated comment in catalog file; EOF treated as end-of-comment.");
-        }
-
-        // Ok, we've found the end of the comment,
-        // loop back to the top and start again...
-      } else {
-        stack[++top] = nextch;
-        stack[++top] = ch;
-        break;
-      }
-    }
-
-    ch = nextChar();
-    if (ch == '"' || ch == '\'') {
-      int quote = ch;
-      while ((ch = nextChar()) != quote) {
-        char[] chararr = new char[1];
-        chararr[0] = (char) ch;
-        String s = new String(chararr);
-        token = token.concat(s);
-      }
-      return token;
-    } else {
-      // return the next whitespace or comment delimited
-      // string
-      while (ch > ' ') {
-        nextch = nextChar();
-        if (ch == '-' && nextch == '-') {
-          stack[++top] = ch;
-          stack[++top] = nextch;
-          return token;
-        } else {
-          char[] chararr = new char[1];
-          chararr[0] = (char) ch;
-          String s = new String(chararr);
-          token = token.concat(s);
-          ch = nextch;
-        }
-      }
-      return token;
-    }
-  }
-
-  /**
-     * Return the next logical character from the input stream.
-     *
-     * @return The next (logical) character from the input stream. The
-     * character may be buffered from a previous lookahead.
-     *
-     * @throws IOException If an error occurs reading from the stream.
-     */
-  protected int nextChar() throws IOException {
-    if (top < 0) {
-      return catfile.read();
-    } else {
-      return stack[top--];
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-
-import org.xml.sax.*;
-
-import javax.xml.parsers.*;
-
-/**
- * Parse "XCatalog" XML Catalog files, this is the XML Catalog format
- * developed by John Cowan and supported by Apache.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
-  /** The catalog object needs to be stored by the object so that
-   * SAX callbacks can use it.
-   */
-  protected Catalog catalog = null;
-
-  /** Set the current catalog. */
-  public void setCatalog (Catalog catalog) {
-    this.catalog = catalog;
-    debug = catalog.getCatalogManager().debug;
-  }
-
-  /** Get the current catalog. */
-  public Catalog getCatalog () {
-    return catalog;
-  }
-
-  /** Default constructor */
-  public XCatalogReader() {
-    super();
-  }
-
-  /** Constructor allowing for providing custom SAX parser factory */
-  public XCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
-    super(parserFactory);
-    setCatalog(catalog);
-  }
-
-  // ----------------------------------------------------------------------
-  // Implement the SAX ContentHandler interface
-
-  /** The SAX <code>setDocumentLocator</code> method does nothing. */
-  public void setDocumentLocator (Locator locator) {
-    return;
-  }
-
-  /** The SAX <code>startDocument</code> method does nothing. */
-  public void startDocument ()
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>endDocument</code> method does nothing. */
-  public void endDocument ()
-    throws SAXException {
-    return;
-  }
-
-  /**
-   * The SAX <code>startElement</code> method recognizes elements
-   * from the plain catalog format and instantiates CatalogEntry
-   * objects for them.
-   *
-   * @param namespaceURI The namespace name of the element.
-   * @param localName The local name of the element.
-   * @param qName The QName of the element.
-   * @param atts The list of attributes on the element.
-   *
-   * @see CatalogEntry
-   */
-  public void startElement (String namespaceURI,
-                            String localName,
-                            String qName,
-                            Attributes atts)
-    throws SAXException {
-
-    int entryType = -1;
-    Vector entryArgs = new Vector();
-
-    if (localName.equals("Base")) {
-      entryType = Catalog.BASE;
-      entryArgs.add(atts.getValue("HRef"));
-
-      debug.message(4, "Base", atts.getValue("HRef"));
-    } else if (localName.equals("Delegate")) {
-      entryType = Catalog.DELEGATE_PUBLIC;
-      entryArgs.add(atts.getValue("PublicID"));
-      entryArgs.add(atts.getValue("HRef"));
-
-      debug.message(4, "Delegate",
-                    PublicId.normalize(atts.getValue("PublicID")),
-                    atts.getValue("HRef"));
-    } else if (localName.equals("Extend")) {
-      entryType = Catalog.CATALOG;
-      entryArgs.add(atts.getValue("HRef"));
-
-      debug.message(4, "Extend", atts.getValue("HRef"));
-    } else if (localName.equals("Map")) {
-      entryType = Catalog.PUBLIC;
-      entryArgs.add(atts.getValue("PublicID"));
-      entryArgs.add(atts.getValue("HRef"));
-
-      debug.message(4, "Map",
-                    PublicId.normalize(atts.getValue("PublicID")),
-                    atts.getValue("HRef"));
-    } else if (localName.equals("Remap")) {
-      entryType = Catalog.SYSTEM;
-      entryArgs.add(atts.getValue("SystemID"));
-      entryArgs.add(atts.getValue("HRef"));
-
-      debug.message(4, "Remap",
-                    atts.getValue("SystemID"),
-                    atts.getValue("HRef"));
-    } else if (localName.equals("XCatalog")) {
-      // nop, start of catalog
-    } else {
-      // This is equivalent to an invalid catalog entry type
-      debug.message(1, "Invalid catalog entry type", localName);
-    }
-
-    if (entryType >= 0) {
-      try {
-        CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
-        catalog.addEntry(ce);
-      } catch (CatalogException cex) {
-        if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
-          debug.message(1, "Invalid catalog entry type", localName);
-        } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
-          debug.message(1, "Invalid catalog entry", localName);
-        }
-      }
-    }
-  }
-
-  /** The SAX <code>endElement</code> method does nothing. */
-  public void endElement (String namespaceURI,
-                          String localName,
-                          String qName)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>characters</code> method does nothing. */
-  public void characters (char ch[], int start, int length)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>ignorableWhitespace</code> method does nothing. */
-  public void ignorableWhitespace (char ch[], int start, int length)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>processingInstruction</code> method does nothing. */
-  public void processingInstruction (String target, String data)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>skippedEntity</code> method does nothing. */
-  public void skippedEntity (String name)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>startPrefixMapping</code> method does nothing. */
-  public void startPrefixMapping(String prefix, String uri)
-    throws SAXException {
-    return;
-  }
-
-  /** The SAX <code>endPrefixMapping</code> method does nothing. */
-  public void endPrefixMapping(String prefix)
-    throws SAXException {
-    return;
-  }
-
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
-import org.xml.sax.EntityResolver;
-
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.Source;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.TransformerException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-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.helpers.FileURL;
-
-/**
- * A SAX EntityResolver/JAXP URIResolver that uses catalogs.
- *
- * <p>This class implements both a SAX EntityResolver and a JAXP URIResolver.
- * </p>
- *
- * <p>This resolver understands OASIS TR9401 catalogs, XCatalogs, and the
- * current working draft of the OASIS Entity Resolution Technical
- * Committee specification.</p>
- *
- * @see Catalog
- * @see org.xml.sax.EntityResolver
- * @see javax.xml.transform.URIResolver
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogResolver implements EntityResolver, URIResolver {
-  /** Make the parser Namespace aware? */
-  public boolean namespaceAware = true;
-
-  /** Make the parser validating? */
-  public boolean validating = false;
-
-  /** The underlying catalog */
-  private Catalog catalog = null;
-
-  /** The catalog manager */
-  private CatalogManager catalogManager = CatalogManager.getStaticManager();
-
-  /** Constructor */
-  public CatalogResolver() {
-    initializeCatalogs(false);
-  }
-
-  /** Constructor */
-  public CatalogResolver(boolean privateCatalog) {
-    initializeCatalogs(privateCatalog);
-  }
-
-  /** Constructor */
-  public CatalogResolver(CatalogManager manager) {
-    catalogManager = manager;
-    initializeCatalogs(!catalogManager.getUseStaticCatalog());
-  }
-
-  /** Initialize catalog */
-  private void initializeCatalogs(boolean privateCatalog) {
-    catalog = catalogManager.getCatalog();
-  }
-
-  /** Return the underlying catalog */
-  public Catalog getCatalog() {
-    return catalog;
-  }
-
-  /**
-   * Implements the guts of the <code>resolveEntity</code> method
-   * for the SAX interface.
-   *
-   * <p>Presented with an optional public identifier and a system
-   * identifier, this function attempts to locate a mapping in the
-   * catalogs.</p>
-   *
-   * <p>If such a mapping is found, it is returned.  If no mapping is
-   * found, null is returned.</p>
-   *
-   * @param publicId  The public identifier for the entity in question.
-   * This may be null.
-   *
-   * @param systemId  The system identifier for the entity in question.
-   * XML requires a system identifier on all external entities, so this
-   * value is always specified.
-   *
-   * @return The resolved identifier (a URI reference).
-   */
-  public String getResolvedEntity (String publicId, String systemId) {
-    String resolved = null;
-
-    if (catalog == null) {
-      catalogManager.debug.message(1, "Catalog resolution attempted with null catalog; ignored");
-      return null;
-    }
-
-    if (systemId != null) {
-      try {
-        resolved = catalog.resolveSystem(systemId);
-      } catch (MalformedURLException me) {
-        catalogManager.debug.message(1, "Malformed URL exception trying to resolve",
-                      publicId);
-        resolved = null;
-      } catch (IOException ie) {
-        catalogManager.debug.message(1, "I/O exception trying to resolve", publicId);
-        resolved = null;
-      }
-    }
-
-    if (resolved == null) {
-      if (publicId != null) {
-        try {
-          resolved = catalog.resolvePublic(publicId, systemId);
-        } catch (MalformedURLException me) {
-          catalogManager.debug.message(1, "Malformed URL exception trying to resolve",
-                        publicId);
-        } catch (IOException ie) {
-          catalogManager.debug.message(1, "I/O exception trying to resolve", publicId);
-        }
-      }
-
-      if (resolved != null) {
-        catalogManager.debug.message(2, "Resolved public", publicId, resolved);
-      }
-    } else {
-      catalogManager.debug.message(2, "Resolved system", systemId, resolved);
-    }
-
-    return resolved;
-  }
-
-  /**
-   * Implements the <code>resolveEntity</code> method
-   * for the SAX interface.
-   *
-   * <p>Presented with an optional public identifier and a system
-   * identifier, this function attempts to locate a mapping in the
-   * catalogs.</p>
-   *
-   * <p>If such a mapping is found, the resolver attempts to open
-   * the mapped value as an InputSource and return it. Exceptions are
-   * ignored and null is returned if the mapped value cannot be opened
-   * as an input source.</p>
-   *
-   * <p>If no mapping is found (or an error occurs attempting to open
-   * the mapped value as an input source), null is returned and the system
-   * will use the specified system identifier as if no entityResolver
-   * was specified.</p>
-   *
-   * @param publicId  The public identifier for the entity in question.
-   * This may be null.
-   *
-   * @param systemId  The system identifier for the entity in question.
-   * XML requires a system identifier on all external entities, so this
-   * value is always specified.
-   *
-   * @return An InputSource for the mapped identifier, or null.
-   */
-  public InputSource resolveEntity (String publicId, String systemId) {
-    String resolved = getResolvedEntity(publicId, systemId);
-
-    if (resolved != null) {
-      try {
-        InputSource iSource = new InputSource(resolved);
-        iSource.setPublicId(publicId);
-
-        // Ideally this method would not attempt to open the
-        // InputStream, but there is a bug (in Xerces, at least)
-        // that causes the parser to mistakenly open the wrong
-        // system identifier if the returned InputSource does
-        // not have a byteStream.
-        //
-        // It could be argued that we still shouldn't do this here,
-        // but since the purpose of calling the entityResolver is
-        // almost certainly to open the input stream, it seems to
-        // do little harm.
-        //
-        URL url = new URL(resolved);
-        InputStream iStream = url.openStream();
-        iSource.setByteStream(iStream);
-
-        return iSource;
-      } catch (Exception e) {
-        catalogManager.debug.message(1,
-                                     "Failed to create InputSource ("
-                                     + e.toString()
-                                     + ")", resolved);
-        return null;
-      }
-    }
-
-    return null;
-  }
-
-  /** JAXP URIResolver API */
-  public Source resolve(String href, String base)
-    throws TransformerException {
-
-    String uri = href;
-    String fragment = null;
-    int hashPos = href.indexOf("#");
-    if (hashPos >= 0) {
-      uri = href.substring(0, hashPos);
-      fragment = href.substring(hashPos+1);
-    }
-
-    String result = null;
-
-    try {
-      result = catalog.resolveURI(href);
-    } catch (Exception e) {
-      // nop;
-    }
-
-    if (result == null) {
-      try {
-        URL url = null;
-
-        if (base==null) {
-          url = new URL(uri);
-          result = url.toString();
-        } else {
-          URL baseURL = new URL(base);
-          url = (href.length()==0 ? baseURL : new URL(baseURL, uri));
-          result = url.toString();
-        }
-      } catch (java.net.MalformedURLException mue) {
-        // try to make an absolute URI from the current base
-        String absBase = makeAbsolute(base);
-        if (!absBase.equals(base)) {
-          // don't bother if the absBase isn't different!
-          return resolve(href, absBase);
-        } else {
-          throw new TransformerException("Malformed URL "
-                                         + href + "(base " + base + ")",
-                                         mue);
-        }
-      }
-    }
-
-    catalogManager.debug.message(2, "Resolved URI", href, result);
-
-    SAXSource source = new SAXSource();
-    source.setInputSource(new InputSource(result));
-    setEntityResolver(source);
-    return source;
-  }
-
-  /**
-   * <p>Establish an entityResolver for newly resolved URIs.</p>
-   *
-   * <p>This is called from the URIResolver to set an EntityResolver
-   * on the SAX parser to be used for new XML documents that are
-   * encountered as a result of the document() function, xsl:import,
-   * or xsl:include.  This is done because the XSLT processor calls
-   * out to the SAXParserFactory itself to create a new SAXParser to
-   * parse the new document.  The new parser does not automatically
-   * inherit the EntityResolver of the original (although arguably
-   * it should).  See below:</p>
-   *
-   * <tt>"If an application wants to set the ErrorHandler or
-   * EntityResolver for an XMLReader used during a transformation,
-   * it should use a URIResolver to return the SAXSource which
-   * provides (with getXMLReader) a reference to the XMLReader"</tt>
-   *
-   * <p>...quoted from page 118 of the Java API for XML
-   * Processing 1.1 specification</p>
-   *
-   */
-  private void setEntityResolver(SAXSource source) throws TransformerException {
-    XMLReader reader = source.getXMLReader();
-    if (reader == null) {
-      SAXParserFactory spFactory = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-      spFactory.setNamespaceAware(true);
-      try {
-        reader = spFactory.newSAXParser().getXMLReader();
-      }
-      catch (ParserConfigurationException ex) {
-        throw new TransformerException(ex);
-      }
-      catch (SAXException ex) {
-        throw new TransformerException(ex);
-      }
-    }
-    reader.setEntityResolver(this);
-    source.setXMLReader(reader);
-  }
-
-  /** Attempt to construct an absolute URI */
-  private String makeAbsolute(String uri) {
-    if (uri == null) {
-      uri = "";
-    }
-
-    try {
-      URL url = new URL(uri);
-      return url.toString();
-    } catch (MalformedURLException mue) {
-      try {
-        URL fileURL = FileURL.makeURL(uri);
-        return fileURL.toString();
-      } catch (MalformedURLException mue2) {
-        // bail
-        return uri;
-      }
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,434 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Locale;
-
-import org.xml.sax.Parser;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.AttributeList;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.SAXParser;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-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.helpers.FileURL;
-
-/**
- * A SAX Parser that performs catalog-based entity resolution.
- *
- * <p>This class implements a SAX Parser that performs entity resolution
- * using the CatalogResolver. The actual, underlying parser is obtained
- * from a SAXParserFactory.</p>
- * </p>
- *
- * @deprecated This interface has been replaced by the
- *             {@link com.sun.org.apache.xml.internal.resolver.tools.ResolvingXMLReader} for SAX2.
- * @see CatalogResolver
- * @see org.xml.sax.Parser
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public class ResolvingParser
-  implements Parser, DTDHandler, DocumentHandler, EntityResolver {
-
-  /** Suppress explanatory message?
-   *
-   * @see #parse(InputSource)
-   */
-  private static final boolean suppressExplanation = false;
-
-  /** The underlying parser. */
-  private SAXParser saxParser = null;
-
-  /** The underlying reader. */
-  private Parser parser = null;
-
-  /** The underlying DocumentHandler. */
-  private DocumentHandler documentHandler = null;
-
-  /** The underlying DTDHandler. */
-  private DTDHandler dtdHandler = null;
-
-  /** The manager for the underlying resolver. */
-  private CatalogManager catalogManager = CatalogManager.getStaticManager();
-
-  /** The underlying catalog resolver. */
-  private CatalogResolver catalogResolver = null;
-
-  /** A separate resolver for oasis-xml-pi catalogs. */
-  private CatalogResolver piCatalogResolver = null;
-
-  /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
-  private boolean allowXMLCatalogPI = false;
-
-  /** The base URI of the input document, if known. */
-  private URL baseURL = null;
-
-  /** Constructor. */
-  public ResolvingParser() {
-    initParser();
-  }
-
-  /** Constructor. */
-  public ResolvingParser(CatalogManager manager) {
-    catalogManager = manager;
-    initParser();
-  }
-
-  /** Initialize the parser. */
-  private void initParser() {
-    catalogResolver = new CatalogResolver(catalogManager);
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(true);
-    spf.setValidating(false);
-
-    try {
-      saxParser = spf.newSAXParser();
-      parser = saxParser.getParser();
-      documentHandler = null;
-      dtdHandler = null;
-    } catch (Exception ex) {
-      ex.printStackTrace();
-    }
-  }
-
-  /** Return the Catalog being used. */
-  public Catalog getCatalog() {
-    return catalogResolver.getCatalog();
-  }
-
-  /**
-   * SAX Parser API.
-   *
-   * <p>Note that the JAXP 1.1ea2 parser crashes with an InternalError if
-   * it encounters a system identifier that appears to be a relative URI
-   * that begins with a slash. For example, the declaration:</p>
-   *
-   * <pre>
-   * &lt;!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd">
-   * </pre>
-   *
-   * <p>would cause such an error. As a convenience, this method catches
-   * that error and prints an explanation. (Unfortunately, it's not possible
-   * to identify the particular system identifier that causes the problem.)
-   * </p>
-   *
-   * <p>The underlying error is forwarded after printing the explanatory
-   * message. The message is only every printed once and if
-   * <code>suppressExplanation</code> is set to <code>false</code> before
-   * parsing, it will never be printed.</p>
-   */
-  public void parse(InputSource input)
-    throws IOException,
-           SAXException {
-    setupParse(input.getSystemId());
-    try {
-      parser.parse(input);
-    } catch (InternalError ie) {
-      explain(input.getSystemId());
-      throw ie;
-    }
-  }
-
-  /** SAX Parser API.
-   *
-   * @see #parse(InputSource)
-   */
-  public void parse(String systemId)
-    throws IOException,
-           SAXException {
-    setupParse(systemId);
-    try {
-      parser.parse(systemId);
-    } catch (InternalError ie) {
-      explain(systemId);
-      throw ie;
-    }
-  }
-
-  /** SAX Parser API. */
-  public void setDocumentHandler(DocumentHandler handler) {
-    documentHandler = handler;
-  }
-
-  /** SAX Parser API. */
-  public void setDTDHandler(DTDHandler handler) {
-    dtdHandler = handler;
-  }
-
-  /**
-   * SAX Parser API.
-   *
-   * <p>The purpose of this class is to implement an entity resolver.
-   * Attempting to set a different one is pointless (and ignored).</p>
-   */
-  public void setEntityResolver(EntityResolver resolver) {
-    // nop
-  }
-
-  /** SAX Parser API. */
-  public void setErrorHandler(ErrorHandler handler) {
-    parser.setErrorHandler(handler);
-  }
-
-  /** SAX Parser API. */
-  public void setLocale(Locale locale) throws SAXException {
-    parser.setLocale(locale);
-  }
-
-  /** SAX DocumentHandler API. */
-  public void characters(char[] ch, int start, int length)
-    throws SAXException {
-    if (documentHandler != null) {
-      documentHandler.characters(ch,start,length);
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void endDocument() throws SAXException {
-    if (documentHandler != null) {
-      documentHandler.endDocument();
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void endElement(String name) throws SAXException {
-    if (documentHandler != null) {
-      documentHandler.endElement(name);
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void ignorableWhitespace(char[] ch, int start, int length)
-    throws SAXException {
-    if (documentHandler != null) {
-      documentHandler.ignorableWhitespace(ch,start,length);
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void processingInstruction(String target, String pidata)
-    throws SAXException {
-
-    if (target.equals("oasis-xml-catalog")) {
-      URL catalog = null;
-      String data = pidata;
-
-      int pos = data.indexOf("catalog=");
-      if (pos >= 0) {
-        data = data.substring(pos+8);
-        if (data.length() > 1) {
-          String quote = data.substring(0,1);
-          data = data.substring(1);
-          pos = data.indexOf(quote);
-          if (pos >= 0) {
-            data = data.substring(0, pos);
-            try {
-              if (baseURL != null) {
-                catalog = new URL(baseURL, data);
-              } else {
-                catalog = new URL(data);
-              }
-            } catch (MalformedURLException mue) {
-              // nevermind
-            }
-          }
-        }
-      }
-
-      if (allowXMLCatalogPI) {
-        if (catalogManager.getAllowOasisXMLCatalogPI()) {
-          catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata);
-
-          if (catalog != null) {
-            try {
-              catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
-
-              if (piCatalogResolver == null) {
-                piCatalogResolver = new CatalogResolver(true);
-              }
-
-              piCatalogResolver.getCatalog().parseCatalog(catalog.toString());
-            } catch (Exception e) {
-              catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: "
-                            + catalog.toString());
-            }
-          } else {
-            catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata);
-          }
-        } else {
-          catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata);
-        }
-      } else {
-        catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: "
-                      + pidata);
-      }
-    } else {
-      if (documentHandler != null) {
-        documentHandler.processingInstruction(target, pidata);
-      }
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void setDocumentLocator(Locator locator) {
-    if (documentHandler != null) {
-      documentHandler.setDocumentLocator(locator);
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void startDocument() throws SAXException {
-    if (documentHandler != null) {
-      documentHandler.startDocument();
-    }
-  }
-
-  /** SAX DocumentHandler API. */
-  public void startElement(String name, AttributeList atts)
-    throws SAXException {
-    allowXMLCatalogPI = false;
-    if (documentHandler != null) {
-      documentHandler.startElement(name,atts);
-    }
-  }
-
-  /** SAX DTDHandler API. */
-  public void notationDecl (String name, String publicId, String systemId)
-    throws SAXException {
-    allowXMLCatalogPI = false;
-    if (dtdHandler != null) {
-      dtdHandler.notationDecl(name,publicId,systemId);
-    }
-  }
-
-  /** SAX DTDHandler API. */
-  public void unparsedEntityDecl (String name,
-                                  String publicId,
-                                  String systemId,
-                                  String notationName)
-    throws SAXException {
-    allowXMLCatalogPI = false;
-    if (dtdHandler != null) {
-      dtdHandler.unparsedEntityDecl (name, publicId, systemId, notationName);
-    }
-  }
-
-  /**
-   * Implements the <code>resolveEntity</code> method
-   * for the SAX interface, using an underlying CatalogResolver
-   * to do the real work.
-   */
-  public InputSource resolveEntity (String publicId, String systemId) {
-    allowXMLCatalogPI = false;
-    String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
-    if (resolved == null && piCatalogResolver != null) {
-      resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
-    }
-
-    if (resolved != null) {
-      try {
-        InputSource iSource = new InputSource(resolved);
-        iSource.setPublicId(publicId);
-
-        // Ideally this method would not attempt to open the
-        // InputStream, but there is a bug (in Xerces, at least)
-        // that causes the parser to mistakenly open the wrong
-        // system identifier if the returned InputSource does
-        // not have a byteStream.
-        //
-        // It could be argued that we still shouldn't do this here,
-        // but since the purpose of calling the entityResolver is
-        // almost certainly to open the input stream, it seems to
-        // do little harm.
-        //
-        URL url = new URL(resolved);
-        InputStream iStream = url.openStream();
-        iSource.setByteStream(iStream);
-
-        return iSource;
-      } catch (Exception e) {
-        catalogManager.debug.message(1,
-                                     "Failed to create InputSource ("
-                                     + e.toString()
-                                     + ")", resolved);
-        return null;
-      }
-    } else {
-      return null;
-    }
-  }
-
-  /** Setup for parsing. */
-  private void setupParse(String systemId) {
-    allowXMLCatalogPI = true;
-    parser.setEntityResolver(this);
-    parser.setDocumentHandler(this);
-    parser.setDTDHandler(this);
-
-    URL cwd = null;
-
-    try {
-      cwd = FileURL.makeURL("basename");
-    } catch (MalformedURLException mue) {
-      cwd = null;
-    }
-
-    try {
-      baseURL = new URL(systemId);
-    } catch (MalformedURLException mue) {
-      if (cwd != null) {
-        try {
-          baseURL = new URL(cwd, systemId);
-        } catch (MalformedURLException mue2) {
-          // give up
-          baseURL = null;
-        }
-      } else {
-        // give up
-        baseURL = null;
-      }
-    }
-  }
-
-  /** Provide one possible explanation for an InternalError. */
-  private void explain(String systemId) {
-    if (!suppressExplanation) {
-      System.out.println("Parser probably encountered bad URI in " + systemId);
-      System.out.println("For example, replace '/some/uri' with 'file:/some/uri'.");
-    }
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-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.helpers.FileURL;
-
-/**
- * A SAX XMLFilter that performs catalog-based entity resolution.
- *
- * <p>This class implements a SAX XMLFilter that performs entity resolution
- * using the CatalogResolver. The actual, underlying parser is obtained
- * from a SAXParserFactory.</p>
- * </p>
- *
- * @see CatalogResolver
- * @see org.xml.sax.XMLFilter
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public class ResolvingXMLFilter extends XMLFilterImpl {
-  /**
-   * Suppress explanatory message?
-   *
-   * @see #parse(InputSource)
-   */
-  private static boolean suppressExplanation = false;
-
-  /** The manager for the underlying resolver. */
-  CatalogManager catalogManager = CatalogManager.getStaticManager();
-
-  /** The underlying catalog resolver. */
-  private CatalogResolver catalogResolver = null;
-
-  /** A separate resolver for oasis-xml-pi catalogs. */
-  private CatalogResolver piCatalogResolver = null;
-
-  /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
-  private boolean allowXMLCatalogPI = false;
-
-  /** The base URI of the input document, if known. */
-  private URL baseURL = null;
-
-  /** Construct an empty XML Filter with no parent. */
-  public ResolvingXMLFilter() {
-    super();
-    catalogResolver = new CatalogResolver(catalogManager);
-  }
-
-  /** Construct an XML filter with the specified parent. */
-  public ResolvingXMLFilter(XMLReader parent) {
-    super(parent);
-    catalogResolver = new CatalogResolver(catalogManager);
-  }
-
-  /** Construct an XML filter with the specified parent. */
-  public ResolvingXMLFilter(CatalogManager manager) {
-    super();
-    catalogManager = manager;
-    catalogResolver = new CatalogResolver(catalogManager);
-  }
-
-  /** Construct an XML filter with the specified parent. */
-  public ResolvingXMLFilter(XMLReader parent, CatalogManager manager) {
-    super(parent);
-    catalogManager = manager;
-    catalogResolver = new CatalogResolver(catalogManager);
-  }
-
-  /**
-   * Provide accessto the underlying Catalog.
-   */
-  public Catalog getCatalog() {
-    return catalogResolver.getCatalog();
-  }
-
-  /**
-   * SAX XMLReader API.
-   *
-   * <p>Note that the JAXP 1.1ea2 parser crashes with an InternalError if
-   * it encounters a system identifier that appears to be a relative URI
-   * that begins with a slash. For example, the declaration:</p>
-   *
-   * <pre>
-   * &lt;!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd">
-   * </pre>
-   *
-   * <p>would cause such an error. As a convenience, this method catches
-   * that error and prints an explanation. (Unfortunately, it's not possible
-   * to identify the particular system identifier that causes the problem.)
-   * </p>
-   *
-   * <p>The underlying error is forwarded after printing the explanatory
-   * message. The message is only every printed once and if
-   * <code>suppressExplanation</code> is set to <code>false</code> before
-   * parsing, it will never be printed.</p>
-   */
-  public void parse(InputSource input)
-    throws IOException, SAXException {
-    allowXMLCatalogPI = true;
-
-    setupBaseURI(input.getSystemId());
-
-    try {
-      super.parse(input);
-    } catch (InternalError ie) {
-      explain(input.getSystemId());
-      throw ie;
-    }
-  }
-
-  /** SAX XMLReader API.
-   *
-   * @see #parse(InputSource)
-   */
-  public void parse(String systemId)
-    throws IOException, SAXException {
-    allowXMLCatalogPI = true;
-
-    setupBaseURI(systemId);
-
-    try {
-      super.parse(systemId);
-    } catch (InternalError ie) {
-      explain(systemId);
-      throw ie;
-    }
-  }
-
-  /**
-   * Implements the <code>resolveEntity</code> method
-   * for the SAX interface, using an underlying CatalogResolver
-   * to do the real work.
-   */
-  public InputSource resolveEntity (String publicId, String systemId) {
-    allowXMLCatalogPI = false;
-    String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
-    if (resolved == null && piCatalogResolver != null) {
-      resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
-    }
-
-    if (resolved != null) {
-      try {
-        InputSource iSource = new InputSource(resolved);
-        iSource.setPublicId(publicId);
-
-        // Ideally this method would not attempt to open the
-        // InputStream, but there is a bug (in Xerces, at least)
-        // that causes the parser to mistakenly open the wrong
-        // system identifier if the returned InputSource does
-        // not have a byteStream.
-        //
-        // It could be argued that we still shouldn't do this here,
-        // but since the purpose of calling the entityResolver is
-        // almost certainly to open the input stream, it seems to
-        // do little harm.
-        //
-        URL url = new URL(resolved);
-        InputStream iStream = url.openStream();
-        iSource.setByteStream(iStream);
-
-        return iSource;
-      } catch (Exception e) {
-        catalogManager.debug.message(1,
-                                     "Failed to create InputSource ("
-                                     + e.toString()
-                                     + ")", resolved);
-        return null;
-      }
-    } else {
-      return null;
-    }
-  }
-
-  /** SAX DTDHandler API.
-   *
-   * <p>Captured here only to detect the end of the prolog so that
-   * we can ignore subsequent oasis-xml-catalog PIs. Otherwise
-   * the events are just passed through.</p>
-   */
-  public void notationDecl (String name, String publicId, String systemId)
-    throws SAXException {
-    allowXMLCatalogPI = false;
-    super.notationDecl(name,publicId,systemId);
-  }
-
-  /** SAX DTDHandler API.
-   *
-   * <p>Captured here only to detect the end of the prolog so that
-   * we can ignore subsequent oasis-xml-catalog PIs. Otherwise
-   * the events are just passed through.</p>
-   */
-  public void unparsedEntityDecl (String name,
-                                  String publicId,
-                                  String systemId,
-                                  String notationName)
-    throws SAXException {
-    allowXMLCatalogPI = false;
-    super.unparsedEntityDecl (name, publicId, systemId, notationName);
-  }
-
-  /** SAX ContentHandler API.
-   *
-   * <p>Captured here only to detect the end of the prolog so that
-   * we can ignore subsequent oasis-xml-catalog PIs. Otherwise
-   * the events are just passed through.</p>
-   */
-  public void startElement (String uri, String localName, String qName,
-                            Attributes atts)
-    throws SAXException {
-    allowXMLCatalogPI = false;
-    super.startElement(uri,localName,qName,atts);
-  }
-
-  /** SAX ContentHandler API.
-   *
-   * <p>Detect and use the oasis-xml-catalog PI if it occurs.</p>
-   */
-  public void processingInstruction(String target, String pidata)
-    throws SAXException {
-    if (target.equals("oasis-xml-catalog")) {
-      URL catalog = null;
-      String data = pidata;
-
-      int pos = data.indexOf("catalog=");
-      if (pos >= 0) {
-        data = data.substring(pos+8);
-        if (data.length() > 1) {
-          String quote = data.substring(0,1);
-          data = data.substring(1);
-          pos = data.indexOf(quote);
-          if (pos >= 0) {
-            data = data.substring(0, pos);
-            try {
-              if (baseURL != null) {
-                catalog = new URL(baseURL, data);
-              } else {
-                catalog = new URL(data);
-              }
-            } catch (MalformedURLException mue) {
-              // nevermind
-            }
-          }
-        }
-      }
-
-      if (allowXMLCatalogPI) {
-        if (catalogManager.getAllowOasisXMLCatalogPI()) {
-          catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata);
-
-          if (catalog != null) {
-            try {
-              catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
-
-              if (piCatalogResolver == null) {
-                piCatalogResolver = new CatalogResolver(true);
-              }
-
-              piCatalogResolver.getCatalog().parseCatalog(catalog.toString());
-            } catch (Exception e) {
-              catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: "
-                            + catalog.toString());
-            }
-          } else {
-            catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata);
-          }
-        } else {
-          catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata);
-        }
-      } else {
-        catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: "
-                      + pidata);
-      }
-    } else {
-      super.processingInstruction(target, pidata);
-    }
-  }
-
-  /** Save the base URI of the document being parsed. */
-  private void setupBaseURI(String systemId) {
-    URL cwd = null;
-
-    try {
-      cwd = FileURL.makeURL("basename");
-    } catch (MalformedURLException mue) {
-      cwd = null;
-    }
-
-    try {
-      baseURL = new URL(systemId);
-    } catch (MalformedURLException mue) {
-      if (cwd != null) {
-        try {
-          baseURL = new URL(cwd, systemId);
-        } catch (MalformedURLException mue2) {
-          // give up
-          baseURL = null;
-        }
-      } else {
-        // give up
-        baseURL = null;
-      }
-    }
-  }
-
-  /** Provide one possible explanation for an InternalError. */
-  private void explain(String systemId) {
-    if (!suppressExplanation) {
-      System.out.println("XMLReader probably encountered bad URI in " + systemId);
-      System.out.println("For example, replace '/some/uri' with 'file:/some/uri'.");
-    }
-    suppressExplanation = true;
-  }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java	Sat Jun 17 00:15:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-
-import javax.xml.parsers.*;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xml.internal.resolver.*;
-
-/**
- * A SAX XMLReader that performs catalog-based entity resolution.
- *
- * <p>This class implements a SAX XMLReader that performs entity resolution
- * using the CatalogResolver. The actual, underlying parser is obtained
- * from a SAXParserFactory.</p>
- * </p>
- *
- * @see CatalogResolver
- * @see org.xml.sax.XMLReader
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public class ResolvingXMLReader extends ResolvingXMLFilter {
-  /** Make the parser Namespace aware? */
-  private static final boolean namespaceAware = true;
-
-  /** Make the parser validating? */
-  private static final boolean validating = false;
-
-  /**
-   * Construct a new reader from the JAXP factory.
-   *
-   * <p>In order to do its job, a ResolvingXMLReader must in fact be
-   * a filter. So the only difference between this code and the filter
-   * code is that the constructor builds a new reader.</p>
-   */
-  public ResolvingXMLReader() {
-    super();
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(namespaceAware);
-    spf.setValidating(validating);
-    try {
-      SAXParser parser = spf.newSAXParser();
-      setParent(parser.getXMLReader());
-    } catch (Exception ex) {
-      ex.printStackTrace();
-    }
-  }
-
-  /**
-   * Construct a new reader from the JAXP factory.
-   *
-   * <p>In order to do its job, a ResolvingXMLReader must in fact be
-   * a filter. So the only difference between this code and the filter
-   * code is that the constructor builds a new reader.</p>
-   */
-  public ResolvingXMLReader(CatalogManager manager) {
-    super(manager);
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(namespaceAware);
-    spf.setValidating(validating);
-    try {
-      SAXParser parser = spf.newSAXParser();
-      setParent(parser.getXMLReader());
-    } catch (Exception ex) {
-      ex.printStackTrace();
-    }
-  }
-}