changeset 871:bdbf2342b21b jdk-9+103

Merge
author lana
date Thu, 21 Jan 2016 10:17:05 -0800
parents 09dcbee7948e (current diff) bdf1962531da (diff)
children 58448465334e
files
diffstat 22 files changed, 59 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Thu Jan 21 10:17:05 2016 -0800
@@ -932,9 +932,9 @@
                     //Check if FSP and SM - only then process with loading
                     if (namespace != null && isSecureProcessing
                             && isExtensionFunctionEnabled
-                            && (namespace.equals(JAVA_EXT_XALAN)
-                            || namespace.equals(JAVA_EXT_XSLTC)
-                            || namespace.equals(JAVA_EXT_XALAN_OLD)
+                            && (namespace.startsWith(JAVA_EXT_XALAN)
+                            || namespace.startsWith(JAVA_EXT_XSLTC)
+                            || namespace.startsWith(JAVA_EXT_XALAN_OLD)
                             || namespace.startsWith(XALAN_CLASSPACKAGE_NAMESPACE))) {
                         _clazz = getXSLTC().loadExternalFunction(_className);
                     } else {
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Thu Jan 21 10:17:05 2016 -0800
@@ -36,6 +36,7 @@
 import com.sun.org.apache.xml.internal.serializer.ToHTMLStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -104,9 +105,9 @@
             }
         }
 
-        // Check if we have any declared namesaces
+        // Check if we have any declared namespaces
         if (_accessedPrefixes == null) {
-            _accessedPrefixes = new HashMap<>();
+            _accessedPrefixes = new Hashtable<>();
         }
         else {
             if (!declared) {
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11DocumentScannerImpl.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11DocumentScannerImpl.java	Thu Jan 21 10:17:05 2016 -0800
@@ -331,7 +331,7 @@
                                                          new Object[]{entityName});
                                     }
                                 }
