8158204: accessExternalSchema property handling is inconsistent and differs from spec.
authorjoehw
Tue, 14 Jun 2016 16:14:24 -0700
changeset 39080 57563e513b11
parent 38921 d53037a90c44
child 39084 215ef514ad9b
8158204: accessExternalSchema property handling is inconsistent and differs from spec. Reviewed-by: lancea
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSLoaderImpl.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/XSInputSource.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/Util.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParserImpl.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLGrammarCachingConfiguration.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DOMEntityResolverWrapper.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DOMInputSource.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolver2Wrapper.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolverWrapper.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SAXInputSource.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/StAXInputSource.java
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/xerces/internal/xinclude/XIncludeHandler.java
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java
jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLInputFactoryImpl.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMNormalizer.java	Tue Jun 14 16:14:24 2016 -0700
@@ -696,7 +696,7 @@
         preParser.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY, pool);
 
         String internalSubset = docType.getInternalSubset();
-        XMLInputSource is = new XMLInputSource(docType.getPublicId(), docType.getSystemId(), null);
+        XMLInputSource is = new XMLInputSource(docType.getPublicId(), docType.getSystemId(), null, false);
 
         if(internalSubset != null)
             is.setCharacterStream(new StringReader(internalSubset));
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Tue Jun 14 16:14:24 2016 -0700
@@ -1015,7 +1015,7 @@
             //          is this the right solution? -SG
             //if (systemId != null)
             staxInputSource = new StaxXMLInputSource(
-                    new XMLInputSource(publicId, literalSystemId, baseSystemId), false);
+                    new XMLInputSource(publicId, literalSystemId, baseSystemId, true), false);
         }else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
             //Waiting for the clarification from EG. - nb
         }
@@ -1094,7 +1094,7 @@
             // REVISIT: when systemId is null, I think we should return null.
             //          is this the right solution? -SG
             //if (systemId != null)
