--- old/src/jdk.xml.bind/share/classes/com/sun/xml/internal/dtdparser/Resolver.java 2015-10-16 12:59:44.000000000 +0200 +++ new/src/jdk.xml.bind/share/classes/com/sun/xml/internal/dtdparser/Resolver.java 2015-10-16 12:59:44.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,52 +35,53 @@ import java.net.URL; import java.net.URLConnection; import java.util.Hashtable; +import java.util.Locale; /** * This entity resolver class provides a number of utilities which can help * managment of external parsed entities in XML. These are commonly used * to hold markup declarations that are to be used as part of a Document * Type Declaration (DTD), or to hold text marked up with XML. - *

+ *

*

Features include:

- *

+ *

*

Subclasses can perform tasks such as supporting new URI schemes for * URIs which are not URLs, such as URNs (see RFC 2396) or for accessing * MIME entities which are part of a multipart/related group @@ -126,7 +127,7 @@ } /** - * Returns an input source, using the MIME type information and URL + *

Returns an input source, using the MIME type information and URL * scheme to statically determine the correct character encoding if * possible and otherwise autodetecting it. MIME carefully specifies * the character encoding defaults, and how attributes of the content @@ -134,18 +135,18 @@ * (UTF-8 and UTF-16), and includes an XML declaration which can be * used to internally label most documents encoded using US-ASCII * supersets (such as Shift_JIS, EUC-JP, ISO-2022-*, ISO-8859-*, and - * more). - *

- *

This method can be used to access XML documents which do not + * more).

+ * + *

This method can be used to access XML documents which do not * have URIs (such as servlet input streams, or most JavaMail message * entities) and to support access methods such as HTTP POST or PUT. - * (URLs normally return content using the GET method.) - *

- *

The caller should set the system ID in order for relative URIs + * (URLs normally return content using the GET method.)

+ * + *

The caller should set the system ID in order for relative URIs * found in this document to be interpreted correctly. In some cases, * a custom resolver will need to be used; for example, documents * may be grouped in a single MIME "multipart/related" bundle, and - * relative URLs would refer to other documents in that bundle. + * relative URLs would refer to other documents in that bundle.

* * @param contentType The MIME content type for the source for which * an InputSource is desired, such as text/xml;charset=utf-8. @@ -166,7 +167,7 @@ if (contentType != null) { int index; - contentType = contentType.toLowerCase(); + contentType = contentType.toLowerCase(Locale.ENGLISH); index = contentType.indexOf(';'); if (index != -1) { String attributes; @@ -295,7 +296,7 @@ * consulted. If no mapping is found there, a catalog mapping names * to java resources is consulted. Finally, if neither mapping found * a copy of the entity, the specified URI is used. - *

+ *

*

When a URI is used, * createInputSource is used to correctly deduce the character * encoding used by this entity. No MIME type checking is done. @@ -305,6 +306,7 @@ * @param uri Used when no alternate copy of the entity is found; * this is the XML "system ID", normally a URI. */ + @Override public InputSource resolveEntity(String name, String uri) throws IOException { InputSource retval; @@ -312,7 +314,7 @@ InputStream stream; // prefer explicit URI mappings, then bundled resources... - if (mappedURI == null && (stream = mapResource(name)) != null) { + if (mappedURI == null && (stream = mapResource(name)) != null && id2resource != null) { uri = "java:resource:" + (String) id2resource.get(name); retval = new InputSource(XmlReader.createReader(stream)); @@ -423,7 +425,7 @@ * included in XML documents. This mechanism should most typically be * used for Document Type Definitions (DTDs), where the public IDs are * formally managed and versioned. - *

+ *

*

If a mapping to a URI has been provided, that mapping takes * precedence over this one. *