-                                fEntityManager.startEntity(false, entityName, true);
+                                fEntityManager.startEntity(true, entityName, true);
                             }
                         }
                     }
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java	Thu Jan 21 10:17:05 2016 -0800
@@ -904,7 +904,7 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
-        if (fCurrentEntity.reference) {
+        if (fCurrentEntity.isGE) {
             checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
         }
         content.setValues(fCurrentEntity.ch, offset, length);
@@ -1051,6 +1051,9 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
+        if (fCurrentEntity.isGE) {
+            checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
+        }
         content.setValues(fCurrentEntity.ch, offset, length);
 
         // return next character
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Thu Jan 21 10:17:05 2016 -0800
@@ -1155,7 +1155,7 @@
                             StaxXMLInputSource staxInputSource =  fEntityManager.resolveEntityAsPerStax(resourceIdentifier);
 
                             // Check access permission. If the source is resolved by a resolver, the check is skipped.
-                            if (!staxInputSource.hasResolver()) {
+                            if (!staxInputSource.isCreatedByResolver()) {
                                 String accessError = checkAccess(fDoctypeSystemId, fAccessExternalDTD);
                                 if (accessError != null) {
                                     reportFatalError("AccessExternalDTD", new Object[]{ SecuritySupport.sanitizePath(fDoctypeSystemId), accessError });
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Thu Jan 21 10:17:05 2016 -0800
@@ -1008,12 +1008,14 @@
         }
 
         // do default resolution
-        //this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
+        //this works for both stax & Xerces, if staxInputSource is null,
+        //it means parser need to revert to default resolution
         if (staxInputSource == null) {
             // REVISIT: when systemId is null, I think we should return null.
             //          is this the right solution? -SG
             //if (systemId != null)
-            staxInputSource = new StaxXMLInputSource(new XMLInputSource(publicId, literalSystemId, baseSystemId));
+            staxInputSource = new StaxXMLInputSource(
+                    new XMLInputSource(publicId, literalSystemId, baseSystemId), false);
         }else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
             //Waiting for the clarification from EG. - nb
         }
@@ -1108,7 +1110,7 @@
     /**
      * Starts a named entity.
      *
-     * @param reference flag to indicate whether the entity is an Entity Reference.
+     * @param isGE flag to indicate whether the entity is a General Entity
      * @param entityName The name of the entity to start.
      * @param literal    True if this entity is started within a literal
      *                   value.
@@ -1116,7 +1118,7 @@
      * @throws IOException  Thrown on i/o error.
      * @throws XNIException Thrown by entity handler to signal an error.
      */
-    public void startEntity(boolean reference, String entityName, boolean literal)
+    public void startEntity(boolean isGE, String entityName, boolean literal)
     throws IOException, XNIException {
 
         // was entity declared?
@@ -1240,7 +1242,7 @@
         }
 
         // start the entity
-        startEntity(reference, entityName, xmlInputSource, literal, external);
+        startEntity(isGE, entityName, xmlInputSource, literal, external);
 
     } // startEntity(String,boolean)
 
@@ -1289,7 +1291,7 @@
      * This method can be used to insert an application defined XML
      * entity stream into the parsing stream.
      *
-     * @param reference flag to indicate whether the entity is an Entity Reference.
+     * @param isGE flag to indicate whether the entity is a General Entity
      * @param name           The name of the entity.
      * @param xmlInputSource The input source of the entity.
      * @param literal        True if this entity is started within a
@@ -1299,12 +1301,12 @@
      * @throws IOException  Thrown on i/o error.
      * @throws XNIException Thrown by entity handler to signal an error.
      */
-    public void startEntity(boolean reference, String name,
+    public void startEntity(boolean isGE, String name,
             XMLInputSource xmlInputSource,
             boolean literal, boolean isExternal)
             throws IOException, XNIException {
 
-        String encoding = setupCurrentEntity(reference, name, xmlInputSource, literal, isExternal);
+        String encoding = setupCurrentEntity(isGE, name, xmlInputSource, literal, isExternal);
 
         //when entity expansion limit is set by the Application, we need to
         //check for the entity expansion limit set by the parser, if number of entity
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java	Thu Jan 21 10:17:05 2016 -0800
@@ -1038,7 +1038,7 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
-        if (fCurrentEntity.reference) {
+        if (fCurrentEntity.isGE) {
             checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
         }
 
@@ -1205,6 +1205,9 @@
         }
         int length = fCurrentEntity.position - offset;
         fCurrentEntity.columnNumber += length - newlines;
+        if (fCurrentEntity.isGE) {
+            checkLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fCurrentEntity, offset, length);
+        }
         content.setValues(fCurrentEntity.ch, offset, length);
 
         // return next character
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Thu Jan 21 10:17:05 2016 -0800
@@ -946,7 +946,7 @@
                                                 new Object[]{entityName});
                                     }
                                 }
-                                fEntityManager.startEntity(false, entityName, true);
+                                fEntityManager.startEntity(true, entityName, true);
                             }
                         }
                     }
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/Entity.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/Entity.java	Thu Jan 21 10:17:05 2016 -0800
@@ -344,8 +344,8 @@
         // to know that prolog is read
         public boolean xmlDeclChunkRead = false;
 
-        // flag to indicate whether the Entity is an Entity Reference
-        public boolean reference = false;
+        // flag to indicate whether the Entity is a General Entity
+        public boolean isGE = false;
 
         /** returns the name of the current encoding
          *  @return current encoding name
@@ -391,11 +391,11 @@
         //
 
         /** Constructs a scanned entity. */