-            xmlInputSource = new XMLInputSource(publicId, literalSystemId, baseSystemId);
+            xmlInputSource = new XMLInputSource(publicId, literalSystemId, baseSystemId, false);
         }
 
         if (DEBUG_RESOLVER) {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java	Tue Jun 14 16:14:24 2016 -0700
@@ -139,7 +139,7 @@
     public XMLStreamReaderImpl(String systemid, PropertyManager props) throws  XMLStreamException {
         init(props);
         //publicId, systemid, baseSystemId, inputStream, enocding
-        XMLInputSource inputSource = new XMLInputSource(null,systemid,null);
+        XMLInputSource inputSource = new XMLInputSource(null, systemid, null, false);
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java	Tue Jun 14 16:14:24 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -601,7 +601,7 @@
             processJAXPSchemaSource(locationPairs);
         }
 
-        if (desc.isExternal()) {
+        if (desc.isExternal() && !source.isCreatedByResolver()) {
             String accessError = SecuritySupport.checkAccess(desc.getExpandedSystemId(), faccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
             if (accessError != null) {
                 throw new XNIException(fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
@@ -882,7 +882,7 @@
             if (xis == null) {
                 // REVISIT: can this happen?
                 // Treat value as a URI and pass in as systemId
-                return new XMLInputSource(null, loc, null);
+                return new XMLInputSource(null, loc, null, false);
             }
             return xis;
         }
@@ -931,7 +931,7 @@
                     sis.getEncoding());
         }
 
-        return new XMLInputSource(publicId, systemId, null);
+        return new XMLInputSource(publicId, systemId, null, false);
     }
 
     public static class LocationArray{
@@ -1170,7 +1170,7 @@
      */
     public XSModel loadURI(String uri) {
         try {
-            Grammar g = loadGrammar(new XMLInputSource(null, uri, null));
+            Grammar g = loadGrammar(new XMLInputSource(null, uri, null, false));
             return ((XSGrammar)g).toXSModel();
         }
         catch (Exception e){
@@ -1188,7 +1188,7 @@
         for (int i = 0; i < length; i++) {
             try {
                 gs[i] =
-                    (SchemaGrammar) loadGrammar(new XMLInputSource(null, uriList.item(i), null));
+                    (SchemaGrammar) loadGrammar(new XMLInputSource(null, uriList.item(i), null, false));
             } catch (Exception e) {
                 reportDOMFatalError(e);
                 return null;
@@ -1415,7 +1415,7 @@
         // otherwise, just use the public/system/base Ids
         else {
             xis = new XMLInputSource(is.getPublicId(), is.getSystemId(),
-                    is.getBaseURI());
+                    is.getBaseURI(), false);
         }
 
         return xis;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSDDescription.java	Tue Jun 14 16:14:24 2016 -0700
@@ -181,7 +181,7 @@
     }
 
     /**
-     * @return true is the schema is external
+     * @return true if the schema is external
      */
     public boolean isExternal() {
         return fContextType == CONTEXT_INCLUDE ||
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSLoaderImpl.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XSLoaderImpl.java	Tue Jun 14 16:14:24 2016 -0700
@@ -104,7 +104,7 @@
         try {
             fGrammarPool.clear();
             for (int i = 0; i < length; ++i) {
-                fSchemaLoader.loadGrammar(new XMLInputSource(null, uriList.item(i), null));
+                fSchemaLoader.loadGrammar(new XMLInputSource(null, uriList.item(i), null, false));
             }
             return fGrammarPool.toXSModel();
         }
@@ -146,7 +146,7 @@
     public XSModel loadURI(String uri) {
         try {
             fGrammarPool.clear();
-            return ((XSGrammar) fSchemaLoader.loadGrammar(new XMLInputSource(null, uri, null))).toXSModel();
+            return ((XSGrammar) fSchemaLoader.loadGrammar(new XMLInputSource(null, uri, null, false))).toXSModel();
         }
         catch (Exception e){
             fSchemaLoader.reportDOMFatalError(e);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Tue Jun 14 16:14:24 2016 -0700
@@ -681,7 +681,7 @@
             createAnnotationValidator();
         }
         final int size = annotationInfo.size();
-        final XMLInputSource src = new XMLInputSource(null, null, null);
+        final XMLInputSource src = new XMLInputSource(null, null, null, false);
         fGrammarBucketAdapter.refreshGrammars(fGrammarBucket);
         for (int i = 0; i < size; i += 2) {
             src.setSystemId((String) annotationInfo.get(i));
@@ -2041,7 +2041,7 @@
 
     /**
      * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
-     * and if it was succefully resolved getting the schema Document.
+     * and if it was successfully resolved getting the schema Document.
      * @param desc
      * @param mustResolve
      * @param referElement
@@ -2164,8 +2164,9 @@
                         fLastSchemaWasDuplicate = true;
                         return schemaElement;
                     }
-                    if (referType == XSDDescription.CONTEXT_IMPORT || referType == XSDDescription.CONTEXT_INCLUDE
-                            || referType == XSDDescription.CONTEXT_REDEFINE) {
+                    if ((!schemaSource.isCreatedByResolver()) &&
+                            (referType == XSDDescription.CONTEXT_IMPORT || referType == XSDDescription.CONTEXT_INCLUDE
+                            || referType == XSDDescription.CONTEXT_REDEFINE)) {
                         String accessError = SecuritySupport.checkAccess(schemaId, fAccessExternalSchema, Constants.ACCESS_EXTERNAL_ALL);
                         if (accessError != null) {
                             reportSchemaFatalError("schema_reference.access",
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/XSInputSource.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/XSInputSource.java	Tue Jun 14 16:14:24 2016 -0700
@@ -36,13 +36,13 @@
     private XSObject[] fComponents;
 
     public XSInputSource(SchemaGrammar[] grammars) {
-        super(null, null, null);
+        super(null, null, null, false);
         fGrammars = grammars;
         fComponents = null;
     }
 
     public XSInputSource(XSObject[] component) {
-        super(null, null, null);
+        super(null, null, null, false);
         fGrammars = null;
         fComponents = component;
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java	Tue Jun 14 16:14:24 2016 -0700
@@ -130,7 +130,7 @@
                 identityTransformerHandler.setResult(result);
             }
 
-            XMLInputSource input = new XMLInputSource(streamSource.getPublicId(), streamSource.getSystemId(), null);
+            XMLInputSource input = new XMLInputSource(streamSource.getPublicId(), streamSource.getSystemId(), null, false);
             input.setByteStream(streamSource.getInputStream());
             input.setCharacterStream(streamSource.getReader());
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/Util.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/Util.java	Tue Jun 14 16:14:24 2016 -0700
@@ -51,7 +51,7 @@
             in.getInputStream(), null );
 
         return new XMLInputSource(
-        in.getPublicId(), in.getSystemId(), in.getSystemId() );
+        in.getPublicId(), in.getSystemId(), in.getSystemId(), false );
     }
 
     /**
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Tue Jun 14 16:14:24 2016 -0700
@@ -221,7 +221,7 @@
                 String systemId = streamSource.getSystemId();
                 inputStream = streamSource.getInputStream();
                 reader = streamSource.getReader();
-                XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, null);
+                XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, null, false);
                 xmlInputSource.setByteStream(inputStream);
                 xmlInputSource.setCharacterStream(reader);
                 xmlInputSources[i] = xmlInputSource;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java	Tue Jun 14 16:14:24 2016 -0700
@@ -1134,7 +1134,7 @@
     public void parse(String systemId) throws SAXException, IOException {
 
         // parse document
-        XMLInputSource source = new XMLInputSource(null, systemId, null);
+        XMLInputSource source = new XMLInputSource(null, systemId, null, false);
         try {
             parse(source);
         }
@@ -1205,7 +1205,7 @@
             XMLInputSource xmlInputSource =
                 new XMLInputSource(inputSource.getPublicId(),
                                    inputSource.getSystemId(),
-                                   null);
+                                   null, false);
             xmlInputSource.setByteStream(inputSource.getByteStream());
             xmlInputSource.setCharacterStream(inputSource.getCharacterStream());
             xmlInputSource.setEncoding(inputSource.getEncoding());
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParser.java	Tue Jun 14 16:14:24 2016 -0700
@@ -175,7 +175,7 @@
     public void parse(String systemId) throws SAXException, IOException {
 
         // parse document
-        XMLInputSource source = new XMLInputSource(null, systemId, null);
+        XMLInputSource source = new XMLInputSource(null, systemId, null, false);
         try {
             parse(source);
         }
@@ -235,7 +235,7 @@
             XMLInputSource xmlInputSource =
                 new XMLInputSource(inputSource.getPublicId(),
                                    inputSource.getSystemId(),
-                                   null);
+                                   null, false);
             xmlInputSource.setByteStream(inputSource.getByteStream());
             xmlInputSource.setCharacterStream(inputSource.getCharacterStream());
             xmlInputSource.setEncoding(inputSource.getEncoding());
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParserImpl.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DOMParserImpl.java	Tue Jun 14 16:14:24 2016 -0700
@@ -917,7 +917,7 @@
             throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
         }
 
-        XMLInputSource source = new XMLInputSource (null, uri, null);
+        XMLInputSource source = new XMLInputSource (null, uri, null, false);
         try {
             currentThread = Thread.currentThread();
                         fBusy = true;
@@ -1082,7 +1082,7 @@
         else if ((is.getSystemId() != null && is.getSystemId().length() > 0) ||
             (is.getPublicId() != null && is.getPublicId().length() > 0)) {
             xis = new XMLInputSource (is.getPublicId (), is.getSystemId (),
-            is.getBaseURI ());
+            is.getBaseURI(), false);
         }
         else {
             // all inputs are null
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLGrammarCachingConfiguration.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XMLGrammarCachingConfiguration.java	Tue Jun 14 16:14:24 2016 -0700
@@ -205,7 +205,7 @@
      */
     public Grammar parseGrammar(String type, String uri)
                               throws XNIException, IOException {
-        XMLInputSource source = new XMLInputSource(null, uri, null);
+        XMLInputSource source = new XMLInputSource(null, uri, null, false);
         return parseGrammar(type, source);
 
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DOMEntityResolverWrapper.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DOMEntityResolverWrapper.java	Tue Jun 14 16:14:24 2016 -0700
@@ -135,7 +135,7 @@
                  * stringData, systemId, publicId.
                  */
                 XMLInputSource xmlInputSource =
-                    new XMLInputSource(publicId, systemId, baseSystemId);
+                    new XMLInputSource(publicId, systemId, baseSystemId, true);
 
                 if (charStream != null) {
                     xmlInputSource.setCharacterStream(charStream);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DOMInputSource.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/DOMInputSource.java	Tue Jun 14 16:14:24 2016 -0700
@@ -36,12 +36,12 @@
     }
 
     public DOMInputSource(Node node) {
-        super(null, getSystemIdFromNode(node), null);
+        super(null, getSystemIdFromNode(node), null, false);
         fNode = node;
     }
 
     public DOMInputSource(Node node, String systemId) {
-        super(null, systemId, null);
+        super(null, systemId, null, false);
         fNode = node;
     }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolver2Wrapper.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolver2Wrapper.java	Tue Jun 14 16:14:24 2016 -0700
@@ -204,7 +204,7 @@
         Reader charStream = source.getCharacterStream();
         String encoding = source.getEncoding();
         XMLInputSource xmlInputSource =
-            new XMLInputSource(publicId, systemId, baseSystemId);
+            new XMLInputSource(publicId, systemId, baseSystemId, false);
         xmlInputSource.setByteStream(byteStream);
         xmlInputSource.setCharacterStream(charStream);
         xmlInputSource.setEncoding(encoding);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolverWrapper.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/EntityResolverWrapper.java	Tue Jun 14 16:14:24 2016 -0700
@@ -116,7 +116,7 @@
                     Reader charStream = inputSource.getCharacterStream();
                     String encoding = inputSource.getEncoding();
                     XMLInputSource xmlInputSource =
-                        new XMLInputSource(publicId, systemId, baseSystemId);
+                        new XMLInputSource(publicId, systemId, baseSystemId, true);
                     xmlInputSource.setByteStream(byteStream);
                     xmlInputSource.setCharacterStream(charStream);
                     xmlInputSource.setEncoding(encoding);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/HTTPInputSource.java	Tue Jun 14 16:14:24 2016 -0700
@@ -73,7 +73,7 @@
      *                     base system identifier, if possible.
      */
     public HTTPInputSource(String publicId, String systemId, String baseSystemId) {
-        super(publicId, systemId, baseSystemId);
+        super(publicId, systemId, baseSystemId, false);
     } // <init>(String,String,String)
 
     /**
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SAXInputSource.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/SAXInputSource.java	Tue Jun 14 16:14:24 2016 -0700
@@ -46,7 +46,8 @@
 
     public SAXInputSource(XMLReader reader, InputSource inputSource) {
         super(inputSource != null ? inputSource.getPublicId() : null,
-                inputSource != null ? inputSource.getSystemId() : null, null);
+                inputSource != null ? inputSource.getSystemId() : null, null,
+                false);
         if (inputSource != null) {
             setByteStream(inputSource.getByteStream());
             setCharacterStream(inputSource.getCharacterStream());
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/StAXInputSource.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/StAXInputSource.java	Tue Jun 14 16:14:24 2016 -0700
@@ -42,7 +42,7 @@
     }
 
     public StAXInputSource(XMLStreamReader source, boolean consumeRemainingContent) {
-        super(null, source.getLocation().getSystemId(), null);
+        super(null, source.getLocation().getSystemId(), null, false);
         if (source == null) {
             throw new IllegalArgumentException("XMLStreamReader parameter cannot be null.");
         }
@@ -56,7 +56,7 @@
     }
 
     public StAXInputSource(XMLEventReader source, boolean consumeRemainingContent) {
-        super(null, getEventReaderSystemId(source), null);
+        super(null, getEventReaderSystemId(source), null, false);
         if (source == null) {
             throw new IllegalArgumentException("XMLEventReader parameter cannot be null.");
         }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java	Tue Jun 14 16:14:24 2016 -0700
@@ -395,8 +395,7 @@
         String resolvedId = resolveIdentifier(resourceIdentifier);
         if (resolvedId != null) {
             return new XMLInputSource(resourceIdentifier.getPublicId(),
-                                      resolvedId,
-                                      resourceIdentifier.getBaseSystemId());
+                    resolvedId, resourceIdentifier.getBaseSystemId(), false);
         }
         return null;
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Tue Jun 14 16:14:24 2016 -0700
@@ -1623,7 +1623,7 @@
                 includedSource = createInputSource(null, href, fCurrentBaseURI.getExpandedSystemId(), accept, acceptLanguage);
             }
             else {
-                includedSource = new XMLInputSource(null, href, fCurrentBaseURI.getExpandedSystemId());
+                includedSource = new XMLInputSource(null, href, fCurrentBaseURI.getExpandedSystemId(), false);
             }
         }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java	Tue Jun 14 16:14:24 2016 -0700
@@ -62,6 +62,8 @@
     /** Encoding. */
     protected String fEncoding;
 
+    //indicates whether the source is created by a resolver
+    boolean fIsCreatedByResolver = false;
     //
     // Constructors
     //
@@ -80,12 +82,15 @@
      * @param baseSystemId The base system identifier. This value should
      *                     always be set to the fully expanded URI of the
      *                     base system identifier, if possible.
+     * @param isCreatedByResolver a flag to indicate whether the source is
+     * created by a resolver
      */
     public XMLInputSource(String publicId, String systemId,
-                          String baseSystemId) {
+                          String baseSystemId, boolean isCreatedByResolver) {
         fPublicId = publicId;
         fSystemId = systemId;
         fBaseSystemId = baseSystemId;
+        fIsCreatedByResolver = isCreatedByResolver;
     } // <init>(String,String,String)
 
     /**
@@ -251,4 +256,19 @@
         return fEncoding;
     } // getEncoding():String
 
+    /**
+     * Sets the flag to indicate whether this source is created by a resolver
+     * @param createdByResolver the flag
+     */
+    public void setCreatedByResolver(boolean createdByResolver) {
+        fIsCreatedByResolver = createdByResolver;
+    }
+    /**
+     * Returns a boolean to indicate whether this source is created by a resolver.
+     * @return true if the source is created by a resolver, false otherwise
+     */
+    public boolean isCreatedByResolver() {
+        return fIsCreatedByResolver;
+    }
+
 } // class XMLInputSource
--- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLInputFactoryImpl.java	Wed Jul 05 21:50:08 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLInputFactoryImpl.java	Tue Jun 14 16:14:24 2016 -0700
@@ -293,7 +293,7 @@
              else if(reader != null){
                  return new XMLInputSource(publicId, systemId,null, reader, null);
              }else{
-                 return new XMLInputSource(publicId, systemId, null);
+                 return new XMLInputSource(publicId, systemId, null, false);
              }
          }