-        public ScannedEntity(boolean reference, String name,
+        public ScannedEntity(boolean isGE, String name,
                 XMLResourceIdentifier entityLocation,
                 InputStream stream, Reader reader,
                 String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
-            this.reference = reference;
+            this.isGE = isGE;
             this.name = name ;
             this.entityLocation = entityLocation;
             this.stream = stream;
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxEntityResolverWrapper.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxEntityResolverWrapper.java	Thu Jan 21 10:17:05 2016 -0800
@@ -71,12 +71,12 @@
         if(object == null) return null ;
 
         if(object  instanceof java.io.InputStream){
-            return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null));
+            return new StaxXMLInputSource(new XMLInputSource(null, null, null, (InputStream)object, null), true);
         }
         else if(object instanceof XMLStreamReader){
-            return new StaxXMLInputSource((XMLStreamReader)object) ;
+            return new StaxXMLInputSource((XMLStreamReader)object, true) ;
         }else if(object instanceof XMLEventReader){
-            return new StaxXMLInputSource((XMLEventReader)object) ;
+            return new StaxXMLInputSource((XMLEventReader)object, true) ;
         }
 
         return null ;
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxXMLInputSource.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/StaxXMLInputSource.java	Thu Jan 21 10:17:05 2016 -0800
@@ -43,27 +43,22 @@
     XMLEventReader fEventReader ;
     XMLInputSource fInputSource ;
 
-    //indicate if the source is resolved by a resolver
-    boolean fHasResolver = false;
+    //indicates if the source is created by a resolver
+    boolean fIsCreatedByResolver = false;
 
     /** Creates a new instance of StaxXMLInputSource */
-    public StaxXMLInputSource(XMLStreamReader streamReader) {
+    public StaxXMLInputSource(XMLStreamReader streamReader, boolean byResolver) {
         fStreamReader = streamReader ;
     }
 
     /** Creates a new instance of StaxXMLInputSource */
-    public StaxXMLInputSource(XMLEventReader eventReader) {
+    public StaxXMLInputSource(XMLEventReader eventReader, boolean byResolver) {
         fEventReader = eventReader ;
     }
 
-    public StaxXMLInputSource(XMLInputSource inputSource){
+    public StaxXMLInputSource(XMLInputSource inputSource, boolean byResolver){
         fInputSource = inputSource ;
-
-    }
-
-    public StaxXMLInputSource(XMLInputSource inputSource, boolean hasResolver){
-        fInputSource = inputSource ;
-        fHasResolver = hasResolver;
+        fIsCreatedByResolver = byResolver;
     }
 
     public XMLStreamReader getXMLStreamReader(){
@@ -82,7 +77,7 @@
         return (fStreamReader == null) && (fEventReader == null) ? false : true ;
     }
 
-    public boolean hasResolver() {
-        return fHasResolver;
+    public boolean isCreatedByResolver() {
+        return fIsCreatedByResolver;
     }
 }
--- a/src/java.xml/share/classes/javax/xml/xpath/XPath.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/javax/xml/xpath/XPath.java	Thu Jan 21 10:17:05 2016 -0800
@@ -351,7 +351,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
      * @throws NullPointerException If {@code expression or type} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(String expression, Object item, Class<T> type)
         throws XPathExpressionException {
@@ -399,7 +399,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      * @throws NullPointerException If {@code expression} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(String expression, Object item)
         throws XPathExpressionException
@@ -445,7 +445,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
      * @throws NullPointerException If {@code expression, source or type}is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(String expression, InputSource source, Class<T> type)
         throws XPathExpressionException
@@ -486,7 +486,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      * @throws NullPointerException If {@code expression or source} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(String expression, InputSource source)
         throws XPathExpressionException
--- a/src/java.xml/share/classes/javax/xml/xpath/XPathEvaluationResult.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/javax/xml/xpath/XPathEvaluationResult.java	Thu Jan 21 10:17:05 2016 -0800
@@ -37,7 +37,7 @@
  * @see <a href="http://www.w3.org/TR/xpath">XML Path Language (XPath) Version
  * 1.0</a>
  *
- * @since 1.9
+ * @since 9
  */
 public interface XPathEvaluationResult<T> {
 
--- a/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java	Thu Jan 21 10:17:05 2016 -0800
@@ -246,7 +246,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
      * @throws NullPointerException If {@code type} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(Object item, Class<T> type)
         throws XPathExpressionException
@@ -292,7 +292,7 @@
      * does not support the
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(Object item)
         throws XPathExpressionException
@@ -338,7 +338,7 @@
      * is not available.
      * @throws NullPointerException If {@code source or type} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default <T>T evaluateExpression(InputSource source, Class<T> type)
         throws XPathExpressionException
@@ -377,7 +377,7 @@
      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
      * @throws NullPointerException If {@code source} is {@code null}.
      *
-     * @since 1.9
+     * @since 9
      */
     default XPathEvaluationResult<?> evaluateExpression(InputSource source)
         throws XPathExpressionException
--- a/src/java.xml/share/classes/javax/xml/xpath/XPathNodes.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/javax/xml/xpath/XPathNodes.java	Thu Jan 21 10:17:05 2016 -0800
@@ -33,7 +33,7 @@
  * in <a href="http://www.w3.org/TR/xpath/#node-sets">XML Path Language (XPath)
  * Version 1.0, 3.3 Node-sets</a>.
  *
- * @since 1.9
+ * @since 9
  */
 public interface XPathNodes extends Iterable<Node> {
 
--- a/src/java.xml/share/classes/org/w3c/dom/ranges/DocumentRange.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/ranges/DocumentRange.java	Thu Jan 21 10:17:05 2016 -0800
@@ -43,7 +43,7 @@
 
 /**
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface DocumentRange {
     /**
--- a/src/java.xml/share/classes/org/w3c/dom/ranges/Range.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/ranges/Range.java	Thu Jan 21 10:17:05 2016 -0800
@@ -47,7 +47,7 @@
 
 /**
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface Range {
     /**
--- a/src/java.xml/share/classes/org/w3c/dom/ranges/RangeException.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/ranges/RangeException.java	Thu Jan 21 10:17:05 2016 -0800
@@ -45,7 +45,7 @@
  * Range operations may throw a <code>RangeException</code> as specified in
  * their method descriptions.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public class RangeException extends RuntimeException {
     public RangeException(short code, String message) {
--- a/src/java.xml/share/classes/org/w3c/dom/traversal/DocumentTraversal.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/traversal/DocumentTraversal.java	Thu Jan 21 10:17:05 2016 -0800
@@ -53,7 +53,7 @@
  * Traversal feature, <code>DocumentTraversal</code> will be implemented by
  * the same objects that implement the Document interface.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface DocumentTraversal {
     /**
--- a/src/java.xml/share/classes/org/w3c/dom/traversal/NodeFilter.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/traversal/NodeFilter.java	Thu Jan 21 10:17:05 2016 -0800
@@ -59,7 +59,7 @@
  * filter may be used with a number of different kinds of traversals,
  * encouraging code reuse.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface NodeFilter {
     // Constants returned by acceptNode
--- a/src/java.xml/share/classes/org/w3c/dom/traversal/NodeIterator.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/traversal/NodeIterator.java	Thu Jan 21 10:17:05 2016 -0800
@@ -55,7 +55,7 @@
  * <code>NodeIterators</code> are created by calling
  * <code>DocumentTraversal</code><code>.createNodeIterator()</code>.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface NodeIterator {
     /**
--- a/src/java.xml/share/classes/org/w3c/dom/traversal/TreeWalker.java	Thu Jan 21 09:46:01 2016 -0800
+++ b/src/java.xml/share/classes/org/w3c/dom/traversal/TreeWalker.java	Thu Jan 21 10:17:05 2016 -0800
@@ -60,7 +60,7 @@
  * nodes will be siblings and appear as direct children of the root node, no
  * matter how deeply nested the structure of the original document.
  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since 1.9, DOM Level 2
+ * @since 9, DOM Level 2
  */
 public interface TreeWalker {
     /**