Merge
authorprr
Fri, 05 Aug 2016 12:03:58 -0700
changeset 40427 592a43ff92cd
parent 40426 8b413b0e064c (current diff)
parent 40174 1c3f804fff32 (diff)
child 40428 a7bcfb5351d7
Merge
jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeatureManager.java
--- a/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -371,3 +371,4 @@
 03e7b2c5ae345be3caf981d76ceb3efe5ff447f8 jdk-9+126
 8e45018bde9de4ad15b972ae62874bba52dba2d5 jdk-9+127
 5bf88dce615f6804f9e101a96ffa7c9dfb4fbbbe jdk-9+128
+e8373543a3f0f60589b7d72b1f9b172721124caf jdk-9+129
--- a/.hgtags-top-repo	Fri Aug 05 16:20:02 2016 +0300
+++ b/.hgtags-top-repo	Fri Aug 05 12:03:58 2016 -0700
@@ -371,3 +371,4 @@
 3a58466296d36944454756ef01e7513ac5e14a16 jdk-9+126
 8fa686245bd2a072ece3392743460030f0854520 jdk-9+127
 b30ae794d974d7dd3eb4e84203f70021823fa6c6 jdk-9+128
+f5902d3841b82cac6e7716a20c24e8e916fb14a8 jdk-9+129
--- a/common/autoconf/spec.gmk.in	Fri Aug 05 16:20:02 2016 +0300
+++ b/common/autoconf/spec.gmk.in	Fri Aug 05 12:03:58 2016 -0700
@@ -175,8 +175,8 @@
 VERSION_STRING := @VERSION_STRING@
 # The short version string, without trailing zeroes and just PRE, if present.
 VERSION_SHORT := @VERSION_SHORT@
-# The Java specification version. It should be equal to version number.
-VERSION_SPECIFICATION := @VERSION_NUMBER@
+# The Java specification version. It usually equals to the major version number.
+VERSION_SPECIFICATION := @VERSION_MAJOR@
 # A GA version is defined by the PRE string being empty. Rather than testing for
 # that, this variable defines it with true/false.
 VERSION_IS_GA := @VERSION_IS_GA@
--- a/corba/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/corba/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -371,3 +371,4 @@
 c7f5ba08fcd4b8416e62c21229f9a07c95498919 jdk-9+126
 8fab452b6f4710762ba1d8e55fd62db00b1355fe jdk-9+127
 1f093d3f8cd99cd37c3b0af4cf5c3bffaa9c8b98 jdk-9+128
+c3e83ccab3bb1733ae903d681879a33f85ed465c jdk-9+129
--- a/hotspot/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/hotspot/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -531,3 +531,4 @@
 adc8c84b7cf8c540d920182f78a2bc982366432a jdk-9+126
 352357128f602dcf0426b1cbe011a4685a4d9f97 jdk-9+127
 22bf6db9767b1b3a1994cbf32eb3331f31ae2093 jdk-9+128
+e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
--- a/jaxp/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -371,3 +371,4 @@
 15722f71281f034bc696d8b96136da2ef34da44f jdk-9+126
 bdc3c0b737efbf899709eb3121ce760dcfb51151 jdk-9+127
 8a7681a9d70640ac7fbf05c28f53c1d51d8d00a1 jdk-9+128
+74241304e87b0d463391a8ecab40979b5af86dc2 jdk-9+129
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java	Fri Aug 05 12:03:58 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.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -223,12 +223,6 @@
     public static final String XML_SECURITY_PROPERTY_MANAGER =
             ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager";
 
-    /**
-     * Feature enableExtensionFunctions
-     */
-    public static final String ORACLE_ENABLE_EXTENSION_FUNCTION =
-            ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions";
-    public static final String SP_ORACLE_ENABLE_EXTENSION_FUNCTION = "javax.xml.enableExtensionFunctions";
 
     /**
      * Values for a feature
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeatureManager.java	Fri Aug 05 16:20:02 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.org.apache.xalan.internal.utils;
-
-
-import com.sun.org.apache.xalan.internal.XalanConstants;
-
-/**
- * This class manages security related properties
- *
- */
-public final class FeatureManager extends FeaturePropertyBase {
-
-    /**
-     * States of the settings of a property, in the order: default value, value
-     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
-     * properties, and jaxp api properties
-     */
-    public static enum State {
-        //this order reflects the overriding order
-        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
-    }
-
-    /**
-     * Xalan Features
-     */
-    public static enum Feature {
-        ORACLE_ENABLE_EXTENSION_FUNCTION(XalanConstants.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                "true");
-
-        final String name;
-        final String defaultValue;
-
-        Feature(String name, String value) {
-            this.name = name;
-            this.defaultValue = value;
-        }
-
-        public boolean equalsName(String propertyName) {
-            return (propertyName == null) ? false : name.equals(propertyName);
-        }
-
-        String defaultValue() {
-            return defaultValue;
-        }
-    }
-
-    /**
-     * Default constructor. Establishes default values
-     */
-    public FeatureManager() {
-        values = new String[Feature.values().length];
-        for (Feature feature : Feature.values()) {
-            values[feature.ordinal()] = feature.defaultValue();
-        }
-        //read system properties or jaxp.properties
-        readSystemProperties();
-    }
-
-
-    /**
-     * Check if the feature is enabled
-     * @param feature name of the feature
-     * @return true if enabled, false otherwise
-     */
-    public boolean isFeatureEnabled(Feature feature) {
-        return Boolean.parseBoolean(values[feature.ordinal()]);
-    }
-
-    /**
-     * Check if the feature is enabled
-     * @param propertyName name of the feature
-     * @return true if enabled, false otherwise
-     */
-    public boolean isFeatureEnabled(String propertyName) {
-        return Boolean.parseBoolean(values[getIndex(propertyName)]);
-    }
-
-    /**
-     * Get the index by property name
-     * @param propertyName property name
-     * @return the index of the property if found; return -1 if not
-     */
-    public int getIndex(String propertyName){
-        for (Feature feature : Feature.values()) {
-            if (feature.equalsName(propertyName)) {
-                return feature.ordinal();
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Read from system properties, or those in jaxp.properties
-     */
-    private void readSystemProperties() {
-        getSystemProperty(Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                XalanConstants.SP_ORACLE_ENABLE_EXTENSION_FUNCTION);
-    }
-
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Fri Aug 05 12:03:58 2016 -0700
@@ -33,7 +33,6 @@
 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
 import com.sun.org.apache.bcel.internal.generic.NEW;
 import com.sun.org.apache.bcel.internal.generic.PUSH;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
@@ -55,6 +54,7 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Vector;
+import jdk.xml.internal.JdkXmlFeatures;
 
 /**
  * @author Jacek Ambroziak
@@ -741,7 +741,7 @@
         final InstructionList il = methodGen.getInstructionList();
         final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing();
         final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC()
-                .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
+                .getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION);
         int index;
 
         // Translate calls to methods in the BasisLibrary
@@ -971,7 +971,7 @@
                 if (_clazz == null) {
                     final boolean isSecureProcessing = getXSLTC().isSecureProcessing();
                     final boolean isExtensionFunctionEnabled = getXSLTC()
-                            .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
+                            .getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION);
 
                     //Check if FSP and SM - only then process with loading
                     if (namespace != null && isSecureProcessing
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -9,7 +9,7 @@
  * (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
+ *     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,
@@ -17,9 +17,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: LiteralElement.java,v 1.2.4.1 2005/09/13 12:38:33 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
@@ -58,8 +55,6 @@
     // names are not known at compile time.
     private boolean _allAttributesUnique = false;
 
-    private final static String XMLNS_STRING = "xmlns";
-
     /**
      * Returns the QName for this literal element
      */
@@ -140,8 +135,8 @@
         // Treat default namespace as "" and not null
         if (prefix == null)
             prefix = Constants.EMPTYSTRING;
-        else if (prefix.equals(XMLNS_STRING))
-            return(XMLNS_STRING);
+        else if (prefix.equals(XMLNS_PREFIX))
+            return(XMLNS_PREFIX);
 
         // Check if we must translate the prefix
         final String alternative = stable.lookupPrefixAlias(prefix);
@@ -264,7 +259,7 @@
                 // Ignore special attributes (e.g. xmlns:prefix and xmlns)
                 final String prefix = qname.getPrefix();
                 if (prefix != null && prefix.equals(XMLNS_PREFIX) ||
-                    prefix == null && qname.getLocalPart().equals("xmlns") ||
+                    prefix == null && qname.getLocalPart().equals(XMLNS_PREFIX) ||
                     uri != null && uri.equals(XSLT_URI))
                 {
                     continue;
@@ -337,9 +332,9 @@
         il.append(methodGen.startElement());
 
         // The value of an attribute may depend on a (sibling) variable
-        int j=0;
+        int j = 0;
         while (j < elementCount())  {
-            final SyntaxTreeNode item = (SyntaxTreeNode) elementAt(j);
+            final SyntaxTreeNode item = elementAt(j);
             if (item instanceof Variable) {
                 item.translate(classGen, methodGen);
             }
@@ -348,35 +343,12 @@
 
         // Compile code to emit namespace attributes
         if (_accessedPrefixes != null) {
-            boolean declaresDefaultNS = false;
-
             for (Map.Entry<String, String> entry : _accessedPrefixes.entrySet()) {
                 final String prefix = entry.getKey();
                 final String uri = entry.getValue();
-
-                if (uri != Constants.EMPTYSTRING ||
-                        prefix != Constants.EMPTYSTRING)
-                {
-                    if (prefix == Constants.EMPTYSTRING) {
-                        declaresDefaultNS = true;
-                    }
-                    il.append(methodGen.loadHandler());
-                    il.append(new PUSH(cpg,prefix));
-                    il.append(new PUSH(cpg,uri));
-                    il.append(methodGen.namespace());
-                }
-            }
-
-            /*
-             * If our XslElement parent redeclares the default NS, and this
-             * element doesn't, it must be redeclared one more time.
-             */
-            if (!declaresDefaultNS && (_parent instanceof XslElement)
-                    && ((XslElement) _parent).declaresDefaultNS())
-            {
                 il.append(methodGen.loadHandler());
-                il.append(new PUSH(cpg, Constants.EMPTYSTRING));
-                il.append(new PUSH(cpg, Constants.EMPTYSTRING));
+                il.append(new PUSH(cpg, prefix));
+                il.append(new PUSH(cpg, uri));
                 il.append(methodGen.namespace());
             }
         }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,9 +17,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: Parser.java,v 1.2.4.1 2005/09/13 12:14:32 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
@@ -37,6 +34,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -44,17 +42,20 @@
 import java.util.Properties;
 import java.util.Stack;
 import java.util.StringTokenizer;
-import java.util.Vector;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.AttributesImpl;
@@ -68,20 +69,20 @@
  */
 public class Parser implements Constants, ContentHandler {
 
-    private static final String XSL = "xsl";            // standard prefix
+    private static final String XSL = "xsl";           // standard prefix
     private static final String TRANSLET = "translet"; // extension prefix
 
     private Locator _locator = null;
 
-    private XSLTC _xsltc;             // Reference to the compiler object.
-    private XPathParser _xpathParser; // Reference to the XPath parser.
-    private Vector _errors;           // Contains all compilation errors
-    private Vector _warnings;         // Contains all compilation errors
+    private XSLTC _xsltc;                  // Reference to the compiler object.
+    private XPathParser _xpathParser;      // Reference to the XPath parser.
+    private ArrayList<ErrorMsg> _errors;   // Contains all compilation errors
+    private ArrayList<ErrorMsg> _warnings; // Contains all compilation warnings
 
     private Map<String, String>   _instructionClasses; // Maps instructions to classes
     private Map<String, String[]> _instructionAttrs;  // reqd and opt attrs
-    private Map<String, QName>   _qNames;
-    private Map<String, Map>     _namespaces;
+    private Map<String, QName>    _qNames;
+    private Map<String, Map<String, QName>> _namespaces;
     private QName       _useAttributeSets;
     private QName       _excludeResultPrefixes;
     private QName       _extensionElementPrefixes;
@@ -113,8 +114,8 @@
         _instructionAttrs    = new HashMap<>();
         _variableScope       = new HashMap<>();
         _template            = null;
-        _errors              = new Vector();
-        _warnings            = new Vector();
+        _errors              = new ArrayList<>();
+        _warnings            = new ArrayList<>();
         _symbolTable         = new SymbolTable();
         _xpathParser         = new XPathParser(this);
         _currentStylesheet   = null;
@@ -139,7 +140,6 @@
     public void setOutput(Output output) {
         if (_output != null) {
             if (_output.getImportPrecedence() <= output.getImportPrecedence()) {
-                String cdata = _output.getCdata();
                 output.mergeOutput(_output);
                 _output.disable();
                 _output = output;
@@ -173,12 +173,13 @@
         Object existing = _variableScope.get(var.getName().getStringRep());
         if (existing != null) {
             if (existing instanceof Stack) {
-                Stack stack = (Stack)existing;
+                @SuppressWarnings("unchecked")
+                Stack<VariableBase> stack = (Stack<VariableBase>)existing;
                 stack.push(var);
             }
             else if (existing instanceof VariableBase) {
-                Stack stack = new Stack();
-                stack.push(existing);
+                Stack<VariableBase> stack = new Stack<>();
+                stack.push((VariableBase)existing);
                 stack.push(var);
                 _variableScope.put(var.getName().getStringRep(), stack);
             }
@@ -191,7 +192,8 @@
     public void removeVariable(QName name) {
         Object existing = _variableScope.get(name.getStringRep());
         if (existing instanceof Stack) {
-            Stack stack = (Stack)existing;
+            @SuppressWarnings("unchecked")
+            Stack<VariableBase> stack = (Stack<VariableBase>)existing;
             if (!stack.isEmpty()) stack.pop();
             if (!stack.isEmpty()) return;
         }
@@ -201,13 +203,14 @@
     public VariableBase lookupVariable(QName name) {
         Object existing = _variableScope.get(name.getStringRep());
         if (existing instanceof VariableBase) {
-            return((VariableBase)existing);
+            return (VariableBase)existing;
         }
         else if (existing instanceof Stack) {
-            Stack stack = (Stack)existing;
-            return((VariableBase)stack.peek());
+            @SuppressWarnings("unchecked")
+            Stack<VariableBase> stack = (Stack<VariableBase>)existing;
+            return stack.peek();
         }
-        return(null);
+        return null;
     }
 
     public void setXSLTC(XSLTC xsltc) {
@@ -397,10 +400,9 @@
         try {
             if (stylesheet != null) {
                 stylesheet.parseContents(this);
-                final int precedence = stylesheet.getImportPrecedence();
                 final Iterator<SyntaxTreeNode> elements = stylesheet.elements();
                 while (elements.hasNext()) {
-                    Object child = elements.next();
+                    SyntaxTreeNode child = elements.next();
                     if (child instanceof Text) {
                         final int l = getLineNumber();
                         ErrorMsg err =
@@ -475,9 +477,10 @@
             try {
                 factory.setFeature(Constants.NAMESPACE_FEATURE,true);
             }
-            catch (Exception e) {
+            catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
                 factory.setNamespaceAware(true);
             }
+
             final SAXParser parser = factory.newSAXParser();
             try {
                 parser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
@@ -488,6 +491,28 @@
                 reportError(WARNING, err);
             }
 
+            boolean supportCatalog = true;
+            boolean useCatalog = _xsltc.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG);
+            try {
+                factory.setFeature(JdkXmlUtils.USE_CATALOG,useCatalog);
+            }
+            catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+                supportCatalog = false;
+            }
+
+            if (supportCatalog && useCatalog) {
+                try {
+                    CatalogFeatures cf = (CatalogFeatures)_xsltc.getProperty(JdkXmlFeatures.CATALOG_FEATURES);
+                    if (cf != null) {
+                        for (CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+                            parser.setProperty(f.getPropertyName(), cf.get(f));
+                        }
+                    }
+                } catch (SAXNotRecognizedException e) {
+                    //shall not happen for internal settings
+                }
+            }
+
             final XMLReader reader = parser.getXMLReader();
             String lastProperty = "";
             try {
@@ -704,8 +729,6 @@
            new String[] {"stylesheet-prefix", "result-prefix"});
     }
 
-
-
     /**
      * Initialize the _instructionClasses map, which maps XSL element
      * names to Java classes in this package.
@@ -779,6 +802,7 @@
     /**
      * Add primops and base functions to the symbol table.
      */
+    @SuppressWarnings("unused")
     private void initSymbolTable() {
         MethodType I_V  = new MethodType(Type.Int, Type.Void);
         MethodType I_R  = new MethodType(Type.Int, Type.Real);
@@ -971,12 +995,12 @@
         String local, Attributes attributes)
     {
         SyntaxTreeNode node = null;
-        QName  qname = getQName(uri, prefix, local);
+        QName qname = getQName(uri, prefix, local);
         String className = _instructionClasses.get(qname.getStringRep());
 
         if (className != null) {
             try {
-                final Class clazz = ObjectFactory.findProviderClass(className, true);
+                final Class<?> clazz = ObjectFactory.findProviderClass(className, true);
                 node = (SyntaxTreeNode)clazz.newInstance();
                 node.setQName(qname);
                 node.setParser(this);
@@ -1023,7 +1047,7 @@
                 else {
                     Stylesheet sheet = _xsltc.getStylesheet();
                     if ((sheet != null) && (sheet.isExtension(uri))) {
-                        if (sheet != (SyntaxTreeNode)_parentStack.peek()) {
+                        if (sheet != _parentStack.peek()) {
                             node = new UnsupportedElement(uri, prefix, local, true);
                             UnsupportedElement elem = (UnsupportedElement)node;
                             ErrorMsg msg =
@@ -1156,7 +1180,6 @@
                     node.setParser(this);
                     node.setParent(parent);
                     node.setLineNumber(line);
-// System.out.println("e = " + text + " " + node);
                     return node;
                 }
             }
@@ -1191,7 +1214,7 @@
         if (size > 0) {
             System.err.println(new ErrorMsg(ErrorMsg.COMPILER_ERROR_KEY));
             for (int i = 0; i < size; i++) {
-                System.err.println("  " + _errors.elementAt(i));
+                System.err.println("  " + _errors.get(i));
             }
         }
     }
@@ -1204,7 +1227,7 @@
         if (size > 0) {
             System.err.println(new ErrorMsg(ErrorMsg.COMPILER_WARNING_KEY));
             for (int i = 0; i < size; i++) {
-                System.err.println("  " + _warnings.elementAt(i));
+                System.err.println("  " + _warnings.get(i));
             }
         }
     }
@@ -1217,42 +1240,42 @@
         case Constants.INTERNAL:
             // Unexpected internal errors, such as null-ptr exceptions, etc.
             // Immediately terminates compilation, no translet produced
-            _errors.addElement(error);
+            _errors.add(error);
             break;
         case Constants.UNSUPPORTED:
             // XSLT elements that are not implemented and unsupported ext.
             // Immediately terminates compilation, no translet produced
-            _errors.addElement(error);
+            _errors.add(error);
             break;
         case Constants.FATAL:
             // Fatal error in the stylesheet input (parsing or content)
             // Immediately terminates compilation, no translet produced
-            _errors.addElement(error);
+            _errors.add(error);
             break;
         case Constants.ERROR:
             // Other error in the stylesheet input (parsing or content)
             // Does not terminate compilation, no translet produced
-            _errors.addElement(error);
+            _errors.add(error);
             break;
         case Constants.WARNING:
             // Other error in the stylesheet input (content errors only)
             // Does not terminate compilation, a translet is produced
-            _warnings.addElement(error);
+            _warnings.add(error);
             break;
         }
     }
 
-    public Vector getErrors() {
+    public ArrayList<ErrorMsg> getErrors() {
         return _errors;
     }
 
-    public Vector getWarnings() {
+    public ArrayList<ErrorMsg> getWarnings() {
         return _warnings;
     }
 
     /************************ SAX2 ContentHandler INTERFACE *****************/
 
-    private Stack _parentStack = null;
+    private Stack<SyntaxTreeNode> _parentStack = null;
     private Map<String, String> _prefixMapping = null;
 
     /**
@@ -1262,7 +1285,7 @@
         _root = null;
         _target = null;
         _prefixMapping = null;
-        _parentStack = new Stack();
+        _parentStack = new Stack<>();
     }
 
     /**
@@ -1318,7 +1341,7 @@
             _root = element;
         }
         else {
-            SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
+            SyntaxTreeNode parent = _parentStack.peek();
             parent.addElement(element);
             element.setParent(parent);
         }
@@ -1349,7 +1372,7 @@
      */
     public void characters(char[] ch, int start, int length) {
         String string = new String(ch, start, length);
-        SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
+        SyntaxTreeNode parent = _parentStack.peek();
 
         if (string.length() == 0) return;
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java	Fri Aug 05 12:03:58 2016 -0700
@@ -73,7 +73,7 @@
     protected QName _qname;                    // The element QName
     private int _line;                         // Source file line number
     protected AttributesImpl _attributes = null;   // Attributes of this element
-    private   Map<String, String> _prefixMapping = null; // Namespace declarations
+    private Map<String, String> _prefixMapping = null; // Namespace declarations
 
     // Sentinel - used to denote unrecognised syntaxt tree nodes.
     protected static final SyntaxTreeNode Dummy = new AbsolutePathPattern(null);
@@ -828,7 +828,7 @@
      * @param pos The child node's position.
      * @return The child node.
      */
-    protected final Object elementAt(int pos) {
+    protected final SyntaxTreeNode elementAt(int pos) {
         return _contents.get(pos);
     }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,16 +17,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: XSLTC.java,v 1.2.4.1 2005/09/05 09:51:38 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
 import com.sun.org.apache.bcel.internal.classfile.JavaClass;
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -39,20 +34,21 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Properties;
-import java.util.Objects;
 import java.util.Vector;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import jdk.xml.internal.JdkXmlFeatures;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 
@@ -101,7 +97,7 @@
 
 
     // All literal text in the stylesheet
-    private Vector m_characterData;
+    private ArrayList<StringBuilder> m_characterData;
 
     // These define the various methods for outputting the translet
     public static final int FILE_OUTPUT        = 0;
@@ -152,26 +148,31 @@
 
     private XMLSecurityManager _xmlSecurityManager;
 
-    private final FeatureManager _featureManager;
+    private final JdkXmlFeatures _xmlFeatures;
 
     /**
     *  Extension function class loader variables
     */
 
-    /* Class loader reference that will be used to external extension functions loading */
+    /* Class loader reference that will be used for external extension functions loading */
     private ClassLoader _extensionClassLoader;
 
     /**
-    *  HashSet with the loaded classes
+    *  HashMap with the loaded classes
     */
     private final Map<String, Class> _externalExtensionFunctions;
 
     /**
+     * Catalog features
+     */
+    CatalogFeatures _catalogFeatures;
+
+    /**
      * XSLTC compiler constructor
      */
-    public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
+    public XSLTC(boolean useServicesMechanism, JdkXmlFeatures featureManager) {
         _parser = new Parser(this, useServicesMechanism);
-        _featureManager = featureManager;
+        _xmlFeatures = featureManager;
         _extensionClassLoader = null;
         _externalExtensionFunctions = new HashMap<>();
     }
@@ -208,12 +209,14 @@
      * @param name name of the feature
      * @return true if the feature is enabled, false otherwise
      */
-    public boolean getFeature(Feature name) {
-        return _featureManager.isFeatureEnabled(name);
+    public boolean getFeature(JdkXmlFeatures.XmlFeature name) {
+        return _xmlFeatures.getFeature(name);
     }
 
     /**
      * Return allowed protocols for accessing external stylesheet.
+     * @param name the name of the property
+     * @return the value of the property
      */
     public Object getProperty(String name) {
         if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
@@ -225,12 +228,16 @@
             return _xmlSecurityManager;
         } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
             return _extensionClassLoader;
+        } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
+            return _catalogFeatures;
         }
         return null;
     }
 
     /**
      * Set allowed protocols for accessing external stylesheet.
+     * @param name the name of the property
+     * @param value the value of the property
      */
     public void setProperty(String name, Object value) {
         if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
@@ -245,6 +252,8 @@
             /* Clear the external extension functions HashMap if extension class
                loader was changed */
             _externalExtensionFunctions.clear();
+        } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
+            _catalogFeatures = (CatalogFeatures)value;
         }
     }
 
@@ -286,7 +295,7 @@
     }
 
     /*
-     * Function loads an external external extension functions.
+     * Function loads an external extension function.
      * The filtering of function types (external,internal) takes place in FunctionCall class
      *
      */
@@ -601,18 +610,18 @@
     }
 
     /**
-     * Get a Vector containing all compile error messages
-     * @return A Vector containing all compile error messages
+     * Get a list of all compile error messages
+     * @return A List containing all compile error messages
      */
-    public Vector getErrors() {
+    public ArrayList<ErrorMsg> getErrors() {
         return _parser.getErrors();
     }
 
     /**
-     * Get a Vector containing all compile warning messages
-     * @return A Vector containing all compile error messages
+     * Get a list of all compile warning messages
+     * @return A List containing all compile error messages
      */
-    public Vector getWarnings() {
+    public ArrayList<ErrorMsg> getWarnings() {
         return _parser.getWarnings();
     }
 
@@ -991,7 +1000,7 @@
      *               <code>char[]</code>.
      */
     public String getCharacterData(int index) {
-        return ((StringBuffer) m_characterData.elementAt(index)).toString();
+        return (m_characterData.get(index)).toString();
     }
 
     /**
@@ -1010,14 +1019,13 @@
      * @return int offset at which character data will be stored
      */
     public int addCharacterData(String newData) {
-        StringBuffer currData;
+        StringBuilder currData;
         if (m_characterData == null) {
-            m_characterData = new Vector();
-            currData = new StringBuffer();
-            m_characterData.addElement(currData);
+            m_characterData = new ArrayList<>();
+            currData = new StringBuilder();
+            m_characterData.add(currData);
         } else {
-            currData = (StringBuffer) m_characterData
-                                           .elementAt(m_characterData.size()-1);
+            currData = m_characterData.get(m_characterData.size()-1);
         }
 
         // Character data could take up to three-times as much space when
@@ -1025,8 +1033,8 @@
         // constant is 65535/3.  If we exceed that,
         // (We really should use some "bin packing".)
         if (newData.length() + currData.length() > 21845) {
-            currData = new StringBuffer();
-            m_characterData.addElement(currData);
+            currData = new StringBuilder();
+            m_characterData.add(currData);
         }
 
         int newDataOffset = currData.length();
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,16 +17,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: XslElement.java,v 1.2.4.1 2005/09/12 11:39:55 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.compiler;
 
 import com.sun.org.apache.bcel.internal.generic.ALOAD;
 import com.sun.org.apache.bcel.internal.generic.ASTORE;
 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
-import com.sun.org.apache.bcel.internal.generic.ICONST;
 import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
 import com.sun.org.apache.bcel.internal.generic.InstructionList;
 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
@@ -61,14 +57,6 @@
         displayContents(indent + IndentIncrement);
     }
 
-    /**
-     * This method is now deprecated. The new implemation of this class
-     * never declares the default NS.
-     */
-    public boolean declaresDefaultNS() {
-        return false;
-    }
-
     public void parseContents(Parser parser) {
         final SymbolTable stable = parser.getSymbolTable();
 
@@ -211,7 +199,6 @@
      * on the handler (vii) evaluates the contents (viii) calls endElement().
      */
     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
-        LocalVariableGen local = null;
         final ConstantPoolGen cpg = classGen.getConstantPool();
         final InstructionList il = methodGen.getInstructionList();
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -17,18 +17,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: TemplatesHandlerImpl.java,v 1.2.4.1 2005/09/06 12:09:03 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.TemplatesHandler;
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser;
@@ -37,14 +28,20 @@
 import com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
-
+import java.util.ArrayList;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.sax.TemplatesHandler;
+import jdk.xml.internal.JdkXmlFeatures;
+import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
-import org.xml.sax.Attributes;
-
-import java.util.Vector;
 
 /**
  * Implementation of a JAXP1.1 TemplatesHandler
@@ -85,6 +82,12 @@
      */
     private TemplatesImpl _templates = null;
 
+    // Catalog features
+    CatalogFeatures _catalogFeatures;
+
+    // Catalog is enabled by default
+    boolean _useCatalog = true;
+
     /**
      * Default constructor
      */
@@ -95,7 +98,7 @@
         _tfactory = tfactory;
 
         // Instantiate XSLTC and get reference to parser object
-        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
+        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getJdkXmlFeatures());
         if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
             xsltc.setSecureProcessing(true);
 
@@ -112,6 +115,10 @@
         else
             xsltc.setTemplateInlining(false);
 
+        _useCatalog = tfactory.getFeature(XMLConstants.USE_CATALOG);
+        _catalogFeatures = (CatalogFeatures)tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
+        xsltc.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
+
         _parser = xsltc.getParser();
     }
 
@@ -229,7 +236,8 @@
                    stylesheet.setTemplateInlining(false);
 
                 // Set a document loader (for xsl:include/import) if defined
-                if (_uriResolver != null) {
+                if (_uriResolver != null || (_useCatalog &&
+                        _catalogFeatures.get(CatalogFeatures.Feature.FILES) != null)) {
                     stylesheet.setSourceLoader(this);
                 }
 
@@ -268,13 +276,13 @@
                 }
             }
             else {
-                StringBuffer errorMessage = new StringBuffer();
-                Vector errors = _parser.getErrors();
+                StringBuilder errorMessage = new StringBuilder();
+                ArrayList<ErrorMsg> errors = _parser.getErrors();
                 final int count = errors.size();
                 for (int i = 0; i < count; i++) {
                     if (errorMessage.length() > 0)
                         errorMessage.append('\n');
-                    errorMessage.append(errors.elementAt(i).toString());
+                    errorMessage.append(errors.get(i).toString());
                 }
                 throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, new TransformerException(errorMessage.toString()));
             }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,17 +17,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: TransformerFactoryImpl.java,v 1.8 2007/04/09 21:30:41 joehw Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
-import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
@@ -48,6 +43,7 @@
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Properties;
@@ -55,6 +51,10 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.ErrorListener;
@@ -75,6 +75,8 @@
 import javax.xml.transform.stax.*;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLFilter;
 import org.xml.sax.XMLReader;
@@ -86,6 +88,7 @@
  * @author Morten Jorgensen
  * @author Santiago Pericas-Geertsen
  */
+@SuppressWarnings("deprecation") //org.xml.sax.helpers.XMLReaderFactory
 public class TransformerFactoryImpl
     extends SAXTransformerFactory implements SourceLoader, ErrorListener
 {
@@ -229,7 +232,7 @@
     private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
     private XMLSecurityManager _xmlSecurityManager;
 
-    private final FeatureManager _featureManager;
+    private final JdkXmlFeatures _xmlFeatures;
 
     private ClassLoader _extensionClassLoader = null;
 
@@ -238,6 +241,15 @@
     // type checking
     private Map<String, Class> _xsltcExtensionFunctions;
 
+    CatalogUriResolver _catalogUriResolver;
+    CatalogFeatures _catalogFeatures;
+    CatalogFeatures.Builder cfBuilder = CatalogFeatures.builder();
+    // Catalog features
+    String _catalogFiles = null;
+    String _catalogDefer = null;
+    String _catalogPrefer = null;
+    String _catalogResolve = null;
+
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
      */
@@ -251,15 +263,13 @@
 
     private TransformerFactoryImpl(boolean useServicesMechanism) {
         this._useServicesMechanism = useServicesMechanism;
-        _featureManager = new FeatureManager();
 
         if (System.getSecurityManager() != null) {
             _isSecureMode = true;
             _isNotSecureProcessing = false;
-            _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                    FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
         }
 
+        _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
         _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
         _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
                 Property.ACCESS_EXTERNAL_DTD);
@@ -332,10 +342,10 @@
             return _transletName;
         }
         else if (name.equals(GENERATE_TRANSLET)) {
-            return new Boolean(_generateTranslet);
+            return _generateTranslet;
         }
         else if (name.equals(AUTO_TRANSLET)) {
-            return new Boolean(_autoTranslet);
+            return _autoTranslet;
         }
         else if (name.equals(ENABLE_INLINING)) {
             if (_enableInlining)
@@ -346,6 +356,16 @@
             return _xmlSecurityManager;
         } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
            return _extensionClassLoader;
+        } else if (JdkXmlUtils.CATALOG_FILES.equals(name)) {
+            return _catalogFiles;
+        } else if (JdkXmlUtils.CATALOG_DEFER.equals(name)) {
+            return _catalogDefer;
+        } else if (JdkXmlUtils.CATALOG_PREFER.equals(name)) {
+            return _catalogPrefer;
+        } else if (JdkXmlUtils.CATALOG_RESOLVE.equals(name)) {
+            return _catalogResolve;
+        } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
+            return buildCatalogFeatures();
         }
 
         /** Check to see if the property is managed by the security manager **/
@@ -398,7 +418,7 @@
         }
         else if (name.equals(GENERATE_TRANSLET)) {
             if (value instanceof Boolean) {
-                _generateTranslet = ((Boolean) value).booleanValue();
+                _generateTranslet = ((Boolean) value);
                 return;
             }
             else if (value instanceof String) {
@@ -408,7 +428,7 @@
         }
         else if (name.equals(AUTO_TRANSLET)) {
             if (value instanceof Boolean) {
-                _autoTranslet = ((Boolean) value).booleanValue();
+                _autoTranslet = ((Boolean) value);
                 return;
             }
             else if (value instanceof String) {
@@ -418,7 +438,7 @@
         }
         else if (name.equals(USE_CLASSPATH)) {
             if (value instanceof Boolean) {
-                _useClasspath = ((Boolean) value).booleanValue();
+                _useClasspath = ((Boolean) value);
                 return;
             }
             else if (value instanceof String) {
@@ -428,7 +448,7 @@
         }
         else if (name.equals(DEBUG)) {
             if (value instanceof Boolean) {
-                _debug = ((Boolean) value).booleanValue();
+                _debug = ((Boolean) value);
                 return;
             }
             else if (value instanceof String) {
@@ -438,7 +458,7 @@
         }
         else if (name.equals(ENABLE_INLINING)) {
             if (value instanceof Boolean) {
-                _enableInlining = ((Boolean) value).booleanValue();
+                _enableInlining = ((Boolean) value);
                 return;
             }
             else if (value instanceof String) {
@@ -457,7 +477,7 @@
                 }
             }
             else if (value instanceof Integer) {
-                _indentNumber = ((Integer) value).intValue();
+                _indentNumber = ((Integer) value);
                 return;
             }
         }
@@ -470,6 +490,22 @@
                     = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_VALUE_ERR, "Extension Functions ClassLoader");
                 throw new IllegalArgumentException(err.toString());
             }
+        } else if (JdkXmlUtils.CATALOG_FILES.equals(name)) {
+            _catalogFiles = (String) value;
+            cfBuilder = CatalogFeatures.builder().with(Feature.FILES, _catalogFiles);
+            return;
+        } else if (JdkXmlUtils.CATALOG_DEFER.equals(name)) {
+            _catalogDefer = (String) value;
+            cfBuilder = CatalogFeatures.builder().with(Feature.DEFER, _catalogDefer);
+            return;
+        } else if (JdkXmlUtils.CATALOG_PREFER.equals(name)) {
+            _catalogPrefer = (String) value;
+            cfBuilder = CatalogFeatures.builder().with(Feature.PREFER, _catalogPrefer);
+            return;
+        } else if (JdkXmlUtils.CATALOG_RESOLVE.equals(name)) {
+            _catalogResolve = (String) value;
+            cfBuilder = CatalogFeatures.builder().with(Feature.RESOLVE, _catalogResolve);
+            return;
         }
 
         if (_xmlSecurityManager != null &&
@@ -534,18 +570,18 @@
             // set external access restriction when FSP is explicitly set
             if (value) {
                 _xmlSecurityPropertyMgr.setValue(Property.ACCESS_EXTERNAL_DTD,
-                        State.FSP, XalanConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
+                        FeaturePropertyBase.State.FSP, XalanConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
                 _xmlSecurityPropertyMgr.setValue(Property.ACCESS_EXTERNAL_STYLESHEET,
-                        State.FSP, XalanConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
+                        FeaturePropertyBase.State.FSP, XalanConstants.EXTERNAL_ACCESS_DEFAULT_FSP);
                 _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
                         Property.ACCESS_EXTERNAL_DTD);
                 _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
                         Property.ACCESS_EXTERNAL_STYLESHEET);
             }
 
-            if (value && _featureManager != null) {
-                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+            if (value && _xmlFeatures != null) {
+                _xmlFeatures.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION,
+                        JdkXmlFeatures.State.FSP, false);
             }
         }
         else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
@@ -554,8 +590,8 @@
                 _useServicesMechanism = value;
         }
         else {
-            if (_featureManager != null &&
-                    _featureManager.setValue(name, State.APIPROPERTY, value)) {
+            if (_xmlFeatures != null &&
+                    _xmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
                 return;
             }
 
@@ -598,21 +634,20 @@
         }
 
         // Inefficient, but array is small
-        for (int i =0; i < features.length; i++) {
+        for (int i = 0; i < features.length; i++) {
             if (name.equals(features[i])) {
                 return true;
             }
         }
-        // secure processing?
+
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
-                return !_isNotSecureProcessing;
+            return !_isNotSecureProcessing;
         }
 
-        /** Check to see if the property is managed by the security manager **/
-        String propertyValue = (_featureManager != null) ?
-                _featureManager.getValueAsString(name) : null;
-        if (propertyValue != null) {
-            return Boolean.parseBoolean(propertyValue);
+        /** Check to see if the property is managed by the JdkXmlFeatues **/
+        int index = _xmlFeatures.getIndex(name);
+        if (index > -1) {
+            return _xmlFeatures.getFeature(index);
         }
 
         // Feature not supported
@@ -628,8 +663,8 @@
      /**
      * @return the feature manager
      */
-    public FeatureManager getFeatureManager() {
-        return _featureManager;
+    public JdkXmlFeatures getJdkXmlFeatures() {
+        return _xmlFeatures;
     }
 
     /**
@@ -736,21 +771,9 @@
         } catch (StopParseException e ) {
           // startElement encountered so do not parse further
 
-        } catch (javax.xml.parsers.ParserConfigurationException e) {
-
+        } catch (javax.xml.parsers.ParserConfigurationException | org.xml.sax.SAXException | IOException e) {
              throw new TransformerConfigurationException(
              "getAssociatedStylesheets failed", e);
-
-        } catch (org.xml.sax.SAXException se) {
-
-             throw new TransformerConfigurationException(
-             "getAssociatedStylesheets failed", se);
-
-
-        } catch (IOException ioe ) {
-           throw new TransformerConfigurationException(
-           "getAssociatedStylesheets failed", ioe);
-
         }
 
          return _stylesheetPIHandler.getAssociatedStylesheet();
@@ -768,6 +791,9 @@
     public Transformer newTransformer()
         throws TransformerConfigurationException
     {
+        // create CatalogFeatures that is accessible by the Transformer
+        // through the factory instance
+        buildCatalogFeatures();
         TransformerImpl result = new TransformerImpl(new Properties(),
             _indentNumber, this);
         if (_uriResolver != null) {
@@ -805,7 +831,7 @@
     /**
      * Pass warning messages from the compiler to the error listener
      */
-    private void passWarningsToListener(Vector messages)
+    private void passWarningsToListener(ArrayList<ErrorMsg> messages)
         throws TransformerException
     {
         if (_errorListener == null || messages == null) {
@@ -814,7 +840,7 @@
         // Pass messages to listener, one by one
         final int count = messages.size();
         for (int pos = 0; pos < count; pos++) {
-            ErrorMsg msg = (ErrorMsg)messages.elementAt(pos);
+            ErrorMsg msg = messages.get(pos);
             // Workaround for the TCK failure ErrorListener.errorTests.error001.
             if (msg.isWarningError())
                 _errorListener.error(
@@ -828,7 +854,7 @@
     /**
      * Pass error messages from the compiler to the error listener
      */
-    private void passErrorsToListener(Vector messages) {
+    private void passErrorsToListener(ArrayList<ErrorMsg> messages) {
         try {
             if (_errorListener == null || messages == null) {
                 return;
@@ -836,7 +862,7 @@
             // Pass messages to listener, one by one
             final int count = messages.size();
             for (int pos = 0; pos < count; pos++) {
-                String message = messages.elementAt(pos).toString();
+                String message = messages.get(pos).toString();
                 _errorListener.error(new TransformerException(message));
             }
         }
@@ -858,6 +884,7 @@
     public Templates newTemplates(Source source)
         throws TransformerConfigurationException
     {
+        TemplatesImpl templates;
         // If the _useClasspath attribute is true, try to load the translet from
         // the CLASSPATH and create a template object using the loaded
         // translet.
@@ -871,7 +898,11 @@
                 final Class clazz = ObjectFactory.findProviderClass(transletName, true);
                 resetTransientAttributes();
 
-                return new TemplatesImpl(new Class[]{clazz}, transletName, null, _indentNumber, this);
+                templates = new TemplatesImpl(new Class[]{clazz}, transletName, null, _indentNumber, this);
+                if (_uriResolver != null) {
+                    templates.setURIResolver(_uriResolver);
+                }
+                return templates;
             }
             catch (ClassNotFoundException cnfe) {
                 ErrorMsg err = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, transletName);
@@ -892,7 +923,7 @@
             String transletClassName = getTransletBaseName(source);
 
             if (_packageName != null)
-               transletClassName = _packageName + "." + transletClassName;
+                transletClassName = _packageName + "." + transletClassName;
 
             if (_jarFileName != null)
                 bytecodes = getBytecodesFromJar(source, transletClassName);
@@ -912,12 +943,16 @@
                 // Reset the per-session attributes to their default values
                 // after each newTemplates() call.
                 resetTransientAttributes();
-                return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);
+                templates = new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);
+                if (_uriResolver != null) {
+                    templates.setURIResolver(_uriResolver);
+                }
+                return templates;
             }
         }
 
         // Create and initialize a stylesheet compiler
-        final XSLTC xsltc = new XSLTC(_useServicesMechanism, _featureManager);
+        final XSLTC xsltc = new XSLTC(_useServicesMechanism, _xmlFeatures);
         if (_debug) xsltc.setDebug(true);
         if (_enableInlining)
                 xsltc.setTemplateInlining(true);
@@ -929,11 +964,17 @@
         xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
         xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager);
         xsltc.setProperty(XalanConstants.JDK_EXTENSION_CLASSLOADER, _extensionClassLoader);
+
+        // set Catalog features
+        buildCatalogFeatures();
+        xsltc.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
+
         xsltc.init();
         if (!_isNotSecureProcessing)
             _xsltcExtensionFunctions = xsltc.getExternalExtensionFunctions();
         // Set a document loader (for xsl:include/import) if defined
-        if (_uriResolver != null) {
+        if (_uriResolver != null || ( _catalogFiles != null
+                && _xmlFeatures.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG))) {
             xsltc.setSourceLoader(this);
         }
 
@@ -1010,43 +1051,47 @@
         }
 
         // Check that the transformation went well before returning
-    if (bytecodes == null) {
-        Vector errs = xsltc.getErrors();
-        ErrorMsg err;
-        if (errs != null) {
-            err = (ErrorMsg)errs.elementAt(errs.size()-1);
-        } else {
-            err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
-        }
-        Throwable cause = err.getCause();
-        TransformerConfigurationException exc;
-        if (cause != null) {
-            exc =  new TransformerConfigurationException(cause.getMessage(), cause);
-        } else {
-            exc =  new TransformerConfigurationException(err.toString());
+        if (bytecodes == null) {
+            ArrayList<ErrorMsg> errs = xsltc.getErrors();
+            ErrorMsg err;
+            if (errs != null) {
+                err = errs.get(errs.size()-1);
+            } else {
+                err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
+            }
+            Throwable cause = err.getCause();
+            TransformerConfigurationException exc;
+            if (cause != null) {
+                exc =  new TransformerConfigurationException(cause.getMessage(), cause);
+            } else {
+                exc =  new TransformerConfigurationException(err.toString());
+            }
+
+            // Pass compiler errors to the error listener
+            if (_errorListener != null) {
+                passErrorsToListener(xsltc.getErrors());
+
+                // As required by TCK 1.2, send a fatalError to the
+                // error listener because compilation of the stylesheet
+                // failed and no further processing will be possible.
+                try {
+                    _errorListener.fatalError(exc);
+                } catch (TransformerException te) {
+                    // well, we tried.
+                }
+            }
+            else {
+                xsltc.printErrors();
+            }
+            throw exc;
         }
 
-        // Pass compiler errors to the error listener
-        if (_errorListener != null) {
-            passErrorsToListener(xsltc.getErrors());
-
-            // As required by TCK 1.2, send a fatalError to the
-            // error listener because compilation of the stylesheet
-            // failed and no further processing will be possible.
-            try {
-                _errorListener.fatalError(exc);
-            } catch (TransformerException te) {
-                // well, we tried.
-            }
+        templates = new TemplatesImpl(bytecodes, transletName, xsltc.getOutputProperties(),
+                _indentNumber, this);
+        if (_uriResolver != null) {
+            templates.setURIResolver(_uriResolver);
         }
-        else {
-            xsltc.printErrors();
-        }
-        throw exc;
-    }
-
-        return new TemplatesImpl(bytecodes, transletName,
-            xsltc.getOutputProperties(), _indentNumber, this);
+        return templates;
     }
 
     /**
@@ -1061,6 +1106,9 @@
     public TemplatesHandler newTemplatesHandler()
         throws TransformerConfigurationException
     {
+        // create CatalogFeatures that is accessible by the Handler
+        // through the factory instance
+        buildCatalogFeatures();
         final TemplatesHandlerImpl handler =
             new TemplatesHandlerImpl(_indentNumber, this);
         if (_uriResolver != null) {
@@ -1272,11 +1320,19 @@
     @Override
     public InputSource loadSource(String href, String context, XSLTC xsltc) {
         try {
+            Source source = null;
             if (_uriResolver != null) {
-                final Source source = _uriResolver.resolve(href, context);
-                if (source != null) {
-                    return Util.getInputSource(xsltc, source);
+                source = _uriResolver.resolve(href, context);
+            }
+            if (source == null && _catalogFiles != null &&
+                    _xmlFeatures.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG)) {
+                if (_catalogUriResolver == null) {
+                    _catalogUriResolver = CatalogManager.catalogUriResolver(_catalogFeatures);
                 }
+                source = _catalogUriResolver.resolve(href, context);
+            }
+            if (source != null) {
+                return Util.getInputSource(xsltc, source);
             }
         }
         catch (TransformerException e) {
@@ -1289,6 +1345,26 @@
     }
 
     /**
+     * Build the CatalogFeatures object when a newTemplates or newTransformer is
+     * created. This will read any System Properties for the CatalogFeatures that
+     * may have been set.
+     */
+    private CatalogFeatures buildCatalogFeatures() {
+        // build will cause the CatalogFeatures to read SPs for those not set through the API
+        if (_catalogFeatures == null) {
+            _catalogFeatures = cfBuilder.build();
+        }
+
+        // update fields
+        _catalogFiles = _catalogFeatures.get(Feature.FILES);
+        _catalogDefer = _catalogFeatures.get(Feature.DEFER);
+        _catalogPrefer = _catalogFeatures.get(Feature.PREFER);
+        _catalogResolve = _catalogFeatures.get(Feature.RESOLVE);
+
+        return _catalogFeatures;
+    }
+
+    /**
      * Reset the per-session attributes to their default values
      */
     private void resetTransientAttributes() {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -60,6 +60,9 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -80,6 +83,8 @@
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -217,6 +222,14 @@
      */
     private Map<String, Object> _parameters = null;
 
+    // Catalog features
+    CatalogFeatures _catalogFeatures;
+    CatalogUriResolver _catalogUriResolver;
+
+    // Catalog is enabled by default
+    boolean _useCatalog = true;
+
+
     /**
      * This class wraps an ErrorListener into a MessageHandler in order to
      * capture messages reported via xsl:message.
@@ -270,6 +283,16 @@
         _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
         _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
         _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
+
+        _useCatalog = _tfactory.getFeature(XMLConstants.USE_CATALOG);
+        if (_useCatalog) {
+            _catalogFeatures = (CatalogFeatures)_tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
+            String catalogFiles = _catalogFeatures.get(CatalogFeatures.Feature.DEFER);
+            if (catalogFiles != null) {
+                _readerManager.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
+                _readerManager.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
+            }
+        }
         //_isIncremental = tfactory._incremental;
     }
 
@@ -339,7 +362,8 @@
             throw new TransformerException(err.toString());
         }
 
-        if (_uriResolver != null && !_isIdentity) {
+        if (!_isIdentity && (_uriResolver != null || (_tfactory.getFeature(XMLConstants.USE_CATALOG)
+                    && _tfactory.getAttribute(JdkXmlUtils.CATALOG_FILES) != null))) {
             _translet.setDOMCache(this);
         }
 
@@ -723,15 +747,33 @@
                 ((SAXSource)source).getXMLReader()==null )||
                 (source instanceof DOMSource &&
                 ((DOMSource)source).getNode()==null)){
-                        DocumentBuilderFactory builderF = FactoryImpl.getDOMFactory(_useServicesMechanism);
-                        DocumentBuilder builder = builderF.newDocumentBuilder();
-                        String systemID = source.getSystemId();
-                        source = new DOMSource(builder.newDocument());
+
+                boolean supportCatalog = true;
+
+                DocumentBuilderFactory builderF = FactoryImpl.getDOMFactory(_useServicesMechanism);
+                try {
+                    builderF.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
+                } catch (ParserConfigurationException e) {
+                    supportCatalog = false;
+                }
 
-                        // Copy system ID from original, empty Source to new
-                        if (systemID != null) {
-                          source.setSystemId(systemID);
+                if (supportCatalog && _useCatalog) {
+                    CatalogFeatures cf = (CatalogFeatures)_tfactory.getAttribute(JdkXmlFeatures.CATALOG_FEATURES);
+                    if (cf != null) {
+                        for (CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+                            builderF.setAttribute(f.getPropertyName(), cf.get(f));
                         }
+                    }
+                }
+
+                DocumentBuilder builder = builderF.newDocumentBuilder();
+                String systemID = source.getSystemId();
+                source = new DOMSource(builder.newDocument());
+
+                // Copy system ID from original, empty Source to new
+                if (systemID != null) {
+                  source.setSystemId(systemID);
+                }
             }
             if (_isIdentity) {
                 transformIdentity(source, handler);
@@ -1287,7 +1329,19 @@
              *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
              *
              */
-            Source resolvedSource = _uriResolver.resolve(href, baseURI);
+            Source resolvedSource = null;
+            if (_uriResolver != null) {
+                resolvedSource = _uriResolver.resolve(href, baseURI);
+            }
+
+            if (resolvedSource == null && _useCatalog &&
+                    _catalogFeatures.get(CatalogFeatures.Feature.FILES) != null)  {
+                if (_catalogUriResolver == null) {
+                    _catalogUriResolver = CatalogManager.catalogUriResolver(_catalogFeatures);
+                }
+                resolvedSource = _catalogUriResolver.resolve(href, baseURI);
+            }
+
             if (resolvedSource == null)  {
                 StreamSource streamSource = new StreamSource(
                      SystemIDResolver.getAbsoluteURI(href, baseURI));
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -17,37 +17,32 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: Util.java,v 1.2.4.1 2005/09/14 09:37:34 pvedula Exp $
- */
 
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
+import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
+import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
+import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
 import java.io.InputStream;
 import java.io.Reader;
-
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
-
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLStreamReader;
-
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
-
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
-import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
-import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
-
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.Document;
-
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
@@ -57,6 +52,8 @@
 
 /**
  * @author Santiago Pericas-Geertsen
+ *
+ * Added Catalog Support for URI resolution
  */
 public final class Util {
 
@@ -72,9 +69,6 @@
         return com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util.toJavaName(name);
     }
 
-
-
-
     /**
      * Creates a SAX2 InputSource object from a TrAX Source object
      */
@@ -169,6 +163,29 @@
                     } catch (SAXException se) {
                         XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
                     }
+
+                    boolean supportCatalog = true;
+                    boolean useCatalog = xsltc.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG);
+                    try {
+                        reader.setFeature(JdkXmlUtils.USE_CATALOG, useCatalog);
+                    }
+                    catch (SAXNotRecognizedException | SAXNotSupportedException e) {
+                        supportCatalog = false;
+                    }
+
+                    if (supportCatalog & useCatalog) {
+                        try {
+                            CatalogFeatures cf = (CatalogFeatures)xsltc.getProperty(JdkXmlFeatures.CATALOG_FEATURES);
+                            if (cf != null) {
+                                for (Feature f : CatalogFeatures.Feature.values()) {
+                                    reader.setProperty(f.getPropertyName(), cf.get(f));
+                                }
+                            }
+                        } catch (SAXNotRecognizedException e) {
+                            //shall not happen for internal settings
+                        }
+                    }
+
                     xsltc.setXMLReader(reader);
                 }catch (SAXNotRecognizedException snre ) {
                   throw new TransformerConfigurationException
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -51,6 +51,10 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Locale;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMErrorHandler;
 import org.w3c.dom.DOMException;
@@ -191,7 +195,7 @@
     protected SymbolTable fSymbolTable;
 
     /** Components. */
-    protected ArrayList fComponents;
+    protected ArrayList<XMLComponent> fComponents;
 
     protected ValidationManager fValidationManager;
 
@@ -253,7 +257,8 @@
             NORMALIZE_DATA,
             SEND_PSVI,
             NAMESPACE_GROWTH,
-            TOLERATE_DUPLICATES
+            TOLERATE_DUPLICATES,
+            XMLConstants.USE_CATALOG
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -266,6 +271,7 @@
         setFeature(XERCES_NAMESPACES, true);
         setFeature(SEND_PSVI, true);
         setFeature(NAMESPACE_GROWTH, false);
+        setFeature(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
@@ -282,7 +288,11 @@
             DTD_VALIDATOR_FACTORY_PROPERTY,
             SCHEMA_DV_FACTORY,
             SECURITY_MANAGER,
-            XML_SECURITY_PROPERTY_MANAGER
+            XML_SECURITY_PROPERTY_MANAGER,
+            JdkXmlUtils.CATALOG_DEFER,
+            JdkXmlUtils.CATALOG_FILES,
+            JdkXmlUtils.CATALOG_PREFER,
+            JdkXmlUtils.CATALOG_RESOLVE
         };
         addRecognizedProperties(recognizedProperties);
 
@@ -300,7 +310,7 @@
         }
         fSymbolTable = symbolTable;
 
-        fComponents = new ArrayList();
+        fComponents = new ArrayList<>();
 
         setProperty(SYMBOL_TABLE, fSymbolTable);
         fErrorReporter = new XMLErrorReporter();
@@ -354,7 +364,10 @@
             // REVISIT: What is the right thing to do? -Ac
         }
 
-
+        // Initialize Catalog features
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            setProperty(f.getPropertyName(), null);
+        }
     } // <init>(SymbolTable)
 
 
@@ -1027,7 +1040,7 @@
 
         int count = fComponents.size();
         for (int i = 0; i < count; i++) {
-            XMLComponent c = (XMLComponent) fComponents.get(i);
+            XMLComponent c = fComponents.get(i);
             c.reset(this);
         }
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -29,9 +29,13 @@
 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
 import java.util.HashMap;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLResolver;
+import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
 
 /**
  *  This class manages different properties related to Stax specification and its implementation.
@@ -58,7 +62,7 @@
     private static final String XML_SECURITY_PROPERTY_MANAGER =
             Constants.XML_SECURITY_PROPERTY_MANAGER;
 
-    HashMap supportedProps = new HashMap();
+    HashMap<String, Object> supportedProps = new HashMap<>();
 
     private XMLSecurityManager fSecurityManager;
     private XMLSecurityPropertyManager fSecurityPropertyMgr;
@@ -85,13 +89,13 @@
      */
     public PropertyManager(PropertyManager propertyManager){
 
-        HashMap properties = propertyManager.getProperties();
+        HashMap<String, Object> properties = propertyManager.getProperties();
         supportedProps.putAll(properties);
         fSecurityManager = (XMLSecurityManager)getProperty(SECURITY_MANAGER);
         fSecurityPropertyMgr = (XMLSecurityPropertyManager)getProperty(XML_SECURITY_PROPERTY_MANAGER);
     }
 
-    private HashMap getProperties(){
+    private HashMap<String, Object> getProperties(){
         return supportedProps ;
     }
 
@@ -117,30 +121,36 @@
 
         //zephyr (implementation) specific properties which can be set by the application.
         //interning is always done
-        supportedProps.put(Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE , new Boolean(true));
+        supportedProps.put(Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE , true);
         //recognizing java encoding names by default
-        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE,  new Boolean(true)) ;
+        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE, true) ;
         //in stax mode, namespace declarations are not added as attributes
         supportedProps.put(Constants.ADD_NAMESPACE_DECL_AS_ATTRIBUTE ,  Boolean.FALSE) ;
-        supportedProps.put(Constants.READER_IN_DEFINED_STATE, new Boolean(true));
-        supportedProps.put(Constants.REUSE_INSTANCE, new Boolean(true));
-        supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT , new Boolean(false));
+        supportedProps.put(Constants.READER_IN_DEFINED_STATE, true);
+        supportedProps.put(Constants.REUSE_INSTANCE, true);
+        supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT , false);
         supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD, Boolean.FALSE);
-        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE, new Boolean(false));
-        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, new Boolean(false));
-        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, new Boolean(false));
+        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE, false);
+        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, false);
+        supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, false);
 
         fSecurityManager = new XMLSecurityManager(true);
         supportedProps.put(SECURITY_MANAGER, fSecurityManager);
         fSecurityPropertyMgr = new XMLSecurityPropertyManager();
         supportedProps.put(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
+
+        // Initialize Catalog features
+        supportedProps.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            supportedProps.put(f.getPropertyName(), null);
+        }
     }
 
     private void initWriterProps(){
         supportedProps.put(XMLOutputFactory.IS_REPAIRING_NAMESPACES , Boolean.FALSE);
         //default value of escaping characters is 'true'
         supportedProps.put(Constants.ESCAPE_CHARACTERS , Boolean.TRUE);
-        supportedProps.put(Constants.REUSE_INSTANCE, new Boolean(true));
+        supportedProps.put(Constants.REUSE_INSTANCE, true);
     }
 
     /**
@@ -160,20 +170,20 @@
 
     public void setProperty(String property, Object value){
         String equivalentProperty = null ;
-        if(property == XMLInputFactory.IS_NAMESPACE_AWARE || property.equals(XMLInputFactory.IS_NAMESPACE_AWARE)){
+        if(property.equals(XMLInputFactory.IS_NAMESPACE_AWARE)){
             equivalentProperty = Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE ;
         }
-        else if(property == XMLInputFactory.IS_VALIDATING || property.equals(XMLInputFactory.IS_VALIDATING)){
+        else if(property.equals(XMLInputFactory.IS_VALIDATING)){
             if( (value instanceof Boolean) && ((Boolean)value).booleanValue()){
                 throw new java.lang.IllegalArgumentException("true value of isValidating not supported") ;
             }
         }
-        else if(property == STRING_INTERNING || property.equals(STRING_INTERNING)){
+        else if(property.equals(STRING_INTERNING)){
             if( (value instanceof Boolean) && !((Boolean)value).booleanValue()){
                 throw new java.lang.IllegalArgumentException("false value of " + STRING_INTERNING + "feature is not supported") ;
             }
         }
-        else if(property == XMLInputFactory.RESOLVER || property.equals(XMLInputFactory.RESOLVER)){
+        else if(property.equals(XMLInputFactory.RESOLVER)){
             //add internal stax property
             supportedProps.put( Constants.XERCES_PROPERTY_PREFIX + Constants.STAX_ENTITY_RESOLVER_PROPERTY , new StaxEntityResolverWrapper((XMLResolver)value)) ;
         }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -48,9 +48,11 @@
 import com.sun.xml.internal.stream.dtd.DTDGrammarUtil;
 import java.io.EOFException;
 import java.io.IOException;
+import javax.xml.XMLConstants;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.events.XMLEvent;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  *
@@ -175,7 +177,8 @@
                 VALIDATION,
                 NOTIFY_BUILTIN_REFS,
                 NOTIFY_CHAR_REFS,
-                Constants.STAX_REPORT_CDATA_EVENT
+                Constants.STAX_REPORT_CDATA_EVENT,
+                XMLConstants.USE_CATALOG
     };
 
     /** Feature defaults. */
@@ -184,15 +187,20 @@
                 null,
                 Boolean.FALSE,
                 Boolean.FALSE,
-                Boolean.TRUE
+                Boolean.TRUE,
+                JdkXmlUtils.USE_CATALOG_DEFAULT
     };
 
     /** Recognized properties. */
     private static final String[] RECOGNIZED_PROPERTIES = {
-        SYMBOL_TABLE,
+                SYMBOL_TABLE,
                 ERROR_REPORTER,
                 ENTITY_MANAGER,
-                XML_SECURITY_PROPERTY_MANAGER
+                XML_SECURITY_PROPERTY_MANAGER,
+                JdkXmlUtils.CATALOG_DEFER,
+                JdkXmlUtils.CATALOG_FILES,
+                JdkXmlUtils.CATALOG_PREFER,
+                JdkXmlUtils.CATALOG_RESOLVE
     };
 
     /** Property defaults. */
@@ -200,9 +208,14 @@
                 null,
                 null,
                 null,
+                null,
+                null,
+                null,
+                null,
                 null
     };
 
+
     private static final char [] cdata = {'[','C','D','A','T','A','['};
     static final char [] xmlDecl = {'<','?','x','m','l'};
     // private static final char [] endTag = {'<','/'};
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Fri Aug 05 12:03:58 2016 -0700
@@ -53,7 +53,17 @@
 import java.util.Map;
 import java.util.Stack;
 import java.util.StringTokenizer;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
 import javax.xml.stream.XMLInputFactory;
+import javax.xml.transform.Source;
+import jdk.xml.internal.JdkXmlUtils;
+import org.xml.sax.InputSource;
 
 
 /**
@@ -184,7 +194,8 @@
                 EXTERNAL_PARAMETER_ENTITIES,
                 ALLOW_JAVA_ENCODINGS,
                 WARN_ON_DUPLICATE_ENTITYDEF,
-                STANDARD_URI_CONFORMANT
+                STANDARD_URI_CONFORMANT,
+                XMLConstants.USE_CATALOG
     };
 
     /** Feature defaults. */
@@ -194,7 +205,8 @@
                 Boolean.TRUE,
                 Boolean.TRUE,
                 Boolean.FALSE,
-                Boolean.FALSE
+                Boolean.FALSE,
+                JdkXmlUtils.USE_CATALOG_DEFAULT
     };
 
     /** Recognized properties. */
@@ -205,7 +217,11 @@
                 VALIDATION_MANAGER,
                 BUFFER_SIZE,
                 SECURITY_MANAGER,
-                XML_SECURITY_PROPERTY_MANAGER
+                XML_SECURITY_PROPERTY_MANAGER,
+                JdkXmlUtils.CATALOG_DEFER,
+                JdkXmlUtils.CATALOG_FILES,
+                JdkXmlUtils.CATALOG_PREFER,
+                JdkXmlUtils.CATALOG_RESOLVE
     };
 
     /** Property defaults. */
@@ -214,7 +230,11 @@
                 null,
                 null,
                 null,
-                new Integer(DEFAULT_BUFFER_SIZE),
+                DEFAULT_BUFFER_SIZE,
+                null,
+                null,
+                null,
+                null,
                 null,
                 null
     };
@@ -396,6 +416,17 @@
     /** Pool of character buffers. */
     private CharacterBufferPool fBufferPool = new CharacterBufferPool(fBufferSize, DEFAULT_INTERNAL_BUFFER_SIZE);
 
+    /** indicate whether Catalog should be used for resolving external resources */
+    private boolean fUseCatalog = true;
+    CatalogFeatures fCatalogFeatures;
+    CatalogResolver fCatalogResolver;
+    CatalogUriResolver fCatalogUriResolver;
+
+    private String fCatalogFile;
+    private String fDefer;
+    private String fPrefer;
+    private String fResolve;
+
     //
     // Constructors
     //
@@ -1007,6 +1038,22 @@
             staxInputSource = new StaxXMLInputSource(xmlInputSource, fISCreatedByResolver);
         }
 
+        if (staxInputSource == null) {
+            if (fCatalogFeatures == null) {
+                fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
+            }
+            fCatalogFile = fCatalogFeatures.get(Feature.FILES);
+            if (fUseCatalog && fCatalogFile != null) {
+                if (fCatalogResolver == null) {
+                    fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
+                }
+                InputSource is = fCatalogResolver.resolveEntity(publicId, literalSystemId);
+                if (is != null && !is.isEmpty()) {
+                    staxInputSource = new StaxXMLInputSource(new XMLInputSource(is, true), true);
+                }
+            }
+        }
+
         // do default resolution
         //this works for both stax & Xerces, if staxInputSource is null,
         //it means parser need to revert to default resolution
@@ -1085,6 +1132,41 @@
             xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
         }
 
+        if (xmlInputSource == null) {
+            if (fCatalogFeatures == null) {
+                fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
+            }
+            fCatalogFile = fCatalogFeatures.get(Feature.FILES);
+            if (fUseCatalog && fCatalogFile != null) {
+                /*
+                 since the method can be called from various processors, both
+                 CatalogResolver and CatalogUriResolver are used to attempt to find
+                 a match
+                */
+                InputSource is = null;
+                try {
+                    if (fCatalogResolver == null) {
+                        fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
+                    }
+                    String pid = (publicId != null? publicId : resourceIdentifier.getNamespace());
+                    if (pid != null || literalSystemId != null) {
+                        is = fCatalogResolver.resolveEntity(pid, literalSystemId);
+                    }
+                } catch (CatalogException e) {}
+                if (is != null && !is.isEmpty()) {
+                    xmlInputSource = new XMLInputSource(is, true);
+                } else if (literalSystemId != null) {
+                    if (fCatalogUriResolver == null) {
+                        fCatalogUriResolver = CatalogManager.catalogUriResolver(fCatalogFeatures);
+                    }
+                    Source source = fCatalogUriResolver.resolve(literalSystemId, baseSystemId);
+                    if (source != null && !source.isEmpty()) {
+                        xmlInputSource = new XMLInputSource(publicId, source.getSystemId(), baseSystemId, true);
+                    }
+                }
+            }
+        }
+
         // do default resolution
         // REVISIT: what's the correct behavior if the user provided an entity
         // resolver (fEntityResolver != null), but resolveEntity doesn't return
@@ -1442,12 +1524,19 @@
             fStaxEntityResolver = null;
         }
 
-        fSupportDTD = ((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD)).booleanValue();
-        fReplaceEntityReferences = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)).booleanValue();
-        fSupportExternalEntities = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)).booleanValue();
+        fSupportDTD = ((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD));
+        fReplaceEntityReferences = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES));
+        fSupportExternalEntities = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES));
 
         // Zephyr feature ignore-external-dtd is the opposite of Xerces' load-external-dtd
-        fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD)).booleanValue();
+        fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD));
+
+        //Use Catalog
+        fUseCatalog = (Boolean)propertyManager.getProperty(XMLConstants.USE_CATALOG);
+        fCatalogFile = (String)propertyManager.getProperty(JdkXmlUtils.CATALOG_FILES);
+        fDefer = (String)propertyManager.getProperty(JdkXmlUtils.CATALOG_DEFER);
+        fPrefer = (String)propertyManager.getProperty(JdkXmlUtils.CATALOG_PREFER);
+        fResolve = (String)propertyManager.getProperty(JdkXmlUtils.CATALOG_RESOLVE);
 
         // JAXP 1.5 feature
         XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
@@ -1535,6 +1624,13 @@
         }
         fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
 
+        //Use Catalog
+        fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG, true);
+        fCatalogFile = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_FILES);
+        fDefer = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_DEFER);
+        fPrefer = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_PREFER);
+        fResolve = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_RESOLVE);
+
         //reset general state
         reset();
 
@@ -1631,6 +1727,8 @@
                 fLoadExternalDTD = state;
                 return;
             }
+        } else if (featureId.equals(XMLConstants.USE_CATALOG)) {
+            fUseCatalog = state;
         }
 
     } // setFeature(String,boolean)
@@ -1691,6 +1789,18 @@
         {
             XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)value;
             fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
+            return;
+        }
+
+        //Catalog properties
+        if (propertyId.equals(JdkXmlUtils.CATALOG_FILES)) {
+            fCatalogFile = (String)value;
+        } else if (propertyId.equals(JdkXmlUtils.CATALOG_DEFER)) {
+            fDefer = (String)value;
+        } else if (propertyId.equals(JdkXmlUtils.CATALOG_PREFER)) {
+            fPrefer = (String)value;
+        } else if (propertyId.equals(JdkXmlUtils.CATALOG_RESOLVE)) {
+            fResolve = (String)value;
         }
     }
 
@@ -2066,7 +2176,6 @@
 
         // system id has to be a valid URI
         if (strict) {
-
             try {
                 // if it's already an absolute one, return it
                 new URI(systemId);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2016, 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
@@ -28,7 +28,7 @@
 #
 # The messages are arranged in key and value tuples in a ListResourceBundle.
 #
-# @version $Id: DOMMessages_ko.properties /st_wptg_1.8.0.0.0jdk/2 2013/05/29 02:40:33 gmolloy Exp $
+# @version $Id: DOMMessages_ko.properties /st_wptg_1.9.dev.jdk/3 2016/07/14 00:25:31 gmolloy Exp $
 
         BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
         FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n  
@@ -82,7 +82,7 @@
 jaxp-null-input-source = \uC9C0\uC815\uB41C \uC18C\uC2A4\uB294 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
 
 #Ranges
-BAD_BOUNDARYPOINTS_ERR = \uBC94\uC704\uC758 \uACBD\uACC4 \uC9C0\uC810\uC774 \uD2B9\uC815 \uC694\uAD6C \uC0AC\uD56D\uC744 \uCDA9\uC871\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+BAD_BOUNDARYPOINTS_ERR = \uBC94\uC704\uC758 \uACBD\uACC4 \uC9C0\uC810\uC774 \uD2B9\uC815 \uC694\uAD6C\uC0AC\uD56D\uC744 \uCDA9\uC871\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
 INVALID_NODE_TYPE_ERR = \uBC94\uC704\uC758 \uACBD\uACC4 \uC9C0\uC810 \uCEE8\uD14C\uC774\uB108\uAC00 \uBD80\uC801\uD569\uD55C \uC720\uD615\uC758 \uB178\uB4DC \uB610\uB294 \uBD80\uC801\uD569\uD55C \uC720\uD615\uC758 \uC870\uC0C1\uC744 \uAC00\uC9C4 \uB178\uB4DC\uB85C \uC124\uC815\uB418\uACE0 \uC788\uC2B5\uB2C8\uB2E4.
 
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -26,7 +26,7 @@
 # This file contains error and warning messages related to XML Schema
 # The messages are arranged in key and value tuples in a ListResourceBundle.
 #
-# @version $Id: XMLSchemaMessages_ko.properties /st_wptg_1.9.0.0.0jdk/2 2016/04/12 02:39:51 gmolloy Exp $
+# @version $Id: XMLSchemaMessages_ko.properties /st_wptg_1.9.dev.jdk/3 2016/07/14 00:25:31 gmolloy Exp $
 
         BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
         FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
@@ -159,9 +159,9 @@
         src-redefine.7.1 = src-redefine.7.1: <redefine> \uC694\uC18C\uC758 attributeGroup \uD558\uC704\uC5D0 \uC790\uC2E0\uC744 \uCC38\uC870\uD558\uB294 attributeGroup\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC744 \uACBD\uC6B0 \uC815\uD655\uD788 1\uC774 \uC0AC\uC6A9\uB418\uC5B4\uC57C \uD558\uC9C0\uB9CC {0}\uC774(\uAC00) \uC0AC\uC6A9\uB429\uB2C8\uB2E4.
         src-redefine.7.2.1 = src-redefine.7.2.1: \uC7AC\uC815\uC758\uB41C \uC2A4\uD0A4\uB9C8\uC5D0 \uC774\uB984\uC774 ''{0}''\uC778 attributeGroup\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
         src-redefine.7.2.2 = src-redefine.7.2.2: AttributeGroup ''{0}''\uC740(\uB294) \uC7AC\uC815\uC758\uD558\uB294 attributeGroup\uC744 \uC81C\uB300\uB85C \uC81C\uD55C\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC704\uBC18\uB41C \uC81C\uC57D \uC870\uAC74: ''{1}''.
-        src-resolve = src-resolve: ''{0}'' \uC774\uB984\uC744 ''{1}'' \uAD6C\uC131 \uC694\uC18C\uB85C \uBD84\uC11D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-        src-resolve.4.1 = src-resolve.4.1: ''{2}'' \uAD6C\uC131 \uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAD6C\uC131 \uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC788\uC5B4\uC57C \uD560 \uACBD\uC6B0 \uC811\uB450\uC5B4\uB97C \uC81C\uACF5\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uC5B4\uC57C \uD560 \uACBD\uC6B0 "namespace" \uC18D\uC131 \uC5C6\uC774 ''import''\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
-        src-resolve.4.2 = src-resolve.4.2: ''{2}'' \uAD6C\uC131 \uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC774(\uAC00) ''{1}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uC788\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uC774 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC758 \uAD6C\uC131 \uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC811\uB450\uC5B4\uC778 ''{2}''\uC744(\uB97C) \uBCC0\uACBD\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB978 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC801\uD569\uD55C ''import'' \uD0DC\uADF8\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
+        src-resolve = src-resolve: ''{0}'' \uC774\uB984\uC744 ''{1}'' \uAD6C\uC131\uC694\uC18C\uB85C \uBD84\uC11D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+        src-resolve.4.1 = src-resolve.4.1: ''{2}'' \uAD6C\uC131\uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAD6C\uC131\uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC788\uC5B4\uC57C \uD560 \uACBD\uC6B0 \uC811\uB450\uC5B4\uB97C \uC81C\uACF5\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uC5B4\uC57C \uD560 \uACBD\uC6B0 "namespace" \uC18D\uC131 \uC5C6\uC774 ''import''\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
+        src-resolve.4.2 = src-resolve.4.2: ''{2}'' \uAD6C\uC131\uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC774(\uAC00) ''{1}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uC788\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uC774 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC758 \uAD6C\uC131\uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC811\uB450\uC5B4\uC778 ''{2}''\uC744(\uB97C) \uBCC0\uACBD\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB978 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC801\uD569\uD55C ''import'' \uD0DC\uADF8\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
         src-simple-type.2.a = src-simple-type.2.a: \uD574\uB2F9 [children] \uC911 base [attribute]\uC640 <simpleType> \uC694\uC18C\uAC00 \uBAA8\uB450 \uC788\uB294 <restriction> \uC694\uC18C\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uD5C8\uC6A9\uB429\uB2C8\uB2E4.
         src-simple-type.2.b = src-simple-type.2.b: \uD574\uB2F9 [children] \uC911 base [attribute]\uC640 <simpleType> \uC694\uC18C\uAC00 \uBAA8\uB450 \uC5C6\uB294 <restriction> \uC694\uC18C\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uD544\uC694\uD569\uB2C8\uB2E4.
         src-simple-type.3.a = src-simple-type.3.a: \uD574\uB2F9 [children] \uC911 itemType [attribute]\uC640 <simpleType> \uC694\uC18C\uAC00 \uBAA8\uB450 \uC788\uB294 <list> \uC694\uC18C\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uD5C8\uC6A9\uB429\uB2C8\uB2E4.
@@ -190,8 +190,8 @@
         cos-particle-restrict.2 = cos-particle-restrict.2: \uAE08\uC9C0\uB41C \uC870\uAC01 \uC81C\uD55C \uC0AC\uD56D: ''{0}''.
         cos-st-restricts.1.1 = cos-st-restricts.1.1: ''{1}'' \uC720\uD615\uC774 \uAE30\uBCF8 \uB2E8\uC704\uC774\uBBC0\uB85C \uD574\uB2F9 '{'base type definition'}' ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uB2E8\uC21C \uC720\uD615 \uC815\uC758 \uB610\uB294 \uB0B4\uC7A5\uB41C \uAE30\uBCF8 \uB370\uC774\uD130 \uC720\uD615\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
         cos-st-restricts.2.1 = cos-st-restricts.2.1: \uBAA9\uB85D \uC720\uD615 ''{0}''\uC758 \uC815\uC758\uC5D0\uC11C ''{1}'' \uC720\uD615\uC740 \uBAA9\uB85D \uC720\uD615\uC774\uAC70\uB098 \uBAA9\uB85D\uC744 \uD3EC\uD568\uD558\uB294 \uD569\uC9D1\uD569 \uC720\uD615\uC774\uBBC0\uB85C \uBD80\uC801\uD569\uD55C \uD56D\uBAA9 \uC720\uD615\uC785\uB2C8\uB2E4.
-        cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''list''\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uD56D\uBAA9 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-        cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''union''\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uBA64\uBC84 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+        cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131\uC694\uC18C\uC5D0 ''list''\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uD56D\uBAA9 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+        cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131\uC694\uC18C\uC5D0 ''union''\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uBA64\uBC84 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
         cos-valid-default.2.1 = cos-valid-default.2.1: ''{0}'' \uC694\uC18C\uC5D0 \uAC12 \uC81C\uC57D \uC870\uAC74\uC774 \uC788\uC73C\uBBC0\uB85C \uD63C\uD569 \uB610\uB294 \uB2E8\uC21C \uCF58\uD150\uCE20 \uBAA8\uB378\uC774 \uD3EC\uD568\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
         cos-valid-default.2.2.2 = cos-valid-default.2.2.2: ''{0}'' \uC694\uC18C\uC5D0 '{'value constraint'}'\uAC00 \uC788\uC73C\uBA70 \uD574\uB2F9 \uC720\uD615 \uC815\uC758\uC5D0 \uD63C\uD569 '{'content type'}'\uC774 \uC788\uC73C\uBBC0\uB85C '{'content type'}'\uC758 \uC870\uAC01\uC744 \uBE44\uC6B8 \uC218 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
         c-props-correct.2 = c-props-correct.2: keyref ''{0}''\uACFC(\uC640) \uD0A4 ''{1}''\uC5D0 \uB300\uD55C \uD544\uB4DC \uAE30\uC218\uB294 \uC11C\uB85C \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4.
@@ -282,7 +282,7 @@
         rcase-RecurseUnordered.2 = rcase-RecurseUnordered.2: \uC870\uAC01 \uAC04 \uC804\uCCB4 \uAE30\uB2A5 \uB9E4\uD551\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
 #        We're using sch-props-correct.2 instead of the old src-redefine.1
 #        src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
-        sch-props-correct.2 = sch-props-correct.2: \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB3D9\uC77C\uD55C \uC774\uB984\uC744 \uAC00\uC9C4 \uB450 \uAC1C\uC758 \uC804\uC5ED \uAD6C\uC131 \uC694\uC18C\uAC00 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB450 \uAC1C\uC758 ''{0}''\uC774(\uAC00) \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
+        sch-props-correct.2 = sch-props-correct.2: \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB3D9\uC77C\uD55C \uC774\uB984\uC744 \uAC00\uC9C4 \uB450 \uAC1C\uC758 \uC804\uC5ED \uAD6C\uC131\uC694\uC18C\uAC00 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB450 \uAC1C\uC758 ''{0}''\uC774(\uAC00) \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
         st-props-correct.2 = st-props-correct.2: \uB2E8\uC21C \uC720\uD615 ''{0}''\uC5D0 \uB300\uD55C \uC21C\uD658 \uC815\uC758\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC740(\uB294) \uACE0\uC720\uD55C \uC720\uD615 \uACC4\uCE35\uC5D0 \uD3EC\uD568\uB41C \uAC83\uC774\uBA70 \uC774\uB294 \uC624\uB958\uC785\uB2C8\uB2E4.
         st-props-correct.3 = st-props-correct.3: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. '{'base type definition'}' ''{1}''\uC758 '{'final'}' \uAC12\uC740 \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD569\uB2C8\uB2E4.
         totalDigits-valid-restriction = totalDigits-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''totalDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{1}''(\uC73C)\uB85C \uC124\uC815\uB41C ''totalDigits''\uC5D0 \uB300\uD55C \uAC12\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java	Fri Aug 05 12:03:58 2016 -0700
@@ -76,6 +76,7 @@
 import java.util.StringTokenizer;
 import java.util.WeakHashMap;
 import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMError;
 import org.w3c.dom.DOMErrorHandler;
@@ -173,7 +174,8 @@
         HONOUR_ALL_SCHEMALOCATIONS,
         NAMESPACE_GROWTH,
         TOLERATE_DUPLICATES,
-        USE_SERVICE_MECHANISM
+        USE_SERVICE_MECHANISM,
+        XMLConstants.USE_CATALOG
     };
 
     // property identifiers
@@ -187,7 +189,7 @@
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
 
     /** Property identifier: error handler. */
-    protected static final String ERROR_HANDLER =
+    public static final String ERROR_HANDLER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
 
     /** Property identifier: entity resolver. */
@@ -244,7 +246,11 @@
         SECURITY_MANAGER,
         LOCALE,
         SCHEMA_DV_FACTORY,
-        XML_SECURITY_PROPERTY_MANAGER
+        XML_SECURITY_PROPERTY_MANAGER,
+        JdkXmlUtils.CATALOG_DEFER,
+        JdkXmlUtils.CATALOG_FILES,
+        JdkXmlUtils.CATALOG_PREFER,
+        JdkXmlUtils.CATALOG_RESOLVE
     };
 
     // Data
@@ -813,7 +819,7 @@
         // InputSource also, apart from [] of type Object.
         Object[] objArr = (Object[]) fJAXPSource;
         // make local array for storing target namespaces of schemasources specified in object arrays.
-        ArrayList jaxpSchemaSourceNamespaces = new ArrayList();
+        ArrayList<String> jaxpSchemaSourceNamespaces = new ArrayList<>();
         for (int i = 0; i < objArr.length; i++) {
             if (objArr[i] instanceof InputStream ||
                     objArr[i] instanceof InputSource) {
@@ -1280,7 +1286,7 @@
      */
     public DOMStringList getParameterNames() {
         if (fRecognizedParameters == null){
-            ArrayList v = new ArrayList();
+            ArrayList<String> v = new ArrayList<>();
             v.add(Constants.DOM_VALIDATE);
             v.add(Constants.DOM_ERROR_HANDLER);
             v.add(Constants.DOM_RESOURCE_RESOLVER);
@@ -1381,7 +1387,7 @@
 
     }
 
-        XMLInputSource dom2xmlInputSource(LSInput is) {
+    XMLInputSource dom2xmlInputSource(LSInput is) {
         // need to wrap the LSInput with an XMLInputSource
         XMLInputSource xis = null;
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -86,6 +86,8 @@
 import java.util.Stack;
 import java.util.Vector;
 import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
 
 /**
  * The XML Schema validator. The validator implements a document
@@ -264,6 +266,8 @@
 
     protected static final String USE_SERVICE_MECHANISM = Constants.ORACLE_FEATURE_SERVICE_MECHANISM;
 
+    protected static final String USE_CATALOG = XMLConstants.USE_CATALOG;
+
     // recognized features and properties
 
     /** Recognized features. */
@@ -286,7 +290,8 @@
             UNPARSED_ENTITY_CHECKING,
             NAMESPACE_GROWTH,
             TOLERATE_DUPLICATES,
-            USE_SERVICE_MECHANISM
+            USE_SERVICE_MECHANISM,
+            USE_CATALOG
         };
 
     /** Feature defaults. */
@@ -317,7 +322,8 @@
         null,
         null,
         null,
-        Boolean.TRUE
+        Boolean.TRUE,
+        JdkXmlUtils.USE_CATALOG_DEFAULT
     };
 
     /** Recognized properties. */
@@ -334,12 +340,17 @@
             ROOT_TYPE_DEF,
             ROOT_ELEMENT_DECL,
             SCHEMA_DV_FACTORY,
-            XML_SECURITY_PROPERTY_MANAGER
+            XML_SECURITY_PROPERTY_MANAGER,
+            JdkXmlUtils.CATALOG_DEFER,
+            JdkXmlUtils.CATALOG_FILES,
+            JdkXmlUtils.CATALOG_PREFER,
+            JdkXmlUtils.CATALOG_RESOLVE
         };
 
     /** Property defaults. */
     private static final Object[] PROPERTY_DEFAULTS =
-        { null, null, null, null, null, null, null, null, null, null, null, null};
+        { null, null, null, null, null, null, null, null, null, null, null, null,
+        null, null, null, null};
 
     // this is the number of valuestores of each kind
     // we expect an element to have.  It's almost
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -39,7 +39,6 @@
 import com.sun.org.apache.xerces.internal.parsers.BasicParserConfiguration;
 import com.sun.org.apache.xerces.internal.util.FeatureState;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
-import com.sun.org.apache.xerces.internal.util.Status;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
 import com.sun.org.apache.xerces.internal.xni.XNIException;
@@ -51,6 +50,9 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
 
 /**
  * @xerces.internal
@@ -301,7 +303,8 @@
             PARSER_SETTINGS, WARN_ON_DUPLICATE_ATTDEF,   WARN_ON_UNDECLARED_ELEMDEF,
             ALLOW_JAVA_ENCODINGS,       CONTINUE_AFTER_FATAL_ERROR,
             LOAD_EXTERNAL_DTD,          NOTIFY_BUILTIN_REFS,
-            NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS
+            NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS,
+            XMLConstants.USE_CATALOG
         };
         addRecognizedFeatures(recognizedFeatures);
         fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
@@ -315,6 +318,7 @@
         fFeatures.put(NOTIFY_BUILTIN_REFS, Boolean.FALSE);
         fFeatures.put(NOTIFY_CHAR_REFS, Boolean.FALSE);
         fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
+        fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
@@ -328,7 +332,11 @@
             DATATYPE_VALIDATOR_FACTORY,
             VALIDATION_MANAGER,
             GENERATE_SYNTHETIC_ANNOTATIONS,
-            LOCALE
+            LOCALE,
+            JdkXmlUtils.CATALOG_DEFER,
+            JdkXmlUtils.CATALOG_FILES,
+            JdkXmlUtils.CATALOG_PREFER,
+            JdkXmlUtils.CATALOG_RESOLVE
         };
         addRecognizedProperties(recognizedProperties);
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Fri Aug 05 12:03:58 2016 -0700
@@ -102,9 +102,11 @@
 import java.util.Stack;
 import java.util.Vector;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -391,7 +393,7 @@
     private Locale fLocale;
 
     // the XMLEntityManager
-    private XMLEntityResolver fEntityManager;
+    private XMLEntityManager fEntityManager;
 
     // the XSAttributeChecker
     private XSAttributeChecker fAttributeChecker;
@@ -411,6 +413,13 @@
     // the security property manager
     private XMLSecurityPropertyManager fSecurityPropertyMgr = null;
 
+    /** indicate whether Catalog should be used for resolving external resources */
+    private boolean fUseCatalog = true;
+    private String fCatalogFile;
+    private String fDefer;
+    private String fPrefer;
+    private String fResolve;
+
     //************ Traversers **********
     XSDAttributeGroupTraverser fAttributeGroupTraverser;
     XSDAttributeTraverser fAttributeTraverser;
@@ -710,6 +719,13 @@
         fAnnotationValidator.setProperty(ERROR_HANDLER, (fErrorHandler != null) ? fErrorHandler : new DefaultErrorHandler());
         /** Set locale. **/
         fAnnotationValidator.setProperty(LOCALE, fLocale);
+
+        // Passing on the Catalog settings
+        fAnnotationValidator.setFeature(XMLConstants.USE_CATALOG, fUseCatalog);
+        fAnnotationValidator.setProperty(JdkXmlUtils.CATALOG_FILES, fCatalogFile);
+        fAnnotationValidator.setProperty(JdkXmlUtils.CATALOG_DEFER, fDefer);
+        fAnnotationValidator.setProperty(JdkXmlUtils.CATALOG_PREFER, fPrefer);
+        fAnnotationValidator.setProperty(JdkXmlUtils.CATALOG_RESOLVE, fResolve);
     }
 
     /**
@@ -3514,7 +3530,7 @@
         fSecurityManager = (XMLSecurityManager) componentManager.getProperty(SECURITY_MANAGER, null);
 
         //set entity manager
-        fEntityManager = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER);
+        fEntityManager = (XMLEntityManager) componentManager.getProperty(ENTITY_MANAGER);
 
         //set entity resolver
         XMLEntityResolver er = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER);
@@ -3593,6 +3609,20 @@
         fAccessExternalDTD = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
         fAccessExternalSchema = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
 
+        // Passing the Catalog settings to the parser
+        fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG);
+        fSchemaParser.setFeature(XMLConstants.USE_CATALOG, fUseCatalog);
+        fEntityManager.setFeature(XMLConstants.USE_CATALOG, fUseCatalog);
+
+        fCatalogFile = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_FILES);
+        fDefer = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_DEFER);
+        fPrefer = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_PREFER);
+        fResolve = (String)componentManager.getProperty(JdkXmlUtils.CATALOG_RESOLVE);
+
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            fSchemaParser.setProperty(f.getPropertyName(), componentManager.getProperty(f.getPropertyName()));
+            fEntityManager.setProperty(f.getPropertyName(), componentManager.getProperty(f.getPropertyName()));
+        }
     } // reset(XMLComponentManager)
 
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -32,6 +32,7 @@
 import java.io.IOException;
 import java.lang.ref.SoftReference;
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerConfigurationException;
@@ -41,6 +42,8 @@
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.SAXException;
 
 /**
@@ -190,6 +193,10 @@
                 fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
         config.setProperty(Constants.SECURITY_MANAGER,
                 fComponentManager.getProperty(Constants.SECURITY_MANAGER));
+
+        // Passing on the CatalogFeatures settings
+        JdkXmlUtils.catalogFeaturesConfig2Config(fComponentManager, config);
+
         fConfiguration = new SoftReference(config);
         return config;
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -71,6 +71,8 @@
 import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
 import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
 import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
+import javax.xml.catalog.CatalogFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.TypeInfo;
 import org.w3c.dom.ls.LSInput;
 import org.w3c.dom.ls.LSResourceResolver;
@@ -701,6 +703,9 @@
                                        XMLConstants.ACCESS_EXTERNAL_DTD, exc);
                            }
                         }
+
+                        // Passing on the CatalogFeatures settings from a configuration object to the reader
+                        JdkXmlUtils.catalogFeaturesConfig2Reader(fComponentManager, reader);
                     } catch( Exception e ) {
                         // this is impossible, but better safe than sorry
                         throw new FactoryConfigurationError(e);
@@ -1046,7 +1051,7 @@
                      */
                     InputSource inputSource = new InputSource();
                     inputSource.setPublicId(pubId);
-                    inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId);
+                    inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(sysId, baseSystemId) : sysId);
 
                     if (charStream != null) {
                         inputSource.setCharacterStream(charStream);
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -22,12 +22,10 @@
 
 import java.io.IOException;
 
-import javax.xml.XMLConstants;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stax.StAXResult;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Validator;
@@ -83,7 +81,8 @@
     private boolean fResourceResolverChanged = false;
 
     /** Support current-element-node property */
-    private static final String CURRENT_ELEMENT_NODE = Constants.XERCES_PROPERTY_PREFIX + Constants.CURRENT_ELEMENT_NODE_PROPERTY;
+    private static final String CURRENT_ELEMENT_NODE =
+            Constants.XERCES_PROPERTY_PREFIX + Constants.CURRENT_ELEMENT_NODE_PROPERTY;
 
     public ValidatorImpl(XSGrammarPoolContainer grammarContainer) {
         fComponentManager = new XMLSchemaValidatorComponentManager(grammarContainer);
@@ -91,6 +90,7 @@
         setResourceResolver(null);
     }
 
+    @Override
     public void validate(Source source, Result result)
         throws SAXException, IOException {
         if (source instanceof SAXSource) {
@@ -133,24 +133,29 @@
         }
     }
 
+    @Override
     public void setErrorHandler(ErrorHandler errorHandler) {
         fErrorHandlerChanged = (errorHandler != null);
         fComponentManager.setErrorHandler(errorHandler);
     }
 
+    @Override
     public ErrorHandler getErrorHandler() {
         return fComponentManager.getErrorHandler();
     }
 
+    @Override
     public void setResourceResolver(LSResourceResolver resourceResolver) {
         fResourceResolverChanged = (resourceResolver != null);
         fComponentManager.setResourceResolver(resourceResolver);
     }
 
+    @Override
     public LSResourceResolver getResourceResolver() {
         return fComponentManager.getResourceResolver();
     }
 
+    @Override
     public boolean getFeature(String name)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -169,6 +174,7 @@
         }
     }
 
+    @Override
     public void setFeature(String name, boolean value)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -197,6 +203,7 @@
         fConfigurationChanged = true;
     }
 
+    @Override
     public Object getProperty(String name)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -219,6 +226,7 @@
         }
     }
 
+    @Override
     public void setProperty(String name, Object object)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -238,6 +246,7 @@
         fConfigurationChanged = true;
     }
 
+    @Override
     public void reset() {
         // avoid resetting features and properties if the state the validator
         // is currently in, is the same as it will be after reset.
@@ -265,14 +274,17 @@
      * PSVIProvider methods
      */
 
+    @Override
     public ElementPSVI getElementPSVI() {
         return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getElementPSVI() : null;
     }
 
+    @Override
     public AttributePSVI getAttributePSVI(int index) {
         return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getAttributePSVI(index) : null;
     }
 
+    @Override
     public AttributePSVI getAttributePSVIByName(String uri, String localname) {
         return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getAttributePSVIByName(uri, localname) : null;
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,3 +1,6 @@
+/*
+ * Copyright (c) 2007, 2016, 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
@@ -17,20 +20,6 @@
 
 package com.sun.org.apache.xerces.internal.jaxp.validation;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-
-import javax.xml.XMLConstants;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stax.StAXSource;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader;
 import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper;
@@ -49,6 +38,20 @@
 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.Node;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.ErrorHandler;
@@ -156,6 +159,12 @@
         fSecurityPropertyMgr = new XMLSecurityPropertyManager();
         fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
                 fSecurityPropertyMgr);
+
+        // use catalog
+        fXMLSchemaLoader.setFeature(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
+        for (Feature f : Feature.values()) {
+            fXMLSchemaLoader.setProperty(f.getPropertyName(), null);
+        }
     }
 
     /**
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +22,6 @@
 
 import java.util.HashMap;
 import java.util.Locale;
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.xml.XMLConstants;
@@ -48,6 +47,7 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
+import javax.xml.catalog.CatalogFeatures;
 import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.ErrorHandler;
 
@@ -176,7 +176,7 @@
     private boolean fUseGrammarPoolOnly;
 
     /** Lookup map for components required for validation. **/
-    private final HashMap fComponents = new HashMap();
+    private final HashMap<String, Object> fComponents = new HashMap<>();
 
     //
     // Components
@@ -202,10 +202,10 @@
     //
 
     /** Stores initial feature values for validator reset. */
-    private final HashMap fInitFeatures = new HashMap();
+    private final HashMap<String, Boolean> fInitFeatures = new HashMap<>();
 
     /** Stores initial property values for validator reset. */
-    private final HashMap fInitProperties = new HashMap();
+    private final HashMap<String, Object> fInitProperties = new HashMap<>();
 
     /** Stores the initial security manager. */
     private XMLSecurityManager fInitSecurityManager;
@@ -262,13 +262,15 @@
                 DISALLOW_DOCTYPE_DECL_FEATURE,
                 NORMALIZE_DATA,
                 SCHEMA_ELEMENT_DEFAULT,
-                SCHEMA_AUGMENT_PSVI
+                SCHEMA_AUGMENT_PSVI,
+                XMLConstants.USE_CATALOG
         };
         addRecognizedFeatures(recognizedFeatures);
         fFeatures.put(DISALLOW_DOCTYPE_DECL_FEATURE, Boolean.FALSE);
         fFeatures.put(NORMALIZE_DATA, Boolean.FALSE);
         fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.FALSE);
         fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
+        fFeatures.put(XMLConstants.USE_CATALOG, grammarContainer.getFeature(XMLConstants.USE_CATALOG));
 
         addRecognizedParamsAndSetDefaults(fEntityManager, grammarContainer);
         addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer);
@@ -304,6 +306,11 @@
         fSecurityPropertyMgr = (XMLSecurityPropertyManager)
                 grammarContainer.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER);
         setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
+
+        //initialize Catalog properties
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            setProperty(f.getPropertyName(), grammarContainer.getProperty(f.getPropertyName()));
+        }
     }
 
     /**
@@ -541,20 +548,16 @@
 
         // Reset feature and property values to their initial values
         if (!fInitFeatures.isEmpty()) {
-            Iterator iter = fInitFeatures.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry) iter.next();
-                String name = (String) entry.getKey();
-                boolean value = ((Boolean) entry.getValue()).booleanValue();
+            for (Map.Entry<String, Boolean> entry : fInitFeatures.entrySet()) {
+                String name = entry.getKey();
+                boolean value = entry.getValue();
                 super.setFeature(name, value);
             }
             fInitFeatures.clear();
         }
         if (!fInitProperties.isEmpty()) {
-            Iterator iter = fInitProperties.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry) iter.next();
-                String name = (String) entry.getKey();
+            for (Map.Entry<String, Object> entry : fInitProperties.entrySet()) {
+                String name = entry.getKey();
                 Object value = entry.getValue();
                 super.setProperty(name, value);
             }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -36,7 +36,6 @@
 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
 import com.sun.org.apache.xerces.internal.util.FeatureState;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
-import com.sun.org.apache.xerces.internal.util.Status;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
@@ -49,6 +48,9 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * This is the DTD-only parser configuration.  It extends the basic
@@ -308,6 +310,7 @@
             //NOTIFY_BUILTIN_REFS,  // from XMLDocumentFragmentScannerImpl
             //NOTIFY_CHAR_REFS,         // from XMLDocumentFragmentScannerImpl
             //WARN_ON_DUPLICATE_ENTITYDEF,  // from XMLEntityManager
+            XMLConstants.USE_CATALOG
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -320,6 +323,7 @@
         //setFeature(NOTIFY_BUILTIN_REFS, false);   // from XMLDocumentFragmentScannerImpl
         //setFeature(NOTIFY_CHAR_REFS, false);      // from XMLDocumentFragmentScannerImpl
         //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);   // from XMLEntityManager
+        fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
@@ -337,7 +341,11 @@
             JAXP_SCHEMA_LANGUAGE,
             LOCALE,
             SECURITY_MANAGER,
-            XML_SECURITY_PROPERTY_MANAGER
+            XML_SECURITY_PROPERTY_MANAGER,
+            JdkXmlUtils.CATALOG_DEFER,
+            JdkXmlUtils.CATALOG_FILES,
+            JdkXmlUtils.CATALOG_PREFER,
+            JdkXmlUtils.CATALOG_RESOLVE
         };
         addRecognizedProperties(recognizedProperties);
 
@@ -416,6 +424,11 @@
         }
 
         setProperty(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
+
+        // Initialize Catalog features
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            setProperty(f.getPropertyName(), null);
+        }
     } // <init>(SymbolTable,XMLGrammarPool)
 
     //
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -47,6 +47,9 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * This is the non validating parser configuration. It extends the basic
@@ -281,8 +284,8 @@
 
         // add default recognized features
         final String[] recognizedFeatures = {
-                PARSER_SETTINGS,
-                        NAMESPACES,
+            PARSER_SETTINGS,
+            NAMESPACES,
             //WARN_ON_DUPLICATE_ATTDEF,     // from XMLDTDScannerImpl
             //WARN_ON_UNDECLARED_ELEMDEF,   // from XMLDTDScannerImpl
             //ALLOW_JAVA_ENCODINGS,         // from XMLEntityManager
@@ -291,6 +294,7 @@
             //NOTIFY_BUILTIN_REFS,  // from XMLDocumentFragmentScannerImpl
             //NOTIFY_CHAR_REFS,         // from XMLDocumentFragmentScannerImpl
             //WARN_ON_DUPLICATE_ENTITYDEF   // from XMLEntityManager
+            XMLConstants.USE_CATALOG
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -299,12 +303,13 @@
         //setFeature(WARN_ON_UNDECLARED_ELEMDEF, false);    // from XMLDTDScannerImpl
         //setFeature(ALLOW_JAVA_ENCODINGS, false);      // from XMLEntityManager
         fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
-                fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
-                fFeatures.put(NAMESPACES, Boolean.TRUE);
+        fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
+        fFeatures.put(NAMESPACES, Boolean.TRUE);
         //setFeature(LOAD_EXTERNAL_DTD, true);      // from XMLDTDScannerImpl
         //setFeature(NOTIFY_BUILTIN_REFS, false);   // from XMLDocumentFragmentScannerImpl
         //setFeature(NOTIFY_CHAR_REFS, false);      // from XMLDocumentFragmentScannerImpl
         //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);   // from XMLEntityManager
+        fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
@@ -319,7 +324,11 @@
             VALIDATION_MANAGER,
             LOCALE,
             SECURITY_MANAGER,
-            XML_SECURITY_PROPERTY_MANAGER
+            XML_SECURITY_PROPERTY_MANAGER,
+            JdkXmlUtils.CATALOG_DEFER,
+            JdkXmlUtils.CATALOG_FILES,
+            JdkXmlUtils.CATALOG_PREFER,
+            JdkXmlUtils.CATALOG_RESOLVE
         };
         addRecognizedProperties(recognizedProperties);
 
@@ -377,6 +386,11 @@
         }
 
         setProperty(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
+
+        // Initialize Catalog features
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            setProperty(f.getPropertyName(), null);
+        }
     } // <init>(SymbolTable,XMLGrammarPool)
 
     //
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Fri Aug 05 12:03:58 2016 -0700
@@ -20,12 +20,6 @@
 
 package com.sun.org.apache.xerces.internal.parsers;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Locale;
-import javax.xml.XMLConstants;
-
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
 import com.sun.org.apache.xerces.internal.impl.XML11DocumentScannerImpl;
@@ -52,7 +46,6 @@
 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
@@ -69,6 +62,13 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Locale;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import jdk.xml.internal.JdkXmlUtils;
+import jdk.xml.internal.SecuritySupport;
 
 /**
  * This class is the configuration used to parse XML 1.0 and XML 1.1 documents.
@@ -478,10 +478,6 @@
         // Common components for XML 1.1. and XML 1.0
         fCommonComponents = new ArrayList<>();
 
-        // create table for features and properties
-        fFeatures = new HashMap<>();
-        fProperties = new HashMap<>();
-
         // add default recognized features
         final String[] recognizedFeatures =
         {
@@ -503,7 +499,8 @@
             EXTERNAL_GENERAL_ENTITIES,
             EXTERNAL_PARAMETER_ENTITIES,
             PARSER_SETTINGS,
-            XMLConstants.FEATURE_SECURE_PROCESSING
+            XMLConstants.FEATURE_SECURE_PROCESSING,
+            XMLConstants.USE_CATALOG
         };
         addRecognizedFeatures(recognizedFeatures);
         // set state for default features
@@ -528,6 +525,7 @@
         fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
         fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
         fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+        fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties =
@@ -559,7 +557,11 @@
             LOCALE,
             SCHEMA_DV_FACTORY,
             SECURITY_MANAGER,
-            XML_SECURITY_PROPERTY_MANAGER
+            XML_SECURITY_PROPERTY_MANAGER,
+            JdkXmlUtils.CATALOG_DEFER,
+            JdkXmlUtils.CATALOG_FILES,
+            JdkXmlUtils.CATALOG_PREFER,
+            JdkXmlUtils.CATALOG_RESOLVE
         };
         addRecognizedProperties(recognizedProperties);
 
@@ -622,6 +624,11 @@
             // REVISIT: What is the right thing to do? -Ac
         }
 
+        // Initialize Catalog features
+        for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+            fProperties.put(f.getPropertyName(), null);
+        }
+
         fConfigUpdated = false;
     } // <init>(SymbolTable,XMLGrammarPool)
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001, 2002,2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -20,16 +20,15 @@
 
 package com.sun.org.apache.xerces.internal.util;
 
+import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-
 /**
  * This class implements the basic operations for managing parser
  * configuration features and properties. This utility class can
@@ -87,12 +86,12 @@
     public ParserConfigurationSettings(XMLComponentManager parent) {
 
         // create storage for recognized features and properties
-        fRecognizedFeatures = new HashSet<String>();
-        fRecognizedProperties = new HashSet<String>();
+        fRecognizedFeatures = new HashSet<>();
+        fRecognizedProperties = new HashSet<>();
 
         // create table for features and properties
-        fFeatures = new HashMap<String, Boolean>();
-        fProperties = new HashMap<String, Object>();
+        fFeatures = new HashMap<>();
+        fProperties = new HashMap<>();
 
         // save parent
         fParentSettings = parent;
@@ -195,6 +194,7 @@
      *                                   it is <strong>really</strong>
      *                                   a critical error.
      */
+    @Override
     public final boolean getFeature(String featureId)
         throws XMLConfigurationException {
 
@@ -205,6 +205,7 @@
         return state.state;
     } // getFeature(String):boolean
 
+    @Override
     public final boolean getFeature(String featureId, boolean defaultValue) {
         FeatureState state = getFeatureState(featureId);
         if (state.isExceptional()) {
@@ -213,8 +214,9 @@
         return state.state;
     }
 
+    @Override
     public FeatureState getFeatureState(String featureId) {
-        Boolean state = (Boolean) fFeatures.get(featureId);
+        Boolean state = fFeatures.get(featureId);
 
         if (state == null) {
             FeatureState checkState = checkFeature(featureId);
@@ -238,6 +240,7 @@
      *                                   it is <strong>really</strong>
      *                                   a critical error.
      */
+    @Override
     public final Object getProperty(String propertyId)
         throws XMLConfigurationException {
 
@@ -249,6 +252,7 @@
         return state.state;
     } // getProperty(String):Object
 
+    @Override
     public final Object getProperty(String propertyId, Object defaultValue) {
         PropertyState state = getPropertyState(propertyId);
         if (state.isExceptional()) {
@@ -258,6 +262,7 @@
         return state.state;
     }
 
+    @Override
     public PropertyState getPropertyState(String propertyId) {
         Object propertyValue = fProperties.get(propertyId);
 
@@ -307,6 +312,7 @@
      *
      * @param propertyId The unique identifier (URI) of the property
      *                   being set.
+     * @return the PropertyState
      * @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
      *            requested feature is not known.
      */
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,21 +1,26 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 2002,2004 The Apache Software Foundation.
+ * Copyright (c) 2012, 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
- * Licensed 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
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * 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.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 package com.sun.org.apache.xerces.internal.utils;
@@ -48,72 +53,57 @@
 
     /**
      * Return an instance of this class.
+     * @return an instance of this class
      */
     public static SecuritySupport getInstance() {
         return securitySupport;
     }
 
     static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
-                try {
-                    cl = Thread.currentThread().getContextClassLoader();
-                } catch (SecurityException ex) { }
-                return cl;
-            }
+        return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+            ClassLoader cl = null;
+            try {
+                cl = Thread.currentThread().getContextClassLoader();
+            } catch (SecurityException ex) { }
+            return cl;
         });
     }
 
     static ClassLoader getSystemClassLoader() {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader cl = null;
-                try {
-                    cl = ClassLoader.getSystemClassLoader();
-                } catch (SecurityException ex) {}
-                return cl;
-            }
+        return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+            ClassLoader cl = null;
+            try {
+                cl = ClassLoader.getSystemClassLoader();
+            } catch (SecurityException ex) {}
+            return cl;
         });
     }
 
     static ClassLoader getParentClassLoader(final ClassLoader cl) {
-        return (ClassLoader)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                ClassLoader parent = null;
-                try {
-                    parent = cl.getParent();
-                } catch (SecurityException ex) {}
+        return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> {
+            ClassLoader parent = null;
+            try {
+                parent = cl.getParent();
+            } catch (SecurityException ex) {}
 
-                // eliminate loops in case of the boot
-                // ClassLoader returning itself as a parent
-                return (parent == cl) ? null : parent;
-            }
+            // eliminate loops in case of the boot
+            // ClassLoader returning itself as a parent
+            return (parent == cl) ? null : parent;
         });
     }
 
     public static String getSystemProperty(final String propName) {
-        return (String)
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
-                return System.getProperty(propName);
-            }
-        });
+        return AccessController.doPrivileged((PrivilegedAction<String>) () ->
+                System.getProperty(propName));
     }
 
     static FileInputStream getFileInputStream(final File file)
     throws FileNotFoundException
     {
         try {
-            return (FileInputStream)
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws FileNotFoundException {
-                    return new FileInputStream(file);
-                }
-            });
+            return AccessController.doPrivileged(
+                    (PrivilegedExceptionAction<FileInputStream>)() ->
+                    new FileInputStream(file));
         } catch (PrivilegedActionException e) {
             throw (FileNotFoundException)e.getException();
         }
@@ -135,38 +125,28 @@
      * @return a resource bundle for the given base name and locale
      */
     public static ResourceBundle getResourceBundle(final String bundle, final Locale locale) {
-        return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
-            public ResourceBundle run() {
+        return AccessController.doPrivileged((PrivilegedAction<ResourceBundle>) () -> {
+            try {
+                return PropertyResourceBundle.getBundle(bundle, locale);
+            } catch (MissingResourceException e) {
                 try {
-                    return PropertyResourceBundle.getBundle(bundle, locale);
-                } catch (MissingResourceException e) {
-                    try {
-                        return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
-                    } catch (MissingResourceException e2) {
-                        throw new MissingResourceException(
-                                "Could not load any resource bundle by " + bundle, bundle, "");
-                    }
+                    return PropertyResourceBundle.getBundle(bundle, new Locale("en", "US"));
+                } catch (MissingResourceException e2) {
+                    throw new MissingResourceException(
+                            "Could not load any resource bundle by " + bundle, bundle, "");
                 }
             }
         });
     }
 
     static boolean getFileExists(final File f) {
-        return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
-                    }
-                })).booleanValue();
+        return (AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+                f.exists()));
     }
 
     static long getLastModified(final File f) {
-        return ((Long)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return new Long(f.lastModified());
-                    }
-                })).longValue();
+        return (AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+                f.lastModified()));
     }
 
     /**
@@ -193,6 +173,7 @@
      * @param allowedProtocols a list of allowed protocols separated by comma
      * @param accessAny keyword to indicate allowing any protocol
      * @return the name of the protocol if rejected, null otherwise
+     * @throws java.io.IOException
      */
     public static String checkAccess(String systemId, String allowedProtocols, String accessAny) throws IOException {
         if (systemId == null || (allowedProtocols != null &&
@@ -201,7 +182,7 @@
         }
 
         String protocol;
-        if (systemId.indexOf(":")==-1) {
+        if (!systemId.contains(":")) {
             protocol = "file";
         } else {
             URL url = new URL(systemId);
@@ -249,15 +230,15 @@
      * Read JAXP system property in this order: system property,
      * $java.home/conf/jaxp.properties if the system property is not specified
      *
-     * @param propertyId the Id of the property
+     * @param sysPropertyId the Id of the property
      * @return the value of the property
      */
     public static String getJAXPSystemProperty(String sysPropertyId) {
-        String accessExternal = getSystemProperty(sysPropertyId);
-        if (accessExternal == null) {
-            accessExternal = readJAXPProperty(sysPropertyId);
+        String value = getSystemProperty(sysPropertyId);
+        if (value == null) {
+            value = readJAXPProperty(sysPropertyId);
         }
-        return accessExternal;
+        return value;
     }
 
      /**
@@ -288,7 +269,7 @@
             value = cacheProps.getProperty(propertyId);
 
         }
-        catch (Exception ex) {}
+        catch (IOException ex) {}
         finally {
             if (is != null) {
                 try {
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2003-2005 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -17,6 +17,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.sun.org.apache.xerces.internal.xinclude;
 
 import java.io.CharConversionException;
@@ -70,6 +71,14 @@
 import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import java.util.Objects;
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+import javax.xml.transform.Source;
+import jdk.xml.internal.JdkXmlUtils;
+import org.xml.sax.InputSource;
 
 /**
  * <p>
@@ -247,7 +256,7 @@
         { ERROR_REPORTER, ENTITY_RESOLVER, SECURITY_MANAGER, BUFFER_SIZE };
 
     /** Property defaults. */
-    private static final Object[] PROPERTY_DEFAULTS = { null, null, null, new Integer(XMLEntityManager.DEFAULT_BUFFER_SIZE) };
+    private static final Object[] PROPERTY_DEFAULTS = { null, null, null, XMLEntityManager.DEFAULT_BUFFER_SIZE};
 
     // instance variables
 
@@ -335,8 +344,8 @@
     private int[] fState = new int[INITIAL_SIZE];
 
     // buffering the necessary DTD events
-    private ArrayList fNotations;
-    private ArrayList fUnparsedEntities;
+    private final ArrayList<Notation> fNotations;
+    private final ArrayList<UnparsedEntity> fUnparsedEntities;
 
     // flags which control whether base URI or language fixup is performed.
     private boolean fFixupBaseURIs = true;
@@ -358,6 +367,17 @@
     // track whether the child config needs its features refreshed
     private boolean fNeedCopyFeatures = true;
 
+    /** indicate whether Catalog should be used for resolving external resources */
+    private boolean fUseCatalog = true;
+    CatalogFeatures fCatalogFeatures;
+    CatalogResolver fCatalogResolver;
+    CatalogUriResolver fCatalogUriResolver;
+
+    private String fCatalogFile;
+    private String fDefer;
+    private String fPrefer;
+    private String fResolve;
+
     // Constructors
 
     public XIncludeHandler() {
@@ -366,8 +386,8 @@
         fSawFallback[fDepth] = false;
         fSawInclude[fDepth] = false;
         fState[fDepth] = STATE_NORMAL_PROCESSING;
-        fNotations = new ArrayList();
-        fUnparsedEntities = new ArrayList();
+        fNotations = new ArrayList<>();
+        fUnparsedEntities = new ArrayList<>();
 
         fBaseURIScope = new IntStack();
         fBaseURI = new Stack();
@@ -534,24 +554,31 @@
         fSecurityPropertyMgr = (XMLSecurityPropertyManager)
                 componentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER);
 
+        //Use Catalog
+        fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG);
+        fCatalogFile = (String)componentManager.getProperty(CatalogFeatures.Feature.FILES.getPropertyName());
+        fDefer = (String)componentManager.getProperty(CatalogFeatures.Feature.DEFER.getPropertyName());
+        fPrefer = (String)componentManager.getProperty(CatalogFeatures.Feature.PREFER.getPropertyName());
+        fResolve = (String)componentManager.getProperty(CatalogFeatures.Feature.RESOLVE.getPropertyName());
+
         // Get buffer size.
         try {
             Integer value =
                 (Integer)componentManager.getProperty(
                     BUFFER_SIZE);
 
-            if (value != null && value.intValue() > 0) {
-                fBufferSize = value.intValue();
+            if (value != null && value > 0) {
+                fBufferSize = value;
                 if (fChildConfig != null) {
                     fChildConfig.setProperty(BUFFER_SIZE, value);
                 }
             }
             else {
-                fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE)).intValue();
+                fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE));
             }
         }
         catch (XMLConfigurationException e) {
-                fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE)).intValue();
+            fBufferSize = ((Integer)getPropertyDefault(BUFFER_SIZE));
         }
 
         // Reset XML 1.0 text reader.
@@ -1599,6 +1626,39 @@
                 includedSource =
                     fEntityResolver.resolveEntity(resourceIdentifier);
 
+                if (includedSource == null) {
+                    if (fCatalogFeatures == null) {
+                        fCatalogFeatures = JdkXmlUtils.getCatalogFeatures(fDefer, fCatalogFile, fPrefer, fResolve);
+                    }
+                    fCatalogFile = fCatalogFeatures.get(CatalogFeatures.Feature.FILES);
+                    if (fUseCatalog && fCatalogFile != null) {
+                        /*
+                           Although URI entry is preferred for resolving XInclude, system entry
+                           is allowed as well.
+                        */
+                        Source source = null;
+                        try {
+                            if (fCatalogUriResolver == null) {
+                                fCatalogUriResolver = CatalogManager.catalogUriResolver(fCatalogFeatures);
+                            }
+                            source = fCatalogUriResolver.resolve(href, fCurrentBaseURI.getExpandedSystemId());
+                        } catch (CatalogException e) {}
+
+                        if (source != null && !source.isEmpty()) {
+                            includedSource = new XMLInputSource(null, source.getSystemId(),
+                                    fCurrentBaseURI.getExpandedSystemId(), true);
+                        } else {
+                            if (fCatalogResolver == null) {
+                                fCatalogResolver = CatalogManager.catalogResolver(fCatalogFeatures);
+                            }
+                            InputSource is = fCatalogResolver.resolveEntity(href, href);
+                            if (is != null && !is.isEmpty()) {
+                                includedSource = new XMLInputSource(is, true);
+                            }
+                        }
+                    }
+                }
+
                 if (includedSource != null &&
                     !(includedSource instanceof HTTPInputSource) &&
                     (accept != null || acceptLanguage != null) &&
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java	Fri Aug 05 12:03:58 2016 -0700
@@ -21,9 +21,9 @@
 package com.sun.org.apache.xerces.internal.xni.parser;
 
 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
-
 import java.io.InputStream;
 import java.io.Reader;
+import org.xml.sax.InputSource;
 
 /**
  * This class represents an input source for an XML document. The
@@ -108,6 +108,23 @@
     } // <init>(XMLResourceIdentifier)
 
     /**
+     * Constructs an input source from a SAX InputSource
+     * object.
+     *
+     * @param inputSource  a SAX InputSource
+     * @param isCreatedByResolver a flag to indicate whether the source is
+     * created by a resolver
+     */
+    public XMLInputSource(InputSource inputSource, boolean isCreatedByResolver) {
+        fPublicId = inputSource.getPublicId();
+        fSystemId = inputSource.getSystemId();
+        fByteStream = inputSource.getByteStream();
+        fCharStream = inputSource.getCharacterStream();
+        fEncoding = inputSource.getEncoding();
+        fIsCreatedByResolver = isCreatedByResolver;
+    }
+
+    /**
      * Constructs an input source from a byte stream.
      *
      * @param publicId     The public identifier, if known.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
  *
@@ -17,9 +17,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: XMLReaderManager.java,v 1.2.4.1 2005/09/15 08:16:02 suresh_emailid Exp $
- */
+
 package com.sun.org.apache.xml.internal.utils;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
@@ -27,13 +25,16 @@
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import java.util.HashMap;
-
 import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
 
@@ -41,6 +42,7 @@
  * Creates XMLReader objects and caches them for re-use.
  * This class follows the singleton pattern.
  */
+@SuppressWarnings("deprecation") //org.xml.sax.helpers.XMLReaderFactory
 public class XMLReaderManager {
 
     private static final String NAMESPACES_FEATURE =
@@ -58,12 +60,12 @@
     /**
      * Cache of XMLReader objects
      */
-    private ThreadLocal m_readers;
+    private ThreadLocal<XMLReader> m_readers;
 
     /**
      * Keeps track of whether an XMLReader object is in use.
      */
-    private HashMap m_inUse;
+    private HashMap<XMLReader, Boolean> m_inUse;
 
     private boolean m_useServicesMechanism = true;
 
@@ -75,6 +77,10 @@
 
     private XMLSecurityManager _xmlSecurityManager;
 
+    //Catalog Feature
+    private boolean _useCatalog;
+    private CatalogFeatures _catalogFeatures;
+
     /**
      * Hidden constructor
      */
@@ -101,17 +107,17 @@
         if (m_readers == null) {
             // When the m_readers.get() method is called for the first time
             // on a thread, a new XMLReader will automatically be created.
-            m_readers = new ThreadLocal();
+            m_readers = new ThreadLocal<>();
         }
 
         if (m_inUse == null) {
-            m_inUse = new HashMap();
+            m_inUse = new HashMap<>();
         }
 
         // If the cached reader for this thread is in use, construct a new
         // one; otherwise, return the cached reader unless it isn't an
         // instance of the class set in the 'org.xml.sax.driver' property
-        reader = (XMLReader) m_readers.get();
+        reader = m_readers.get();
         boolean threadHasReader = (reader != null);
         String factory = SecuritySupport.getSystemProperty(property);
         if (threadHasReader && m_inUse.get(reader) != Boolean.TRUE &&
@@ -131,7 +137,7 @@
                         XMLSecurityManager.printWarning(reader.getClass().getName(),
                                 XMLConstants.FEATURE_SECURE_PROCESSING, e);
                     }
-                } catch (Exception e) {
+                } catch (SAXException e) {
                    try {
                         // If unable to create an instance, let's try to use
                         // the XMLReader from JAXP
@@ -156,8 +162,7 @@
                 throw new SAXException(ex);
             } catch (FactoryConfigurationError ex1) {
                 throw new SAXException(ex1.toString());
-            } catch (NoSuchMethodError ex2) {
-            } catch (AbstractMethodError ame) {
+            } catch (NoSuchMethodError | AbstractMethodError ex2) {
             }
 
             // Cache the XMLReader if this is the first time we've created
@@ -193,6 +198,23 @@
             XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
         }
 
+        boolean supportCatalog = true;
+        try {
+            reader.setFeature(JdkXmlUtils.USE_CATALOG, _useCatalog);
+        }
+        catch (SAXNotRecognizedException | SAXNotSupportedException e) {
+            supportCatalog = false;
+        }
+
+        if (supportCatalog && _useCatalog && _catalogFeatures != null) {
+            try {
+                for (CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+                    reader.setProperty(f.getPropertyName(), _catalogFeatures.get(f));
+                }
+            } catch (SAXNotRecognizedException e) {
+                //shall not happen for internal settings
+            }
+        }
         return reader;
     }
 
@@ -229,6 +251,8 @@
     public void setFeature(String name, boolean value) {
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
             _secureProcessing = value;
+        } else if (XMLConstants.USE_CATALOG.equals(name)) {
+            _useCatalog = value;
         }
     }
 
@@ -252,6 +276,9 @@
             _accessExternalDTD = (String)value;
         } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
             _xmlSecurityManager = (XMLSecurityManager)value;
+        } else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
+            _catalogFeatures = (CatalogFeatures)value;
         }
+
     }
 }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,15 +1,15 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * 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
  *
- * Licensed 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
+ *      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,
@@ -18,27 +18,21 @@
  * limitations under the License.
  */
 
-// $Id: JAXPExtensionsProvider.java,v 1.1.2.1 2005/08/01 01:30:17 jeffsuttor Exp $
-
 package com.sun.org.apache.xpath.internal.jaxp;
 
-import javax.xml.transform.TransformerException;
-import javax.xml.xpath.XPathFunctionResolver;
+import com.sun.org.apache.xalan.internal.res.XSLMessages;
+import com.sun.org.apache.xpath.internal.ExtensionsProvider;
+import com.sun.org.apache.xpath.internal.functions.FuncExtFunction;
+import com.sun.org.apache.xpath.internal.objects.XNodeSet;
+import com.sun.org.apache.xpath.internal.objects.XObject;
+import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
+import java.util.ArrayList;
+import java.util.Vector;
+import javax.xml.namespace.QName;
 import javax.xml.xpath.XPathFunction;
 import javax.xml.xpath.XPathFunctionException;
-
-import com.sun.org.apache.xpath.internal.ExtensionsProvider;
-import com.sun.org.apache.xpath.internal.XPathContext;
-import com.sun.org.apache.xpath.internal.objects.XObject;
-import com.sun.org.apache.xpath.internal.objects.XNodeSet;
-import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
-import com.sun.org.apache.xalan.internal.res.XSLMessages;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
-
-import com.sun.org.apache.xpath.internal.functions.FuncExtFunction;
-import java.util.Vector;
-import java.util.ArrayList;
-import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathFunctionResolver;
+import jdk.xml.internal.JdkXmlFeatures;
 
 /**
  *
@@ -55,10 +49,10 @@
     }
 
     public JAXPExtensionsProvider(XPathFunctionResolver resolver,
-        boolean featureSecureProcessing, FeatureManager featureManager ) {
+        boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
         this.resolver = resolver;
         if (featureSecureProcessing &&
-                !featureManager.isFeatureEnabled(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION)) {
+                !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
             this.extensionInvocationDisabled = true;
         }
     }
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -20,7 +20,6 @@
 
 package com.sun.org.apache.xpath.internal.jaxp;
 
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xpath.internal.objects.XObject;
 import javax.xml.namespace.QName;
 import javax.xml.transform.TransformerException;
@@ -30,6 +29,7 @@
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathVariableResolver;
+import jdk.xml.internal.JdkXmlFeatures;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
@@ -48,7 +48,7 @@
      */
     protected XPathExpressionImpl() {
         this(null, null, null, null,
-             false, true, new FeatureManager());
+             false, true, new JdkXmlFeatures(false));
     };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
@@ -56,13 +56,13 @@
             XPathFunctionResolver functionResolver,
             XPathVariableResolver variableResolver) {
         this(xpath, prefixResolver, functionResolver, variableResolver,
-             false, true, new FeatureManager());
+             false, true, new JdkXmlFeatures(false));
     };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
             JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
             XPathVariableResolver variableResolver, boolean featureSecureProcessing,
-            boolean useServiceMechanism, FeatureManager featureManager) {
+            boolean useServiceMechanism, JdkXmlFeatures featureManager) {
         this.xpath = xpath;
         this.prefixResolver = prefixResolver;
         this.functionResolver = functionResolver;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -22,16 +22,14 @@
 package com.sun.org.apache.xpath.internal.jaxp;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
+import com.sun.org.apache.xalan.internal.res.XSLMessages;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
-import com.sun.org.apache.xalan.internal.res.XSLMessages;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
-import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
-
 import javax.xml.XMLConstants;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathVariableResolver;
+import jdk.xml.internal.JdkXmlFeatures;
 
 /**
  * The XPathFactory builds XPaths.
@@ -69,7 +67,7 @@
 
         private boolean _useServicesMechanism = true;
 
-        private final FeatureManager _featureManager;
+        private final JdkXmlFeatures _featureManager;
 
         public XPathFactoryImpl() {
             this(true);
@@ -80,13 +78,11 @@
         }
 
         public XPathFactoryImpl(boolean useServicesMechanism) {
-            _featureManager = new FeatureManager();
             if (System.getSecurityManager() != null) {
                 _isSecureMode = true;
                 _isNotSecureProcessing = false;
-                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
             }
+            _featureManager = new JdkXmlFeatures(!_isNotSecureProcessing);
             this._useServicesMechanism = useServicesMechanism;
         }
         /**
@@ -189,8 +185,8 @@
 
                 _isNotSecureProcessing = !value;
                 if (value && _featureManager != null) {
-                    _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                            FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+                    _featureManager.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION,
+                            JdkXmlFeatures.State.FSP, false);
                 }
 
                 // all done processing feature
@@ -204,7 +200,7 @@
             }
 
             if (_featureManager != null &&
-                    _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
+                    _featureManager.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
                 return;
             }
 
@@ -257,11 +253,10 @@
                 return _useServicesMechanism;
             }
 
-            /** Check to see if the property is managed by the security manager **/
-            String propertyValue = (_featureManager != null) ?
-                    _featureManager.getValueAsString(name) : null;
-            if (propertyValue != null) {
-                return _featureManager.isFeatureEnabled(name);
+            /** Check to see if the property is managed by the feature manager **/
+            int index = _featureManager.getIndex(name);
+            if (index > -1) {
+                return _featureManager.getFeature(index);
             }
 
             // unknown feature
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Fri Aug 05 12:03:58 2016 -0700
@@ -20,20 +20,20 @@
 
 package com.sun.org.apache.xpath.internal.jaxp;
 
-import javax.xml.namespace.QName;
+import com.sun.org.apache.xpath.internal.*;
+import com.sun.org.apache.xpath.internal.objects.XObject;
 import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.transform.TransformerException;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathEvaluationResult;
+import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathVariableResolver;
-import javax.xml.xpath.XPathExpression;
-import com.sun.org.apache.xpath.internal.*;
-import com.sun.org.apache.xpath.internal.objects.XObject;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import jdk.xml.internal.JdkXmlFeatures;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
-import javax.xml.transform.TransformerException;
-import javax.xml.xpath.XPathEvaluationResult;
 
 /**
  * The XPathImpl class provides implementation for the methods defined  in
@@ -54,12 +54,12 @@
     private NamespaceContext namespaceContext=null;
 
     XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr) {
-        this(vr, fr, false, true, new FeatureManager());
+        this(vr, fr, false, true, new JdkXmlFeatures(false));
     }
 
     XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
             boolean featureSecureProcessing, boolean useServiceMechanism,
-            FeatureManager featureManager) {
+            JdkXmlFeatures featureManager) {
         this.origVariableResolver = this.variableResolver = vr;
         this.origFunctionResolver = this.functionResolver = fr;
         this.featureSecureProcessing = featureSecureProcessing;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImplUtil.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImplUtil.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -27,7 +27,6 @@
 
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xml.internal.dtm.DTM;
 import com.sun.org.apache.xpath.internal.objects.XObject;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
@@ -42,6 +41,7 @@
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathNodes;
 import javax.xml.xpath.XPathVariableResolver;
+import jdk.xml.internal.JdkXmlFeatures;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.traversal.NodeIterator;
@@ -61,7 +61,7 @@
     // Secure Processing Feature is set on XPathFactory then the invocation of
     // extensions function need to throw XPathFunctionException
     boolean featureSecureProcessing = false;
-    FeatureManager featureManager;
+    JdkXmlFeatures featureManager;
 
     /**
      * Evaluate an XPath context using the internal XPath engine
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -381,4 +381,42 @@
          */
         public static final String ACCESS_EXTERNAL_STYLESHEET = "http://javax.xml.XMLConstants/property/accessExternalStylesheet";
 
+
+        /**
+         * Feature: useCatalog
+         *
+         * <p>
+         * Instructs XML processors to use XML Catalogs to resolve entity references.
+         * Catalogs may be set through JAXP factories, system properties, or
+         * jaxp.properties by using the {@code javax.xml.catalog.files} property
+         * defined in {@link javax.xml.catalog.CatalogFeatures}.
+         * The following code enables Catalog on SAX parser:
+         * <pre>{@code
+         *      SAXParserFactory spf = SAXParserFactory.newInstance();
+         *      spf.setFeature(XMLConstants.USE_CATALOG, true);
+         *      SAXParser parser = spf.newSAXParser();
+         *      parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), "catalog.xml");
+         * }</pre>
+         *
+         * <p>
+         * <b>Value:</b> a boolean. If the value is true, and a catalog is set,
+         * the XML parser will resolve external references using
+         * {@link javax.xml.catalog.CatalogResolver}. If the value is false,
+         * XML Catalog is ignored even if one is set. The default value is true.
+         *
+         * <p>
+         * <b>System Property:</b> The value of this property can be set or overridden by
+         * system property {@code javax.xml.useCatalog}
+         *
+         * <p>
+         * <b>jaxp.properties:</b> This configuration file is in standard
+         * {@link java.util.Properties} format and typically located in the {@code conf}
+         * directory of the Java installation. If the file exists and the system
+         * property is specified, its value will be used to override the default
+         * value of the property.
+         *
+         * @since 9
+         */
+        public static final String USE_CATALOG = "http://javax.xml.XMLConstants/feature/useCatalog";
+
 }
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java	Fri Aug 05 12:03:58 2016 -0700
@@ -195,29 +195,184 @@
                         .build();
  * }</pre>
  *
+ * <p>
+ * <h3>JAXP XML Processor Support</h3>
+ * The Catalog Features are supported throughout the JAXP processors, including
+ * SAX and DOM ({@link javax.xml.parsers}), and StAX parsers ({@link javax.xml.stream}),
+ * Schema Validation ({@link javax.xml.validation}), and XML Transformation
+ * ({@link javax.xml.transform}). The features described above can be set through JAXP
+ * factories or processors that define a setProperty or setAttribute interface.
+ * For example, the following code snippet sets a path to a catalog file on a SAX
+ * parser through the {@code javax.xml.catalog.files} property:
+ * <p>
+ * <pre>{@code
+ *      SAXParserFactory spf = SAXParserFactory.newInstance();
+ *      spf.setFeature(XMLConstants.USE_CATALOG, true); [1]
+ *      SAXParser parser = spf.newSAXParser();
+ *      parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), "catalog.xml");
+ * }</pre>
+ * <p>
+ * [1] Note that this statement is not required since the default value of
+ * {@link javax.xml.XMLConstants#USE_CATALOG USE_CATALOG} is true.
+ *
+ * <p>
+ * The JAXP Processors' support for Catalog depends on both the
+ * {@link javax.xml.XMLConstants#USE_CATALOG USE_CATALOG} feature and the
+ * existence of valid Catalog file(s). A JAXP processor will use the Catalog
+ * only when the feature is true and valid Catalog file(s) are specified through
+ * the {@code javax.xml.catalog.files} property. It will make no attempt to use
+ * the Catalog if either {@link javax.xml.XMLConstants#USE_CATALOG USE_CATALOG}
+ * is set to false, or there is no Catalog file specified.
+ *
+ * <p>
+ * The JAXP processors will observe the default settings of the
+ * {@link javax.xml.catalog.CatalogFeatures}. The processors, for example, will
+ * report an Exception by default when no matching entry is found since the
+ * default value of the {@code javax.xml.catalog.resolve} property is strict.
+ *
+ * <p>
+ * The JAXP processors give preference to user-specified custom resolvers. If such
+ * a resolver is registered, it will be used over the CatalogResolver. If it returns
+ * null however, the processors will continue resolving with the CatalogResolver.
+ * If it returns an empty source, no attempt will be made by the CatalogResolver.
+ *
+ * <p>
+ * The Catalog support is available for any process in the JAXP library that
+ * supports a resolver. The following table lists all such processes.
+ *
+ * <p>
+ * <center><h3><a name="CatalogFeatures">Processes with Catalog Support</a></h3></center></p>
+ *
+ * <table border="1">
+ * <thead>
+ * <tr>
+ * <th>Process</th>
+ * <th>Catalog Entry Type</th>
+ * <th>Example</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>DTDs and external entities</td>
+ * <td>public, system</td>
+ * <td>
+ * <pre>{@literal
+   The following DTD reference:
+   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+   Can be resolved using the following Catalog entry:
+   <public publicId="-//W3C//DTD XHTML 1.0 Strict//EN" uri="catalog/xhtml1-strict.dtd"/>
+   or
+   <systemSuffix systemIdSuffix="html1-strict.dtd" uri="catalog/xhtml1-strict.dtd"/>
+ * }</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>XInclude</td>
+ * <td>uri</td>
+ * <td>
+ * <pre>{@literal
+   The following XInclude element:
+   <xi:include href="http://openjdk.java.net/xml/disclaimer.xml"/>
+
+   can be resolved using an uri entry:
+   <uri name="http://openjdk.java.net/xml/disclaimer.xml" uri="file:///pathto/local/disclaimer.xml"/>
+   or
+   <uriSuffix uriSuffix="disclaimer.xml" uri="file:///pathto/local/disclaimer.xml"/>
+ * }</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>XSD import</td>
+ * <td>uri</td>
+ * <td>
+ * <pre>{@literal
+   The following import element:
+    <xsd:import namespace="http://openjdk.java.net/xsd/XSDImport_person"
+                schemaLocation="http://openjdk.java.net/xsd/XSDImport_person.xsd"/>
+
+   can be resolved using an uri entry:
+   <uri name="http://openjdk.java.net/xsd/XSDImport_person.xsd" uri="file:///pathto/local/XSDImport_person.xsd"/>
+   or
+   <uriSuffix uriSuffix="XSDImport_person.xsd" uri="file:///pathto/local/XSDImport_person.xsd"/>
+   or
+   <uriSuffix uriSuffix="http://openjdk.java.net/xsd/XSDImport_person" uri="file:///pathto/local/XSDImport_person.xsd"/>
+ * }</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>XSD include</td>
+ * <td>uri</td>
+ * <td>
+ * <pre>{@literal
+   The following include element:
+   <xsd:include schemaLocation="http://openjdk.java.net/xsd/XSDInclude_person.xsd"/>
+
+   can be resolved using an uri entry:
+   <uri name="http://openjdk.java.net/xsd/XSDInclude_person.xsd" uri="file:///pathto/local/XSDInclude_person.xsd"/>
+   or
+   <uriSuffix uriSuffix="XSDInclude_person.xsd" uri="file:///pathto/local/XSDInclude_person.xsd"/>
+ * }</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>XSL import and include</td>
+ * <td>uri</td>
+ * <td>
+ * <pre>{@literal
+   The following include element:
+   <xsl:include href="http://openjdk.java.net/xsl/include.xsl"/>
+
+   can be resolved using an uri entry:
+   <uri name="http://openjdk.java.net/xsl/include.xsl" uri="file:///pathto/local/include.xsl"/>
+   or
+   <uriSuffix uriSuffix="include.xsl" uri="file:///pathto/local/include.xsl"/>
+ * }</pre>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>XSL document function</td>
+ * <td>uri</td>
+ * <td>
+ * <pre>{@literal
+   The document in the following element:
+   <xsl:variable name="dummy" select="document('http://openjdk.java.net/xsl/list.xml')"/>
+
+   can be resolved using an uri entry:
+   <uri name="http://openjdk.java.net/xsl/list.xml" uri="file:///pathto/local/list.xml"/>
+   or
+   <uriSuffix uriSuffix="list.xml" uri="file:///pathto/local/list.xml"/>
+ * }</pre>
+ * </td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
  * @since 9
  */
 public class CatalogFeatures {
 
     /**
-     * The constant name of the javax.xml.catalog.files property. See the property table for more details.
+     * The constant name of the javax.xml.catalog.files property as described
+     * in the property table above.
      */
     static final String CATALOG_FILES = "javax.xml.catalog.files";
 
     /**
-     * The javax.xml.catalog.prefer property. See the property table for more details.
+     * The javax.xml.catalog.prefer property as described
+     * in the property table above.
      */
     static final String CATALOG_PREFER = "javax.xml.catalog.prefer";
 
     /**
-     * Determines whether or not delegated catalogs and nextCatalog will be read
-     * when the current catalog is loaded.
+     * The javax.xml.catalog.defer property as described
+     * in the property table above.
      */
     static final String CATALOG_DEFER = "javax.xml.catalog.defer";
 
     /**
-     * Determines the action if there is no matching entry found after
-     * all of the specified catalogs are exhausted.
+     * The javax.xml.catalog.resolve property as described
+     * in the property table above.
      */
     static final String CATALOG_RESOLVE = "javax.xml.catalog.resolve";
 
@@ -305,7 +460,7 @@
          * Returns the default value of the property.
          * @return the default value of the property
          */
-        String defaultValue() {
+        public String defaultValue() {
             return defaultValue;
         }
 
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -181,78 +181,78 @@
 public abstract class XMLGregorianCalendar
         implements Cloneable {
 
-        /**
-         * Default no-arg constructor.
-         *
-         * <p>Note: Always use the {@link DatatypeFactory} to
-         * construct an instance of {@code XMLGregorianCalendar}.
-         * The constructor on this class cannot be guaranteed to
-         * produce an object with a consistent state and may be
-         * removed in the future.
-         */
-         public XMLGregorianCalendar() {
-         }
+    /**
+     * Default no-arg constructor.
+     *
+     * <p>Note: Always use the {@link DatatypeFactory} to
+     * construct an instance of {@code XMLGregorianCalendar}.
+     * The constructor on this class cannot be guaranteed to
+     * produce an object with a consistent state and may be
+     * removed in the future.
+     */
+    public XMLGregorianCalendar() {
+    }
 
-        /**
-         * Unset all fields to undefined.
-         *
-         * <p>Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields
-         * to null.
-         */
-        public abstract void clear();
+    /**
+     * Unset all fields to undefined.
+     *
+     * <p>Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields
+     * to null.
+     */
+    public abstract void clear();
 
-        /**
-         * Reset this {@code XMLGregorianCalendar} to its original values.
-         *
-         * <p>{@code XMLGregorianCalendar} is reset to the same values as when it was created with
-         * {@link DatatypeFactory#newXMLGregorianCalendar()},
-         * {@link DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)},
-         * {@link DatatypeFactory#newXMLGregorianCalendar(
-         *   BigInteger year,
-         *   int month,
-         *   int day,
-         *   int hour,
-         *   int minute,
-         *   int second,
-         *   BigDecimal fractionalSecond,
-         *   int timezone)},
-         * {@link DatatypeFactory#newXMLGregorianCalendar(
-         *   int year,
-         *   int month,
-         *   int day,
-         *   int hour,
-         *   int minute,
-         *   int second,
-         *   int millisecond,
-         *   int timezone)},
-         * {@link DatatypeFactory#newXMLGregorianCalendar(GregorianCalendar cal)},
-         * {@link DatatypeFactory#newXMLGregorianCalendarDate(
-         *   int year,
-         *   int month,
-         *   int day,
-         *   int timezone)},
-         * {@link DatatypeFactory#newXMLGregorianCalendarTime(
-         *   int hours,
-         *   int minutes,
-         *   int seconds,
-         *   int timezone)},
-         * {@link DatatypeFactory#newXMLGregorianCalendarTime(
-         *   int hours,
-         *   int minutes,
-         *   int seconds,
-         *   BigDecimal fractionalSecond,
-         *   int timezone)} or
-         * {@link DatatypeFactory#newXMLGregorianCalendarTime(
-         *   int hours,
-         *   int minutes,
-         *   int seconds,
-         *   int milliseconds,
-         *   int timezone)}.
-         *
-         * <p>{@code reset()} is designed to allow the reuse of existing {@code XMLGregorianCalendar}s
-         * thus saving resources associated with the creation of new {@code XMLGregorianCalendar}s.
-         */
-        public abstract void reset();
+    /**
+     * Reset this {@code XMLGregorianCalendar} to its original values.
+     *
+     * <p>{@code XMLGregorianCalendar} is reset to the same values as when it was created with
+     * {@link DatatypeFactory#newXMLGregorianCalendar()},
+     * {@link DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)},
+     * {@link DatatypeFactory#newXMLGregorianCalendar(
+     *   BigInteger year,
+     *   int month,
+     *   int day,
+     *   int hour,
+     *   int minute,
+     *   int second,
+     *   BigDecimal fractionalSecond,
+     *   int timezone)},
+     * {@link DatatypeFactory#newXMLGregorianCalendar(
+     *   int year,
+     *   int month,
+     *   int day,
+     *   int hour,
+     *   int minute,
+     *   int second,
+     *   int millisecond,
+     *   int timezone)},
+     * {@link DatatypeFactory#newXMLGregorianCalendar(GregorianCalendar cal)},
+     * {@link DatatypeFactory#newXMLGregorianCalendarDate(
+     *   int year,
+     *   int month,
+     *   int day,
+     *   int timezone)},
+     * {@link DatatypeFactory#newXMLGregorianCalendarTime(
+     *   int hours,
+     *   int minutes,
+     *   int seconds,
+     *   int timezone)},
+     * {@link DatatypeFactory#newXMLGregorianCalendarTime(
+     *   int hours,
+     *   int minutes,
+     *   int seconds,
+     *   BigDecimal fractionalSecond,
+     *   int timezone)} or
+     * {@link DatatypeFactory#newXMLGregorianCalendarTime(
+     *   int hours,
+     *   int minutes,
+     *   int seconds,
+     *   int milliseconds,
+     *   int timezone)}.
+     *
+     * <p>{@code reset()} is designed to allow the reuse of existing {@code XMLGregorianCalendar}s
+     * thus saving resources associated with the creation of new {@code XMLGregorianCalendar}s.
+     */
+    public abstract void reset();
 
     /**
      * Set low and high order component of XSD {@code dateTime} year field.
@@ -340,75 +340,75 @@
      */
     public void setTime(int hour, int minute, int second) {
 
-                setTime(
-                        hour,
-                        minute,
-                        second,
-                        null // fractional
-                );
+        setTime(
+                hour,
+                minute,
+                second,
+                null // fractional
+        );
     }
 
-        /**
-         * Set hours.
-         *
-         * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * @param hour value constraints summarized in <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
-         *
-         * @throws IllegalArgumentException if {@code hour} parameter is outside value constraints for the field as specified in
-         *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
-        */
-        public abstract void setHour(int hour);
+    /**
+     * Set hours.
+     *
+     * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * @param hour value constraints summarized in <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
+     *
+     * @throws IllegalArgumentException if {@code hour} parameter is outside value constraints for the field as specified in
+     *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
+     */
+    public abstract void setHour(int hour);
 
-        /**
-         * Set minutes.
-         *
-         * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * @param minute value constraints summarized in <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
-         *
-         * @throws IllegalArgumentException if {@code minute} parameter is outside value constraints for the field as specified in
-         *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
-        */
-        public abstract void setMinute(int minute);
+    /**
+     * Set minutes.
+     *
+     * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * @param minute value constraints summarized in <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
+     *
+     * @throws IllegalArgumentException if {@code minute} parameter is outside value constraints for the field as specified in
+     *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
+     */
+    public abstract void setMinute(int minute);
 
-        /**
-         * Set seconds.
-         *
-         * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * @param second value constraints summarized in <a href="#datetimefield-second">second field of date/time field mapping table</a>.
-         *
-         * @throws IllegalArgumentException if {@code second} parameter is outside value constraints for the field as specified in
-         *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
-        */
-        public abstract void setSecond(int second);
+    /**
+     * Set seconds.
+     *
+     * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * @param second value constraints summarized in <a href="#datetimefield-second">second field of date/time field mapping table</a>.
+     *
+     * @throws IllegalArgumentException if {@code second} parameter is outside value constraints for the field as specified in
+     *   <a href="#datetimefieldmapping">date/time field mapping table</a>.
+     */
+    public abstract void setSecond(int second);
 
-        /**
-         * Set milliseconds.
-         *
-         * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * @param millisecond value constraints summarized in
-         *   <a href="#datetimefield-second">second field of date/time field mapping table</a>.
-         *
-         * @throws IllegalArgumentException if {@code millisecond} parameter is outside value constraints for the field as specified
-         *   in <a href="#datetimefieldmapping">date/time field mapping table</a>.
-        */
-        public abstract void setMillisecond(int millisecond);
+    /**
+     * Set milliseconds.
+     *
+     * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * @param millisecond value constraints summarized in
+     *   <a href="#datetimefield-second">second field of date/time field mapping table</a>.
+     *
+     * @throws IllegalArgumentException if {@code millisecond} parameter is outside value constraints for the field as specified
+     *   in <a href="#datetimefieldmapping">date/time field mapping table</a>.
+     */
+    public abstract void setMillisecond(int millisecond);
 
-        /**
-         * Set fractional seconds.
-         *
-         * <p>Unset this field by invoking the setter with a parameter value of {@code null}.
-         *
-         * @param fractional value constraints summarized in
-         *   <a href="#datetimefield-second">second field of date/time field mapping table</a>.
-         *
-         * @throws IllegalArgumentException if {@code fractional} parameter is outside value constraints for the field as specified
-         *   in <a href="#datetimefieldmapping">date/time field mapping table</a>.
-        */
-        public abstract void setFractionalSecond(BigDecimal fractional);
+    /**
+     * Set fractional seconds.
+     *
+     * <p>Unset this field by invoking the setter with a parameter value of {@code null}.
+     *
+     * @param fractional value constraints summarized in
+     *   <a href="#datetimefield-second">second field of date/time field mapping table</a>.
+     *
+     * @throws IllegalArgumentException if {@code fractional} parameter is outside value constraints for the field as specified
+     *   in <a href="#datetimefieldmapping">date/time field mapping table</a>.
+     */
+    public abstract void setFractionalSecond(BigDecimal fractional);
 
 
     /**
@@ -429,12 +429,12 @@
      * <a href="#datetimefieldmapping">date/time field mapping table</a>.
      */
     public void setTime(
-        int hour,
-        int minute,
-        int second,
-        BigDecimal fractional) {
+            int hour,
+            int minute,
+            int second,
+            BigDecimal fractional) {
 
-                setHour(hour);
+        setHour(hour);
         setMinute(minute);
         setSecond(second);
         setFractionalSecond(fractional);
@@ -465,173 +465,182 @@
         setMillisecond(millisecond);
     }
 
-        /**
-         * Return high order component for XML Schema 1.0 dateTime datatype field for
-         * {@code year}.
-         * {@code null} if this optional part of the year field is not defined.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
-         * @return eon of this {@code XMLGregorianCalendar}. The value
-         * returned is an integer multiple of 10^9.
-         *
-         * @see #getYear()
-         * @see #getEonAndYear()
-         */
-        public abstract BigInteger getEon();
+    /**
+     * Returns the high order component for XML Schema 1.0 dateTime datatype field for
+     * {@code year}.
+     * {@code null} if this optional part of the year field is not defined.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
+     * @return The eon of this {@code XMLGregorianCalendar}. The value
+     * returned is an integer multiple of 10^9.
+     *
+     * @see #getYear()
+     * @see #getEonAndYear()
+     */
+    public abstract BigInteger getEon();
 
-        /**
-         * Return low order component for XML Schema 1.0 dateTime datatype field for
-         * {@code year} or {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
-         *
-         * @return year  of this {@code XMLGregorianCalendar}.
-         *
-         * @see #getEon()
-         * @see #getEonAndYear()
-         */
-        public abstract int getYear();
+    /**
+     * Returns the low order component for XML Schema 1.0 dateTime datatype field for
+     * {@code year} or {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
+     *
+     * @return The year of this {@code XMLGregorianCalendar}.
+     *
+     * @see #getEon()
+     * @see #getEonAndYear()
+     */
+    public abstract int getYear();
 
-        /**
-         * Return XML Schema 1.0 dateTime datatype field for
-         * {@code year}.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
-         *
-         * @return sum of {@code eon} and {@code BigInteger.valueOf(year)}
-         * when both fields are defined. When only {@code year} is defined,
-         * return it. When both {@code eon} and {@code year} are not
-         * defined, return {@code null}.
-         *
-         * @see #getEon()
-         * @see #getYear()
-         */
-        public abstract BigInteger getEonAndYear();
+    /**
+     * Returns the XML Schema 1.0 dateTime datatype field for
+     * {@code year}.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-year">year field of date/time field mapping table</a>.
+     *
+     * @return sum of {@code eon} and {@code BigInteger.valueOf(year)}
+     * when both fields are defined. When only {@code year} is defined,
+     * return it. When both {@code eon} and {@code year} are not
+     * defined, return {@code null}.
+     *
+     * @see #getEon()
+     * @see #getYear()
+     */
+    public abstract BigInteger getEonAndYear();
 
-        /**
-         * Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-month">month field of date/time field mapping table</a>.
-         *
-         * @return year  of this {@code XMLGregorianCalendar}.
-         *
-         */
-        public abstract int getMonth();
+    /**
+     * Returns the month of this calendar or {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-month">month field of date/time field mapping table</a>.
+     *
+     * @return The month of this {@code XMLGregorianCalendar}, from 1 to 12.
+     *
+     */
+    public abstract int getMonth();
 
-        /**
-         * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-day">day field of date/time field mapping table</a>.
-         *
-         * @see #setDay(int)
-         */
-        public abstract int getDay();
+    /**
+     * Returns the day of month or {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-day">day field of date/time field mapping table</a>.
+     *
+     * @return The day of month of this {@code XMLGregorianCalendar}, from 1 to 31.
+     *
+     * @see #setDay(int)
+     */
+    public abstract int getDay();
 
-        /**
-         * Return timezone offset in minutes or
-         * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-timezone">timezone field of date/time field mapping table</a>.
-         *
-         * @see #setTimezone(int)
-         */
-        public abstract int getTimezone();
+    /**
+     * Returns the Timezone offset in minutes or
+     * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-timezone">timezone field of date/time field mapping table</a>.
+     *
+     * @return The Timezone offset in minutes of this {@code XMLGregorianCalendar}.
+     *
+     * @see #setTimezone(int)
+     */
+    public abstract int getTimezone();
 
-        /**
-         * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}.
-         * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
-         * @see #setTime(int, int, int)
-         */
-        public abstract int getHour();
+    /**
+     * Returns the hour of day or
+     * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-hour">hour field of date/time field mapping table</a>.
+     *
+     * @return The hour of day of this {@code XMLGregorianCalendar}, from 0 to 23.
+     *
+     * @see #setTime(int, int, int)
+     */
+    public abstract int getHour();
 
-        /**
-         * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.
-         * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
-         * @see #setTime(int, int, int)
-         */
-        public abstract int getMinute();
+    /**
+     * Returns the minute of hour or
+     * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-minute">minute field of date/time field mapping table</a>.
+     *
+     * @return The minute of hour of this {@code XMLGregorianCalendar}, from 0 to 59.
+     *
+     * @see #setTime(int, int, int)
+     */
+    public abstract int getMinute();
 
-        /**
-         * Return seconds or {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * <p>Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
-         * When this field is not defined, the optional xs:dateTime
-         * fractional seconds field, represented by
-         * {@link #getFractionalSecond()} and {@link #getMillisecond()},
-         * must not be defined.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
-         *
-         * @return Second  of this {@code XMLGregorianCalendar}.
-         *
-         * @see #getFractionalSecond()
-         * @see #getMillisecond()
-         * @see #setTime(int, int, int)
-         */
-        public abstract int getSecond();
+    /**
+     * Returns the second of minute or
+     * {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined.
+     * When this field is not defined, the optional xs:dateTime
+     * fractional seconds field, represented by
+     * {@link #getFractionalSecond()} and {@link #getMillisecond()},
+     * must not be defined.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
+     *
+     * @return The second of minute of this {@code XMLGregorianCalendar},  from 0 to 59.
+     *
+     * @see #getFractionalSecond()
+     * @see #getMillisecond()
+     * @see #setTime(int, int, int)
+     */
+    public abstract int getSecond();
 
-        /**
-         * Return millisecond precision of {@link #getFractionalSecond()}.
-         *
-         * <p>This method represents a convenience accessor to infinite
-         * precision fractional second value returned by
-         * {@link #getFractionalSecond()}. The returned value is the rounded
-         * down to milliseconds value of
-         * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
-         * returns {@code null}, this method must return
-         * {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * <p>Value constraints for this value are summarized in
-         * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
-         *
-         * @return Millisecond  of this {@code XMLGregorianCalendar}.
-         *
-         * @see #getFractionalSecond()
-         * @see #setTime(int, int, int)
-         */
-        public int getMillisecond() {
+    /**
+     * Returns the millisecond precision of {@link #getFractionalSecond()}.
+     *
+     * <p>This method represents a convenience accessor to infinite
+     * precision fractional second value returned by
+     * {@link #getFractionalSecond()}. The returned value is the rounded
+     * down to milliseconds value of
+     * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
+     * returns {@code null}, this method must return
+     * {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * <p>Value constraints for this value are summarized in
+     * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
+     *
+     * @return The millisecond precision of this {@code XMLGregorianCalendar}.
+     *
+     * @see #getFractionalSecond()
+     * @see #setTime(int, int, int)
+     */
+    public int getMillisecond() {
 
-                BigDecimal fractionalSeconds = getFractionalSecond();
+        BigDecimal fractionalSeconds = getFractionalSecond();
 
-                // is field undefined?
-                if (fractionalSeconds == null) {
-                        return DatatypeConstants.FIELD_UNDEFINED;
-                }
-
-                return getFractionalSecond().movePointRight(3).intValue();
+        // is field undefined?
+        if (fractionalSeconds == null) {
+            return DatatypeConstants.FIELD_UNDEFINED;
         }
 
-        /**
-         * Return fractional seconds.
-         *
-         * <p>{@code null} is returned when this optional field is not defined.
-         *
-         * <p>Value constraints are detailed in
-         * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
-         *
-         * <p>This optional field can only have a defined value when the
-         * xs:dateTime second field, represented by {@link #getSecond()},
-         * does not return {@link DatatypeConstants#FIELD_UNDEFINED}.
-         *
-         * @return fractional seconds  of this {@code XMLGregorianCalendar}.
-         *
-         * @see #getSecond()
-         * @see #setTime(int, int, int, BigDecimal)
-         */
-        public abstract BigDecimal getFractionalSecond();
+        return getFractionalSecond().movePointRight(3).intValue();
+    }
+
+    /**
+     * Returns fractional seconds.
+     *
+     * <p>{@code null} is returned when this optional field is not defined.
+     *
+     * <p>Value constraints are detailed in
+     * <a href="#datetimefield-second">second field of date/time field mapping table</a>.
+     *
+     * <p>This optional field can only have a defined value when the
+     * xs:dateTime second field, represented by {@link #getSecond()},
+     * does not return {@link DatatypeConstants#FIELD_UNDEFINED}.
+     *
+     * @return Fractional seconds of this {@code XMLGregorianCalendar}.
+     *
+     * @see #getSecond()
+     * @see #setTime(int, int, int, BigDecimal)
+     */
+    public abstract BigDecimal getFractionalSecond();
 
     // comparisons
     /**
@@ -681,10 +690,11 @@
      * returns {@link DatatypeConstants#EQUAL},
      * otherwise {@code false}.
      */
+    @Override
     public boolean equals(Object obj) {
 
         if (obj == null || !(obj instanceof XMLGregorianCalendar)) {
-               return false;
+            return false;
         }
         return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL;
     }
@@ -694,6 +704,7 @@
      *
      * @return hash code of this object.
      */
+    @Override
     public int hashCode() {
 
         // Following two dates compare to EQUALS since in different timezones.
@@ -846,18 +857,19 @@
      */
     public abstract QName getXMLSchemaType();
 
-        /**
-         * Returns a {@code String} representation of this {@code XMLGregorianCalendar} {@code Object}.
-         *
-         * <p>The result is a lexical representation generated by {@link #toXMLFormat()}.
-         *
-         * @return A non-{@code null} valid {@code String} representation of this {@code XMLGregorianCalendar}.
-         *
+    /**
+     * Returns a {@code String} representation of this {@code XMLGregorianCalendar} {@code Object}.
+     *
+     * <p>The result is a lexical representation generated by {@link #toXMLFormat()}.
+     *
+     * @return A non-{@code null} valid {@code String} representation of this {@code XMLGregorianCalendar}.
+     *
      * @throws IllegalStateException if the combination of set fields
      *    does not match one of the eight defined XML Schema builtin date/time datatypes.
      *
      * @see #toXMLFormat()
-         */
+     */
+    @Override
     public String toString() {
 
         return toXMLFormat();
@@ -970,6 +982,8 @@
      *       {@code Calendar.set(int,int)}</li>
      * </ul>
      *
+     * @return An instance of {@link java.util.GregorianCalendar}.
+     *
      * @see #toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)
      */
     public abstract GregorianCalendar toGregorianCalendar();
@@ -1026,9 +1040,9 @@
      * @return a java.util.GregorianCalendar conversion of this instance.
      */
     public abstract GregorianCalendar toGregorianCalendar(
-        java.util.TimeZone timezone,
-                java.util.Locale aLocale,
-                XMLGregorianCalendar defaults);
+            java.util.TimeZone timezone,
+            java.util.Locale aLocale,
+            XMLGregorianCalendar defaults);
 
     /**
      * Returns a {@code java.util.TimeZone} for this class.
@@ -1055,5 +1069,7 @@
      *
      * @return copy of this {@code Object}
      */
-   public abstract Object clone();
+    @Override
+    public abstract Object clone();
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.xml.internal;
+
+import javax.xml.XMLConstants;
+import static jdk.xml.internal.JdkXmlUtils.SP_USE_CATALOG;
+
+/**
+ * This class manages JDK's XML Features. Previously added features and properties
+ * may be gradually moved to this class.
+ */
+public class JdkXmlFeatures {
+    public static final String ORACLE_JAXP_PROPERTY_PREFIX =
+        "http://www.oracle.com/xml/jaxp/properties/";
+    /**
+     * Feature enableExtensionFunctions
+     */
+    public static final String ORACLE_ENABLE_EXTENSION_FUNCTION =
+            ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions";
+    public static final String SP_ENABLE_EXTENSION_FUNCTION =
+            "javax.xml.enableExtensionFunctions";
+    public static final String CATALOG_FEATURES = "javax.xml.catalog.catalogFeatures";
+
+    public final static String PROPERTY_USE_CATALOG = XMLConstants.USE_CATALOG;
+
+    public static enum XmlFeature {
+        /**
+         * Feature enableExtensionFunctions
+         * FSP: extension function is enforced by FSP. When FSP is on, entension
+         * function is disabled.
+         */
+        ENABLE_EXTENSION_FUNCTION(ORACLE_ENABLE_EXTENSION_FUNCTION,
+                SP_ENABLE_EXTENSION_FUNCTION, true, false, true, true),
+        /**
+         * The {@link javax.xml.XMLConstants.USE_CATALOG} feature.
+         * FSP: USE_CATALOG is not enforced by FSP.
+         */
+        USE_CATALOG(PROPERTY_USE_CATALOG, SP_USE_CATALOG, true, false, true, false);
+
+        private final String name;
+        private final String nameSP;
+        private final boolean valueDefault;
+        private final boolean valueEnforced;
+        private final boolean hasSystem;
+        private final boolean enforced;
+
+        /**
+         * Constructs an XmlFeature instance.
+         * @param name the name of the feature
+         * @param nameSP the name of the System Property
+         * @param value the value of the feature
+         * @param hasSystem a flag to indicate whether the feature is supported
+         * @param enforced a flag indicating whether the feature is
+         * FSP (Feature_Secure_Processing) enforced
+         * with a System property
+         */
+        XmlFeature(String name, String nameSP, boolean value, boolean valueEnforced, boolean hasSystem, boolean enforced) {
+            this.name = name;
+            this.nameSP = nameSP;
+            this.valueDefault = value;
+            this.valueEnforced = valueEnforced;
+            this.hasSystem = hasSystem;
+            this.enforced = enforced;
+        }
+
+        /**
+         * Checks whether the specified property is equal to the current property.
+         * @param propertyName the name of a property
+         * @return true if the specified property is the current property, false
+         * otherwise
+         */
+        boolean equalsPropertyName(String propertyName) {
+            return name.equals(propertyName);
+        }
+
+        /**
+         * Returns the name of the property.
+         *
+         * @return the name of the property
+         */
+        public String apiProperty() {
+            return name;
+        }
+
+        /**
+         * Returns the name of the corresponding System Property.
+         *
+         * @return the name of the System Property
+         */
+        String systemProperty() {
+            return nameSP;
+        }
+
+        /**
+         * Returns the default value of the property.
+         * @return the default value of the property
+         */
+        public boolean defaultValue() {
+            return valueDefault;
+        }
+
+        /**
+         * Returns the FSP-enforced value.
+         * @return the FSP-enforced value
+         */
+        public boolean enforcedValue() {
+            return valueEnforced;
+        }
+
+        /**
+         * Checks whether System property is supported for the feature.
+         * @return true it is supported, false otherwise
+         */
+        boolean hasSystemProperty() {
+            return hasSystem;
+        }
+
+        /**
+         * Checks whether the property is enforced by FSP
+         * @return true it is, false otherwise
+         */
+        boolean enforced() {
+            return enforced;
+        }
+
+    }
+
+    /**
+     * States of the settings of a property, in the order: default value, value
+     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+     * properties, and jaxp api properties
+     */
+    public static enum State {
+        //this order reflects the overriding order
+
+        DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"),
+        JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"),
+        APIPROPERTY("property");
+
+        final String literal;
+        State(String literal) {
+            this.literal = literal;
+        }
+
+        String literal() {
+            return literal;
+        }
+    }
+
+    /**
+     * Values of the features
+     */
+    private boolean[] featureValues;
+
+    /**
+     * States of the settings for each property
+     */
+    private State[] states;
+
+    /**
+     * Flag indicating if secure processing is set
+     */
+    boolean secureProcessing;
+
+    /**
+     * Instantiate JdkXmlFeatures and initialize the fields
+     * @param secureProcessing
+     */
+    public JdkXmlFeatures(boolean secureProcessing) {
+        featureValues = new boolean[XmlFeature.values().length];
+        states = new State[XmlFeature.values().length];
+        this.secureProcessing = secureProcessing;
+        for (XmlFeature f : XmlFeature.values()) {
+            if (secureProcessing && f.enforced()) {
+                featureValues[f.ordinal()] = f.enforcedValue();
+                states[f.ordinal()] = State.FSP;
+            } else {
+                featureValues[f.ordinal()] = f.defaultValue();
+                states[f.ordinal()] = State.DEFAULT;
+            }
+        }
+        //read system properties or jaxp.properties
+        readSystemProperties();
+    }
+
+    /**
+     * Updates the JdkXmlFeatures instance by reading the system properties again.
+     * This will become necessary in case the system properties are set after
+     * the instance has been created.
+     */
+    public void update() {
+        readSystemProperties();
+    }
+
+    /**
+     * Set feature by property name and state
+     * @param propertyName property name
+     * @param state the state of the property
+     * @param value the value of the property
+     * @return true if the property is managed by the JdkXmlFeatures instance;
+     *         false otherwise.
+     */
+    public boolean setFeature(String propertyName, State state, Object value) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            setFeature(index, state, value);
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Set the value for a specific feature.
+     *
+     * @param feature the feature
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setFeature(XmlFeature feature, State state, boolean value) {
+        setFeature(feature.ordinal(), state, value);
+    }
+
+    /**
+     * Return the value of the specified property
+     *
+     * @param feature the property
+     * @return the value of the property
+     */
+    public boolean getFeature(XmlFeature feature) {
+        return featureValues[feature.ordinal()];
+    }
+
+    /**
+     * Return the value of a feature by its index (the Feature's ordinal)
+     * @param index the index of a feature
+     * @return value of a feature
+     */
+    public boolean getFeature(int index) {
+        return featureValues[index];
+    }
+
+    /**
+     * Set the value of a property by its index
+     *
+     * @param index the index of the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setFeature(int index, State state, Object value) {
+        boolean temp;
+        if (Boolean.class.isAssignableFrom(value.getClass())) {
+            temp = (Boolean)value;
+        } else {
+            temp = Boolean.parseBoolean((String) value);
+        }
+        setFeature(index, state, temp);
+    }
+
+    /**
+     * Set the value of a property by its index
+     *
+     * @param index the index of the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setFeature(int index, State state, boolean value) {
+        //only update if it shall override
+        if (state.compareTo(states[index]) >= 0) {
+            featureValues[index] = value;
+            states[index] = state;
+        }
+    }
+
+    /**
+     * Get the index by property name
+     *
+     * @param propertyName property name
+     * @return the index of the property if found; return -1 if not
+     */
+    public int getIndex(String propertyName) {
+        for (XmlFeature feature : XmlFeature.values()) {
+            if (feature.equalsPropertyName(propertyName)) {
+                //internally, ordinal is used as index
+                return feature.ordinal();
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     */
+    private void readSystemProperties() {
+        for (XmlFeature feature : XmlFeature.values()) {
+            getSystemProperty(feature, feature.systemProperty());
+        }
+    }
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     *
+     * @param property the type of the property
+     * @param sysPropertyName the name of system property
+     */
+    private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) {
+        try {
+            String value = SecuritySupport.getSystemProperty(sysPropertyName);
+            if (value != null && !value.equals("")) {
+                setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value));
+                return true;
+            }
+
+            value = SecuritySupport.readJAXPProperty(sysPropertyName);
+            if (value != null && !value.equals("")) {
+                setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value));
+                return true;
+            }
+        } catch (NumberFormatException e) {
+            //invalid setting
+            throw new NumberFormatException("Invalid setting for system property: " + feature.systemProperty());
+        }
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/java.xml/share/classes/jdk/xml/internal/JdkXmlUtils.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.xml.internal;
+
+import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+/**
+ * Constants for use across JAXP processors.
+ */
+public class JdkXmlUtils {
+    /**
+     * Catalog features
+     */
+    public final static String USE_CATALOG = XMLConstants.USE_CATALOG;
+    public final static String SP_USE_CATALOG = "javax.xml.useCatalog";
+    public final static String CATALOG_FILES = CatalogFeatures.Feature.FILES.getPropertyName();
+    public final static String CATALOG_DEFER = CatalogFeatures.Feature.DEFER.getPropertyName();
+    public final static String CATALOG_PREFER = CatalogFeatures.Feature.PREFER.getPropertyName();
+    public final static String CATALOG_RESOLVE = CatalogFeatures.Feature.RESOLVE.getPropertyName();
+
+    /**
+     * Values for a feature
+     */
+    public static final String FEATURE_TRUE = "true";
+    public static final String FEATURE_FALSE = "false";
+
+    /**
+     * Default value of USE_CATALOG. This will read the System property
+     */
+    public static final boolean USE_CATALOG_DEFAULT =
+            SecuritySupport.getJAXPSystemProperty(SP_USE_CATALOG, true);
+
+    /**
+     * Returns the value of a Catalog feature by the property name.
+     * @param features a CatalogFeatures instance
+     * @param name the name of a Catalog feature
+     * @return the value of a Catalog feature, null if the name does not match
+     * any feature supported by the Catalog.
+     */
+    public static String getCatalogFeature(CatalogFeatures features, String name) {
+        for (Feature feature : Feature.values()) {
+            if (feature.getPropertyName().equals(name)) {
+                return features.get(feature);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Creates an instance of a CatalogFeatures.
+     *
+     * @param defer the defer property defined in CatalogFeatures
+     * @param file the file path to a catalog
+     * @param prefer the prefer property defined in CatalogFeatures
+     * @param resolve the resolve property defined in CatalogFeatures
+     * @return a {@link javax.xml.transform.Source} object
+     */
+    public static CatalogFeatures getCatalogFeatures(String defer, String file,
+            String prefer, String resolve) {
+
+        CatalogFeatures.Builder builder = CatalogFeatures.builder();
+        if (file != null) {
+            builder = builder.with(CatalogFeatures.Feature.FILES, file);
+        }
+        if (prefer != null) {
+            builder = builder.with(CatalogFeatures.Feature.PREFER, prefer);
+        }
+        if (defer != null) {
+            builder = builder.with(CatalogFeatures.Feature.DEFER, defer);
+        }
+        if (resolve != null) {
+            builder = builder.with(CatalogFeatures.Feature.RESOLVE, resolve);
+        }
+
+        return builder.build();
+    }
+
+
+    /**
+     * Passing on the CatalogFeatures settings from one Xerces configuration object
+     * to another.
+     *
+     * @param config1 a Xerces configuration object
+     * @param config2 a Xerces configuration object
+     */
+    public static void catalogFeaturesConfig2Config(XMLComponentManager config1,
+            ParserConfigurationSettings config2) {
+        boolean supportCatalog = true;
+        boolean useCatalog = config1.getFeature(XMLConstants.USE_CATALOG);
+        try {
+            config2.setFeature(JdkXmlUtils.USE_CATALOG, useCatalog);
+        }
+        catch (XMLConfigurationException e) {
+            supportCatalog = false;
+        }
+
+        if (supportCatalog && useCatalog) {
+            try {
+                for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+                    config2.setProperty(f.getPropertyName(), config1.getProperty(f.getPropertyName()));
+                }
+            } catch (XMLConfigurationException e) {
+                //shall not happen for internal settings
+            }
+        }
+    }
+
+    /**
+     * Passing on the CatalogFeatures settings from a Xerces configuration object
+     * to an XMLReader.
+     *
+     * @param config a Xerces configuration object
+     * @param reader an XMLReader
+     */
+    public static void catalogFeaturesConfig2Reader(XMLComponentManager config, XMLReader reader) {
+        boolean supportCatalog = true;
+        boolean useCatalog = config.getFeature(XMLConstants.USE_CATALOG);
+        try {
+            reader.setFeature(JdkXmlUtils.USE_CATALOG, useCatalog);
+        }
+        catch (SAXNotRecognizedException | SAXNotSupportedException e) {
+            supportCatalog = false;
+        }
+
+        if (supportCatalog && useCatalog) {
+            try {
+                for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
+                    reader.setProperty(f.getPropertyName(), config.getProperty(f.getPropertyName()));
+                }
+            } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
+                //shall not happen for internal settings
+            }
+        }
+    }
+}
--- a/jaxp/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -83,6 +83,22 @@
     }
 
     /**
+     * Reads boolean type system property.
+     *
+     * @param propName the name of the property
+     * @param defValue the default value
+     * @return the value of the property, or the default value of no system
+     * property is found
+     */
+    public static boolean getJAXPSystemProperty(String propName, boolean defValue) {
+        String value = getJAXPSystemProperty(propName);
+        if (value == null) {
+            return defValue;
+        }
+        return Boolean.parseBoolean(value);
+    }
+
+    /**
      * Reads JAXP system property in this order: system property,
      * $java.home/conf/jaxp.properties if the system property is not specified
      *
--- a/jaxp/test/TEST.ROOT	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/test/TEST.ROOT	Fri Aug 05 12:03:58 2016 -0700
@@ -15,7 +15,7 @@
 othervm.dirs=javax/xml/jaxp
 
 # Group definitions
-groups=TEST.groups 
+groups=TEST.groups
 
 # Minimum jtreg version
 requiredVersion=4.2 b02
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.File;
+import java.io.StringReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * @bug 8158084 8162438 8162442
+ * @summary verifies the use of Catalog in SAX/DOM/StAX/Validation/Transform.
+ * The two main scenarios for all processors are:
+ * A custom resolver is used whether or not there's a Catalog;
+ * A Catalog is used when there's no custom resolver, and the USE_CATALOG
+ * is true (which is the case by default).
+ */
+
+/**
+ * Support Catalog:
+ * With this patch, the Catalog features are supported by all of the JAXP processors.
+ * The support is enabled by default. Using Catalog is as simple as setting a
+ * path to a catalog, through the API, or System property, or jaxp.properties.
+ *
+ * Test notes:
+ * For all DataProviders, the 1st and 2nd columns determine whether to set USE_CATALOG
+ * through the API and to use Catalog. When a custom resolver is specified, these
+ * settings should not affect the operation, thus the tests are repeated for both
+ * false and true.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class CatalogSupport extends CatalogSupportBase {
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setUp();
+    }
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    @Test(dataProvider = "data_SAXA")
+    public void testSAXA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    @Test(dataProvider = "data_SAXA")
+    public void testXMLReaderA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    @Test(dataProvider = "data_XIA")
+    public void testXIncludeA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXInclude(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    @Test(dataProvider = "data_DOMA")
+    public void testDOMA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    @Test(dataProvider = "data_SchemaA")
+    public void testValidationA(boolean setUseCatalog, boolean useCatalog,
+            String catalog, String xsd, LSResourceResolver resolver)
+            throws Exception {
+
+        testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
+    }
+
+    /*
+       @bug 8158084 8162438 these tests also verifies the fix for 8162438
+       Verifies the Catalog support on the Schema Validator.
+    */
+    @Test(dataProvider = "data_ValidatorA")
+    public void testValidatorA(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+        testValidator(setUseCatalog1, setUseCatalog2, useCatalog, source,
+                resolver1, resolver2, catalog1, catalog2);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLA")
+    public void testXSLImportA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml, URIResolver resolver, String expected)
+            throws Exception {
+
+        testXSLImport(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       @bug 8158084 8162442
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLA")
+    public void testXSLImportWTemplatesA(boolean setUseCatalog, boolean useCatalog,
+            String catalog, SAXSource xsl, StreamSource xml, URIResolver resolver, String expected)
+            throws Exception {
+        testXSLImportWTemplates(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       DataProvider: for testing the SAX parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_SAXA")
+    Object[][] getDataSAX() {
+        String[] systemIds = {"system.xsd"};
+        InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
+        MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
+        return new Object[][]{
+            {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
+            {false, true, xml_catalog, xml_system, entityHandler, expectedWResolver},
+            {true, true, xml_catalog, xml_system, entityHandler, expectedWResolver}
+        };
+    }
+
+    /*
+       DataProvider: for testing XInclude
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_XIA")
+    Object[][] getDataXI() {
+        String[] systemIds = {"XI_simple.xml"};
+        InputSource[] returnValues = {new InputSource(xml_xIncludeSimple)};
+        MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInXISimple);
+        return new Object[][]{
+            {false, true, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
+            {false, true, xml_catalog, xml_xInclude, entityHandler, contentInXIutf8},
+            {true, true, xml_catalog, xml_xInclude, entityHandler, contentInXIutf8}
+        };
+    }
+
+    /*
+       DataProvider: for testing DOM parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_DOMA")
+    Object[][] getDataDOM() {
+        String[] systemIds = {"system.xsd"};
+        InputSource[] returnValues = {new InputSource(new StringReader(dtd_systemResolved))};
+        MyEntityHandler entityHandler = new MyEntityHandler(systemIds, returnValues, elementInSystem);
+        return new Object[][]{
+            {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
+            {false, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
+                    new InputSource(new StringReader(dtd_systemResolved))), expectedWResolver},
+            {true, true, xml_catalog, xml_system, getMyEntityHandler(elementInSystem, systemIds,
+                    new InputSource(new StringReader(dtd_systemResolved))), expectedWResolver}
+        };
+    }
+
+    MyEntityHandler getMyEntityHandler(String elementName, String[] systemIds, InputSource... returnValues) {
+       return new MyEntityHandler(systemIds, returnValues, elementName);
+    }
+
+    /*
+       DataProvider: for testing Schema validation
+       Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
+     */
+    @DataProvider(name = "data_SchemaA")
+    Object[][] getDataSchema() {
+        String[] systemIds = {"pathto/XMLSchema.dtd", "datatypes.dtd"};
+        XmlInput[] returnValues = {new XmlInput(null, dtd_xmlSchema, null), new XmlInput(null, dtd_datatypes, null)};
+        LSResourceResolver resolver = new SourceResolver(null, systemIds, returnValues);
+
+        String[] systemIds1 = {"xml.xsd"};
+        XmlInput[] returnValues1 = {new XmlInput(null, xsd_xml, null)};
+        LSResourceResolver resolverImport = new SourceResolver(null, systemIds1, returnValues1);
+
+        String[] systemIds2 = {"XSDInclude_person.xsd", "XSDInclude_product.xsd"};
+        XmlInput[] returnValues2 = {new XmlInput(null, xsd_include_person, null),
+                        new XmlInput(null, xsd_include_product, null)};
+        LSResourceResolver resolverInclude = new SourceResolver(null, systemIds2, returnValues2);
+
+        return new Object[][]{
+            // for resolving DTD in xsd
+            {false, true, xml_catalog, xsd_xmlSchema, null},
+            {false, true, xml_bogus_catalog, xsd_xmlSchema, resolver},
+            {true, true, xml_bogus_catalog, xsd_xmlSchema, resolver},
+            // for resolving xsd import
+            {false, true, xml_catalog, xsd_xmlSchema_import, null},
+            {false, true, xml_bogus_catalog, xsd_xmlSchema_import, resolverImport},
+            {true, true, xml_bogus_catalog, xsd_xmlSchema_import, resolverImport},
+            // for resolving xsd include
+            {false, true, xml_catalog, xsd_include_company, null},
+            {false, true, xml_bogus_catalog, xsd_include_company, resolverInclude},
+            {true, true, xml_bogus_catalog, xsd_include_company, resolverInclude}
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema Validator
+       Data: source, resolver1, resolver2, catalog1, a catalog2
+     */
+    @DataProvider(name = "data_ValidatorA")
+    Object[][] getDataValidator() {
+        DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
+
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        StreamSource source = new StreamSource(new File(xml_val_test));
+
+        String[] systemIds = {"system.dtd", "val_test.xsd"};
+        XmlInput[] returnValues = {new XmlInput(null, dtd_system, null), new XmlInput(null, xsd_val_test, null)};
+        LSResourceResolver resolver = new SourceResolver(null, systemIds, returnValues);
+
+        StAXSource stax2 = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax3 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        return new Object[][]{
+            // use catalog
+            {false, false, true, ds, null, null, xml_catalog, null},
+            {false, false, true, ds, null, null, null, xml_catalog},
+            {false, false, true, ss, null, null, xml_catalog, null},
+            {false, false, true, ss, null, null, null, xml_catalog},
+            {false, false, true, stax, null, null, xml_catalog, null},
+            {false, false, true, stax1, null, null, null, xml_catalog},
+            {false, false, true, source, null, null, xml_catalog, null},
+            {false, false, true, source, null, null, null, xml_catalog},
+            // use resolver
+            {false, false, true, ds, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
+            {false, false, true, ss, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
+            {false, false, true, stax2, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
+            {false, false, true, source, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog}
+        };
+    }
+
+    /*
+       DataProvider: for testing XSL import and include
+       Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected result
+     */
+    @DataProvider(name = "data_XSLA")
+    Object[][] getDataXSL() {
+        // XSLInclude.xsl has one import XSLImport_html.xsl and two includes,
+        // XSLInclude_header.xsl and XSLInclude_footer.xsl;
+        String[] hrefs = {"XSLImport_html.xsl", "XSLInclude_header.xsl", "XSLInclude_footer.xsl"};
+        Source[] returnValues = {new StreamSource(xsl_import_html),
+                        new StreamSource(xsl_include_header),
+                        new StreamSource(xsl_include_footer)};
+        URIResolver resolver = new XslResolver(hrefs, returnValues);
+        SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
+        StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
+
+        String[] hrefs1 = {"pathto/DocFunc2.xml"};
+        Source[] returnValues1 = {new StreamSource(xml_doc2)};
+        URIResolver docResolver = new XslResolver(hrefs1, returnValues1);
+        SAXSource xslDocSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+        StreamSource xmlDocSource = new StreamSource(new File(xml_doc));
+        return new Object[][]{
+            // for resolving DTD, import and include in xsl
+            {false, true, xml_catalog, xslSourceDTD, xmlSourceDTD, null, ""},
+            {false, true, xml_bogus_catalog, new SAXSource(new InputSource(new StringReader(xsl_include))),
+                new StreamSource(new StringReader(xml_xsl)), resolver, ""},
+            {true, true, xml_bogus_catalog, new SAXSource(new InputSource(new StringReader(xsl_include))),
+                new StreamSource(new StringReader(xml_xsl)), resolver, ""},
+            // for resolving reference by the document function
+            {false, true, xml_catalog, xslDocSource, xmlDocSource, null, "Resolved by a catalog"},
+            {false, true, xml_bogus_catalog, xslDocSource, xmlDocSource, docResolver, "Resolved by a resolver"},
+            {true, true, xml_bogus_catalog, xslDocSource, xmlDocSource, docResolver, "Resolved by a resolver"}
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <!-- DTDs and external entities -->
+    <system systemId="http://openjdk.java.net/xml/catalog/dtd/system.dtd" uri="system.dtd"/>
+    
+    <!-- XMLSchema refers to XMLSchema.dtd -->
+    <public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="XMLSchema.dtd"/>
+    <!-- XMLSchema.dtd refers to datatypes.dtd -->
+    <systemSuffix systemIdSuffix="datatypes.dtd" uri="datatypes.dtd"/>
+    <!-- XMLSchema.dtd refers to datatypes.dtd, can use public entry as well -->
+    <!-- public publicId="datatypes" uri="datatypes.dtd"/-->
+
+    <!-- XInclude -->
+    <uri name="XI_simple.xml" uri="XI_simple4Catalog.xml"/>
+    <uri name="XI_utf8.xml" uri="XI_utf8.xml"/>
+    <uri name="XI_utf8Catalog.xml" uri="XI_utf8Catalog.xml"/>
+    <uri name="XI_test2.xml" uri="XI_test2.xml"/>
+    <system systemId="XI_red.dtd" uri="XI_red.dtd"/>
+
+    <!-- xsd import can be mapped using the namespace or systemId -->
+    <!--public publicId="http://www.w3.org/XML/1998/namespace" uri="xml.xsd"/-->
+    <!--uri name="http://www.w3.org/XML/1998/namespace" uri="xml.xsd"/-->
+    <uri name="http://www.w3.org/2001/pathto/xml.xsd" uri="xml.xsd"/>
+    
+    <!-- schema include -->
+    <uri name="pathto/XSDInclude_person.xsd" uri="XSDInclude_person.xsd"/>
+    <uri name="pathto/XSDInclude_product.xsd" uri="XSDInclude_product.xsd"/>
+    
+    <!-- for relative path, use Suffix -->    
+    <systemSuffix systemIdSuffix="pathto/val_test.xsd" uri="val_test.xsd"/>
+    
+    <!-- XSL import and include -->
+    <uri name="pathto/XSLImport_html.xsl" uri="XSLImport_html.xsl"/>
+    <uri name="pathto/XSLInclude_header.xsl" uri="XSLInclude_header.xsl"/>
+    <uri name="pathto/XSLInclude_footer.xsl" uri="XSLInclude_footer.xsl"/>
+    <!-- and DTDs -->
+    <system systemId="http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd" uri="XSLDTD.dtd"/>
+    <system systemId="http://openjdk.java.net/xml/catalog/dtd/include.dtd" uri="include.dtd"/>
+    
+    <!-- XSLT document function -->
+    <uri name="pathto/DocFunc2.xml" uri="DocFuncCatalog.xml"/>
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport1.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.File;
+import java.io.StringReader;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.transform.Source;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 8158084 8162438 8162442
+ * @summary extends CatalogSupport, verifies that the catalog file can be set
+ * using the System property.
+ */
+
+/**
+ * The name of a System property in javax.xml.catalog is the same as that of the
+ * property, and can be read through CatalogFeatures.Feature.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class CatalogSupport1 extends CatalogSupportBase {
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setUp();
+        System.setProperty(Feature.FILES.getPropertyName(), xml_catalog);
+    }
+
+    @AfterClass
+    public void tearDownClass() throws Exception {
+        System.clearProperty(Feature.FILES.getPropertyName());
+    }
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    @Test(dataProvider = "data_SAXC")
+    public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog, String xml, MyHandler handler, String expected) throws Exception {
+        testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    @Test(dataProvider = "data_SAXC")
+    public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog, String xml, MyHandler handler, String expected) throws Exception {
+        testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    @Test(dataProvider = "data_XIC")
+    public void testXIncludeC(boolean setUseCatalog, boolean useCatalog, String catalog, String xml, MyHandler handler, String expected) throws Exception {
+        testXInclude(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    @Test(dataProvider = "data_DOMC")
+    public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog, String xml, MyHandler handler, String expected) throws Exception {
+        testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    @Test(dataProvider = "data_SchemaC")
+    public void testValidationC(boolean setUseCatalog, boolean useCatalog, String catalog, String xsd, LSResourceResolver resolver)
+            throws Exception {
+
+        testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
+    }
+
+    /*
+       @bug 8158084 8162438 these tests also verifies the fix for 8162438
+       Verifies the Catalog support on the Schema Validator.
+    */
+    @Test(dataProvider = "data_ValidatorC")
+    public void testValidatorA(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+        testValidator(setUseCatalog1, setUseCatalog2, useCatalog, source,
+                resolver1, resolver2, catalog1, catalog2);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC")
+    public void testXSLImportC(boolean setUseCatalog, boolean useCatalog, String catalog, SAXSource xsl, StreamSource xml,
+        URIResolver resolver, String expected) throws Exception {
+
+        testXSLImport(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       @bug 8158084 8162442
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC")
+    public void testXSLImportWTemplatesC(boolean setUseCatalog, boolean useCatalog, String catalog, SAXSource xsl, StreamSource xml,
+        URIResolver resolver, String expected) throws Exception {
+        testXSLImportWTemplates(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       DataProvider: for testing the SAX parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_SAXC")
+    Object[][] getDataSAXC() {
+        return new Object[][]{
+            {false, true, null, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+
+        };
+    }
+
+    /*
+       DataProvider: for testing XInclude
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_XIC")
+    Object[][] getDataXIC() {
+        return new Object[][]{
+            {false, true, null, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing DOM parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_DOMC")
+    Object[][] getDataDOMC() {
+        return new Object[][]{
+            {false, true, null, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema validation
+       Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
+     */
+    @DataProvider(name = "data_SchemaC")
+    Object[][] getDataSchemaC() {
+
+        return new Object[][]{
+            // for resolving DTD in xsd
+            {false, true, null, xsd_xmlSchema, null},
+            // for resolving xsd import
+            {false, true, null, xsd_xmlSchema_import, null},
+            // for resolving xsd include
+            {false, true, null, xsd_include_company, null}
+        };
+    }
+
+
+    /*
+       DataProvider: for testing Schema Validator
+       Data: source, resolver1, resolver2, catalog1, a catalog2
+     */
+    @DataProvider(name = "data_ValidatorC")
+    Object[][] getDataValidator() {
+        DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, null);
+
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        StreamSource source = new StreamSource(new File(xml_val_test));
+
+        String[] systemIds = {"system.dtd", "val_test.xsd"};
+        XmlInput[] returnValues = {new XmlInput(null, dtd_system, null), new XmlInput(null, xsd_val_test, null)};
+        LSResourceResolver resolver = new SourceResolver(null, systemIds, returnValues);
+
+        StAXSource stax2 = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax3 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        return new Object[][]{
+            // use catalog
+            {false, false, true, ds, null, null, null, null},
+            {false, false, true, ds, null, null, null, null},
+            {false, false, true, ss, null, null, null, null},
+            {false, false, true, ss, null, null, null, null},
+            {false, false, true, stax, null, null, null, null},
+            {false, false, true, stax1, null, null, null, null},
+            {false, false, true, source, null, null, null, null},
+            {false, false, true, source, null, null, null, null},
+            // use resolver
+            {false, false, true, ds, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
+            {false, false, true, ss, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
+            {false, false, true, stax2, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
+            {false, false, true, source, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog}
+        };
+    }
+
+    /*
+       DataProvider: for testing XSL import and include
+       Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
+     */
+    @DataProvider(name = "data_XSLC")
+    Object[][] getDataXSLC() {
+        SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
+        StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
+
+        SAXSource xslDocSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+        StreamSource xmlDocSource = new StreamSource(new File(xml_doc));
+        return new Object[][]{
+            // for resolving DTD, import and include in xsl
+            {false, true, null, xslSourceDTD, xmlSourceDTD, null, ""},
+            // for resolving reference by the document function
+            {false, true, null, xslDocSource, xmlDocSource, null, "Resolved by a catalog"},
+        };
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport2.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.StringReader;
+import java.net.SocketTimeoutException;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 8158084 8162438 8162442
+ * @summary extends CatalogSupport tests, verifies that the use of the Catalog may
+ * be disabled through the System property.
+ */
+
+/**
+ * For all of the JAXP processors that support the Catalog, the use of the Catalog
+ * is turned on by default. It can then be turned off through the API and the
+ * System property.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class CatalogSupport2 extends CatalogSupportBase {
+    static final String TTIMEOUTREAD = "sun.net.client.defaultReadTimeout";
+    static final String TIMEOUTCONNECT = "sun.net.client.defaultConnectTimeout";
+    static String timeoutRead = System.getProperty(TTIMEOUTREAD);
+    static String timeoutConnect = System.getProperty(TIMEOUTCONNECT);
+
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setUp();
+        System.setProperty(SP_USE_CATALOG, "false");
+        timeoutRead = System.getProperty(TTIMEOUTREAD);
+        timeoutConnect = System.getProperty(TIMEOUTCONNECT);
+        System.setProperty(TTIMEOUTREAD, "1000");
+        System.setProperty(TIMEOUTCONNECT, "1000");
+    }
+
+    @AfterClass
+    public void tearDownClass() throws Exception {
+        System.clearProperty(SP_USE_CATALOG);
+        System.setProperty(TIMEOUTCONNECT, "-1");
+        System.setProperty(TTIMEOUTREAD, "-1");
+    }
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    @Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
+    public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog, String
+            xml, MyHandler handler, String expected) throws Exception {
+        testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    @Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
+    public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    @Test(dataProvider = "data_XIC", expectedExceptions = SAXParseException.class)
+    public void testXIncludeC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXInclude(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    @Test(dataProvider = "data_DOMC", expectedExceptions = {FileNotFoundException.class, SocketTimeoutException.class})
+    public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    @Test(dataProvider = "data_SchemaC", expectedExceptions = SAXParseException.class)
+    public void testValidationC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xsd, LSResourceResolver resolver)
+            throws Exception {
+        testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
+    }
+
+    @Test(dataProvider = "data_ValidatorC", expectedExceptions = {SAXException.class, FileNotFoundException.class})
+    public void testValidatorC(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+        testValidator(setUseCatalog1, setUseCatalog2, useCatalog, source,
+                resolver1, resolver2, catalog1, catalog2);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC", expectedExceptions = TransformerException.class)
+    public void testXSLImportC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml, URIResolver resolver, String expected) throws Exception {
+
+        testXSLImport(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       @bug 8158084 8162442
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC", expectedExceptions = TransformerException.class)
+    public void testXSLImportWTemplatesC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml, URIResolver resolver, String expected) throws Exception {
+        testXSLImportWTemplates(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       DataProvider: for testing the SAX parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_SAXC")
+    Object[][] getDataSAXC() {
+        return new Object[][]{
+            {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+
+        };
+    }
+
+    /*
+       DataProvider: for testing XInclude
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_XIC")
+    Object[][] getDataXIC() {
+        return new Object[][]{
+            {false, true, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing DOM parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_DOMC")
+    Object[][] getDataDOMC() {
+        return new Object[][]{
+            {false, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema validation
+       Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
+     */
+    @DataProvider(name = "data_SchemaC")
+    Object[][] getDataSchemaC() {
+
+        return new Object[][]{
+            // for resolving DTD in xsd
+            {false, true, xml_catalog, xsd_xmlSchema, null},
+            // for resolving xsd import
+            {false, true, xml_catalog, xsd_xmlSchema_import, null},
+            // for resolving xsd include
+            {false, true, xml_catalog, xsd_include_company, null}
+        };
+    }
+
+
+    /*
+       DataProvider: for testing Schema Validator
+       Data: source, resolver1, resolver2, catalog1, a catalog2
+     */
+    @DataProvider(name = "data_ValidatorC")
+    Object[][] getDataValidator() {
+        DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
+
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        StreamSource source = new StreamSource(new File(xml_val_test));
+
+        return new Object[][]{
+            // use catalog
+            {false, false, true, ds, null, null, xml_catalog, null},
+            {false, false, true, ds, null, null, null, xml_catalog},
+            {false, false, true, ss, null, null, xml_catalog, null},
+            {false, false, true, ss, null, null, null, xml_catalog},
+            {false, false, true, stax, null, null, xml_catalog, null},
+            {false, false, true, stax1, null, null, null, xml_catalog},
+            {false, false, true, source, null, null, xml_catalog, null},
+            {false, false, true, source, null, null, null, xml_catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing XSL import and include
+       Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
+     */
+    @DataProvider(name = "data_XSLC")
+    Object[][] getDataXSLC() {
+        SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
+        StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
+
+        SAXSource xslDocSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+        StreamSource xmlDocSource = new StreamSource(new File(xml_doc));
+        return new Object[][]{
+            // for resolving DTD, import and include in xsl
+            {false, true, xml_catalog, xslSourceDTD, xmlSourceDTD, null, ""},
+            // for resolving reference by the document function
+            {false, true, xml_catalog, xslDocSource, xmlDocSource, null, "Resolved by a catalog"},
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport3.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.StringReader;
+import java.net.SocketTimeoutException;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 8158084 8162438 8162442
+ * @summary extends CatalogSupport tests, verifies that the use of the Catalog may
+ * be disabled through the API property.
+ */
+
+/**
+ * For all of the JAXP processors that support the Catalog, the use of the Catalog
+ * is turned on by default. It can then be turned off through the API and the
+ * System property.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class CatalogSupport3 extends CatalogSupportBase {
+    static final String TTIMEOUTREAD = "sun.net.client.defaultReadTimeout";
+    static final String TIMEOUTCONNECT = "sun.net.client.defaultConnectTimeout";
+    static String timeoutRead = System.getProperty(TTIMEOUTREAD);
+    static String timeoutConnect = System.getProperty(TIMEOUTCONNECT);
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setUp();
+        timeoutRead = System.getProperty(TTIMEOUTREAD);
+        timeoutConnect = System.getProperty(TIMEOUTCONNECT);
+        System.setProperty(TTIMEOUTREAD, "1000");
+        System.setProperty(TIMEOUTCONNECT, "1000");
+    }
+
+    @AfterClass
+    public void tearDownClass() throws Exception {
+        System.setProperty(TIMEOUTCONNECT, "-1");
+        System.setProperty(TTIMEOUTREAD, "-1");
+    }
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    @Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
+    public void testSAXC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    @Test(dataProvider = "data_SAXC", expectedExceptions = FileNotFoundException.class)
+    public void testXMLReaderC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    @Test(dataProvider = "data_XIC", expectedExceptions = SAXParseException.class)
+    public void testXIncludeC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXInclude(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    @Test(dataProvider = "data_DOMC", expectedExceptions = {FileNotFoundException.class, SocketTimeoutException.class})
+    public void testDOMC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    @Test(dataProvider = "data_SchemaC", expectedExceptions = SAXParseException.class)
+    public void testValidationC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xsd, LSResourceResolver resolver)
+            throws Exception {
+        testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
+    }
+
+    /*
+       @bug 8158084 8162438 these tests also verifies the fix for 8162438
+       Verifies the Catalog support on the Schema Validator.
+    */
+    @Test(dataProvider = "data_ValidatorC", expectedExceptions = {SAXException.class, FileNotFoundException.class})
+    public void testValidatorC(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+        testValidator(setUseCatalog1, setUseCatalog2, useCatalog, source,
+                resolver1, resolver2, catalog1, catalog2);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC", expectedExceptions = TransformerException.class)
+    public void testXSLImportC(boolean setUseCatalog, boolean useCatalog, String catalog, SAXSource xsl, StreamSource xml,
+        URIResolver resolver, String expected) throws Exception {
+
+        testXSLImport(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       @bug 8158084 8162442
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLC", expectedExceptions = TransformerException.class)
+    public void testXSLImportWTemplatesC(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml,
+        URIResolver resolver, String expected) throws Exception {
+        testXSLImportWTemplates(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       DataProvider: for testing the SAX parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_SAXC")
+    Object[][] getDataSAXC() {
+        return new Object[][]{
+            {true, false, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+
+        };
+    }
+
+    /*
+       DataProvider: for testing XInclude
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_XIC")
+    Object[][] getDataXIC() {
+        return new Object[][]{
+            {true, false, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing DOM parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_DOMC")
+    Object[][] getDataDOMC() {
+        return new Object[][]{
+            {true, false, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog}
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema validation
+       Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
+     */
+    @DataProvider(name = "data_SchemaC")
+    Object[][] getDataSchemaC() {
+
+        return new Object[][]{
+            // for resolving DTD in xsd
+            {true, false, xml_catalog, xsd_xmlSchema, null},
+            // for resolving xsd import
+            {true, false, xml_catalog, xsd_xmlSchema_import, null},
+            // for resolving xsd include
+            {true, false, xml_catalog, xsd_include_company, null}
+        };
+    }
+
+
+    /*
+       DataProvider: for testing Schema Validator
+       Data: source, resolver1, resolver2, catalog1, a catalog2
+     */
+    @DataProvider(name = "data_ValidatorC")
+    Object[][] getDataValidator() {
+        DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
+
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        StreamSource source = new StreamSource(new File(xml_val_test));
+
+        return new Object[][]{
+            // use catalog disabled through factory
+            {true, false, false, ds, null, null, xml_catalog, null},
+            {true, false, false, ds, null, null, null, xml_catalog},
+            {true, false, false, ss, null, null, xml_catalog, null},
+            {true, false, false, ss, null, null, null, xml_catalog},
+            {true, false, false, stax, null, null, xml_catalog, null},
+            {true, false, false, stax1, null, null, null, xml_catalog},
+            {true, false, false, source, null, null, xml_catalog, null},
+            {true, false, false, source, null, null, null, xml_catalog},
+            // use catalog disabled through validatory
+            {false, true, false, ds, null, null, xml_catalog, null},
+            {false, true, false, ds, null, null, null, xml_catalog},
+            {false, true, false, ss, null, null, xml_catalog, null},
+            {false, true, false, ss, null, null, null, xml_catalog},
+            {false, true, false, stax, null, null, xml_catalog, null},
+            {false, true, false, stax1, null, null, null, xml_catalog},
+            {false, true, false, source, null, null, xml_catalog, null},
+            {false, true, false, source, null, null, null, xml_catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing XSL import and include
+       Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected
+     */
+    @DataProvider(name = "data_XSLC")
+    Object[][] getDataXSLC() {
+        SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
+        StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
+
+        SAXSource xslDocSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+        StreamSource xmlDocSource = new StreamSource(new File(xml_doc));
+        return new Object[][]{
+            // for resolving DTD, import and include in xsl
+            {true, false, xml_catalog, xslSourceDTD, xmlSourceDTD, null, ""},
+            // for resolving reference by the document function
+            {true, false, xml_catalog, xslDocSource, xmlDocSource, null, "Resolved by a catalog"},
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport4.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.File;
+import java.io.StringReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * @bug 8158084 8162438 8162442
+ * @summary verifies the overriding over of the USE_CATALOG feature. Extending
+ * CatalogSupport tests, the USE_CATALOG is turned off system-wide, however,
+ * a JAXP processor may decide to use Catalog by enabling it through the factory
+ * or a processor created by the factory.
+ */
+
+/**
+ *
+ * Test notes:
+ * Same set of data as in CatalogSupport without the ones with resolvers.
+ * The set-use-catalog is set to true.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class CatalogSupport4 extends CatalogSupportBase {
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setUp();
+        //turn off USE_CATALOG system-wide
+        System.setProperty(SP_USE_CATALOG, "false");
+    }
+
+    @AfterClass
+    public void tearDownClass() throws Exception {
+        System.clearProperty(SP_USE_CATALOG);
+    }
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    @Test(dataProvider = "data_SAXA")
+    public void testSAXA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testSAX(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    @Test(dataProvider = "data_SAXA")
+    public void testXMLReaderA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXMLReader(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    @Test(dataProvider = "data_XIA")
+    public void testXIncludeA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testXInclude(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    @Test(dataProvider = "data_DOMA")
+    public void testDOMA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        testDOM(setUseCatalog, useCatalog, catalog, xml, handler, expected);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    @Test(dataProvider = "data_SchemaA")
+    public void testValidationA(boolean setUseCatalog, boolean useCatalog,
+            String catalog, String xsd, LSResourceResolver resolver)
+            throws Exception {
+
+        testValidation(setUseCatalog, useCatalog, catalog, xsd, resolver) ;
+    }
+
+    /*
+       @bug 8158084 8162438 these tests also verifies the fix for 8162438
+       Verifies the Catalog support on the Schema Validator.
+    */
+    @Test(dataProvider = "data_ValidatorA")
+    public void testValidatorA(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+        testValidator(setUseCatalog1, setUseCatalog2, useCatalog, source,
+                resolver1, resolver2, catalog1, catalog2);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLA")
+    public void testXSLImportA(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml, URIResolver resolver, String expected)
+            throws Exception {
+
+        testXSLImport(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       @bug 8158084 8162442
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    @Test(dataProvider = "data_XSLA")
+    public void testXSLImportWTemplatesA(boolean setUseCatalog, boolean useCatalog,
+            String catalog, SAXSource xsl, StreamSource xml, URIResolver resolver, String expected)
+            throws Exception {
+        testXSLImportWTemplates(setUseCatalog, useCatalog, catalog, xsl, xml, resolver, expected);
+    }
+
+    /*
+       DataProvider: for testing the SAX parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_SAXA")
+    Object[][] getDataSAX() {
+        return new Object[][]{
+            {true, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing XInclude
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_XIA")
+    Object[][] getDataXI() {
+        return new Object[][]{
+            {true, true, xml_catalog, xml_xInclude, new MyHandler(elementInXISimple), contentInUIutf8Catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing DOM parser
+       Data: set use_catalog, use_catalog, catalog file, xml file, handler, expected result string
+     */
+    @DataProvider(name = "data_DOMA")
+    Object[][] getDataDOM() {
+        return new Object[][]{
+            {true, true, xml_catalog, xml_system, new MyHandler(elementInSystem), expectedWCatalog},
+        };
+    }
+
+    MyEntityHandler getMyEntityHandler(String elementName, String[] systemIds, InputSource... returnValues) {
+       return new MyEntityHandler(systemIds, returnValues, elementName);
+    }
+
+    /*
+       DataProvider: for testing Schema validation
+       Data: set use_catalog, use_catalog, catalog file, xsd file, a LSResourceResolver
+     */
+    @DataProvider(name = "data_SchemaA")
+    Object[][] getDataSchema() {
+        return new Object[][]{
+            // for resolving DTD in xsd
+            {true, true, xml_catalog, xsd_xmlSchema, null},
+            // for resolving xsd import
+            {true, true, xml_catalog, xsd_xmlSchema_import, null},
+            // for resolving xsd include
+            {true, true, xml_catalog, xsd_include_company, null},
+        };
+    }
+
+    /*
+       DataProvider: for testing Schema Validator
+       Data: source, resolver1, resolver2, catalog1, a catalog2
+     */
+    @DataProvider(name = "data_ValidatorA")
+    Object[][] getDataValidator() {
+        DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
+
+        SAXSource ss = new SAXSource(new InputSource(xml_val_test));
+        ss.setSystemId(xml_val_test_id);
+
+        StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id);
+        StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id);
+
+        StreamSource source = new StreamSource(new File(xml_val_test));
+
+        return new Object[][]{
+            // use catalog
+            {true, false, true, ds, null, null, xml_catalog, null},
+            {false, true, true, ds, null, null, null, xml_catalog},
+            {true, false, true, ss, null, null, xml_catalog, null},
+            {false, true, true, ss, null, null, null, xml_catalog},
+            {true, false, true, stax, null, null, xml_catalog, null},
+            {false, true, true, stax1, null, null, null, xml_catalog},
+            {true, false, true, source, null, null, xml_catalog, null},
+            {false, true, true, source, null, null, null, xml_catalog},
+        };
+    }
+
+    /*
+       DataProvider: for testing XSL import and include
+       Data: set use_catalog, use_catalog, catalog file, xsl file, xml file, a URIResolver, expected result
+     */
+    @DataProvider(name = "data_XSLA")
+    Object[][] getDataXSL() {
+        // XSLInclude.xsl has one import XSLImport_html.xsl and two includes,
+        // XSLInclude_header.xsl and XSLInclude_footer.xsl;
+        SAXSource xslSourceDTD = new SAXSource(new InputSource(new StringReader(xsl_includeDTD)));
+        StreamSource xmlSourceDTD = new StreamSource(new StringReader(xml_xslDTD));
+
+        SAXSource xslDocSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
+        StreamSource xmlDocSource = new StreamSource(new File(xml_doc));
+        return new Object[][]{
+            // for resolving DTD, import and include in xsl
+            {true, true, xml_catalog, xslSourceDTD, xmlSourceDTD, null, ""},
+            // for resolving reference by the document function
+            {true, true, xml_catalog, xslDocSource, xmlDocSource, null, "Resolved by a catalog"},
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,934 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package catalog;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import javax.xml.XMLConstants;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DefaultHandler2;
+
+/**
+ * Base class:
+ * Initialized xml/xsd/xsl used for the test;
+ * Handler classes
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class CatalogSupportBase {
+    // the System Property for the USE_CATALOG feature
+    final static String SP_USE_CATALOG = "javax.xml.useCatalog";
+
+    boolean debug = false;
+
+    String filepath;
+    String slash = "";
+
+    protected void setUp() {
+        String file1 = getClass().getResource("CatalogSupport.xml").getFile();
+        if (System.getProperty("os.name").contains("Windows")) {
+            filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
+            slash = "/";
+        } else {
+            filepath = file1.substring(0, file1.lastIndexOf("/") + 1);
+        }
+
+        initFiles();
+    }
+
+    String xml_catalog, xml_bogus_catalog;
+
+    // For tests using system.xml
+    String xml_system, dtd_system, dtd_systemResolved;
+    final String elementInSystem = "catalogtest";
+    final String expectedWCatalog = "Test system entry";
+    final String expectedWResolver = "Test resolved by an EntityHandler, rather than a Catalog entry";
+
+    // For tests using XInclude.xml
+    String xml_xInclude, xml_xIncludeSimple;
+    final String elementInXISimple = "blue";
+    final String contentInXIutf8 = "trjsagdkasgdhasdgashgdhsadgashdg";
+    final String contentInUIutf8Catalog = "usingCatalog";
+
+    // For the xsd import and include
+    String xsd_xmlSchema, dtd_xmlSchema, dtd_datatypes;
+    String xsd_xmlSchema_import, xsd_xml;
+    String xml_val_test, xml_val_test_id, xsd_val_test;
+    String xsd_include_company, xsd_include_person, xsd_include_product;
+    String xsl_include, xsl_includeDTD, xsl_import_html, xsl_include_header, xsl_include_footer;
+
+    // For the xsl import and include
+    String xml_xsl, xml_xslDTD;
+
+    // For document function
+    String xml_doc, xsl_doc, xml_doc2;
+
+    void initFiles() {
+        xml_system = filepath + "system.xml";
+        dtd_system = filepath + "system.dtd";
+        dtd_systemResolved = "<!ENTITY system \"resolved by an EntityHandler, rather than a Catalog\">";
+
+        xml_catalog = filepath + "CatalogSupport.xml";
+        xml_bogus_catalog = filepath + "CatalogSupport_bogus.xml";
+
+        xml_xInclude = "<?xml version=\"1.0\"?>\n" +
+            "<xinclude:include xmlns:xinclude=\"http://www.w3.org/2001/XInclude\"\n" +
+            "  href=\"XI_simple.xml\"/>\n";
+        xml_xIncludeSimple = filepath + "XI_simple.xml";
+
+        xsd_xmlSchema = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>"
+                + "<!DOCTYPE xs:schema PUBLIC \"-//W3C//DTD XMLSCHEMA 200102//EN\" \"pathto/XMLSchema.dtd\" >"
+                + "<xs:schema targetNamespace=\"http://www.w3.org/2001/XMLSchema\" blockDefault=\"#all\" "
+                + "           elementFormDefault=\"qualified\" version=\"1.0\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" "
+                + "           xml:lang=\"EN\" xmlns:hfp=\"http://www.w3.org/2001/XMLSchema-hasFacetAndProperty\">"
+                + " <xs:annotation>"
+                + "  <xs:documentation>"
+                + "    Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp "
+                + "    Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp "
+                + "  </xs:documentation>"
+                + " </xs:annotation>"
+                + "</xs:schema>";
+        dtd_xmlSchema = filepath + "XMLSchema.dtd";
+        dtd_datatypes = filepath + "datatypes.dtd";
+
+        xsd_xmlSchema_import = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>"
+                + "<xs:schema targetNamespace=\"http://www.w3.org/2001/XMLSchema\" "
+                + "blockDefault=\"#all\" elementFormDefault=\"qualified\" version=\"1.0\" "
+                + "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xml:lang=\"EN\" "
+                + "xmlns:hfp=\"http://www.w3.org/2001/XMLSchema-hasFacetAndProperty\">"
+                + " <xs:annotation>"
+                + "  <xs:documentation>"
+                + "    Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp "
+                + "    Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp "
+                + "  </xs:documentation>"
+                + " </xs:annotation>"
+                + ""
+                + " <xs:import namespace=\"http://www.w3.org/XML/1998/namespace\" "
+                + "schemaLocation=\"http://www.w3.org/2001/pathto/xml.xsd\">"
+                + "   <xs:annotation>"
+                + "     <xs:documentation>"
+                + "       Get access to the xml: attribute groups for xml:lang"
+                + "       as declared on 'schema' and 'documentation' below"
+                + "     </xs:documentation>"
+                + "   </xs:annotation>"
+                + " </xs:import>"
+                + " <xs:element name=\"schema\" id=\"schema\">"
+                + "  <xs:complexType>"
+                + "   <xs:simpleContent>"
+                + "    <xs:extension base=\"xs:integer\">"
+                + "     <xs:attribute ref=\"xml:lang\"/>"
+                + "    </xs:extension>"
+                + "   </xs:simpleContent>"
+                + "  </xs:complexType>"
+                + " </xs:element>"
+                + "</xs:schema>";
+
+        xsd_xml = filepath + "xml.xsd";
+
+        xsd_include_company = "<?xml version=\"1.1\"?>"
+                + "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
+                + "            targetNamespace=\"http://www.company.org\""
+                + "            xmlns=\"http://www.company.org\""
+                + "            elementFormDefault=\"qualified\">"
+                + "    <xsd:include schemaLocation=\"pathto/XSDInclude_person.xsd\"/>"
+                + "    <xsd:include schemaLocation=\"pathto/XSDInclude_product.xsd\"/>"
+                + "    <xsd:element name=\"Company\">"
+                + "        <xsd:complexType>"
+                + "            <xsd:sequence>"
+                + "                <xsd:element name=\"Person\" type=\"PersonType\""
+                + "                             maxOccurs=\"unbounded\"/>"
+                + "                <xsd:element name=\"Product\" type=\"ProductType\""
+                + "                             maxOccurs=\"unbounded\"/>"
+                + "            </xsd:sequence>"
+                + "        </xsd:complexType>"
+                + "    </xsd:element>"
+                + "</xsd:schema>";
+        xsd_include_person = filepath + "XSDInclude_person.xsd";
+        xsd_include_product = filepath + "XSDInclude_product.xsd";
+
+        xsl_include = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                + "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">"
+                + "  <xsl:import href=\"pathto/XSLImport_html.xsl\"/>"
+                + "  <xsl:include href=\"pathto/XSLInclude_header.xsl\"/>"
+                + "  "
+                + ""
+                + "  <xsl:template match=\"content/title\">"
+                + "   <h1><xsl:apply-templates/></h1>"
+                + "  </xsl:template>"
+                + "  "
+                + "  <xsl:include href=\"pathto/XSLInclude_footer.xsl\"/>"
+                + ""
+                + "</xsl:stylesheet>";
+        xsl_includeDTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                + "<!DOCTYPE HTMLlat1 SYSTEM \"http://openjdk.java.net/xml/catalog/dtd/XSLDTD.dtd\">"
+                + "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">"
+                + "  <xsl:import href=\"pathto/XSLImport_html.xsl\"/>"
+                + "  <xsl:include href=\"pathto/XSLInclude_header.xsl\"/>"
+                + "  "
+                + ""
+                + "  <xsl:template match=\"content/title\">"
+                + "   <h1><xsl:apply-templates/></h1>"
+                + "  </xsl:template>"
+                + "  "
+                + "  <xsl:include href=\"pathto/XSLInclude_footer.xsl\"/>"
+                + ""
+                + "</xsl:stylesheet>";
+
+        xsl_import_html = filepath + "XSLImport_html.xsl";
+        xsl_include_header = filepath + "XSLInclude_header.xsl";
+        xsl_include_footer = filepath + "XSLInclude_footer.xsl";
+
+        xml_val_test = filepath + "/val_test.xml";
+        xml_val_test_id = "file://" + slash + xml_val_test;
+        xsd_val_test = filepath + "/val_test.xsd";
+
+        xml_xsl = "<?xml version=\"1.0\"?>\n" +
+                "<content>\n" +
+                "    <header>This is the header</header>\n" +
+                "    Some content\n" +
+                "    <footer>footer</footer>\n" +
+                "</content>";
+
+        xml_xslDTD = "<?xml version=\"1.0\"?>\n" +
+                "<!DOCTYPE content SYSTEM \"http://openjdk.java.net/xml/catalog/dtd/include.dtd\">" +
+                "<content>\n" +
+                "    <header>This is the header</header>\n" +
+                "    Some content\n" +
+                "    <footer>footer</footer>\n" +
+                "</content>";
+
+        xml_doc = filepath + "/DocFunc.xml";
+        xsl_doc = filepath + "/DocFunc.xsl";
+        xml_doc2 = filepath + "/DocFunc2.xml";
+    }
+
+
+    /*
+       Verifies the Catalog support on SAXParser.
+    */
+    public void testSAX(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        SAXParser parser = getSAXParser(setUseCatalog, useCatalog, catalog);
+
+        parser.parse(xml, handler);
+        assertEquals(expected, handler.getResult().trim(), "");
+    }
+
+    /*
+       Verifies the Catalog support on XMLReader.
+    */
+    public void testXMLReader(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        XMLReader reader = getXMLReader(setUseCatalog, useCatalog, catalog);
+
+        reader.setContentHandler(handler);
+        reader.parse(xml);
+        assertEquals(expected, handler.getResult().trim(), "");
+    }
+
+    /*
+       Verifies the Catalog support on XInclude.
+    */
+    public void testXInclude(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        SAXParser parser = getSAXParser(setUseCatalog, useCatalog, catalog);
+
+        parser.parse(new InputSource(new StringReader(xml)), handler);
+        debugPrint("handler.result:" + handler.getResult());
+        assertEquals(expected, handler.getResult(), "Catalog support for XInclude");
+    }
+
+    /*
+       Verifies the Catalog support on DOM parser.
+    */
+    public void testDOM(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xml, MyHandler handler, String expected) throws Exception {
+        DocumentBuilder docBuilder = getDomBuilder(setUseCatalog, useCatalog, catalog);
+        docBuilder.setEntityResolver(handler);
+        Document doc = docBuilder.parse(xml);
+
+        Node node = doc.getElementsByTagName(elementInSystem).item(0);
+        String result = node.getFirstChild().getTextContent();
+
+        assertEquals(expected, result.trim(), "Catalog support for DOM");
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsd import and include in
+    Schema files.
+    */
+    public void testValidation(boolean setUseCatalog, boolean useCatalog, String catalog,
+            String xsd, LSResourceResolver resolver)
+            throws Exception {
+
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+        // use resolver or catalog if resolver = null
+        if (resolver != null) {
+            factory.setResourceResolver(resolver);
+        }
+        if (setUseCatalog) {
+            factory.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+        }
+        factory.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog);
+
+        Schema schema = factory.newSchema(new StreamSource(new StringReader(xsd)));
+        success("XMLSchema.dtd and datatypes.dtd are resolved.");
+    }
+
+    /**
+     * Verifies Catalog Support for the Validator.
+     * @param setUseCatalog1 a flag to indicate whether USE_CATALOG shall be set
+     * on the factory.
+     * @param setUseCatalog2 a flag to indicate whether USE_CATALOG shall be set
+     * on the Validator.
+     * @param source  the XML source
+     * @param resolver1 a resolver to be set on the factory if specified
+     * @param resolver2 a resolver to be set on the Validator if specified
+     * @param catalog1 a catalog to be set on the factory if specified
+     * @param catalog2 a catalog to be set on the Validator if specified
+     */
+    public void testValidator(boolean setUseCatalog1, boolean setUseCatalog2, boolean useCatalog,
+            Source source, LSResourceResolver resolver1, LSResourceResolver resolver2,
+            String catalog1, String catalog2)
+            throws Exception {
+
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            if (setUseCatalog1) {
+                schemaFactory.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+            }
+            if (catalog1 != null) {
+                schemaFactory.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog1);
+            }
+            if (resolver1 != null) {
+                schemaFactory.setResourceResolver(resolver1);
+            }
+
+            Schema schema = schemaFactory.newSchema();
+            Validator validator = schema.newValidator();
+            if (setUseCatalog2) {
+                validator.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+            }
+            if (catalog2 != null) {
+                validator.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog2);
+            }
+            if (resolver2 != null) {
+                validator.setResourceResolver(resolver2);
+            }
+            validator.validate(source);
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    public void testXSLImport(boolean setUseCatalog, boolean useCatalog, String catalog,
+            SAXSource xsl, StreamSource xml,
+        URIResolver resolver, String expected) throws Exception {
+
+        TransformerFactory factory = getTransformerFactory(setUseCatalog, useCatalog, catalog, resolver);
+        Transformer transformer = factory.newTransformer(xsl);
+
+        StringWriter out = new StringWriter();
+        transformer.transform(xml, new StreamResult(out));
+        debugPrint("out:\n" + out.toString());
+        Assert.assertTrue(out.toString().contains(expected), "testXSLImport");
+    }
+
+    /*
+       Verifies the Catalog support on resolving DTD, xsl import and include in
+    XSL files.
+    */
+    public void testXSLImportWTemplates(boolean setUseCatalog, boolean useCatalog,
+            String catalog, SAXSource xsl, StreamSource xml,
+        URIResolver resolver, String expected) throws Exception {
+
+        TransformerFactory factory = getTransformerFactory(setUseCatalog, useCatalog, catalog, resolver);
+        Transformer transformer = factory.newTemplates(xsl).newTransformer();
+        StringWriter out = new StringWriter();
+        transformer.transform(xml, new StreamResult(out));
+        Assert.assertTrue(out.toString().contains(expected), "testXSLImportWTemplates");
+    }
+
+    /**
+     * Returns an instance of SAXParser with a catalog if one is provided.
+     *
+     * @param setUseCatalog a flag indicates whether USE_CATALOG shall be set
+     * through the factory
+     * @param useCatalog the value of USE_CATALOG
+     * @param catalog a catalog
+     * @return an instance of SAXParser
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    SAXParser getSAXParser(boolean setUseCatalog, boolean useCatalog, String catalog)
+            throws ParserConfigurationException, SAXException {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setXIncludeAware(true);
+        if (setUseCatalog) {
+            spf.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+        }
+
+        SAXParser parser = spf.newSAXParser();
+        parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog);
+        return parser;
+    }
+
+    /**
+     * Returns an instance of XMLReader with a catalog if one is provided.
+     *
+     * @param setUseCatalog a flag indicates whether USE_CATALOG shall be set
+     * through the factory
+     * @param useCatalog the value of USE_CATALOG
+     * @param catalog a catalog
+     * @return an instance of XMLReader
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    XMLReader getXMLReader(boolean setUseCatalog, boolean useCatalog, String catalog)
+            throws ParserConfigurationException, SAXException {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader reader = spf.newSAXParser().getXMLReader();
+        if (setUseCatalog) {
+            reader.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+        }
+        reader.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog);
+        return reader;
+    }
+
+    /**
+     * Returns an instance of DocumentBuilder that may have set a Catalog.
+     *
+     * @param setUseCatalog a flag indicates whether USE_CATALOG shall be set
+     * through the factory
+     * @param useCatalog the value of USE_CATALOG
+     * @param catalog a catalog
+     * @return an instance of DocumentBuilder
+     * @throws ParserConfigurationException
+     */
+    DocumentBuilder getDomBuilder(boolean setUseCatalog, boolean useCatalog, String catalog)
+            throws ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        if (setUseCatalog) {
+            dbf.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+        }
+        dbf.setAttribute(CatalogFeatures.Feature.FILES.getPropertyName(), catalog);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        return docBuilder;
+    }
+
+    /**
+     * Creates a DOMSource.
+     *
+     * @param uri the URI to the XML source file
+     * @param systemId the systemId of the source
+     * @param setUseCatalog a flag indicates whether USE_CATALOG shall be set
+     * through the factory
+     * @param useCatalog the value of USE_CATALOG
+     * @param catalog a catalog
+     * @return a DOMSource
+     * @throws Exception
+     */
+    DOMSource getDOMSource(String uri, String systemId, boolean setUseCatalog,
+            boolean useCatalog, String catalog) {
+        DOMSource ds = null;
+        try {
+            DocumentBuilder builder = getDomBuilder(setUseCatalog, useCatalog, catalog);
+            Document doc = builder.parse(new File(uri));
+            ds = new DOMSource(doc, systemId);
+        } catch (Exception e) {}
+
+        return ds;
+    }
+
+    /**
+     * Creates a StAXSource.
+     *
+     * @param xmlFile the XML source file
+     * @param xmlFileId the systemId of the source
+     * @return a StAXSource
+     * @throws XMLStreamException
+     * @throws FileNotFoundException
+     */
+    StAXSource getStaxSource(String xmlFile, String xmlFileId) {
+        StAXSource ss = null;
+        try {
+            ss = new StAXSource(
+                    XMLInputFactory.newFactory().createXMLEventReader(
+                        xmlFileId, new FileInputStream(xmlFile)));
+        } catch (Exception e) {}
+
+        return ss;
+    }
+
+    /**
+     * Creates an XMLStreamReader.
+     * @param catalog the path to a catalog
+     * @param xml the xml to be parsed
+     * @param resolver a resolver to be set on the reader
+     * @return an instance of the XMLStreamReader
+     * @throws FileNotFoundException
+     * @throws XMLStreamException
+     */
+    XMLStreamReader getStreamReader(boolean setUseCatalog, boolean useCatalog,
+            String catalog, String xml, XMLResolver resolver)
+            throws FileNotFoundException, XMLStreamException {
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        factory.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), catalog);
+        factory.setProperty(XMLInputFactory.IS_COALESCING, true);
+        factory.setProperty(XMLInputFactory.RESOLVER, resolver);
+        if (setUseCatalog) {
+            factory.setProperty(XMLConstants.USE_CATALOG, useCatalog);
+        }
+
+        InputStream entityxml = new FileInputStream(xml);
+        XMLStreamReader streamReader = factory.createXMLStreamReader(xml, entityxml);
+        return streamReader;
+    }
+
+    /**
+     * Returns the text of the first element found by the reader.
+     * @param streamReader the XMLStreamReader
+     * @return the text of the first element
+     * @throws XMLStreamException
+     */
+    String getText(XMLStreamReader streamReader) throws XMLStreamException {
+        while(streamReader.hasNext()){
+            int eventType = streamReader.next() ;
+            if(eventType == XMLStreamConstants.START_ELEMENT){
+                eventType = streamReader.next() ;
+                if(eventType == XMLStreamConstants.CHARACTERS){
+                    return streamReader.getText() ;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns an instance of TransformerFactory with either a custom URIResolver
+     * or Catalog.
+     *
+     * @param setUseCatalog a flag indicates whether USE_CATALOG shall be set
+     * through the factory
+     * @param useCatalog the value of USE_CATALOG
+     * @param catalog a catalog
+     * @param resolver a custom resolver
+     * @return an instance of TransformerFactory
+     * @throws Exception
+     */
+    TransformerFactory getTransformerFactory(boolean setUseCatalog, boolean useCatalog,
+            String catalog, URIResolver resolver)
+            throws Exception {
+
+        TransformerFactory factory = TransformerFactory.newInstance();
+        if (setUseCatalog) {
+            factory.setFeature(XMLConstants.USE_CATALOG, useCatalog);
+        }
+        if (catalog != null) {
+            factory.setAttribute(CatalogFeatures.Feature.FILES.getPropertyName(), catalog);
+        }
+
+        // use resolver or catalog if resolver = null
+        if (resolver != null) {
+            factory.setURIResolver(resolver);
+        }
+
+        return factory;
+    }
+
+    void assertNotNull(Object obj, String msg) {
+        if (obj == null) {
+            debugPrint("Test failed: " + msg);
+        } else {
+            debugPrint("Test passed: " + obj + " is not null");
+        }
+    }
+
+    void assertEquals(String expected, String actual, String msg) {
+        if (!expected.equals(actual)) {
+            debugPrint("Test failed: " + msg);
+        } else {
+            debugPrint("Test passed: ");
+        }
+        debugPrint("Expected: " + expected);
+        debugPrint("Actual: " + actual);
+    }
+
+    void fail(String msg) {
+        System.out.println("Test failed:");
+        System.out.println(msg);
+    }
+
+    void success(String msg) {
+        System.out.println("Test succeded:");
+        System.out.println(msg);
+    }
+
+    void debugPrint(String msg) {
+        if (debug) {
+            System.out.println(msg);
+        }
+    }
+
+    /**
+     * Extends MyStaxResolver to override resolveEntity
+     */
+    class MyStaxEntityResolver implements XMLResolver {
+
+        public MyStaxEntityResolver() {
+
+        }
+
+        public Object resolveEntity(String publicId, String systemId, String baseURI,
+                String namespace)
+                throws javax.xml.stream.XMLStreamException {
+            try {
+                return new ByteArrayInputStream(
+                        "<!ENTITY system \"resolved by an EntityHandler, rather than a Catalog\">".getBytes("UTF-8"));
+            } catch (UnsupportedEncodingException ex) {
+                return null;
+            }
+        }
+
+    }
+
+    /**
+     * A custom XMLResolver
+     */
+    class MyStaxResolver implements XMLResolver {
+
+        public MyStaxResolver() {
+        }
+
+        public Object resolveEntity(String publicId, String systemId, String baseURI,
+                String namespace) throws javax.xml.stream.XMLStreamException {
+            return null;
+        }
+
+    }
+
+    /**
+     * Extends MyHandler and overrides resolveEntity
+     */
+    class MyEntityHandler extends MyHandler {
+        String[] systemIds;
+        InputSource[] returnValues;
+        public MyEntityHandler(String[] systemIds, InputSource[] returnValues, String elementName) {
+            super(elementName);
+            this.systemIds = systemIds;
+            this.returnValues = returnValues;
+        }
+
+        @Override
+        public InputSource resolveEntity(String name, String publicId,
+                String baseURI, String systemId) {
+            for (int i = 0; i < systemIds.length; i++) {
+                if (systemId.endsWith(systemIds[i])) {
+                    return returnValues[i];
+                }
+            }
+
+            return null;
+        }
+    }
+
+    /**
+     * SAX handler
+     */
+    public class MyHandler extends DefaultHandler2 implements ErrorHandler {
+
+        String elementName, currentElementName, result;
+        StringBuilder textContent = new StringBuilder();
+
+        /**
+         *
+         * @param elementName the name of the element from which the content
+         * is to be captured
+         */
+        MyHandler(String elementName) {
+            textContent.setLength(0);
+            this.elementName = elementName;
+        }
+
+        String getResult() {
+            return result.trim();
+        }
+
+        public void startDocument() throws SAXException {
+        }
+
+        public void endDocument() throws SAXException {
+        }
+
+        public void startElement(String uri, String localName, String qName, Attributes attributes)
+                throws SAXException {
+            currentElementName = localName;
+            textContent.delete(0, textContent.length());
+            try {
+                debugPrint("Element: " + uri + ":" + localName + " " + qName);
+            } catch (Exception e) {
+                throw new SAXException(e);
+            }
+
+        }
+
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+            debugPrint("Text: " + textContent.toString() + "");
+            debugPrint("End Element: " + uri + ":" + localName + " " + qName);
+            if (currentElementName.equals(elementName)) {
+                result = textContent.toString();
+            }
+        }
+
+        public void characters(char ch[], int start, int length) throws SAXException {
+            if (currentElementName.equals(elementName)) {
+                textContent.append(ch, start, length);
+            }
+        }
+
+        public void internalEntityDecl(String name, String value) throws SAXException {
+            super.internalEntityDecl(name, value);
+            debugPrint("internalEntityDecl() is invoked for entity : " + name);
+        }
+
+        public void externalEntityDecl(String name, String publicId, String systemId)
+                throws SAXException {
+            super.externalEntityDecl(name, publicId, systemId);
+            debugPrint("externalEntityDecl() is invoked for entity : " + name);
+        }
+
+        public void startEntity(String name) throws SAXException {
+            super.startEntity(name);
+//              debugPrint("startEntity() is invoked for entity : " + name) ;
+        }
+
+        public void endEntity(String name) throws SAXException {
+            super.endEntity(name);
+//              debugPrint("endEntity() is invoked for entity : " + name) ;
+        }
+
+        public InputSource resolveEntity(String publicId, String systemId)
+                throws SAXException, IOException {
+            debugPrint("resolveEntity(publicId, systemId) is invoked");
+            return super.resolveEntity(publicId, systemId);
+        }
+
+        /**
+         * public InputSource resolveEntity(String name, String publicId, String
+         * baseURI, String systemId) throws SAXException, IOException {
+         * System.out.println("resolveEntity(name, publicId, baseURI, systemId)
+         * is invoked"); return super.resolveEntity(name, publicId, baseURI,
+         * systemId); }
+         */
+        public InputSource getExternalSubset(String name, String baseURI)
+                throws SAXException, IOException {
+            debugPrint("getExternalSubset() is invoked");
+            return super.getExternalSubset(name, baseURI);
+        }
+    }
+
+    /**
+     * The purpose of this class, vs an anonymous class, is to show clearly what
+     * we're testing by passing the parameters to the constructor.
+     */
+    class SourceResolver implements LSResourceResolver {
+
+        String publicId;
+        String[] systemIds;
+        XmlInput[] returnValues;
+
+        public SourceResolver(String publicId, String[] systemIds, XmlInput[] returnValues) {
+            this.publicId = publicId;
+            this.systemIds = systemIds;
+            this.returnValues = returnValues;
+        }
+
+        @Override
+        public LSInput resolveResource(String type, String namespaceURI, String publicId,
+                String systemId, String baseURI) {
+            for (int i = 0; i < systemIds.length; i++) {
+                if (systemId.endsWith(systemIds[i])) {
+                    return returnValues[i];
+                }
+            }
+
+            return null;
+        }
+    }
+
+    class XmlInput implements LSInput {
+
+        private InputStream inputStream;
+        private String systemId;
+        private String baseUri;
+
+        public XmlInput(InputStream inputStream, String systemId, String baseUri) {
+            this.inputStream = inputStream;
+            this.systemId = systemId;
+            this.baseUri = baseUri;
+        }
+
+        @Override
+        public Reader getCharacterStream() {
+            return null;
+        }
+
+        @Override
+        public void setCharacterStream(Reader characterStream) {
+        }
+
+        @Override
+        public InputStream getByteStream() {
+            return inputStream;
+        }
+
+        @Override
+        public void setByteStream(InputStream byteStream) {
+            this.inputStream = byteStream;
+        }
+
+        @Override
+        public String getStringData() {
+            return null;
+        }
+
+        @Override
+        public void setStringData(String stringData) {
+        }
+
+        @Override
+        public String getSystemId() {
+            return systemId;
+        }
+
+        @Override
+        public void setSystemId(String systemId) {
+            this.systemId = systemId;
+        }
+
+        @Override
+        public String getPublicId() {
+            return null;
+        }
+
+        @Override
+        public void setPublicId(String publicId) {
+        }
+
+        @Override
+        public String getBaseURI() {
+            return baseUri;
+        }
+
+        @Override
+        public void setBaseURI(String baseURI) {
+            this.baseUri = baseURI;
+        }
+
+        @Override
+        public String getEncoding() {
+            return null;
+        }
+
+        @Override
+        public void setEncoding(String encoding) {
+        }
+
+        @Override
+        public boolean getCertifiedText() {
+            return false;
+        }
+
+        @Override
+        public void setCertifiedText(boolean certifiedText) {
+        }
+    }
+
+    class XslResolver implements URIResolver {
+
+        String[] hrefs;
+        Source[] returnValues;
+
+        public XslResolver(String[] href, Source[] returnValues) {
+            this.hrefs = href;
+            this.returnValues = returnValues;
+        }
+
+        @Override
+        public Source resolve(String href, String base) throws TransformerException {
+            for (int i = 0; i < hrefs.length; i++) {
+                if (href.endsWith(hrefs[i])) {
+                    return returnValues[i];
+                }
+            }
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupport_bogus.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+   
+</catalog>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/DocFunc.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<root>
+    <test></test>
+</root>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/DocFunc.xsl	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:variable name="dummy" select="document('pathto/DocFunc2.xml')"/>
+    
+    <xsl:template match="/"> 
+        <test2><xsl:apply-templates select="$dummy//reference/test"/></test2>
+    </xsl:template>
+    
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/DocFunc2.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+
+<reference>
+    <test>Resolved by a resolver</test>
+</reference>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/DocFuncCatalog.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+
+<reference>
+    <test>Resolved by a catalog</test>
+</reference>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_red.dtd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,4 @@
+<!--
+     Comment in DTD
+     
+-->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_simple.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,18 @@
+<simple>
+<test xmlns:xinclude="http://www.w3.org/2001/XInclude">
+  <latin1>
+    <firstElement/>
+    <xinclude:include href="XI_utf8.xml" parse="text"/>
+    <insideChildren/>
+    <another>
+      <deeper>text</deeper>
+    </another>
+  </latin1>
+  <test2>
+    <xinclude:include href="XI_test2.xml"/>
+  </test2>
+  <test3>
+   <!-- <xinclude:include href="XI_roottest.xml"/> -->
+  </test3>
+</test>
+</simple>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_simple4Catalog.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,18 @@
+<simple>
+<test xmlns:xinclude="http://www.w3.org/2001/XInclude">
+  <latin1>
+    <firstElement/>
+    <xinclude:include href="XI_utf8Catalog.xml" parse="text"/>
+    <insideChildren/>
+    <another>
+      <deeper>text</deeper>
+    </another>
+  </latin1>
+  <test2>
+    <xinclude:include href="XI_test2.xml"/>
+  </test2>
+  <test3>
+   <!-- <xinclude:include href="XI_roottest.xml"/> -->
+  </test3>
+</test>
+</simple>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_test2.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!-- comment before root -->
+<!DOCTYPE red SYSTEM "XI_red.dtd">
+<red xmlns:xinclude="http://www.w3.org/2001/XInclude">
+  <blue>
+    <xinclude:include href="XI_utf8.xml" parse="text"/>
+  </blue>
+</red>
+<!-- comment after root -->
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_utf8.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,1 @@
+trjsagdkasgdhasdgashgdhsadgashdg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XI_utf8Catalog.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,1 @@
+usingCatalog
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XMLSchema.dtd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,402 @@
+<!-- DTD for XML Schemas: Part 1: Structures
+     Public Identifier: "-//W3C//DTD XMLSCHEMA 200102//EN"
+     Official Location: http://www.w3.org/2001/XMLSchema.dtd -->
+<!-- $Id: XMLSchema.dtd,v 1.31 2001/10/24 15:50:16 ht Exp $ -->
+<!-- Note this DTD is NOT normative, or even definitive. -->           <!--d-->
+<!-- prose copy in the structures REC is the definitive version -->    <!--d-->
+<!-- (which shouldn't differ from this one except for this -->         <!--d-->
+<!-- comment and entity expansions, but just in case) -->              <!--d-->
+<!-- With the exception of cases with multiple namespace
+     prefixes for the XML Schema namespace, any XML document which is
+     not valid per this DTD given redefinitions in its internal subset of the
+     'p' and 's' parameter entities below appropriate to its namespace
+     declaration of the XML Schema namespace is almost certainly not
+     a valid schema. -->
+
+<!-- The simpleType element and its constituent parts
+     are defined in XML Schema: Part 2: Datatypes -->
+<!ENTITY % xs-datatypes PUBLIC 'datatypes' 'datatypes.dtd' >
+
+<!ENTITY % p 'xs:'> <!-- can be overriden in the internal subset of a
+                         schema document to establish a different
+                         namespace prefix -->
+<!ENTITY % s ':xs'> <!-- if %p is defined (e.g. as foo:) then you must
+                         also define %s as the suffix for the appropriate
+                         namespace declaration (e.g. :foo) -->
+<!ENTITY % nds 'xmlns%s;'>
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % schema "%p;schema">
+<!ENTITY % complexType "%p;complexType">
+<!ENTITY % complexContent "%p;complexContent">
+<!ENTITY % simpleContent "%p;simpleContent">
+<!ENTITY % extension "%p;extension">
+<!ENTITY % element "%p;element">
+<!ENTITY % unique "%p;unique">
+<!ENTITY % key "%p;key">
+<!ENTITY % keyref "%p;keyref">
+<!ENTITY % selector "%p;selector">
+<!ENTITY % field "%p;field">
+<!ENTITY % group "%p;group">
+<!ENTITY % all "%p;all">
+<!ENTITY % choice "%p;choice">
+<!ENTITY % sequence "%p;sequence">
+<!ENTITY % any "%p;any">
+<!ENTITY % anyAttribute "%p;anyAttribute">
+<!ENTITY % attribute "%p;attribute">
+<!ENTITY % attributeGroup "%p;attributeGroup">
+<!ENTITY % include "%p;include">
+<!ENTITY % import "%p;import">
+<!ENTITY % redefine "%p;redefine">
+<!ENTITY % notation "%p;notation">
+
+<!-- annotation elements -->
+<!ENTITY % annotation "%p;annotation">
+<!ENTITY % appinfo "%p;appinfo">
+<!ENTITY % documentation "%p;documentation">
+
+<!-- Customisation entities for the ATTLIST of each element type.
+     Define one of these if your schema takes advantage of the
+     anyAttribute='##other' in the schema for schemas -->
+
+<!ENTITY % schemaAttrs ''>
+<!ENTITY % complexTypeAttrs ''>
+<!ENTITY % complexContentAttrs ''>
+<!ENTITY % simpleContentAttrs ''>
+<!ENTITY % extensionAttrs ''>
+<!ENTITY % elementAttrs ''>
+<!ENTITY % groupAttrs ''>
+<!ENTITY % allAttrs ''>
+<!ENTITY % choiceAttrs ''>
+<!ENTITY % sequenceAttrs ''>
+<!ENTITY % anyAttrs ''>
+<!ENTITY % anyAttributeAttrs ''>
+<!ENTITY % attributeAttrs ''>
+<!ENTITY % attributeGroupAttrs ''>
+<!ENTITY % uniqueAttrs ''>
+<!ENTITY % keyAttrs ''>
+<!ENTITY % keyrefAttrs ''>
+<!ENTITY % selectorAttrs ''>
+<!ENTITY % fieldAttrs ''>
+<!ENTITY % includeAttrs ''>
+<!ENTITY % importAttrs ''>
+<!ENTITY % redefineAttrs ''>
+<!ENTITY % notationAttrs ''>
+<!ENTITY % annotationAttrs ''>
+<!ENTITY % appinfoAttrs ''>
+<!ENTITY % documentationAttrs ''>
+
+<!ENTITY % complexDerivationSet "CDATA">
+      <!-- #all or space-separated list drawn from derivationChoice -->
+<!ENTITY % blockSet "CDATA">
+      <!-- #all or space-separated list drawn from
+                      derivationChoice + 'substitution' -->
+
+<!ENTITY % mgs '%all; | %choice; | %sequence;'>
+<!ENTITY % cs '%choice; | %sequence;'>
+<!ENTITY % formValues '(qualified|unqualified)'>
+
+
+<!ENTITY % attrDecls    '((%attribute;| %attributeGroup;)*,(%anyAttribute;)?)'>
+
+<!ENTITY % particleAndAttrs '((%mgs; | %group;)?, %attrDecls;)'>
+
+<!-- This is used in part2 -->
+<!ENTITY % restriction1 '((%mgs; | %group;)?)'>
+
+%xs-datatypes;
+
+<!-- the duplication below is to produce an unambiguous content model
+     which allows annotation everywhere -->
+<!ELEMENT %schema; ((%include; | %import; | %redefine; | %annotation;)*,
+                    ((%simpleType; | %complexType;
+                      | %element; | %attribute;
+                      | %attributeGroup; | %group;
+                      | %notation; ),
+                     (%annotation;)*)* )>
+<!ATTLIST %schema;
+   targetNamespace      %URIref;               #IMPLIED
+   version              CDATA                  #IMPLIED
+   %nds;                %URIref;               #FIXED 'http://www.w3.org/2001/XMLSchema'
+   xmlns                CDATA                  #IMPLIED
+   finalDefault         %complexDerivationSet; ''
+   blockDefault         %blockSet;             ''
+   id                   ID                     #IMPLIED
+   elementFormDefault   %formValues;           'unqualified'
+   attributeFormDefault %formValues;           'unqualified'
+   xml:lang             CDATA                  #IMPLIED
+   %schemaAttrs;>
+<!-- Note the xmlns declaration is NOT in the Schema for Schemas,
+     because at the Infoset level where schemas operate,
+     xmlns(:prefix) is NOT an attribute! -->
+<!-- The declaration of xmlns is a convenience for schema authors -->
+ 
+<!-- The id attribute here and below is for use in external references
+     from non-schemas using simple fragment identifiers.
+     It is NOT used for schema-to-schema reference, internal or
+     external. -->
+
+<!-- a type is a named content type specification which allows attribute
+     declarations-->
+<!-- -->
+
+<!ELEMENT %complexType; ((%annotation;)?,
+                         (%simpleContent;|%complexContent;|
+                          %particleAndAttrs;))>
+
+<!ATTLIST %complexType;
+          name      %NCName;                        #IMPLIED
+          id        ID                              #IMPLIED
+          abstract  %boolean;                       #IMPLIED
+          final     %complexDerivationSet;          #IMPLIED
+          block     %complexDerivationSet;          #IMPLIED
+          mixed (true|false) 'false'
+          %complexTypeAttrs;>
+
+<!-- particleAndAttrs is shorthand for a root type -->
+<!-- mixed is disallowed if simpleContent, overriden if complexContent
+     has one too. -->
+
+<!-- If anyAttribute appears in one or more referenced attributeGroups
+     and/or explicitly, the intersection of the permissions is used -->
+
+<!ELEMENT %complexContent; ((%annotation;)?, (%restriction;|%extension;))>
+<!ATTLIST %complexContent;
+          mixed (true|false) #IMPLIED
+          id    ID           #IMPLIED
+          %complexContentAttrs;>
+
+<!-- restriction should use the branch defined above, not the simple
+     one from part2; extension should use the full model  -->
+
+<!ELEMENT %simpleContent; ((%annotation;)?, (%restriction;|%extension;))>
+<!ATTLIST %simpleContent;
+          id    ID           #IMPLIED
+          %simpleContentAttrs;>
+
+<!-- restriction should use the simple branch from part2, not the 
+     one defined above; extension should have no particle  -->
+
+<!ELEMENT %extension; ((%annotation;)?, (%particleAndAttrs;))>
+<!ATTLIST %extension;
+          base  %QName;      #REQUIRED
+          id    ID           #IMPLIED
+          %extensionAttrs;>
+
+<!-- an element is declared by either:
+ a name and a type (either nested or referenced via the type attribute)
+ or a ref to an existing element declaration -->
+
+<!ELEMENT %element; ((%annotation;)?, (%complexType;| %simpleType;)?,
+                     (%unique; | %key; | %keyref;)*)>
+<!-- simpleType or complexType only if no type|ref attribute -->
+<!-- ref not allowed at top level -->
+<!ATTLIST %element;
+            name               %NCName;               #IMPLIED
+            id                 ID                     #IMPLIED
+            ref                %QName;                #IMPLIED
+            type               %QName;                #IMPLIED
+            minOccurs          %nonNegativeInteger;   #IMPLIED
+            maxOccurs          CDATA                  #IMPLIED
+            nillable           %boolean;              #IMPLIED
+            substitutionGroup  %QName;                #IMPLIED
+            abstract           %boolean;              #IMPLIED
+            final              %complexDerivationSet; #IMPLIED
+            block              %blockSet;             #IMPLIED
+            default            CDATA                  #IMPLIED
+            fixed              CDATA                  #IMPLIED
+            form               %formValues;           #IMPLIED
+            %elementAttrs;>
+<!-- type and ref are mutually exclusive.
+     name and ref are mutually exclusive, one is required -->
+<!-- In the absence of type AND ref, type defaults to type of
+     substitutionGroup, if any, else the ur-type, i.e. unconstrained -->
+<!-- default and fixed are mutually exclusive -->
+
+<!ELEMENT %group; ((%annotation;)?,(%mgs;)?)>
+<!ATTLIST %group; 
+          name        %NCName;               #IMPLIED
+          ref         %QName;                #IMPLIED
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %groupAttrs;>
+
+<!ELEMENT %all; ((%annotation;)?, (%element;)*)>
+<!ATTLIST %all;
+          minOccurs   (1)                    #IMPLIED
+          maxOccurs   (1)                    #IMPLIED
+          id          ID                     #IMPLIED
+          %allAttrs;>
+
+<!ELEMENT %choice; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
+<!ATTLIST %choice;
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %choiceAttrs;>
+
+<!ELEMENT %sequence; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
+<!ATTLIST %sequence;
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %sequenceAttrs;>
+
+<!-- an anonymous grouping in a model, or
+     a top-level named group definition, or a reference to same -->
+
+<!-- Note that if order is 'all', group is not allowed inside.
+     If order is 'all' THIS group must be alone (or referenced alone) at
+     the top level of a content model -->
+<!-- If order is 'all', minOccurs==maxOccurs==1 on element/any inside -->
+<!-- Should allow minOccurs=0 inside order='all' . . . -->
+
+<!ELEMENT %any; (%annotation;)?>
+<!ATTLIST %any;
+            namespace       CDATA                  '##any'
+            processContents (skip|lax|strict)      'strict'
+            minOccurs       %nonNegativeInteger;   '1'
+            maxOccurs       CDATA                  '1'
+            id              ID                     #IMPLIED
+            %anyAttrs;>
+
+<!-- namespace is interpreted as follows:
+                  ##any      - - any non-conflicting WFXML at all
+
+                  ##other    - - any non-conflicting WFXML from namespace other
+                                  than targetNamespace
+
+                  ##local    - - any unqualified non-conflicting WFXML/attribute
+                  one or     - - any non-conflicting WFXML from
+                  more URI        the listed namespaces
+                  references
+
+                  ##targetNamespace ##local may appear in the above list,
+                    with the obvious meaning -->
+
+<!ELEMENT %anyAttribute; (%annotation;)?>
+<!ATTLIST %anyAttribute;
+            namespace       CDATA              '##any'
+            processContents (skip|lax|strict)  'strict'
+            id              ID                 #IMPLIED
+            %anyAttributeAttrs;>
+<!-- namespace is interpreted as for 'any' above -->
+
+<!-- simpleType only if no type|ref attribute -->
+<!-- ref not allowed at top level, name iff at top level -->
+<!ELEMENT %attribute; ((%annotation;)?, (%simpleType;)?)>
+<!ATTLIST %attribute;
+          name      %NCName;      #IMPLIED
+          id        ID            #IMPLIED
+          ref       %QName;       #IMPLIED
+          type      %QName;       #IMPLIED
+          use       (prohibited|optional|required) #IMPLIED
+          default   CDATA         #IMPLIED
+          fixed     CDATA         #IMPLIED
+          form      %formValues;  #IMPLIED
+          %attributeAttrs;>
+<!-- type and ref are mutually exclusive.
+     name and ref are mutually exclusive, one is required -->
+<!-- default for use is optional when nested, none otherwise -->
+<!-- default and fixed are mutually exclusive -->
+<!-- type attr and simpleType content are mutually exclusive -->
+
+<!-- an attributeGroup is a named collection of attribute decls, or a
+     reference thereto -->
+<!ELEMENT %attributeGroup; ((%annotation;)?,
+                       (%attribute; | %attributeGroup;)*,
+                       (%anyAttribute;)?) >
+<!ATTLIST %attributeGroup;
+                 name       %NCName;       #IMPLIED
+                 id         ID             #IMPLIED
+                 ref        %QName;        #IMPLIED
+                 %attributeGroupAttrs;>
+
+<!-- ref iff no content, no name.  ref iff not top level -->
+
+<!-- better reference mechanisms -->
+<!ELEMENT %unique; ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %unique;
+          name     %NCName;       #REQUIRED
+	  id       ID             #IMPLIED
+	  %uniqueAttrs;>
+
+<!ELEMENT %key;    ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %key;
+          name     %NCName;       #REQUIRED
+	  id       ID             #IMPLIED
+	  %keyAttrs;>
+
+<!ELEMENT %keyref; ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %keyref;
+          name     %NCName;       #REQUIRED
+	  refer    %QName;        #REQUIRED
+	  id       ID             #IMPLIED
+	  %keyrefAttrs;>
+
+<!ELEMENT %selector; ((%annotation;)?)>
+<!ATTLIST %selector;
+          xpath %XPathExpr; #REQUIRED
+          id    ID          #IMPLIED
+          %selectorAttrs;>
+<!ELEMENT %field; ((%annotation;)?)>
+<!ATTLIST %field;
+          xpath %XPathExpr; #REQUIRED
+          id    ID          #IMPLIED
+          %fieldAttrs;>
+
+<!-- Schema combination mechanisms -->
+<!ELEMENT %include; (%annotation;)?>
+<!ATTLIST %include;
+          schemaLocation %URIref; #REQUIRED
+          id             ID       #IMPLIED
+          %includeAttrs;>
+
+<!ELEMENT %import; (%annotation;)?>
+<!ATTLIST %import;
+          namespace      %URIref; #IMPLIED
+          schemaLocation %URIref; #IMPLIED
+          id             ID       #IMPLIED
+          %importAttrs;>
+
+<!ELEMENT %redefine; (%annotation; | %simpleType; | %complexType; |
+                      %attributeGroup; | %group;)*>
+<!ATTLIST %redefine;
+          schemaLocation %URIref; #REQUIRED
+          id             ID       #IMPLIED
+          %redefineAttrs;>
+
+<!ELEMENT %notation; (%annotation;)?>
+<!ATTLIST %notation;
+	  name        %NCName;    #REQUIRED
+	  id          ID          #IMPLIED
+	  public      CDATA       #REQUIRED
+	  system      %URIref;    #IMPLIED
+	  %notationAttrs;>
+
+<!-- Annotation is either application information or documentation -->
+<!-- By having these here they are available for datatypes as well
+     as all the structures elements -->
+
+<!ELEMENT %annotation; (%appinfo; | %documentation;)*>
+<!ATTLIST %annotation; %annotationAttrs;>
+
+<!-- User must define annotation elements in internal subset for this
+     to work -->
+<!ELEMENT %appinfo; ANY>   <!-- too restrictive -->
+<!ATTLIST %appinfo;
+          source     %URIref;      #IMPLIED
+          id         ID         #IMPLIED
+          %appinfoAttrs;>
+<!ELEMENT %documentation; ANY>   <!-- too restrictive -->
+<!ATTLIST %documentation;
+          source     %URIref;   #IMPLIED
+          id         ID         #IMPLIED
+          xml:lang   CDATA      #IMPLIED
+          %documentationAttrs;>
+
+<!NOTATION XMLSchemaStructures PUBLIC
+           'structures' 'http://www.w3.org/2001/XMLSchema.xsd' >
+<!NOTATION XML PUBLIC
+           'REC-xml-1998-0210' 'http://www.w3.org/TR/1998/REC-xml-19980210' >
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XMLSchema.xsd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,92 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+<!-- The prose copy in the structures REC is the normative -->
+<!-- version (which shouldn't differ from this one except for -->
+<!-- this comment and entity expansions, but just in case -->
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "pathto/XMLSchema.dtd" [
+
+<!-- provide ID type information even for parsers which only read the
+     internal subset -->
+<!ATTLIST xs:schema          id  ID  #IMPLIED>
+<!ATTLIST xs:complexType     id  ID  #IMPLIED>
+<!ATTLIST xs:complexContent  id  ID  #IMPLIED>
+<!ATTLIST xs:simpleContent   id  ID  #IMPLIED>
+<!ATTLIST xs:extension       id  ID  #IMPLIED>
+<!ATTLIST xs:element         id  ID  #IMPLIED>
+<!ATTLIST xs:group           id  ID  #IMPLIED> 
+<!ATTLIST xs:all             id  ID  #IMPLIED>
+<!ATTLIST xs:choice          id  ID  #IMPLIED>
+<!ATTLIST xs:sequence        id  ID  #IMPLIED>
+<!ATTLIST xs:any             id  ID  #IMPLIED>
+<!ATTLIST xs:anyAttribute    id  ID  #IMPLIED>
+<!ATTLIST xs:attribute       id  ID  #IMPLIED>
+<!ATTLIST xs:attributeGroup  id  ID  #IMPLIED>
+<!ATTLIST xs:unique          id  ID  #IMPLIED>
+<!ATTLIST xs:key             id  ID  #IMPLIED>
+<!ATTLIST xs:keyref          id  ID  #IMPLIED>
+<!ATTLIST xs:selector        id  ID  #IMPLIED>
+<!ATTLIST xs:field           id  ID  #IMPLIED>
+<!ATTLIST xs:include         id  ID  #IMPLIED>
+<!ATTLIST xs:import          id  ID  #IMPLIED>
+<!ATTLIST xs:redefine        id  ID  #IMPLIED>
+<!ATTLIST xs:notation        id  ID  #IMPLIED>
+<!--
+     keep this schema XML1.0 DTD valid
+  -->
+        <!ENTITY % schemaAttrs 'xmlns:hfp CDATA #IMPLIED'>
+
+        <!ELEMENT hfp:hasFacet EMPTY>
+        <!ATTLIST hfp:hasFacet
+                name NMTOKEN #REQUIRED>
+
+        <!ELEMENT hfp:hasProperty EMPTY>
+        <!ATTLIST hfp:hasProperty
+                name NMTOKEN #REQUIRED
+                value CDATA #REQUIRED>
+<!--
+        Make sure that processors that do not read the external
+        subset will know about the various IDs we declare
+  -->
+        <!ATTLIST xs:simpleType id ID #IMPLIED>
+        <!ATTLIST xs:maxExclusive id ID #IMPLIED>
+        <!ATTLIST xs:minExclusive id ID #IMPLIED>
+        <!ATTLIST xs:maxInclusive id ID #IMPLIED>
+        <!ATTLIST xs:minInclusive id ID #IMPLIED>
+        <!ATTLIST xs:totalDigits id ID #IMPLIED>
+        <!ATTLIST xs:fractionDigits id ID #IMPLIED>
+        <!ATTLIST xs:length id ID #IMPLIED>
+        <!ATTLIST xs:minLength id ID #IMPLIED>
+        <!ATTLIST xs:maxLength id ID #IMPLIED>
+        <!ATTLIST xs:enumeration id ID #IMPLIED>
+        <!ATTLIST xs:pattern id ID #IMPLIED>
+        <!ATTLIST xs:appinfo id ID #IMPLIED>
+        <!ATTLIST xs:documentation id ID #IMPLIED>
+        <!ATTLIST xs:list id ID #IMPLIED>
+        <!ATTLIST xs:union id ID #IMPLIED>
+        ]>
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+  <xs:documentation>
+    Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp 
+    Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp 
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
+   The schema corresponding to this document is normative,
+   with respect to the syntactic constraints it expresses in the
+   XML Schema language.  The documentation (within &lt;documentation&gt; elements)
+   below, is not normative, but rather highlights important aspects of
+   the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+   <xs:documentation>
+   The simpleType element and all of its members are defined
+      towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+
+</xs:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSDInclude_company.xsd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,18 @@
+<?xml version="1.1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://www.company.org"
+            xmlns="http://www.company.org"
+            elementFormDefault="qualified">
+    <xsd:include schemaLocation="XSDInclude_person.xsd"/>
+    <xsd:include schemaLocation="XSDInclude_product.xsd"/>
+    <xsd:element name="Company">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name="Person" type="PersonType"
+                             maxOccurs="unbounded"/>
+                <xsd:element name="Product" type="ProductType"
+                             maxOccurs="unbounded"/>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSDInclude_person.xsd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://www.company.org"
+            xmlns="http://www.person.org"
+            elementFormDefault="qualified">
+    <xsd:complexType name="PersonType">
+        <xsd:sequence>
+           <xsd:element name="Name" type="xsd:string"/>
+           <xsd:element name="SSN" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSDInclude_product.xsd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,11 @@
+<?xml version="1.1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://www.company.org"
+            xmlns="http://www.product.org"
+            elementFormDefault="qualified">
+    <xsd:complexType name="ProductType">
+        <xsd:sequence>
+           <xsd:element name="Type" type="xsd:string"/>
+        </xsd:sequence>
+    </xsd:complexType>
+</xsd:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSLDTD.dtd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Portions (C) International Organization for Standardization 1986
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+     <!ENTITY % HTMLlat1 PUBLIC
+       "-//W3C//ENTITIES Latin 1//EN//HTML">
+     %HTMLlat1;
+-->
+
+<!ENTITY nbsp   "&#160;" >
+<!ENTITY iexcl  "&#161;" >
+<!ENTITY cent   "&#162;" >
+<!ENTITY pound  "&#163;" >
+<!ENTITY curren "&#164;" >
+<!ENTITY yen    "&#165;" >
+<!ENTITY brvbar "&#166;" >
+<!ENTITY sect   "&#167;" >
+<!ENTITY uml    "&#168;" >
+<!ENTITY copy   "&#169;" >
+<!ENTITY ordf   "&#170;" >
+<!ENTITY laquo  "&#171;" >
+<!ENTITY not    "&#172;" >
+<!ENTITY shy    "&#173;" >
+<!ENTITY reg    "&#174;" >
+<!ENTITY macr   "&#175;" >
+<!ENTITY deg    "&#176;" >
+<!ENTITY plusmn "&#177;" >
+<!ENTITY sup2   "&#178;" >
+<!ENTITY sup3   "&#179;" >
+<!ENTITY acute  "&#180;" >
+<!ENTITY micro  "&#181;" >
+<!ENTITY para   "&#182;" >
+<!ENTITY middot "&#183;" >
+<!ENTITY cedil  "&#184;" >
+<!ENTITY sup1   "&#185;" >
+<!ENTITY ordm   "&#186;" >
+<!ENTITY raquo  "&#187;" >
+<!ENTITY frac14 "&#188;" >
+<!ENTITY frac12 "&#189;" >
+<!ENTITY frac34 "&#190;" >
+<!ENTITY iquest "&#191;" >
+<!ENTITY Agrave "&#192;" >
+<!ENTITY Aacute "&#193;" >
+<!ENTITY Acirc  "&#194;" >
+<!ENTITY Atilde "&#195;" >
+<!ENTITY Auml   "&#196;" >
+<!ENTITY Aring  "&#197;" >
+<!ENTITY AElig  "&#198;" >
+<!ENTITY Ccedil "&#199;" >
+<!ENTITY Egrave "&#200;" >
+<!ENTITY Eacute "&#201;" >
+<!ENTITY Ecirc  "&#202;" >
+<!ENTITY Euml   "&#203;" >
+<!ENTITY Igrave "&#204;" >
+<!ENTITY Iacute "&#205;" >
+<!ENTITY Icirc  "&#206;" >
+<!ENTITY Iuml   "&#207;" >
+<!ENTITY ETH    "&#208;" >
+<!ENTITY Ntilde "&#209;" >
+<!ENTITY Ograve "&#210;" >
+<!ENTITY Oacute "&#211;" >
+<!ENTITY Ocirc  "&#212;" >
+<!ENTITY Otilde "&#213;" >
+<!ENTITY Ouml   "&#214;" >
+<!ENTITY times  "&#215;" >
+<!ENTITY Oslash "&#216;" >
+<!ENTITY Ugrave "&#217;" >
+<!ENTITY Uacute "&#218;" >
+<!ENTITY Ucirc  "&#219;" >
+<!ENTITY Uuml   "&#220;" >
+<!ENTITY Yacute "&#221;" >
+<!ENTITY THORN  "&#222;" >
+<!ENTITY szlig  "&#223;" >
+<!ENTITY agrave "&#224;" >
+<!ENTITY aacute "&#225;" >
+<!ENTITY acirc  "&#226;" >
+<!ENTITY atilde "&#227;" >
+<!ENTITY auml   "&#228;" >
+<!ENTITY aring  "&#229;" >
+<!ENTITY aelig  "&#230;" >
+<!ENTITY ccedil "&#231;" >
+<!ENTITY egrave "&#232;" >
+<!ENTITY eacute "&#233;" >
+<!ENTITY ecirc  "&#234;" >
+<!ENTITY euml   "&#235;" >
+<!ENTITY igrave "&#236;" >
+<!ENTITY iacute "&#237;" >
+<!ENTITY icirc  "&#238;" >
+<!ENTITY iuml   "&#239;" >
+<!ENTITY eth    "&#240;" >
+<!ENTITY ntilde "&#241;" >
+<!ENTITY ograve "&#242;" >
+<!ENTITY oacute "&#243;" >
+<!ENTITY ocirc  "&#244;" >
+<!ENTITY otilde "&#245;" >
+<!ENTITY ouml   "&#246;" >
+<!ENTITY divide "&#247;" >
+<!ENTITY oslash "&#248;" >
+<!ENTITY ugrave "&#249;" >
+<!ENTITY uacute "&#250;" >
+<!ENTITY ucirc  "&#251;" >
+<!ENTITY uuml   "&#252;" >
+<!ENTITY yacute "&#253;" >
+<!ENTITY thorn  "&#254;" >
+<!ENTITY yuml   "&#255;" >
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSLDTD.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!DOCTYPE HTMLlat1 SYSTEM \"include.dtd\">
+<content>
+    <header>This is the header</header>
+    Some content
+    <footer>footer</footer>
+</content>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSLImport_html.xsl	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:template match="content">
+   <html><xsl:apply-templates/></html>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSLInclude_footer.xsl	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:template match="footer">
+   <dv id="footer"><xsl:apply-templates/></dv>
+  </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/XSLInclude_header.xsl	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:template match="header">
+   <h4><xsl:apply-templates/></h4>
+  </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/datatypes.dtd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,203 @@
+<!--
+        DTD for XML Schemas: Part 2: Datatypes
+        $Id: datatypes.dtd,v 1.23 2001/03/16 17:36:30 ht Exp $
+        Note this DTD is NOT normative, or even definitive. - - the
+        prose copy in the datatypes REC is the definitive version
+        (which shouldn't differ from this one except for this comment
+        and entity expansions, but just in case)
+  -->
+
+<!--
+        This DTD cannot be used on its own, it is intended
+        only for incorporation in XMLSchema.dtd, q.v.
+  -->
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % simpleType "%p;simpleType">
+<!ENTITY % restriction "%p;restriction">
+<!ENTITY % list "%p;list">
+<!ENTITY % union "%p;union">
+<!ENTITY % maxExclusive "%p;maxExclusive">
+<!ENTITY % minExclusive "%p;minExclusive">
+<!ENTITY % maxInclusive "%p;maxInclusive">
+<!ENTITY % minInclusive "%p;minInclusive">
+<!ENTITY % totalDigits "%p;totalDigits">
+<!ENTITY % fractionDigits "%p;fractionDigits">
+<!ENTITY % length "%p;length">
+<!ENTITY % minLength "%p;minLength">
+<!ENTITY % maxLength "%p;maxLength">
+<!ENTITY % enumeration "%p;enumeration">
+<!ENTITY % whiteSpace "%p;whiteSpace">
+<!ENTITY % pattern "%p;pattern">
+
+<!--
+        Customisation entities for the ATTLIST of each element
+        type. Define one of these if your schema takes advantage
+        of the anyAttribute='##other' in the schema for schemas
+  -->
+
+<!ENTITY % simpleTypeAttrs "">
+<!ENTITY % restrictionAttrs "">
+<!ENTITY % listAttrs "">
+<!ENTITY % unionAttrs "">
+<!ENTITY % maxExclusiveAttrs "">
+<!ENTITY % minExclusiveAttrs "">
+<!ENTITY % maxInclusiveAttrs "">
+<!ENTITY % minInclusiveAttrs "">
+<!ENTITY % totalDigitsAttrs "">
+<!ENTITY % fractionDigitsAttrs "">
+<!ENTITY % lengthAttrs "">
+<!ENTITY % minLengthAttrs "">
+<!ENTITY % maxLengthAttrs "">
+<!ENTITY % enumerationAttrs "">
+<!ENTITY % whiteSpaceAttrs "">
+<!ENTITY % patternAttrs "">
+
+<!-- Define some entities for informative use as attribute
+        types -->
+<!ENTITY % URIref "CDATA">
+<!ENTITY % XPathExpr "CDATA">
+<!ENTITY % QName "NMTOKEN">
+<!ENTITY % QNames "NMTOKENS">
+<!ENTITY % NCName "NMTOKEN">
+<!ENTITY % nonNegativeInteger "NMTOKEN">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % simpleDerivationSet "CDATA">
+<!--
+        #all or space-separated list drawn from derivationChoice
+  -->
+
+<!--
+        Note that the use of 'facet' below is less restrictive
+        than is really intended:  There should in fact be no
+        more than one of each of minInclusive, minExclusive,
+        maxInclusive, maxExclusive, totalDigits, fractionDigits,
+        length, maxLength, minLength within datatype,
+        and the min- and max- variants of Inclusive and Exclusive
+        are mutually exclusive. On the other hand,  pattern and
+        enumeration may repeat.
+  -->
+<!ENTITY % minBound "(%minInclusive; | %minExclusive;)">
+<!ENTITY % maxBound "(%maxInclusive; | %maxExclusive;)">
+<!ENTITY % bounds "%minBound; | %maxBound;">
+<!ENTITY % numeric "%totalDigits; | %fractionDigits;">
+<!ENTITY % ordered "%bounds; | %numeric;">
+<!ENTITY % unordered
+   "%pattern; | %enumeration; | %whiteSpace; | %length; |
+   %maxLength; | %minLength;">
+<!ENTITY % facet "%ordered; | %unordered;">
+<!ENTITY % facetAttr 
+        "value CDATA #REQUIRED
+        id ID #IMPLIED">
+<!ENTITY % fixedAttr "fixed %boolean; #IMPLIED">
+<!ENTITY % facetModel "(%annotation;)?">
+<!ELEMENT %simpleType;
+        ((%annotation;)?, (%restriction; | %list; | %union;))>
+<!ATTLIST %simpleType;
+    name      %NCName; #IMPLIED
+    final     %simpleDerivationSet; #IMPLIED
+    id        ID       #IMPLIED
+    %simpleTypeAttrs;>
+<!-- name is required at top level -->
+<!ELEMENT %restriction; ((%annotation;)?,
+                         (%restriction1; |
+                          ((%simpleType;)?,(%facet;)*)),
+                         (%attrDecls;))>
+<!ATTLIST %restriction;
+    base      %QName;                  #IMPLIED
+    id        ID       #IMPLIED
+    %restrictionAttrs;>
+<!--
+        base and simpleType child are mutually exclusive,
+        one is required.
+
+        restriction is shared between simpleType and
+        simpleContent and complexContent (in XMLSchema.xsd).
+        restriction1 is for the latter cases, when this
+        is restricting a complex type, as is attrDecls.
+  -->
+<!ELEMENT %list; ((%annotation;)?,(%simpleType;)?)>
+<!ATTLIST %list;
+    itemType      %QName;             #IMPLIED
+    id        ID       #IMPLIED
+    %listAttrs;>
+<!--
+        itemType and simpleType child are mutually exclusive,
+        one is required
+  -->
+<!ELEMENT %union; ((%annotation;)?,(%simpleType;)*)>
+<!ATTLIST %union;
+    id            ID       #IMPLIED
+    memberTypes   %QNames;            #IMPLIED
+    %unionAttrs;>
+<!--
+        At least one item in memberTypes or one simpleType
+        child is required
+  -->
+
+<!ELEMENT %maxExclusive; %facetModel;>
+<!ATTLIST %maxExclusive;
+        %facetAttr;
+        %fixedAttr;
+        %maxExclusiveAttrs;>
+<!ELEMENT %minExclusive; %facetModel;>
+<!ATTLIST %minExclusive;
+        %facetAttr;
+        %fixedAttr;
+        %minExclusiveAttrs;>
+
+<!ELEMENT %maxInclusive; %facetModel;>
+<!ATTLIST %maxInclusive;
+        %facetAttr;
+        %fixedAttr;
+        %maxInclusiveAttrs;>
+<!ELEMENT %minInclusive; %facetModel;>
+<!ATTLIST %minInclusive;
+        %facetAttr;
+        %fixedAttr;
+        %minInclusiveAttrs;>
+
+<!ELEMENT %totalDigits; %facetModel;>
+<!ATTLIST %totalDigits;
+        %facetAttr;
+        %fixedAttr;
+        %totalDigitsAttrs;>
+<!ELEMENT %fractionDigits; %facetModel;>
+<!ATTLIST %fractionDigits;
+        %facetAttr;
+        %fixedAttr;
+        %fractionDigitsAttrs;>
+
+<!ELEMENT %length; %facetModel;>
+<!ATTLIST %length;
+        %facetAttr;
+        %fixedAttr;
+        %lengthAttrs;>
+<!ELEMENT %minLength; %facetModel;>
+<!ATTLIST %minLength;
+        %facetAttr;
+        %fixedAttr;
+        %minLengthAttrs;>
+<!ELEMENT %maxLength; %facetModel;>
+<!ATTLIST %maxLength;
+        %facetAttr;
+        %fixedAttr;
+        %maxLengthAttrs;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %enumeration; %facetModel;>
+<!ATTLIST %enumeration;
+        %facetAttr;
+        %enumerationAttrs;>
+
+<!ELEMENT %whiteSpace; %facetModel;>
+<!ATTLIST %whiteSpace;
+        %facetAttr;
+        %fixedAttr;
+        %whiteSpaceAttrs;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %pattern; %facetModel;>
+<!ATTLIST %pattern;
+        %facetAttr;
+        %patternAttrs;>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/include.dtd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,3 @@
+
+<!ENTITY include "include">
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/val_test.xml	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,9 @@
+<?xml version="1.1"?>
+<!DOCTYPE  catalogtest  PUBLIC  "-//OPENJDK//XML CATALOG DTD//1.0"  
+     "http://openjdk.java.net/xml/catalog/dtd/system.dtd">
+<test:root xmlns:test="test"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="test pathto/val_test.xsd"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+   <child xsi:type="xsd:string">has a &system; entry</child>
+</test:root>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/val_test.xsd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+             targetNamespace="test">
+     <xsd:element name="root">
+         <xsd:complexType>
+             <xsd:sequence>
+                 <xsd:element name="child" type="xsd:anyType"/>
+             </xsd:sequence>
+         </xsd:complexType>
+
+         <xsd:key name="key1">
+             <xsd:selector xpath="."/>
+             <xsd:field xpath="child"/>
+         </xsd:key>
+     </xsd:element>
+</xsd:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/xml.xsd	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,287 @@
+<?xml version='1.0'?>
+<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns   ="http://www.w3.org/1999/xhtml"
+  xml:lang="en">
+
+ <xs:annotation>
+  <xs:documentation>
+   <div>
+    <h1>About the XML namespace</h1>
+
+    <div class="bodytext">
+     <p>
+      This schema document describes the XML namespace, in a form
+      suitable for import by other schema documents.
+     </p>
+     <p>
+      See <a href="http://www.w3.org/XML/1998/namespace.html">
+      http://www.w3.org/XML/1998/namespace.html</a> and
+      <a href="http://www.w3.org/TR/REC-xml">
+      http://www.w3.org/TR/REC-xml</a> for information 
+      about this namespace.
+     </p>
+     <p>
+      Note that local names in this namespace are intended to be
+      defined only by the World Wide Web Consortium or its subgroups.
+      The names currently defined in this namespace are listed below.
+      They should not be used with conflicting semantics by any Working
+      Group, specification, or document instance.
+     </p>
+     <p>   
+      See further below in this document for more information about <a
+      href="#usage">how to refer to this schema document from your own
+      XSD schema documents</a> and about <a href="#nsversioning">the
+      namespace-versioning policy governing this schema document</a>.
+     </p>
+    </div>
+   </div>
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang">
+  <xs:annotation>
+   <xs:documentation>
+    <div>
+     
+      <h3>lang (as an attribute name)</h3>
+      <p>
+       denotes an attribute whose value
+       is a language code for the natural language of the content of
+       any element; its value is inherited.  This name is reserved
+       by virtue of its definition in the XML specification.</p>
+     
+    </div>
+    <div>
+     <h4>Notes</h4>
+     <p>
+      Attempting to install the relevant ISO 2- and 3-letter
+      codes as the enumerated possible values is probably never
+      going to be a realistic possibility.  
+     </p>
+     <p>
+      See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
+       http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
+      and the IANA language subtag registry at
+      <a href="http://www.iana.org/assignments/language-subtag-registry">
+       http://www.iana.org/assignments/language-subtag-registry</a>
+      for further information.
+     </p>
+     <p>
+      The union allows for the 'un-declaration' of xml:lang with
+      the empty string.
+     </p>
+    </div>
+   </xs:documentation>
+  </xs:annotation>
+  <xs:simpleType>
+   <xs:union memberTypes="xs:language">
+    <xs:simpleType>    
+     <xs:restriction base="xs:string">
+      <xs:enumeration value=""/>
+     </xs:restriction>
+    </xs:simpleType>
+   </xs:union>
+  </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="space">
+  <xs:annotation>
+   <xs:documentation>
+    <div>
+     
+      <h3>space (as an attribute name)</h3>
+      <p>
+       denotes an attribute whose
+       value is a keyword indicating what whitespace processing
+       discipline is intended for the content of the element; its
+       value is inherited.  This name is reserved by virtue of its
+       definition in the XML specification.</p>
+     
+    </div>
+   </xs:documentation>
+  </xs:annotation>
+  <xs:simpleType>
+   <xs:restriction base="xs:NCName">
+    <xs:enumeration value="default"/>
+    <xs:enumeration value="preserve"/>
+   </xs:restriction>
+  </xs:simpleType>
+ </xs:attribute>
+ 
+ <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
+   <xs:documentation>
+    <div>
+     
+      <h3>base (as an attribute name)</h3>
+      <p>
+       denotes an attribute whose value
+       provides a URI to be used as the base for interpreting any
+       relative URIs in the scope of the element on which it
+       appears; its value is inherited.  This name is reserved
+       by virtue of its definition in the XML Base specification.</p>
+     
+     <p>
+      See <a
+      href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
+      for information about this attribute.
+     </p>
+    </div>
+   </xs:documentation>
+  </xs:annotation>
+ </xs:attribute>
+ 
+ <xs:attribute name="id" type="xs:ID">
+  <xs:annotation>
+   <xs:documentation>
+    <div>
+     
+      <h3>id (as an attribute name)</h3> 
+      <p>
+       denotes an attribute whose value
+       should be interpreted as if declared to be of type ID.
+       This name is reserved by virtue of its definition in the
+       xml:id specification.</p>
+     
+     <p>
+      See <a
+      href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
+      for information about this attribute.
+     </p>
+    </div>
+   </xs:documentation>
+  </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+  <xs:attribute ref="xml:base"/>
+  <xs:attribute ref="xml:lang"/>
+  <xs:attribute ref="xml:space"/>
+  <xs:attribute ref="xml:id"/>
+ </xs:attributeGroup>
+
+ <xs:annotation>
+  <xs:documentation>
+   <div>
+   
+    <h3>Father (in any context at all)</h3> 
+
+    <div class="bodytext">
+     <p>
+      denotes Jon Bosak, the chair of 
+      the original XML Working Group.  This name is reserved by 
+      the following decision of the W3C XML Plenary and 
+      XML Coordination groups:
+     </p>
+     <blockquote>
+       <p>
+	In appreciation for his vision, leadership and
+	dedication the W3C XML Plenary on this 10th day of
+	February, 2000, reserves for Jon Bosak in perpetuity
+	the XML name "xml:Father".
+       </p>
+     </blockquote>
+    </div>
+   </div>
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+  <xs:documentation>
+   <div xml:id="usage" id="usage">
+    <h2><a name="usage">About this schema document</a></h2>
+
+    <div class="bodytext">
+     <p>
+      This schema defines attributes and an attribute group suitable
+      for use by schemas wishing to allow <code>xml:base</code>,
+      <code>xml:lang</code>, <code>xml:space</code> or
+      <code>xml:id</code> attributes on elements they define.
+     </p>
+     <p>
+      To enable this, such a schema must import this schema for
+      the XML namespace, e.g. as follows:
+     </p>
+     <pre>
+          &lt;schema . . .>
+           . . .
+           &lt;import namespace="http://www.w3.org/XML/1998/namespace"
+                      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+     </pre>
+     <p>
+      or
+     </p>
+     <pre>
+           &lt;import namespace="http://www.w3.org/XML/1998/namespace"
+                      schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+     </pre>
+     <p>
+      Subsequently, qualified reference to any of the attributes or the
+      group defined below will have the desired effect, e.g.
+     </p>
+     <pre>
+          &lt;type . . .>
+           . . .
+           &lt;attributeGroup ref="xml:specialAttrs"/>
+     </pre>
+     <p>
+      will define a type which will schema-validate an instance element
+      with any of those attributes.
+     </p>
+    </div>
+   </div>
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+  <xs:documentation>
+   <div id="nsversioning" xml:id="nsversioning">
+    <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
+    <div class="bodytext">
+     <p>
+      In keeping with the XML Schema WG's standard versioning
+      policy, this schema document will persist at
+      <a href="http://www.w3.org/2009/01/xml.xsd">
+       http://www.w3.org/2009/01/xml.xsd</a>.
+     </p>
+     <p>
+      At the date of issue it can also be found at
+      <a href="http://www.w3.org/2001/xml.xsd">
+       http://www.w3.org/2001/xml.xsd</a>.
+     </p>
+     <p>
+      The schema document at that URI may however change in the future,
+      in order to remain compatible with the latest version of XML
+      Schema itself, or with the XML namespace itself.  In other words,
+      if the XML Schema or XML namespaces change, the version of this
+      document at <a href="http://www.w3.org/2001/xml.xsd">
+       http://www.w3.org/2001/xml.xsd 
+      </a> 
+      will change accordingly; the version at 
+      <a href="http://www.w3.org/2009/01/xml.xsd">
+       http://www.w3.org/2009/01/xml.xsd 
+      </a> 
+      will not change.
+     </p>
+     <p>
+      Previous dated (and unchanging) versions of this schema 
+      document are at:
+     </p>
+     <ul>
+      <li><a href="http://www.w3.org/2009/01/xml.xsd">
+	http://www.w3.org/2009/01/xml.xsd</a></li>
+      <li><a href="http://www.w3.org/2007/08/xml.xsd">
+	http://www.w3.org/2007/08/xml.xsd</a></li>
+      <li><a href="http://www.w3.org/2004/10/xml.xsd">
+	http://www.w3.org/2004/10/xml.xsd</a></li>
+      <li><a href="http://www.w3.org/2001/03/xml.xsd">
+	http://www.w3.org/2001/03/xml.xsd</a></li>
+     </ul>
+    </div>
+   </div>
+  </xs:documentation>
+ </xs:annotation>
+
+</xs:schema>
+
--- a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -38,8 +38,9 @@
 
 /*
  * @test
+ * @bug 8144593
+ * @key intermittent
  * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
- * @bug 8144593
  * @summary Check that warnings about unsupported properties from SAX
  *  parsers are suppressed during the xml validation process.
  */
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -62,7 +62,7 @@
 
 /*
  * @summary Transformer Tests
- * @bug 6272879 6305029 6505031 8150704
+ * @bug 6272879 6305029 6505031 8150704 8162598
  */
 public class TransformerTest {
     private Transformer createTransformer() throws TransformerException {
@@ -111,6 +111,41 @@
         }
     }
 
+    /**
+     * Utility method for testBug8162598().
+     * Provides a convenient way to check/assert the expected namespaces
+     * of a Node and its siblings.
+     *
+     * @param test
+     * The node to check
+     * @param nstest
+     * Expected namespace of the node
+     * @param nsb
+     * Expected namespace of the first sibling
+     * @param nsc
+     * Expected namespace of the first sibling of the first sibling
+     */
+    private void checkNodeNS8162598(Node test, String nstest, String nsb, String nsc) {
+        String testNodeName = test.getNodeName();
+        if (nstest == null) {
+            Assert.assertNull(test.getNamespaceURI(), "unexpected namespace for " + testNodeName);
+        } else {
+            Assert.assertEquals(test.getNamespaceURI(), nstest, "unexpected namespace for " + testNodeName);
+        }
+        Node b = test.getChildNodes().item(0);
+        if (nsb == null) {
+            Assert.assertNull(b.getNamespaceURI(), "unexpected namespace for " + testNodeName + "->b");
+        } else {
+            Assert.assertEquals(b.getNamespaceURI(), nsb, "unexpected namespace for " + testNodeName + "->b");
+        }
+        Node c = b.getChildNodes().item(0);
+        if (nsc == null) {
+            Assert.assertNull(c.getNamespaceURI(), "unexpected namespace for " + testNodeName + "->b->c");
+        } else {
+            Assert.assertEquals(c.getNamespaceURI(), nsc, "unexpected namespace for " + testNodeName + "->b->c");
+        }
+    }
+
     private class XMLReaderFor6305029 implements XMLReader {
         private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
         private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
@@ -249,22 +284,19 @@
                 "  </test>" + LINE_SEPARATOR +
                 "</XMLUtils>";
 
-        Document document;
-        Node node;
-
         System.out.println("Stylesheet:");
-        System.out.println("==================================");
+        System.out.println("=============================");
         System.out.println(xsl);
         System.out.println();
 
-        System.out.println("Source file before transformation:");
-        System.out.println("==================================");
+        System.out.println("Source before transformation:");
+        System.out.println("=============================");
         System.out.println(sourceXml);
         System.out.println();
 
-        System.out.println("Source file after transformation:");
-        System.out.println("=================================");
-        document = transformInputStreamToDocument(createTransformerFromInputstream(new ByteArrayInputStream(xsl.getBytes())),
+        System.out.println("Result after transformation:");
+        System.out.println("============================");
+        Document document = transformInputStreamToDocument(createTransformerFromInputstream(new ByteArrayInputStream(xsl.getBytes())),
             new ByteArrayInputStream(sourceXml.getBytes()));
         OutputFormat format = new OutputFormat();
         format.setIndenting(true);
@@ -274,9 +306,8 @@
         System.out.println("Node content for element valeur2:");
         System.out.println("=================================");
         NodeList nodes = document.getElementsByTagName("valeur2");
-        nodes = document.getElementsByTagName("valeur2");
         for (int i = 0; i < nodes.getLength(); i++) {
-            node = nodes.item(i);
+            Node node = nodes.item(i);
             System.out.println("  Node value: " + node.getFirstChild().getNodeValue());
             System.out.println("  Node attribute: " + node.getAttributes().item(0).getNodeValue());
 
@@ -341,4 +372,62 @@
         Assert.assertEquals(resultstring, reference, "Output of transformation of Bug8150704-2.xml does not match reference");
         System.out.println("Passed.");
     }
+
+    /*
+     * @bug 8162598
+     * @summary Test XSLTC handling of namespaces, especially empty namespace definitions to reset the
+     *          default namespace
+     */
+    @Test
+    public final void testBug8162598() throws IOException, TransformerException {
+        final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+        final String xsl =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + LINE_SEPARATOR +
+            "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">" + LINE_SEPARATOR +
+            "    <xsl:template match=\"/\">" + LINE_SEPARATOR +
+            "        <root xmlns=\"ns1\">" + LINE_SEPARATOR +
+            "            <xsl:call-template name=\"transform\"/>" + LINE_SEPARATOR +
+            "        </root>" + LINE_SEPARATOR +
+            "    </xsl:template>" + LINE_SEPARATOR +
+            "    <xsl:template name=\"transform\">" + LINE_SEPARATOR +
+            "        <test1 xmlns=\"ns2\"><b xmlns=\"ns2\"><c xmlns=\"\"></c></b></test1>" + LINE_SEPARATOR +
+            "        <test2 xmlns=\"ns1\"><b xmlns=\"ns2\"><c xmlns=\"\"></c></b></test2>" + LINE_SEPARATOR +
+            "        <test3><b><c xmlns=\"\"></c></b></test3>" + LINE_SEPARATOR +
+            "        <test4 xmlns=\"\"><b><c xmlns=\"\"></c></b></test4>" + LINE_SEPARATOR +
+            "        <test5 xmlns=\"ns1\"><b><c xmlns=\"\"></c></b></test5>" + LINE_SEPARATOR +
+            "        <test6 xmlns=\"\"/>" + LINE_SEPARATOR +
+            "    </xsl:template>" + LINE_SEPARATOR +
+            "</xsl:stylesheet>";
+
+
+        final String sourceXml =
+                "<?xml version=\"1.0\" encoding=\"UTF-8\"?><aaa></aaa>" + LINE_SEPARATOR;
+
+        System.out.println("Stylesheet:");
+        System.out.println("=============================");
+        System.out.println(xsl);
+        System.out.println();
+
+        System.out.println("Source before transformation:");
+        System.out.println("=============================");
+        System.out.println(sourceXml);
+        System.out.println();
+
+        System.out.println("Result after transformation:");
+        System.out.println("============================");
+        Document document = transformInputStreamToDocument(
+            createTransformerFromInputstream(new ByteArrayInputStream(xsl.getBytes())),
+                                             new ByteArrayInputStream(sourceXml.getBytes()));
+        OutputFormat format = new OutputFormat();
+        format.setIndenting(true);
+        new XMLSerializer(System.out, format).serialize(document);
+        System.out.println();
+        checkNodeNS8162598(document.getElementsByTagName("test1").item(0), "ns2", "ns2", null);
+        checkNodeNS8162598(document.getElementsByTagName("test2").item(0), "ns1", "ns2", null);
+        checkNodeNS8162598(document.getElementsByTagName("test3").item(0), null, null, null);
+        checkNodeNS8162598(document.getElementsByTagName("test4").item(0), null, null, null);
+        checkNodeNS8162598(document.getElementsByTagName("test5").item(0), "ns1", "ns1", null);
+        Assert.assertNull(document.getElementsByTagName("test6").item(0).getNamespaceURI(), "unexpected namespace for test6");
+    }
 }
--- a/jaxws/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/jaxws/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -374,3 +374,4 @@
 264a44128cd6286e598d5a849ceeb613c06269d0 jdk-9+126
 06d706c70634775418dc79a2671780ba1c624fd2 jdk-9+127
 fe4e11bd2423635dc0f5f5cb9a64eb2f2cce7f4c jdk-9+128
+46a02f57218e4a8c334dbccf656fb048f823f163 jdk-9+129
--- a/jdk/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -372,3 +372,4 @@
 7a97b89ba83077ca62e4aa5a05437adc8f315343 jdk-9+127
 9446c534f0222b4eecfd9d9e25ab37c4fd4400a5 jdk-9+128
 47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
+6c827500e34587061af97ad6fef0e859280255c5 jdk-9+130
--- a/jdk/src/java.base/share/classes/java/lang/Runtime.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/Runtime.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1112,7 +1112,62 @@
          * @return  The Version of the given string
          */
         public static Version parse(String s) {
-            return VersionBuilder.parse(s);
+            if (s == null)
+                throw new NullPointerException();
+
+            // Shortcut to avoid initializing VersionPattern when creating
+            // major version constants during startup
+            if (isSimpleNumber(s)) {
+                return new Version(List.of(Integer.parseInt(s)),
+                        Optional.empty(), Optional.empty(), Optional.empty());
+            }
+            Matcher m = VersionPattern.VSTR_PATTERN.matcher(s);
+            if (!m.matches())
+                throw new IllegalArgumentException("Invalid version string: '"
+                                                   + s + "'");
+
+            // $VNUM is a dot-separated list of integers of arbitrary length
+            List<Integer> version = new ArrayList<>();
+            for (String i : m.group(VersionPattern.VNUM_GROUP).split("\\."))
+                version.add(Integer.parseInt(i));
+
+            Optional<String> pre = Optional.ofNullable(
+                    m.group(VersionPattern.PRE_GROUP));
+
+            String b = m.group(VersionPattern.BUILD_GROUP);
+            // $BUILD is an integer
+            Optional<Integer> build = (b == null)
+                ? Optional.empty()
+                : Optional.of(Integer.parseInt(b));
+
+            Optional<String> optional = Optional.ofNullable(
+                    m.group(VersionPattern.OPT_GROUP));
+
+            // empty '+'
+            if ((m.group(VersionPattern.PLUS_GROUP) != null)
+                    && !build.isPresent()) {
+                if (optional.isPresent()) {
+                    if (pre.isPresent())
+                        throw new IllegalArgumentException("'+' found with"
+                            + " pre-release and optional components:'" + s
+                            + "'");
+                } else {
+                    throw new IllegalArgumentException("'+' found with neither"
+                        + " build or optional components: '" + s + "'");
+                }
+            }
+            return new Version(version, pre, build, optional);
+        }
+
+        private static boolean isSimpleNumber(String s) {
+            for (int i = 0; i < s.length(); i++) {
+                char c = s.charAt(i);
+                char lowerBound = (i > 0) ? '0' : '1';
+                if (c < lowerBound || c > '9') {
+                    return false;
+                }
+            }
+            return true;
         }
 
         /**
@@ -1441,86 +1496,26 @@
         }
     }
 
-    private static class VersionBuilder {
+    private static class VersionPattern {
         // $VNUM(-$PRE)?(\+($BUILD)?(\-$OPT)?)?
         // RE limits the format of version strings
         // ([1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:-([a-zA-Z0-9]+))?(?:(\+)(0|[1-9][0-9]*)?)?(?:-([-a-zA-Z0-9.]+))?
 
         private static final String VNUM
             = "(?<VNUM>[1-9][0-9]*(?:(?:\\.0)*\\.[1-9][0-9]*)*)";
-        private static final String VNUM_GROUP  = "VNUM";
-
         private static final String PRE      = "(?:-(?<PRE>[a-zA-Z0-9]+))?";
-        private static final String PRE_GROUP   = "PRE";
-
         private static final String BUILD
             = "(?:(?<PLUS>\\+)(?<BUILD>0|[1-9][0-9]*)?)?";
-        private static final String PLUS_GROUP  = "PLUS";
-        private static final String BUILD_GROUP = "BUILD";
-
         private static final String OPT      = "(?:-(?<OPT>[-a-zA-Z0-9.]+))?";
-        private static final String OPT_GROUP   = "OPT";
-
         private static final String VSTR_FORMAT
             = "^" + VNUM + PRE + BUILD + OPT + "$";
-        private static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
 
-        /**
-         * Constructs a valid <a href="verStr">version string</a> containing
-         * a <a href="#verNum">version number</a> followed by pre-release and
-         * build information.
-         *
-         * @param  s
-         *         A string to be interpreted as a version
-         *
-         * @throws  IllegalArgumentException
-         *          If the given string cannot be interpreted as a valid
-         *          version
-         *
-         * @throws  NullPointerException
-         *          If {@code s} is {@code null}
-         *
-         * @throws  NumberFormatException
-         *          If an element of the version number or the build number
-         *          cannot be represented as an {@link Integer}
-         */
-        static Version parse(String s) {
-            if (s == null)
-                throw new NullPointerException();
-
-            Matcher m = VSTR_PATTERN.matcher(s);
-            if (!m.matches())
-                throw new IllegalArgumentException("Invalid version string: '"
-                                                   + s + "'");
+        static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
 
-            // $VNUM is a dot-separated list of integers of arbitrary length
-            List<Integer> version = new ArrayList<>();
-            for (String i : m.group(VNUM_GROUP).split("\\."))
-                version.add(Integer.parseInt(i));
-
-            Optional<String> pre = Optional.ofNullable(m.group(PRE_GROUP));
-
-            String b = m.group(BUILD_GROUP);
-            // $BUILD is an integer
-            Optional<Integer> build = (b == null)
-                ? Optional.empty()
-                : Optional.of(Integer.parseInt(b));
-
-            Optional<String> optional = Optional.ofNullable(m.group(OPT_GROUP));
-
-            // empty '+'
-            if ((m.group(PLUS_GROUP) != null) && !build.isPresent()) {
-                if (optional.isPresent()) {
-                    if (pre.isPresent())
-                        throw new IllegalArgumentException("'+' found with"
-                            + " pre-release and optional components:'" + s
-                            + "'");
-                } else {
-                    throw new IllegalArgumentException("'+' found with neither"
-                        + " build or optional components: '" + s + "'");
-                }
-            }
-            return new Version(version, pre, build, optional);
-        }
+        static final String VNUM_GROUP  = "VNUM";
+        static final String PRE_GROUP   = "PRE";
+        static final String PLUS_GROUP  = "PLUS";
+        static final String BUILD_GROUP = "BUILD";
+        static final String OPT_GROUP   = "OPT";
     }
 }
--- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -164,7 +164,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, 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
@@ -691,7 +691,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      *
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java	Fri Aug 05 12:03:58 2016 -0700
@@ -361,7 +361,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
--- a/jdk/src/java.base/share/classes/java/net/Socket.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, 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
@@ -907,7 +907,6 @@
             throw new SocketException("Socket is not connected");
         if (isInputShutdown())
             throw new SocketException("Socket input is shutdown");
-        final Socket s = this;
         InputStream is = null;
         try {
             is = AccessController.doPrivileged(
@@ -947,7 +946,6 @@
             throw new SocketException("Socket is not connected");
         if (isOutputShutdown())
             throw new SocketException("Socket output is shutdown");
-        final Socket s = this;
         OutputStream os = null;
         try {
             os = AccessController.doPrivileged(
--- a/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java	Fri Aug 05 12:03:58 2016 -0700
@@ -168,7 +168,7 @@
      * @throws  IllegalArgumentException
      *          if {@code maxDepth} is negative
      * @throws  ClassCastException
-     *          if (@code options} contains an element that is not a
+     *          if {@code options} contains an element that is not a
      *          {@code FileVisitOption}
      * @throws  NullPointerException
      *          if {@code options} is {@ocde null} or the options
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Aug 05 12:03:58 2016 -0700
@@ -810,7 +810,7 @@
      * The localized decimal style is not used.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -848,7 +848,7 @@
      * digits from zero to nine are accepted.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Aug 05 12:03:58 2016 -0700
@@ -30,7 +30,7 @@
 import java.lang.reflect.*;
 import java.io.Serializable;
 import java.util.*;
-import java.util.stream.Collectors;
+import java.util.stream.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -163,47 +163,167 @@
      */
     private static String memberValueToString(Object value) {
         Class<?> type = value.getClass();
-        if (!type.isArray()) {   // primitive, string, class, enum const,
-                                 // or annotation
+        if (!type.isArray()) {
+            // primitive value, string, class, enum const, or annotation
             if (type == Class.class)
-                return classValueToString((Class<?>) value);
+                return toSourceString((Class<?>) value);
+            else if (type == String.class)
+                return  toSourceString((String) value);
+            if (type == Character.class)
+                return toSourceString((char) value);
+            else if (type == Double.class)
+                return  toSourceString((double) value);
+            else if (type == Float.class)
+                return  toSourceString((float) value);
+            else if (type == Long.class)
+                return  toSourceString((long) value);
             else
                 return value.toString();
-        }
+        } else {
+            Stream<String> stringStream;
+            if (type == byte[].class)
+                stringStream = convert((byte[]) value);
+            else if (type == char[].class)
+                stringStream = convert((char[]) value);
+            else if (type == double[].class)
+                stringStream = DoubleStream.of((double[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            else if (type == float[].class)
+                stringStream = convert((float[]) value);
+            else if (type == int[].class)
+                stringStream = IntStream.of((int[]) value).mapToObj(String::valueOf);
+            else if (type == long[].class) {
+                stringStream = LongStream.of((long[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            } else if (type == short[].class)
+                stringStream = convert((short[]) value);
+            else if (type == boolean[].class)
+                stringStream = convert((boolean[]) value);
+            else if (type == Class[].class)
+                stringStream =
+                    Arrays.stream((Class<?>[]) value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else if (type == String[].class)
+                stringStream =
+                    Arrays.stream((String[])value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else
+                stringStream = Arrays.stream((Object[])value).map(Objects::toString);
 
-        if (type == byte[].class)
-            return Arrays.toString((byte[]) value);
-        if (type == char[].class)
-            return Arrays.toString((char[]) value);
-        if (type == double[].class)
-            return Arrays.toString((double[]) value);
-        if (type == float[].class)
-            return Arrays.toString((float[]) value);
-        if (type == int[].class)
-            return Arrays.toString((int[]) value);
-        if (type == long[].class)
-            return Arrays.toString((long[]) value);
-        if (type == short[].class)
-            return Arrays.toString((short[]) value);
-        if (type == boolean[].class)
-            return Arrays.toString((boolean[]) value);
-        if (type == Class[].class)
-            return classArrayValueToString((Class<?>[])value);
-        return Arrays.toString((Object[]) value);
+            return stringStreamToString(stringStream);
+        }
     }
 
     /**
      * Translates a Class value to a form suitable for use in the
      * string representation of an annotation.
      */
-    private static String classValueToString(Class<?> clazz) {
-        return clazz.getName() + ".class" ;
+    private static String toSourceString(Class<?> clazz) {
+        Class<?> finalComponent = clazz;
+        StringBuilder arrayBackets = new StringBuilder();
+
+        while(finalComponent.isArray()) {
+            finalComponent = finalComponent.getComponentType();
+            arrayBackets.append("[]");
+        }
+
+        return finalComponent.getName() + arrayBackets.toString() + ".class" ;
+    }
+
+    private static String toSourceString(float f) {
+        if (Float.isFinite(f))
+            return Float.toString(f) + "f" ;
+        else {
+            if (Float.isInfinite(f)) {
+                return (f < 0.0f) ? "-1.0f/0.0f": "1.0f/0.0f";
+            } else
+                return "0.0f/0.0f";
+        }
+    }
+
+    private static String toSourceString(double d) {
+        if (Double.isFinite(d))
+            return Double.toString(d);
+        else {
+            if (Double.isInfinite(d)) {
+                return (d < 0.0f) ? "-1.0/0.0": "1.0/0.0";
+            } else
+                return "0.0/0.0";
+        }
+    }
+
+    private static String toSourceString(char c) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("'");
+        if (c == '\'')
+            sb.append("\\'");
+        else
+            sb.append(c);
+        sb.append("'");
+        return sb.toString();
+    }
+
+    private static String toSourceString(long ell) {
+        return (Math.abs(ell) <= Integer.MAX_VALUE) ?
+            String.valueOf(ell) :
+            (String.valueOf(ell) + "L");
     }
 
-    private static String classArrayValueToString(Class<?>[] classes) {
-        return Arrays.stream(classes)
-            .map(AnnotationInvocationHandler::classValueToString)
-            .collect(Collectors.joining(", ", "{", "}"));
+    /**
+     * Return a string suitable for use in the string representation
+     * of an annotation.
+     */
+    private static String toSourceString(String s) {
+        StringBuilder sb = new StringBuilder();
+        sb.append('"');
+        // Escape embedded quote characters, if present, but don't do
+        // anything more heroic.
+        if (s.indexOf('"') != -1) {
+            s = s.replace("\"", "\\\"");
+        }
+        sb.append(s);
+        sb.append('"');
+        return sb.toString();
+    }
+
+    private static Stream<String> convert(byte[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (byte b : values)
+            list.add(Byte.toString(b));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(char[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (char c : values)
+            list.add(toSourceString(c));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(float[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (float f : values) {
+            list.add(toSourceString(f));
+        }
+        return list.stream();
+    }
+
+    private static Stream<String> convert(short[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (short s : values)
+            list.add(Short.toString(s));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(boolean[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (boolean b : values)
+            list.add(Boolean.toString(b));
+        return list.stream();
+    }
+
+    private static String stringStreamToString(Stream<String> stream) {
+        return stream.collect(Collectors.joining(", ", "{", "}"));
     }
 
     /**
--- a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java	Fri Aug 05 12:03:58 2016 -0700
@@ -28,16 +28,12 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Locale.*;
 import static java.util.Locale.FilteringMode.*;
 import static java.util.Locale.LanguageRange.*;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Implementation for BCP47 Locale matching
@@ -111,10 +107,22 @@
 
     private static List<String> filterBasic(List<LanguageRange> priorityList,
                                             Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingBasicZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             } else {
                 for (String tag : tags) {
@@ -122,7 +130,8 @@
                     if (tag.startsWith(range)) {
                         int len = range.length();
                         if ((tag.length() == len || tag.charAt(len) == '-')
-                            && !list.contains(tag)) {
+                            && !list.contains(tag)
+                            && !shouldIgnoreFilterBasicMatch(zeroRanges, tag)) {
                             list.add(tag);
                         }
                     }
@@ -133,12 +142,76 @@
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the basic exclusion range(s) i.e
+     * range(s) with q=0 and returns the updated collection. If the basic
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingBasicZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterBasicMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the basic exclusion range(s) should not
+     * be considered as the matching tag. Ignores the tag matching with the
+     * non-zero ranges, if the tag also matches with one of the basic exclusion
+     * ranges i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterBasicMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+            if (tag.startsWith(range)) {
+                int len = range.length();
+                if ((tag.length() == len || tag.charAt(len) == '-')) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
     private static List<String> filterExtended(List<LanguageRange> priorityList,
                                                Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingExtendedZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             }
             String[] rangeSubtags = range.split("-");
@@ -150,33 +223,101 @@
                     continue;
                 }
 
-                int rangeIndex = 1;
-                int tagIndex = 1;
-
-                while (rangeIndex < rangeSubtags.length
-                       && tagIndex < tagSubtags.length) {
-                   if (rangeSubtags[rangeIndex].equals("*")) {
-                       rangeIndex++;
-                   } else if (rangeSubtags[rangeIndex].equals(tagSubtags[tagIndex])) {
-                       rangeIndex++;
-                       tagIndex++;
-                   } else if (tagSubtags[tagIndex].length() == 1
-                              && !tagSubtags[tagIndex].equals("*")) {
-                       break;
-                   } else {
-                       tagIndex++;
-                   }
-               }
-
-               if (rangeSubtags.length == rangeIndex && !list.contains(tag)) {
-                   list.add(tag);
-               }
+                int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                        tagSubtags);
+                if (rangeSubtags.length == rangeIndex && !list.contains(tag)
+                        && !shouldIgnoreFilterExtendedMatch(zeroRanges, tag)) {
+                    list.add(tag);
+                }
             }
         }
 
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the extended exclusion range(s)
+     * i.e range(s) with q=0 and returns the updated collection. If the extended
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingExtendedZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterExtendedMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the extended exclusion range(s) should
+     * not be considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the extended
+     * exclusion range(s) i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterExtendedMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        String[] tagSubtags = tag.split("-");
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+
+            String[] rangeSubtags = range.split("-");
+
+            if (!rangeSubtags[0].equals(tagSubtags[0])
+                    && !rangeSubtags[0].equals("*")) {
+                continue;
+            }
+
+            int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                    tagSubtags);
+            if (rangeSubtags.length == rangeIndex) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private static int matchFilterExtendedSubtags(String[] rangeSubtags,
+            String[] tagSubtags) {
+        int rangeIndex = 1;
+        int tagIndex = 1;
+
+        while (rangeIndex < rangeSubtags.length
+                && tagIndex < tagSubtags.length) {
+            if (rangeSubtags[rangeIndex].equals("*")) {
+                rangeIndex++;
+            } else if (rangeSubtags[rangeIndex]
+                    .equals(tagSubtags[tagIndex])) {
+                rangeIndex++;
+                tagIndex++;
+            } else if (tagSubtags[tagIndex].length() == 1
+                    && !tagSubtags[tagIndex].equals("*")) {
+                break;
+            } else {
+                tagIndex++;
+            }
+        }
+        return rangeIndex;
+    }
+
     public static Locale lookup(List<LanguageRange> priorityList,
                                 Collection<Locale> locales) {
         if (priorityList.isEmpty() || locales.isEmpty()) {
@@ -205,7 +346,18 @@
             return null;
         }
 
-        for (LanguageRange lr : priorityList) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
 
             // Special language range ("*") is ignored in lookup.
@@ -217,31 +369,83 @@
             while (rangeForRegex.length() > 0) {
                 for (String tag : tags) {
                     tag = tag.toLowerCase(Locale.ROOT);
-                    if (tag.matches(rangeForRegex)) {
+                    if (tag.matches(rangeForRegex)
+                            && !shouldIgnoreLookupMatch(zeroRanges, tag)) {
                         return tag;
                     }
                 }
 
                 // Truncate from the end....
-                int index = rangeForRegex.lastIndexOf('-');
-                if (index >= 0) {
-                    rangeForRegex = rangeForRegex.substring(0, index);
-
-                    // if range ends with an extension key, truncate it.
-                    index = rangeForRegex.lastIndexOf('-');
-                    if (index >= 0 && index == rangeForRegex.length()-2) {
-                        rangeForRegex =
-                            rangeForRegex.substring(0, rangeForRegex.length()-2);
-                    }
-                } else {
-                    rangeForRegex = "";
-                }
+                rangeForRegex = truncateRange(rangeForRegex);
             }
         }
 
         return null;
     }
 
+    /**
+     * The tag which is falling in the exclusion range(s) should not be
+     * considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the exclusion
+     * range(s) i.e. range(s) having quality weight q=0.
+     */
+    private static boolean shouldIgnoreLookupMatch(List<LanguageRange> zeroRange,
+            String tag) {
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+
+            // Special language range ("*") is ignored in lookup.
+            if (range.equals("*")) {
+                continue;
+            }
+
+            String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*");
+            while (rangeForRegex.length() > 0) {
+                if (tag.matches(rangeForRegex)) {
+                    return true;
+                }
+                // Truncate from the end....
+                rangeForRegex = truncateRange(rangeForRegex);
+            }
+        }
+
+        return false;
+    }
+
+    /* Truncate the range from end during the lookup match */
+    private static String truncateRange(String rangeForRegex) {
+        int index = rangeForRegex.lastIndexOf('-');
+        if (index >= 0) {
+            rangeForRegex = rangeForRegex.substring(0, index);
+
+            // if range ends with an extension key, truncate it.
+            index = rangeForRegex.lastIndexOf('-');
+            if (index >= 0 && index == rangeForRegex.length() - 2) {
+                rangeForRegex
+                        = rangeForRegex.substring(0, rangeForRegex.length() - 2);
+            }
+        } else {
+            rangeForRegex = "";
+        }
+
+        return rangeForRegex;
+    }
+
+    /* Returns the split index of the priority list, if it contains
+     * language range(s) with quality weight as 0 i.e. q=0, else -1
+     */
+    private static int splitRanges(List<LanguageRange> priorityList) {
+        int size = priorityList.size();
+        for (int index = 0; index < size; index++) {
+            LanguageRange range = priorityList.get(index);
+            if (range.getWeight() == 0) {
+                return index;
+            }
+        }
+
+        return -1; // no q=0 range exists
+    }
+
     public static List<LanguageRange> parse(String ranges) {
         ranges = ranges.replaceAll(" ", "").toLowerCase(Locale.ROOT);
         if (ranges.startsWith("accept-language:")) {
--- a/jdk/src/java.base/solaris/lib/security/default.policy	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/solaris/lib/security/default.policy	Fri Aug 05 12:03:58 2016 -0700
@@ -11,6 +11,6 @@
                    "clearProviderProperties.OracleUcrypto";
     permission java.security.SecurityPermission
                    "removeProviderProperty.OracleUcrypto";
-    permission java.io.FilePermission
-                   "${java.home}/conf/security/ucrypto-solaris.cfg", "read";
+    // Needed for reading Ucrypto config file
+    permission java.io.FilePermission "<<ALL FILES>>", "read";
 };
--- a/jdk/src/java.base/unix/native/libjava/TimeZone_md.c	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.base/unix/native/libjava/TimeZone_md.c	Fri Aug 05 12:03:58 2016 -0700
@@ -44,6 +44,12 @@
 
 #define SKIP_SPACE(p)   while (*p == ' ' || *p == '\t') p++;
 
+#define RESTARTABLE(_cmd, _result) do { \
+  do { \
+    _result = _cmd; \
+  } while((_result == -1) && (errno == EINTR)); \
+} while(0)
+
 #if defined(_ALLBSD_SOURCE)
 #define dirent64 dirent
 #define readdir64_r readdir_r
@@ -121,6 +127,7 @@
     int fd = -1;
     char *dbuf = NULL;
     char *tz = NULL;
+    int res;
 
     dirp = opendir(dir);
     if (dirp == NULL) {
@@ -161,7 +168,8 @@
         if (pathname == NULL) {
             break;
         }
-        if (stat(pathname, &statbuf) == -1) {
+        RESTARTABLE(stat(pathname, &statbuf), res);
+        if (res == -1) {
             break;
         }
 
@@ -175,10 +183,12 @@
             if (dbuf == NULL) {
                 break;
             }
-            if ((fd = open(pathname, O_RDONLY)) == -1) {
+            RESTARTABLE(open(pathname, O_RDONLY), fd);
+            if (fd == -1) {
                 break;
             }
-            if (read(fd, dbuf, size) != (ssize_t) size) {
+            RESTARTABLE(read(fd, dbuf, size), res);
+            if (res != (ssize_t) size) {
                 break;
             }
             if (memcmp(buf, dbuf, size) == 0) {
@@ -230,6 +240,7 @@
     int fd;
     char *buf;
     size_t size;
+    int res;
 
 #if defined(__linux__)
     /*
@@ -260,7 +271,8 @@
     /*
      * Next, try /etc/localtime to find the zone ID.
      */
-    if (lstat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {
+    RESTARTABLE(lstat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+    if (res == -1) {
         return NULL;
     }
 
@@ -294,10 +306,13 @@
      * If initial symbolic link resolution failed, we should treat target
      * file as a regular file.
      */
-    if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) {
+    RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
+    if (fd == -1) {
         return NULL;
     }
-    if (fstat(fd, &statbuf) == -1) {
+
+    RESTARTABLE(fstat(fd, &statbuf), res);
+    if (res == -1) {
         (void) close(fd);
         return NULL;
     }
@@ -308,7 +323,8 @@
         return NULL;
     }
 
-    if (read(fd, buf, size) != (ssize_t) size) {
+    RESTARTABLE(read(fd, buf, size), res);
+    if (res != (ssize_t) size) {
         (void) close(fd);
         free((void *) buf);
         return NULL;
@@ -372,7 +388,8 @@
     /*
      * It assumes read open.
      */
-    if ((fd = open(fname, O_RDONLY)) == -1) {
+    RESTARTABLE(open(fname, O_RDONLY), fd);
+    if (fd == -1) {
         return NULL;
     }
 
@@ -420,7 +437,8 @@
         if (iop->ptr == iop->endptr) {
             ssize_t len;
 
-            if ((len = read(iop->fd, (void *)iop->buffer, BUFFER_SIZE)) == -1) {
+            RESTARTABLE(read(iop->fd, (void *)iop->buffer, BUFFER_SIZE), len);
+            if (len == -1) {
                 return NULL;
             }
             if (len == 0) {
@@ -558,6 +576,7 @@
     size_t size;
     char *buf;
     int fd;
+    int res;
     /* scf specific variables */
     scf_handle_t *h = NULL;
     scf_snapshot_t *snap = NULL;
@@ -593,7 +612,8 @@
     }
     cleanupScf(h, snap, inst, pg, prop, val, tz);
 
-    if (stat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {
+    RESTARTABLE(stat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+    if (res == -1) {
         return NULL;
     }
     size = (size_t) statbuf.st_size;
@@ -601,12 +621,14 @@
     if (buf == NULL) {
         return NULL;
     }
-    if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) {
+    RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
+    if (fd == -1) {
         free((void *) buf);
         return NULL;
     }
 
-    if (read(fd, buf, size) != (ssize_t) size) {
+    RESTARTABLE(read(fd, buf, size), res);
+    if (res != (ssize_t) size) {
         (void) close(fd);
         free((void *) buf);
         return NULL;
--- a/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Fri Aug 05 12:03:58 2016 -0700
@@ -177,7 +177,7 @@
      * @param lastRow  the last row affected by this event
      * @param column the column index of cells changed; {@code ALL_COLUMNS}
      *        signifies all cells in the specified range of rows are changed.
-     * @param type the type of change signified by this even, @code INSERT},
+     * @param type the type of change signified by this even, {@code INSERT},
      *        {@code DELETE } or {@code UPDATE}
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type) {
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Fri Aug 05 12:03:58 2016 -0700
@@ -297,7 +297,7 @@
      * If {@code lw1} and {@code lw2} are both greater than zero, then
      * the parallelogram figure is doubled by both expanding and contracting
      * each delta vector by its corresponding {@code lw} value.
-     * If either (@code lw1) or {@code lw2} are also greater than 1, then
+     * If either {@code lw1} or {@code lw2} are also greater than 1, then
      * the inner (contracted) parallelogram disappears and the figure is
      * simply a single expanded parallelogram.
      * The {@code clip} parameter specifies the current clip in effect
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Fri Aug 05 12:03:58 2016 -0700
@@ -395,7 +395,7 @@
     public void dispose() throws GSSException;
 
     /**
-     * Return the mechanism-specific attribute associated with (@code type}.
+     * Return the mechanism-specific attribute associated with {@code type}.
      *
      * @param type the type of the attribute requested
      * @return the attribute
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Fri Aug 05 12:03:58 2016 -0700
@@ -34,6 +34,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.UncheckedIOException;
@@ -55,11 +56,11 @@
 import java.util.Properties;
 import java.util.Set;
 import jdk.tools.jlink.internal.BasicImageWriter;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.PluginException;
 
 /**
@@ -144,14 +145,12 @@
         Files.createDirectories(mdir);
     }
 
-    private void storeFiles(Set<String> modules, Map<String, String> release) throws IOException {
+    private void storeFiles(Set<String> modules, Properties release) throws IOException {
         if (release != null) {
-            Properties props = new Properties();
-            props.putAll(release);
-            addModules(props, modules);
+            addModules(release, modules);
             File r = new File(root.toFile(), "release");
             try (FileOutputStream fo = new FileOutputStream(r)) {
-                props.store(fo, null);
+                release.store(fo, null);
             }
         }
     }
@@ -184,14 +183,10 @@
             files.moduleView().modules().forEach(m -> {
                 // Only add modules that contain packages
                 if (!m.packages().isEmpty()) {
-                    // Skip the fake module used by FileCopierPlugin when copying files.
-                    if (m.name().equals(FileCopierPlugin.FAKE_MODULE)) {
-                        return;
-                    }
                     modules.add(m.name());
                 }
             });
-            storeFiles(modules, files.releaseProperties());
+            storeFiles(modules, releaseProperties(files));
 
             if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
                 // launchers in the bin directory need execute permission
@@ -219,6 +214,28 @@
         }
     }
 
+    private Properties releaseProperties(ResourcePool pool) throws IOException {
+        Properties props = new Properties();
+        Optional<ResourcePoolModule> javaBase = pool.moduleView().findModule("java.base");
+        javaBase.ifPresent(mod -> {
+            // fill release information available from transformed "java.base" module!
+            ModuleDescriptor desc = mod.descriptor();
+            desc.osName().ifPresent(s -> props.setProperty("OS_NAME", s));
+            desc.osVersion().ifPresent(s -> props.setProperty("OS_VERSION", s));
+            desc.osArch().ifPresent(s -> props.setProperty("OS_ARCH", s));
+            props.setProperty("JAVA_VERSION", System.getProperty("java.version"));
+        });
+
+        Optional<ResourcePoolEntry> release = pool.findEntry("/java.base/release");
+        if (release.isPresent()) {
+            try (InputStream is = release.get().content()) {
+                props.load(is);
+            }
+        }
+
+        return props;
+    }
+
     /**
      * Generates launcher scripts.
      *
@@ -317,6 +334,8 @@
                 case CONFIG:
                     writeEntry(in, destFile("conf", filename));
                     break;
+                case TOP:
+                    break;
                 case OTHER:
                     if (file instanceof SymImageFile) {
                         SymImageFile sym = (SymImageFile) file;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Fri Aug 05 12:03:58 2016 -0700
@@ -279,6 +279,8 @@
         private class LastModule implements ResourcePoolModule {
 
             final ResourcePoolModule module;
+            // lazily initialized
+            ModuleDescriptor descriptor;
 
             LastModule(ResourcePoolModule module) {
                 this.module = module;
@@ -297,7 +299,10 @@
 
             @Override
             public ModuleDescriptor descriptor() {
-                return module.descriptor();
+                if (descriptor == null) {
+                    descriptor = ResourcePoolManager.readModuleDescriptor(this);
+                }
+                return descriptor;
             }
 
             @Override
@@ -420,11 +425,6 @@
             return pool.byteOrder();
         }
 
-        @Override
-        public Map<String, String> releaseProperties() {
-            return pool.releaseProperties();
-        }
-
         private ResourcePoolEntry getUncompressed(ResourcePoolEntry res) {
             if (res != null) {
                 if (res instanceof ResourcePoolManager.CompressedModuleData) {
@@ -458,18 +458,6 @@
             throws Exception {
         Objects.requireNonNull(original);
         Objects.requireNonNull(transformed);
-        Optional<ResourcePoolModule> javaBase = transformed.moduleView().findModule("java.base");
-        javaBase.ifPresent(mod -> {
-            try {
-                Map<String, String> release = transformed.releaseProperties();
-                // fill release information available from transformed "java.base" module!
-                ModuleDescriptor desc = mod.descriptor();
-                desc.osName().ifPresent(s -> release.put("OS_NAME", s));
-                desc.osVersion().ifPresent(s -> release.put("OS_VERSION", s));
-                desc.osArch().ifPresent(s -> release.put("OS_ARCH", s));
-            } catch (Exception ignored) {}
-        });
-
         imageBuilder.storeFiles(new LastPoolManager(transformed).resourcePool());
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Fri Aug 05 12:03:58 2016 -0700
@@ -50,10 +50,22 @@
  * A manager for pool of resources.
  */
 public class ResourcePoolManager {
+    // utility to read ModuleDescriptor of the given ResourcePoolModule
+    static ModuleDescriptor readModuleDescriptor(ResourcePoolModule mod) {
+        String p = "/" + mod.name() + "/module-info.class";
+        Optional<ResourcePoolEntry> content = mod.findEntry(p);
+        if (!content.isPresent()) {
+              throw new PluginException("No module-info for " + mod.name()
+                      + " module");
+        }
+        ByteBuffer bb = ByteBuffer.wrap(content.get().contentBytes());
+        return ModuleDescriptor.read(bb);
+    }
 
     class ResourcePoolModuleImpl implements ResourcePoolModule {
 
         final Map<String, ResourcePoolEntry> moduleContent = new LinkedHashMap<>();
+        // lazily initialized
         private ModuleDescriptor descriptor;
         final String name;
 
@@ -80,14 +92,7 @@
         @Override
         public ModuleDescriptor descriptor() {
             if (descriptor == null) {
-                String p = "/" + name + "/module-info.class";
-                Optional<ResourcePoolEntry> content = findEntry(p);
-                if (!content.isPresent()) {
-                    throw new PluginException("No module-info for " + name
-                            + " module");
-                }
-                ByteBuffer bb = ByteBuffer.wrap(content.get().contentBytes());
-                descriptor = ModuleDescriptor.read(bb);
+                descriptor = readModuleDescriptor(this);
             }
             return descriptor;
         }
@@ -166,11 +171,6 @@
             return ResourcePoolManager.this.byteOrder();
         }
 
-        @Override
-        public Map<String, String> releaseProperties() {
-            return ResourcePoolManager.this.releaseProperties();
-        }
-
         public StringTable getStringTable() {
             return ResourcePoolManager.this.getStringTable();
         }
@@ -213,8 +213,6 @@
 
     private final Map<String, ResourcePoolEntry> resources = new LinkedHashMap<>();
     private final Map<String, ResourcePoolModule> modules = new LinkedHashMap<>();
-    private final ResourcePoolModuleImpl fileCopierModule = new ResourcePoolModuleImpl(FileCopierPlugin.FAKE_MODULE);
-    private Map<String, String> releaseProps = new HashMap<>();
     private final ByteOrder order;
     private final StringTable table;
     private final ResourcePool poolImpl;
@@ -273,11 +271,6 @@
         }
         String modulename = data.moduleName();
         ResourcePoolModuleImpl m = (ResourcePoolModuleImpl)modules.get(modulename);
-        // ## TODO: FileCopierPlugin should not add content to a module
-        // FAKE_MODULE is not really a module to be added in the image
-        if (FileCopierPlugin.FAKE_MODULE.equals(modulename)) {
-            m = fileCopierModule;
-        }
         if (m == null) {
             m = new ResourcePoolModuleImpl(modulename);
             modules.put(modulename, m);
@@ -391,10 +384,6 @@
         return order;
     }
 
-    public Map<String, String> releaseProperties() {
-        return releaseProps;
-    }
-
     public StringTable getStringTable() {
         return table;
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Fri Aug 05 12:03:58 2016 -0700
@@ -38,6 +38,7 @@
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.PluginException;
 
@@ -98,9 +99,8 @@
      * e.g.: /java.base/native/amd64/server/libjvm.so
      * /java.base/native/server/libjvm.dylib
      */
-    private List<ResourcePoolEntry> getVMs(ResourcePool in) {
-        String jvmlib = jvmlib();
-        List<ResourcePoolEntry> ret = in.moduleView().findModule("java.base").get().entries().filter((t) -> {
+    private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String jvmlib) {
+        List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
             return t.path().endsWith("/" + jvmlib);
         }).collect(Collectors.toList());
         return ret;
@@ -108,12 +108,13 @@
 
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
-        String jvmlib = jvmlib();
+        ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get();
+        String jvmlib = jvmlib(javaBase.descriptor().osName().get());
         TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator());
         TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator());
         if (!keepAll) {
             // First retrieve all available VM names and removed VM
-            List<ResourcePoolEntry> jvms = getVMs(in);
+            List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlib);
             for (Jvm jvm : Jvm.values()) {
                 for (ResourcePoolEntry md : jvms) {
                     if (md.path().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
@@ -247,21 +248,21 @@
         return orig.copyWithContent(content);
     }
 
-    private static String jvmlib() {
+    private static String jvmlib(String osName) {
         String lib = "libjvm.so";
-        if (isWindows()) {
+        if (isWindows(osName)) {
             lib = "jvm.dll";
-        } else if (isMac()) {
+        } else if (isMac(osName)) {
             lib = "libjvm.dylib";
         }
         return lib;
     }
 
-    private static boolean isWindows() {
-        return System.getProperty("os.name").startsWith("Windows");
+    private static boolean isWindows(String osName) {
+        return osName.startsWith("Windows");
     }
 
-    private static boolean isMac() {
-        return System.getProperty("os.name").startsWith("Mac OS");
+    private static boolean isMac(String osName) {
+        return osName.startsWith("Mac OS") || osName.startsWith("Darwin");
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Fri Aug 05 12:03:58 2016 -0700
@@ -58,8 +58,6 @@
         Path source;
         Path target;
     }
-    public static final String FAKE_MODULE = "$jlink-file-copier";
-
     private final List<CopiedFile> files = new ArrayList<>();
 
     /**
@@ -159,7 +157,7 @@
         Objects.requireNonNull(file);
         Objects.requireNonNull(path);
         ResourcePoolEntry impl = ResourcePoolEntry.create(
-                "/" + FAKE_MODULE + "/other/" + path,
+                "/java.base/other/" + path,
                 ResourcePoolEntry.Type.OTHER, file);
         try {
             pool.add(impl);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Fri Aug 05 12:03:58 2016 -0700
@@ -31,6 +31,7 @@
 import java.util.Locale;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import static java.util.ResourceBundle.Control;
 import java.util.Set;
@@ -342,9 +343,8 @@
                     // locales from the pre-filtered list.
                     locales.stream()
                         .filter(l -> l.toString().equalsIgnoreCase(loc.toString()))
-                        .findAny()
-                        .orElse(Locale.ROOT))
-                .filter(loc -> !loc.equals(Locale.ROOT))
+                        .findAny())
+                .flatMap(Optional::stream)
                 .flatMap(IncludeLocalesPlugin::localeToTags)
                 .distinct()
                 .collect(Collectors.toList());
@@ -373,40 +373,42 @@
     }
 
     private static Stream<String> localeToTags(Locale loc) {
+        Objects.requireNonNull(loc);
+
         String tag = loc.toLanguageTag();
-        Stream<String> ret = null;
+        List<String> tags = null;
 
         switch (loc.getLanguage()) {
             // ISO3166 compatibility
             case "iw":
-                ret = List.of(tag, tag.replaceFirst("^he", "iw")).stream();
+                tags = List.of(tag, tag.replaceFirst("^he", "iw"));
                 break;
             case "in":
-                ret = List.of(tag, tag.replaceFirst("^id", "in")).stream();
+                tags = List.of(tag, tag.replaceFirst("^id", "in"));
                 break;
             case "ji":
-                ret = List.of(tag, tag.replaceFirst("^yi", "ji")).stream();
+                tags = List.of(tag, tag.replaceFirst("^yi", "ji"));
                 break;
 
             // Special COMPAT provider locales
             case "ja":
                 if (loc.getCountry() == "JP") {
-                    ret = List.of(tag, jaJPJPTag).stream();
+                    tags = List.of(tag, jaJPJPTag);
                 }
                 break;
             case "no":
             case "nn":
                 if (loc.getCountry() == "NO") {
-                    ret = List.of(tag, noNONYTag).stream();
+                    tags = List.of(tag, noNONYTag);
                 }
                 break;
             case "th":
                 if (loc.getCountry() == "TH") {
-                    ret = List.of(tag, thTHTHTag).stream();
+                    tags = List.of(tag, thTHTHTag);
                 }
                 break;
         }
 
-        return ret == null ? List.of(tag).stream() : ret;
+        return tags == null ? List.of(tag).stream() : tags.stream();
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Fri Aug 05 12:03:58 2016 -0700
@@ -24,17 +24,23 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
+import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.lang.module.ModuleDescriptor;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.internal.Utils;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.Plugin.Category;
 import jdk.tools.jlink.plugin.Plugin.State;
 import jdk.tools.jlink.plugin.Plugin;
@@ -119,7 +125,23 @@
 
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
-        in.releaseProperties().putAll(release);
-        return in;
+        in.transformAndCopy(Function.identity(), out);
+
+        // create a TOP level ResourcePoolEntry for "release" file.
+        out.add(ResourcePoolEntry.create("/java.base/release",
+            ResourcePoolEntry.Type.TOP, releaseFileContent()));
+        return out.build();
+    }
+
+    private byte[] releaseFileContent() {
+        Properties props = new Properties();
+        props.putAll(release);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try {
+            props.store(baos, "");
+            return baos.toByteArray();
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Fri Aug 05 12:03:58 2016 -0700
@@ -95,13 +95,6 @@
     public ByteOrder byteOrder();
 
     /**
-     * Release properties such as OS, CPU name, version etc.
-     *
-     * @return the release properties
-     */
-    public Map<String, String> releaseProperties();
-
-    /**
      * Visit each ResourcePoolEntry in this ResourcePool to transform it and copy
      * the transformed ResourcePoolEntry to the output ResourcePoolBuilder.
      *
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java	Fri Aug 05 12:03:58 2016 -0700
@@ -41,6 +41,7 @@
  * <ul>
  * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
  * name}</li>
+ * <li>For top-level files:/{module name}/{file name}</li>
  * <li>For other files (shared lib, launchers, config, ...):/{module name}/
  * {@literal bin|conf|native}/{dir1}/.../{dirN}/{file name}</li>
  * </ul>
@@ -54,6 +55,7 @@
      * <ul>CONFIG: A configuration file.</ul>
      * <ul>NATIVE_CMD: A native process launcher.</ul>
      * <ul>NATIVE_LIB: A native library.</ul>
+     * <ul>TOP: A top-level file in the jdk run-time image directory.</ul>
      * <ul>OTHER: Other kind of file.</ul>
      * </li>
      */
@@ -62,6 +64,7 @@
         CONFIG,
         NATIVE_CMD,
         NATIVE_LIB,
+        TOP,
         OTHER
     }
 
--- a/jdk/test/ProblemList.txt	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/ProblemList.txt	Fri Aug 05 12:03:58 2016 -0700
@@ -315,7 +315,7 @@
 
 ############################################################################
 
-# jdk_tools
+# core_tools
 
 tools/pack200/CommandLineTests.java                             7143279,8059906 generic-all
 
@@ -365,20 +365,14 @@
 
 sun/tools/jcmd/TestJcmdSanity.java                              8031482 windows-all
 
-sun/tools/jmap/heapconfig/JMapHeapConfigTest.java               8072131,8132452 generic-all
-
 sun/tools/jstatd/TestJstatdExternalRegistry.java                8046285 generic-all
 
 sun/tools/jps/TestJpsJar.java                                   8160923 generic-all
 
 sun/tools/jps/TestJpsJarRelative.java                           6456333 generic-all
 
-sun/tools/jinfo/JInfoRunningProcessFlagTest.java                6734748 generic-all
-
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    8057732 generic-all
 
-sun/tools/jinfo/JInfoSanityTest.java                            8059035 generic-all
-
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java       8151899 generic-all
 
 ############################################################################
@@ -388,9 +382,3 @@
 com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java                   8141370 linux-i586,macosx-all
 
 ############################################################################
-
-# core_tools
-
-tools/jlink/JLinkOptimTest.java                                 8159264 generic-all
-
-############################################################################
--- a/jdk/test/TEST.groups	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/TEST.groups	Fri Aug 05 12:03:58 2016 -0700
@@ -27,7 +27,6 @@
 
 tier1 = \
     :jdk_lang \
-    -java/lang/ProcessBuilder/Zombies.java \
     :jdk_util \
     -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
@@ -38,7 +37,6 @@
     tools/pack200
 
 tier2 = \
-    java/lang/ProcessBuilder/Zombies.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     :jdk_io \
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java	Fri Aug 05 12:03:58 2016 -0700
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @bug 6474073
+ * @run main/othervm Zombies
+ * @bug 6474073 6180151
  * @key intermittent
  * @summary Make sure zombies don't get created on Unix
  * @author Martin Buchholz
@@ -65,22 +66,21 @@
 
         Process p = rt.exec(TrueCommand);
         ProcessHandle pp = p.toHandle().parent().orElse(null);
-        System.out.printf("pid: %d, parent: %s%n", p.getPid(), pp);
+        System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
         p.waitFor();
 
         // Count all the zombies that are children of this Java process
         final String[] zombieCounter = {
             "/usr/bin/perl", "-e",
-            "exit @{[`/bin/ps -eo ppid,s` =~ /^ *@{[getppid]} +Z$/mog]}"
+                "$a=`/bin/ps -eo ppid,pid,s,command`;" +
+                        "print @b=$a=~/^ *@{[getppid]} +[0-9]+ +Z.*$/mog;" +
+                        "exit @b"
         };
 
-        int zombies = rt.exec(zombieCounter).waitFor();
+        ProcessBuilder pb = new ProcessBuilder(zombieCounter);
+        pb.inheritIO();
+        int zombies = pb.start().waitFor();
         if (zombies != 0) {
-            // Log remaining processes
-            ProcessBuilder pb = new ProcessBuilder("/bin/ps", "-ef");
-            pb.inheritIO();
-            Process p2 = pb.start();
-            p2.waitFor();
             throw new Error(zombies + " zombies!");
         }
     }
--- a/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, 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
@@ -25,7 +25,6 @@
  * @test
  * @bug 4369826 8078582
  * @summary Process with lots of output should not crash VM
- * @key intermittent
  * @author kladko
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/AnnotationToStringTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8162817
+ * @summary Test of toString on normal annotations
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * The expected string values are stored in @ExpectedString
+ * annotations. The essence of the test is comparing the toString()
+ * result of annotations to the corresponding ExpectedString.value().
+ */
+
+public class AnnotationToStringTest {
+    public static void main(String... args) throws Exception {
+        int failures = 0;
+
+        failures += check(PrimHost.class.getAnnotation(ExpectedString.class).value(),
+                          PrimHost.class.getAnnotation(MostlyPrimitive.class).toString());
+        failures += classyTest();
+        failures += arrayAnnotationTest();
+
+        if (failures > 0)
+            throw new RuntimeException(failures + " failures");
+    }
+
+    private static int check(String expected, String actual) {
+        if (!expected.equals(actual)) {
+            System.err.printf("ERROR: Expected ''%s'';%ngot             ''%s''.\n",
+                              expected, actual);
+            return 1;
+        } else
+            return 0;
+    }
+
+    @ExpectedString(
+        "@MostlyPrimitive(c0='a', "+
+        "c1='\\'', " +
+        "i0=1, " +
+        "i1=2, " +
+        "f0=1.0f, " +
+        "f1=0.0f/0.0f, " +
+        "d0=0.0, " +
+        "d1=1.0/0.0, " +
+        "l0=5, " +
+        "l1=9223372036854775807L, " +
+        "s0=\"Hello world.\", " +
+        "s1=\"a\\\"b\", " +
+        "class0=Obj[].class)")
+    @MostlyPrimitive(
+        c0='a',
+        c1='\'',
+        i0=1,
+        i1=2,
+        f0=1.0f,
+        f1=Float.NaN,
+        d0=0.0,
+        d1=2.0/0.0,
+        l0=5,
+        l1=Long.MAX_VALUE,
+        s0="Hello world.",
+        s1="a\"b",
+        class0=Obj[].class
+    )
+    static class PrimHost{}
+
+    private static int classyTest() {
+        int failures = 0;
+        for (Field f : AnnotationHost.class.getFields()) {
+            Annotation a = f.getAnnotation(Classy.class);
+            System.out.println(a);
+            failures += check(f.getAnnotation(ExpectedString.class).value(),
+                              a.toString());
+        }
+        return failures;
+    }
+
+    static class AnnotationHost {
+        @ExpectedString(
+       "@Classy(value=Obj.class)")
+        @Classy(value=Obj.class)
+        public int f0;
+
+        @ExpectedString(
+       "@Classy(value=Obj[].class)")
+        @Classy(value=Obj[].class)
+        public int f1;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][].class)")
+        @Classy(value=Obj[][].class)
+        public int f2;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][][].class)")
+        @Classy(value=Obj[][][].class)
+        public int f3;
+
+        @ExpectedString(
+       "@Classy(value=int.class)")
+        @Classy(value=int.class)
+        public int f4;
+
+        @ExpectedString(
+       "@Classy(value=int[][][].class)")
+        @Classy(value=int[][][].class)
+        public int f5;
+    }
+
+    /**
+     * Each field should have two annotations, the first being
+     * @ExpectedString and the second the annotation under test.
+     */
+    private static int arrayAnnotationTest() {
+        int failures = 0;
+        for (Field f : ArrayAnnotationHost.class.getFields()) {
+            Annotation[] annotations = f.getAnnotations();
+            System.out.println(annotations[1]);
+            failures += check(((ExpectedString)annotations[0]).value(),
+                              annotations[1].toString());
+        }
+        return failures;
+    }
+
+    static class ArrayAnnotationHost {
+        @ExpectedString(
+       "@BooleanArray(value={true, false, true})")
+        @BooleanArray(value={true, false, true})
+        public boolean[]   f0;
+
+        @ExpectedString(
+       "@FloatArray(value={3.0f, 4.0f, 0.0f/0.0f, -1.0f/0.0f, 1.0f/0.0f})")
+        @FloatArray(value={3.0f, 4.0f, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY})
+        public float[]     f1;
+
+        @ExpectedString(
+       "@DoubleArray(value={1.0, 2.0, 0.0/0.0, 1.0/0.0, -1.0/0.0})")
+        @DoubleArray(value={1.0, 2.0, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,})
+        public double[]    f2;
+
+        @ExpectedString(
+       "@ByteArray(value={10, 11, 12})")
+        @ByteArray(value={10, 11, 12})
+        public byte[]      f3;
+
+        @ExpectedString(
+       "@ShortArray(value={0, 4, 5})")
+        @ShortArray(value={0, 4, 5})
+        public short[]     f4;
+
+        @ExpectedString(
+       "@CharArray(value={'a', 'b', 'c', '\\''})")
+        @CharArray(value={'a', 'b', 'c', '\''})
+        public char[]      f5;
+
+        @ExpectedString(
+       "@IntArray(value={1})")
+        @IntArray(value={1})
+        public int[]       f6;
+
+        @ExpectedString(
+       "@LongArray(value={-2147483647, 2147483648L, 9223372036854775807L})")
+        @LongArray(value={-Integer.MAX_VALUE, Integer.MAX_VALUE+1L, Long.MAX_VALUE})
+        public long[]      f7;
+
+        @ExpectedString(
+       "@StringArray(value={\"A\", \"B\", \"C\", \"\\\"Quote\\\"\"})")
+        @StringArray(value={"A", "B", "C", "\"Quote\""})
+        public String[]    f8;
+
+        @ExpectedString(
+       "@ClassArray(value={int.class, Obj[].class})")
+        @ClassArray(value={int.class, Obj[].class})
+        public Class<?>[]  f9;
+
+        @ExpectedString(
+       "@EnumArray(value={SOURCE})")
+        @EnumArray(value={RetentionPolicy.SOURCE})
+        public RetentionPolicy[]  f10;
+    }
+}
+
+// ------------ Supporting types ------------
+
+class Obj {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedString {
+    String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Classy {
+    Class<?> value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface BooleanArray {
+    boolean[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface FloatArray {
+    float[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface DoubleArray {
+    double[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ByteArray {
+    byte[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ShortArray {
+    short[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface CharArray {
+    char[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface IntArray {
+    int[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface LongArray {
+    long[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ClassArray {
+    Class<?>[] value() default {int.class, Obj[].class};
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface StringArray {
+    String[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface EnumArray {
+    RetentionPolicy[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MostlyPrimitive {
+    char   c0();
+    char   c1();
+    int    i0();
+    int    i1();
+    float  f0();
+    float  f1();
+    double d0();
+    double d1();
+    long   l0();
+    long   l1();
+    String s0();
+    String s1();
+    Class<?> class0();
+}
--- a/jdk/test/java/lang/annotation/ParameterAnnotations.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/java/lang/annotation/ParameterAnnotations.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6761678
+ * @bug 6761678 8162817
  * @summary Check properties of Annotations returned from
  * getParameterAnnotations, including freedom from security
  * exceptions.
@@ -89,8 +89,8 @@
                 equal(ann.length, 2);
                 Annotation foo = ann[0][0];
                 Annotation bar = ann[1][0];
-                equal(foo.toString(), "@Named(value=foo)");
-                equal(bar.toString(), "@Named(value=bar)");
+                equal(foo.toString(), "@Named(value=\"foo\")");
+                equal(bar.toString(), "@Named(value=\"bar\")");
                 check(foo.equals(foo));
                 check(! foo.equals(bar));
             }
--- a/jdk/test/java/nio/file/WatchService/DeleteInterference.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/java/nio/file/WatchService/DeleteInterference.java	Fri Aug 05 12:03:58 2016 -0700
@@ -38,6 +38,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import static java.lang.System.out;
 import static java.nio.file.StandardWatchEventKinds.*;
 
 public class DeleteInterference {
@@ -66,22 +67,28 @@
     private static void openAndCloseWatcher(Path dir) {
         FileSystem fs = FileSystems.getDefault();
         for (int i = 0; i < ITERATIONS_COUNT; i++) {
+            out.printf("open %d begin%n", i);
             try (WatchService watcher = fs.newWatchService()) {
                 dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
             } catch (IOException ioe) {
                 // ignore
+            } finally {
+                out.printf("open %d end%n", i);
             }
         }
     }
 
     private static void deleteAndRecreateDirectory(Path dir) {
         for (int i = 0; i < ITERATIONS_COUNT; i++) {
+            out.printf("del %d begin%n", i);
             try {
                 deleteFileTree(dir);
                 Path subdir = Files.createDirectories(dir.resolve("subdir"));
                 Files.createFile(subdir.resolve("test"));
             } catch (IOException ioe) {
                 // ignore
+            } finally {
+                out.printf("del %d end%n", i);
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Locale/Bug8035133.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8035133
+ * @summary Checks that the tags matching the range with quality weight q=0
+ *          e.g. en;q=0 must be elimited and must not be the part of output
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+
+public class Bug8035133 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+
+        // checking Locale.lookup with de-ch;q=0
+        checkLookup("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH");
+
+        /* checking Locale.lookup with *;q=0 '*' should be ignored
+         * in lookup
+         */
+        checkLookup("en;q=0.1, *-ch;q=0.5, *;q=0",
+                "de-ch, en, fr-ch", "de-CH");
+
+        // checking Locale.filter with fr-ch;q=0 in BASIC_FILTERING
+        checkFilter("en;q=0.1, fr-ch;q=0.0, de-ch;q=0.5",
+                "de-ch, en, fr-ch", "de-CH, en");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, *;q=0", "de-ch, fr-ch", "");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, de;q=0", "de-ch", "");
+
+        // checking Locale.filter with *;q=0.6, en;q=0 in BASIC_FILTERING
+        checkFilter("*;q=0.6, en;q=0", "de-ch, hi-in, en", "de-CH, hi-IN");
+
+        // checking Locale.filter with de-ch;q=0 in EXTENDED_FILTERING
+        checkFilter("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH, en");
+
+        /* checking Locale.filter with *-ch;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("de-ch;q=0.5, *-ch;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("*-ch;q=0.5, *;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0.6, *-Latn;q=0 in
+         * EXTENDED_FILTERING
+         */
+        checkFilter("*;q=0.6, *-Latn;q=0", "de-ch, hi-in, en-Latn",
+                "de-CH, hi-IN");
+
+        if (err) {
+            throw new RuntimeException("[LocaleMatcher method(s) failed]");
+        }
+
+    }
+
+    private static void checkLookup(String ranges, String tags,
+            String expectedLocale) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        Locale loc = Locale.lookup(priorityList, localeList);
+        String actualLocale
+                = loc.toLanguageTag();
+
+        if (!actualLocale.equals(expectedLocale)) {
+            System.err.println("Locale.lookup failed with ranges: " + ranges
+                    + " Expected: " + expectedLocale
+                    + " Actual: " + actualLocale);
+            err = true;
+        }
+
+    }
+
+    private static void checkFilter(String ranges, String tags,
+            String expectedLocales) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        String actualLocales = getLocalesAsString(
+                Locale.filter(priorityList, localeList));
+
+        if (!actualLocales.equals(expectedLocales)) {
+            System.err.println("Locale.filter failed with ranges: " + ranges
+                    + " Expected: " + expectedLocales
+                    + " Actual: " + actualLocales);
+            err = true;
+        }
+
+    }
+
+    private static List<Locale> generateLocales(String tags) {
+        if (tags == null) {
+            return null;
+        }
+
+        List<Locale> localeList = new ArrayList<>();
+        if (tags.equals("")) {
+            return localeList;
+        }
+        String[] t = tags.split(", ");
+        for (String tag : t) {
+            localeList.add(Locale.forLanguageTag(tag));
+        }
+        return localeList;
+    }
+
+    private static String getLocalesAsString(List<Locale> locales) {
+        StringBuilder sb = new StringBuilder();
+
+        Iterator<Locale> itr = locales.iterator();
+        if (itr.hasNext()) {
+            sb.append(itr.next().toLanguageTag());
+        }
+        while (itr.hasNext()) {
+            sb.append(", ");
+            sb.append(itr.next().toLanguageTag());
+        }
+
+        return sb.toString().trim();
+    }
+
+}
--- a/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -26,6 +26,7 @@
  * @bug 8068721
  * @summary test RMI-IIOP call with ConcurrentHashMap as an argument
  * @library /lib/testlibrary
+ * @modules java.corba
  * @build jdk.testlibrary.*
  * @compile -addmods java.corba Test.java HelloInterface.java HelloServer.java HelloClient.java
  *    HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java ConcurrentHashMapTest.java
--- a/jdk/test/javax/transaction/testng/Driver.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/javax/transaction/testng/Driver.java	Fri Aug 05 12:03:58 2016 -0700
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @modules java.sql java.transaction
  * @compile -addmods java.transaction
  *   test/transaction/InvalidTransactionExceptionTests.java
  *   test/transaction/TransactionRequiredExceptionTests.java
--- a/jdk/test/javax/xml/soap/spi/SAAJFactoryTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/javax/xml/soap/spi/SAAJFactoryTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -49,6 +49,7 @@
  * run main/othervm SAAJFactoryTest saaj.factory.Valid -
  *      scenario14 javax.xml.soap.MessageFactory=saaj.factory.Valid saaj.factory.Valid2 -
  *
+ * @modules java.xml.ws
  * @compile -addmods java.xml.ws saaj/factory/Invalid.java saaj/factory/Valid.java
  *     saaj/factory/Valid2.java saaj/factory/Valid3.java SAAJFactoryTest.java
  *
--- a/jdk/test/javax/xml/ws/8043129/MailTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/javax/xml/ws/8043129/MailTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary JAF initialisation in SAAJ clashing with the one in javax.mail
  * @author mkos
  * @library javax.mail.jar
+ * @modules java.xml.ws
  * @compile -addmods java.xml.ws MailTest.java
  * @run main/othervm -addmods java.xml.ws MailTest
  */
--- a/jdk/test/javax/xml/ws/publish/WSTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/javax/xml/ws/publish/WSTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -25,6 +25,7 @@
  * @test
  * @bug 8146086
  * @summary Publishing two webservices on same port fails with "java.net.BindException: Address already in use"
+ * @modules java.xml.ws
  * @compile -addmods java.xml.ws WSTest.java
  * @run main/othervm -addmods java.xml.ws WSTest
  */
--- a/jdk/test/javax/xml/ws/xsanymixed/Test.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/javax/xml/ws/xsanymixed/Test.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -26,6 +26,7 @@
  * @bug 8036981 8038966 8051441
  * @summary the content of xs:any content:mixed should remain as is,
  *          no white space changes and no changes to namespace prefixes
+ * @modules java.xml.ws
  * @run shell compile-wsdl.sh
  * @compile -addmods java.xml.ws Test.java
  * @run main/othervm -addmods java.xml.ws Test
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Fri Aug 05 12:03:58 2016 -0700
@@ -32,7 +32,7 @@
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  *                                                   sm TestKeyPairGenerator.policy
- * @key intermittent randomness
+ * @key randomness
  */
 
 import java.math.BigInteger;
--- a/jdk/test/tools/jlink/IntegrationTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/tools/jlink/IntegrationTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -22,6 +22,7 @@
  */
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.nio.file.Files;
@@ -33,6 +34,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.Jlink;
@@ -203,6 +205,27 @@
             throw new AssertionError("release not generated");
         }
 
+        Properties props = new Properties();
+        try (FileReader reader = new FileReader(release)) {
+            props.load(reader);
+        }
+
+        if (props.getProperty("JAVA_VERSION") == null) {
+            throw new AssertionError("release file does not contain JAVA_VERSION");
+        }
+
+        if (props.getProperty("OS_NAME") == null) {
+            throw new AssertionError("release file does not contain OS_NAME");
+        }
+
+        if (props.getProperty("OS_ARCH") == null) {
+            throw new AssertionError("release file does not contain OS_ARCH");
+        }
+
+        if (props.getProperty("OS_VERSION") == null) {
+            throw new AssertionError("release file does not contain OS_VERSION");
+        }
+
         if (!Files.exists(output.resolve("toto.txt"))) {
             throw new AssertionError("Post processing not called");
         }
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -30,6 +30,9 @@
  * @run main ExcludeVMPluginTest
  */
 import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
 import jdk.tools.jlink.internal.ResourcePoolManager;
@@ -167,6 +170,13 @@
         poolMgr.add(
             ResourcePoolEntry.create("/java.base/native/jvm.cfg",
                 ResourcePoolEntry.Type.NATIVE_LIB, jvmcfgContent));
+
+        // java.base/module-info.class is used by exclude vm plugin
+        // to get current osName(). We read it from jrt-fs and add a
+        // ResourcePoolEntry
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/module-info.class",
+                ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
         for (String in : input) {
             poolMgr.add(ResourcePoolEntry.create(in,
                     ResourcePoolEntry.Type.NATIVE_LIB, new byte[0]));
@@ -187,15 +197,19 @@
             throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
         }
 
-        if (out.entryCount() != (expectedOutput.length + 1)) {
+        // Apart from native resources, we should find jvm.cfg and
+        // java.base/module-info.class. So, we add 2 here to the
+        // expected count!
+        if (out.entryCount() != (expectedOutput.length + 2)) {
             out.entries().forEach(m -> {
                 System.err.println(m.path());
             });
-            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 1));
+            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 2));
         }
 
         out.entries().forEach(md -> {
-            if (md.path().equals("/java.base/native/jvm.cfg")) {
+            if (md.path().equals("/java.base/native/jvm.cfg") ||
+                md.path().equals("/java.base/module-info.class")) {
                 return;
             }
             boolean contained = false;
@@ -209,7 +223,11 @@
                 throw new RuntimeException(md.path() + " not expected");
             }
         });
+    }
 
+    // read java.base/module-info.class from jrt-fs
+    private static Path getJavaBaseModuleInfo() {
+        return Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
     }
 
     private static boolean isWindows() {
--- a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -32,8 +32,10 @@
  */
 
 import java.io.File;
+import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -41,6 +43,7 @@
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePool;
 
@@ -86,6 +89,12 @@
         conf.put(FileCopierPlugin.NAME, builder.toString());
         plug.configure(conf);
         ResourcePoolManager poolMgr = new ResourcePoolManager();
+        // java.base/module-info.class is used to add "release" file
+        // We read it from jrt-fs and add a ResourcePoolEntry
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/module-info.class",
+                ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
+        expected++;
         ResourcePool pool = plug.transform(
                 new ResourcePoolManager().resourcePool(),
                 poolMgr.resourcePoolBuilder());
@@ -93,7 +102,8 @@
             throw new AssertionError("Wrong number of added files");
         }
         pool.entries().forEach(f -> {
-            if (!f.type().equals(ResourcePoolEntry.Type.OTHER)) {
+            if (!f.type().equals(ResourcePoolEntry.Type.OTHER) &&
+                !f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
                 throw new AssertionError("Invalid type " + f.type()
                         + " for file " + f.path());
             }
@@ -145,4 +155,9 @@
             throw new AssertionError("Invalid Content in src2 dir");
         }
     }
+
+    // read java.base/module-info.class from jrt-fs
+    private static Path getJavaBaseModuleInfo() {
+        return Paths.get(URI.create("jrt:/modules/java.base/module-info.class"));
+    }
 }
--- a/langtools/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -371,3 +371,4 @@
 ea4eea2997b9e2f26cd7965839921710ff4065c8 jdk-9+126
 a42768b48cb0c5af9063e12093975baeeca3b5fa jdk-9+127
 2764986661b6d339ba73af52d69d3506ce12e648 jdk-9+128
+e181909291981038b041ed4d22714c4760e049cd jdk-9+129
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Aug 05 12:03:58 2016 -0700
@@ -55,7 +55,9 @@
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.jvm.*;
+import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
+import com.sun.tools.javac.tree.JCTree.Tag;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.Name;
@@ -64,9 +66,15 @@
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+import static com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode.FIRSTASGOP;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.FORALL;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
+import static com.sun.tools.javac.jvm.ByteCodes.iadd;
+import static com.sun.tools.javac.jvm.ByteCodes.ishll;
+import static com.sun.tools.javac.jvm.ByteCodes.lushrl;
+import static com.sun.tools.javac.jvm.ByteCodes.lxor;
+import static com.sun.tools.javac.jvm.ByteCodes.string_add;
 
 /** Root class for Java symbols. It contains subclasses
  *  for specific sorts of symbols, such as variables, methods and operators,
@@ -1950,15 +1958,90 @@
     public static class OperatorSymbol extends MethodSymbol {
 
         public int opcode;
+        private int accessCode = Integer.MIN_VALUE;
 
         public OperatorSymbol(Name name, Type type, int opcode, Symbol owner) {
             super(PUBLIC | STATIC, name, type, owner);
             this.opcode = opcode;
         }
 
+        @Override
         public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
             return v.visitOperatorSymbol(this, p);
         }
+
+        public int getAccessCode(Tag tag) {
+            if (accessCode != Integer.MIN_VALUE && !tag.isIncOrDecUnaryOp()) {
+                return accessCode;
+            }
+            accessCode = AccessCode.from(tag, opcode);
+            return accessCode;
+        }
+
+        /** Access codes for dereferencing, assignment,
+         *  and pre/post increment/decrement.
+
+         *  All access codes for accesses to the current class are even.
+         *  If a member of the superclass should be accessed instead (because
+         *  access was via a qualified super), add one to the corresponding code
+         *  for the current class, making the number odd.
+         *  This numbering scheme is used by the backend to decide whether
+         *  to issue an invokevirtual or invokespecial call.
+         *
+         *  @see Gen#visitSelect(JCFieldAccess tree)
+         */
+        public enum AccessCode {
+            UNKNOWN(-1, Tag.NO_TAG),
+            DEREF(0, Tag.NO_TAG),
+            ASSIGN(2, Tag.ASSIGN),
+            PREINC(4, Tag.PREINC),
+            PREDEC(6, Tag.PREDEC),
+            POSTINC(8, Tag.POSTINC),
+            POSTDEC(10, Tag.POSTDEC),
+            FIRSTASGOP(12, Tag.NO_TAG);
+
+            public final int code;
+            public final Tag tag;
+            public static final int numberOfAccessCodes = (lushrl - ishll + lxor + 2 - iadd) * 2 + FIRSTASGOP.code + 2;
+
+            AccessCode(int code, Tag tag) {
+                this.code = code;
+                this.tag = tag;
+            }
+
+            static public AccessCode getFromCode(int code) {
+                for (AccessCode aCodes : AccessCode.values()) {
+                    if (aCodes.code == code) {
+                        return aCodes;
+                    }
+                }
+                return UNKNOWN;
+            }
+
+            static int from(Tag tag, int opcode) {
+                /** Map bytecode of binary operation to access code of corresponding
+                *  assignment operation. This is always an even number.
+                */
+                switch (tag) {
+                    case PREINC:
+                        return AccessCode.PREINC.code;
+                    case PREDEC:
+                        return AccessCode.PREDEC.code;
+                    case POSTINC:
+                        return AccessCode.POSTINC.code;
+                    case POSTDEC:
+                        return AccessCode.POSTDEC.code;
+                }
+                if (iadd <= opcode && opcode <= lxor) {
+                    return (opcode - iadd) * 2 + FIRSTASGOP.code;
+                } else if (opcode == string_add) {
+                    return (lxor + 1 - iadd) * 2 + FIRSTASGOP.code;
+                } else if (ishll <= opcode && opcode <= lushrl) {
+                    return (opcode - ishll + lxor + 2 - iadd) * 2 + FIRSTASGOP.code;
+                }
+                return -1;
+            }
+        }
     }
 
     /** Symbol completer interface.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Aug 05 12:03:58 2016 -0700
@@ -3159,7 +3159,7 @@
         Type operand = attribExpr(tree.rhs, env);
         // Find operator.
         Symbol operator = tree.operator = operators.resolveBinary(tree, tree.getTag().noAssignOp(), owntype, operand);
-        if (operator.kind == MTH &&
+        if (operator != operators.noOpSymbol &&
                 !owntype.isErroneous() &&
                 !operand.isErroneous()) {
             chk.checkDivZero(tree.rhs.pos(), operator, operand);
@@ -3179,7 +3179,7 @@
         // Find operator.
         Symbol operator = tree.operator = operators.resolveUnary(tree, tree.getTag(), argtype);
         Type owntype = types.createErrorType(tree.type);
-        if (operator.kind == MTH &&
+        if (operator != operators.noOpSymbol &&
                 !argtype.isErroneous()) {
             owntype = (tree.getTag().isIncOrDecUnaryOp())
                 ? tree.arg.type
@@ -3204,7 +3204,7 @@
         // Find operator.
         Symbol operator = tree.operator = operators.resolveBinary(tree, tree.getTag(), left, right);
         Type owntype = types.createErrorType(tree.type);
-        if (operator.kind == MTH &&
+        if (operator != operators.noOpSymbol &&
                 !left.isErroneous() &&
                 !right.isErroneous()) {
             owntype = operator.type.getReturnType();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Aug 05 12:03:58 2016 -0700
@@ -38,6 +38,7 @@
 import com.sun.tools.javac.util.List;
 
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.code.Type.*;
 
@@ -49,6 +50,7 @@
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
+import static com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode.DEREF;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
@@ -816,33 +818,6 @@
  * Access methods
  *************************************************************************/
 
-    /** Access codes for dereferencing, assignment,
-     *  and pre/post increment/decrement.
-     *  Access codes for assignment operations are determined by method accessCode
-     *  below.
-     *
-     *  All access codes for accesses to the current class are even.
-     *  If a member of the superclass should be accessed instead (because
-     *  access was via a qualified super), add one to the corresponding code
-     *  for the current class, making the number odd.
-     *  This numbering scheme is used by the backend to decide whether
-     *  to issue an invokevirtual or invokespecial call.
-     *
-     *  @see Gen#visitSelect(JCFieldAccess tree)
-     */
-    private static final int
-        DEREFcode = 0,
-        ASSIGNcode = 2,
-        PREINCcode = 4,
-        PREDECcode = 6,
-        POSTINCcode = 8,
-        POSTDECcode = 10,
-        FIRSTASGOPcode = 12;
-
-    /** Number of access codes
-     */
-    private static final int NCODES = accessCode(ByteCodes.lushrl) + 2;
-
     /** A mapping from symbols to their access numbers.
      */
     private Map<Symbol,Integer> accessNums;
@@ -864,20 +839,6 @@
      */
     private ListBuffer<Symbol> accessed;
 
-    /** Map bytecode of binary operation to access code of corresponding
-     *  assignment operation. This is always an even number.
-     */
-    private static int accessCode(int bytecode) {
-        if (ByteCodes.iadd <= bytecode && bytecode <= ByteCodes.lxor)
-            return (bytecode - iadd) * 2 + FIRSTASGOPcode;
-        else if (bytecode == ByteCodes.string_add)
-            return (ByteCodes.lxor + 1 - iadd) * 2 + FIRSTASGOPcode;
-        else if (ByteCodes.ishll <= bytecode && bytecode <= ByteCodes.lushrl)
-            return (bytecode - ishll + ByteCodes.lxor + 2 - iadd) * 2 + FIRSTASGOPcode;
-        else
-            return -1;
-    }
-
     /** return access code for identifier,
      *  @param tree     The tree representing the identifier use.
      *  @param enclOp   The closest enclosing operation node of tree,
@@ -885,24 +846,24 @@
      */
     private static int accessCode(JCTree tree, JCTree enclOp) {
         if (enclOp == null)
-            return DEREFcode;
+            return AccessCode.DEREF.code;
         else if (enclOp.hasTag(ASSIGN) &&
                  tree == TreeInfo.skipParens(((JCAssign) enclOp).lhs))
-            return ASSIGNcode;
+            return AccessCode.ASSIGN.code;
         else if (enclOp.getTag().isIncOrDecUnaryOp() &&
                  tree == TreeInfo.skipParens(((JCUnary) enclOp).arg))
-            return mapTagToUnaryOpCode(enclOp.getTag());
+            return (((JCUnary) enclOp).operator).getAccessCode(enclOp.getTag());
         else if (enclOp.getTag().isAssignop() &&
                  tree == TreeInfo.skipParens(((JCAssignOp) enclOp).lhs))
-            return accessCode(((OperatorSymbol) ((JCAssignOp) enclOp).operator).opcode);
+            return (((JCAssignOp) enclOp).operator).getAccessCode(enclOp.getTag());
         else
-            return DEREFcode;
+            return AccessCode.DEREF.code;
     }
 
     /** Return binary operator that corresponds to given access code.
      */
-    private OperatorSymbol binaryAccessOperator(int acode) {
-        return (OperatorSymbol)operators.lookupBinaryOp(sym -> accessCode(((OperatorSymbol)sym).opcode) == acode);
+    private OperatorSymbol binaryAccessOperator(int acode, Tag tag) {
+        return operators.lookupBinaryOp(op -> op.getAccessCode(tag) == acode);
     }
 
     /** Return tree tag for assignment operation corresponding
@@ -984,7 +945,7 @@
         if (anum == null) {
             anum = accessed.length();
             accessNums.put(vsym, anum);
-            accessSyms.put(vsym, new MethodSymbol[NCODES]);
+            accessSyms.put(vsym, new MethodSymbol[AccessCode.numberOfAccessCodes]);
             accessed.append(vsym);
             // System.out.println("accessing " + vsym + " in " + vsym.location());
         }
@@ -996,13 +957,13 @@
         switch (vsym.kind) {
         case VAR:
             acode = accessCode(tree, enclOp);
-            if (acode >= FIRSTASGOPcode) {
-                OperatorSymbol operator = binaryAccessOperator(acode);
+            if (acode >= AccessCode.FIRSTASGOP.code) {
+                OperatorSymbol operator = binaryAccessOperator(acode, enclOp.getTag());
                 if (operator.opcode == string_add)
                     argtypes = List.of(syms.objectType);
                 else
                     argtypes = operator.type.getParameterTypes().tail;
-            } else if (acode == ASSIGNcode)
+            } else if (acode == AccessCode.ASSIGN.code)
                 argtypes = List.of(vsym.erasure(types));
             else
                 argtypes = List.nil();
@@ -1010,7 +971,7 @@
             thrown = List.nil();
             break;
         case MTH:
-            acode = DEREFcode;
+            acode = AccessCode.DEREF.code;
             argtypes = vsym.erasure(types).getParameterTypes();
             restype = vsym.erasure(types).getReturnType();
             thrown = vsym.type.getThrownTypes();
@@ -1306,7 +1267,7 @@
                 accessConstructorDef(cdef.pos, sym, accessConstrs.get(sym)));
         } else {
             MethodSymbol[] accessors = accessSyms.get(sym);
-            for (int i = 0; i < NCODES; i++) {
+            for (int i = 0; i < AccessCode.numberOfAccessCodes; i++) {
                 if (accessors[i] != null)
                     cdef.defs = cdef.defs.prepend(
                         accessDef(cdef.pos, sym, accessors[i], i));
@@ -1314,42 +1275,6 @@
         }
     }
 
-    /** Maps unary operator integer codes to JCTree.Tag objects
-     *  @param unaryOpCode the unary operator code
-     */
-    private static Tag mapUnaryOpCodeToTag(int unaryOpCode){
-        switch (unaryOpCode){
-            case PREINCcode:
-                return PREINC;
-            case PREDECcode:
-                return PREDEC;
-            case POSTINCcode:
-                return POSTINC;
-            case POSTDECcode:
-                return POSTDEC;
-            default:
-                return NO_TAG;
-        }
-    }
-
-    /** Maps JCTree.Tag objects to unary operator integer codes
-     *  @param tag the JCTree.Tag
-     */
-    private static int mapTagToUnaryOpCode(Tag tag){
-        switch (tag){
-            case PREINC:
-                return PREINCcode;
-            case PREDEC:
-                return PREDECcode;
-            case POSTINC:
-                return POSTINCcode;
-            case POSTDEC:
-                return POSTDECcode;
-            default:
-                return -1;
-        }
-    }
-
     /** Construct definition of an access method.
      *  @param pos        The source code position of the definition.
      *  @param vsym       The private or protected symbol.
@@ -1388,20 +1313,21 @@
             int acode1 = acode - (acode & 1);
 
             JCExpression expr;      // The access method's return value.
-            switch (acode1) {
-            case DEREFcode:
+            AccessCode aCode = AccessCode.getFromCode(acode1);
+            switch (aCode) {
+            case DEREF:
                 expr = ref;
                 break;
-            case ASSIGNcode:
+            case ASSIGN:
                 expr = make.Assign(ref, args.head);
                 break;
-            case PREINCcode: case POSTINCcode: case PREDECcode: case POSTDECcode:
-                expr = makeUnary(mapUnaryOpCodeToTag(acode1), ref);
+            case PREINC: case POSTINC: case PREDEC: case POSTDEC:
+                expr = makeUnary(aCode.tag, ref);
                 break;
             default:
                 expr = make.Assignop(
-                    treeTag(binaryAccessOperator(acode1)), ref, args.head);
-                ((JCAssignOp) expr).operator = binaryAccessOperator(acode1);
+                    treeTag(binaryAccessOperator(acode1, JCTree.Tag.NO_TAG)), ref, args.head);
+                ((JCAssignOp) expr).operator = binaryAccessOperator(acode1, JCTree.Tag.NO_TAG);
             }
             stat = make.Return(expr.setType(sym.type));
         } else {
@@ -3275,7 +3201,7 @@
                         // tree.lhs.  However, we can still get the
                         // unerased type of tree.lhs as it is stored
                         // in tree.type in Attr.
-                        Symbol newOperator = operators.resolveBinary(tree,
+                        OperatorSymbol newOperator = operators.resolveBinary(tree,
                                                                       newTag,
                                                                       tree.type,
                                                                       tree.rhs.type);
@@ -3304,7 +3230,7 @@
             JCMethodInvocation app = (JCMethodInvocation)tree.lhs;
             // if operation is a += on strings,
             // make sure to convert argument to string
-            JCExpression rhs = (((OperatorSymbol)tree.operator).opcode == string_add)
+            JCExpression rhs = tree.operator.opcode == string_add
               ? makeString(tree.rhs)
               : tree.rhs;
             app.args = List.of(rhs).prependList(app.args);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Fri Aug 05 12:03:58 2016 -0700
@@ -38,6 +38,7 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.function.Consumer;
 import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -148,7 +149,7 @@
     private final String addModsOpt;
     private final String limitModsOpt;
 
-    private Set<ModuleSymbol> rootModules = Collections.emptySet();
+    private Set<ModuleSymbol> rootModules = null;
 
     public static Modules instance(Context context) {
         Modules instance = context.get(Modules.class);
@@ -194,7 +195,31 @@
         System.err.println(msg);
     }
 
+    boolean inInitModules;
+    public void initModules(List<JCCompilationUnit> trees, Collection<String> extraAddMods, Collection<String> extraLimitMods) {
+        Assert.check(!inInitModules);
+        try {
+            inInitModules = true;
+            Assert.checkNull(rootModules);
+            enter(trees, modules -> {
+                Assert.checkNull(rootModules);
+                Assert.checkNull(allModules);
+                this.rootModules = modules;
+                setupAllModules(extraAddMods, extraLimitMods); //initialize the module graph
+                Assert.checkNonNull(allModules);
+                inInitModules = false;
+            }, null);
+        } finally {
+            inInitModules = false;
+        }
+    }
+
     public boolean enter(List<JCCompilationUnit> trees, ClassSymbol c) {
+        Assert.check(rootModules != null || inInitModules || !allowModules);
+        return enter(trees, modules -> {}, c);
+    }
+
+    private boolean enter(List<JCCompilationUnit> trees, Consumer<Set<ModuleSymbol>> init, ClassSymbol c) {
         if (!allowModules) {
             for (JCCompilationUnit tree: trees) {
                 tree.modle = syms.noModule;
@@ -212,10 +237,7 @@
 
             setCompilationUnitModules(trees, roots);
 
-            if (!roots.isEmpty() && this.rootModules.isEmpty()) {
-                this.rootModules = roots;
-                allModules(); //ensure errors reported
-            }
+            init.accept(roots);
 
             for (ModuleSymbol msym: roots) {
                 msym.complete();
@@ -395,6 +417,7 @@
                 defaultModule.completer = sym -> completeModule((ModuleSymbol) sym);
             } else {
                 Assert.check(rootModules.isEmpty());
+                rootModules.add(defaultModule);
             }
 
             if (defaultModule != syms.unnamedModule) {
@@ -462,7 +485,7 @@
                 msym.requires = List.nil();
                 msym.uses = List.nil();
             } else if ((msym.flags_field & Flags.AUTOMATIC_MODULE) != 0) {
-                completeAutomaticModule(msym);
+                setupAutomaticModule(msym);
             } else {
                 msym.module_info.complete();
             }
@@ -485,7 +508,7 @@
         }
     };
 
-    private void completeAutomaticModule(ModuleSymbol msym) throws CompletionFailure {
+    private void setupAutomaticModule(ModuleSymbol msym) throws CompletionFailure {
         try {
             ListBuffer<Directive> directives = new ListBuffer<>();
             ListBuffer<ExportsDirective> exports = new ListBuffer<>();
@@ -501,28 +524,9 @@
                 }
             }
 
-            ListBuffer<RequiresDirective> requires = new ListBuffer<>();
-
-            //ensure all modules are found:
-            moduleFinder.findAllModules();
-
-            for (ModuleSymbol ms : allModules()) {
-                if (ms == syms.unnamedModule || ms == msym)
-                    continue;
-                Set<RequiresFlag> flags = (ms.flags_field & Flags.AUTOMATIC_MODULE) != 0 ?
-                        EnumSet.of(RequiresFlag.PUBLIC) : EnumSet.noneOf(RequiresFlag.class);
-                RequiresDirective d = new RequiresDirective(ms, flags);
-                directives.add(d);
-                requires.add(d);
-            }
-
-            RequiresDirective requiresUnnamed = new RequiresDirective(syms.unnamedModule);
-            directives.add(requiresUnnamed);
-            requires.add(requiresUnnamed);
-
             msym.exports = exports.toList();
             msym.provides = List.nil();
-            msym.requires = requires.toList();
+            msym.requires = List.nil();
             msym.uses = List.nil();
             msym.directives = directives.toList();
             msym.flags_field |= Flags.ACYCLIC;
@@ -531,6 +535,31 @@
         }
     }
 
+    private void completeAutomaticModule(ModuleSymbol msym) throws CompletionFailure {
+        ListBuffer<Directive> directives = new ListBuffer<>();
+
+        directives.addAll(msym.directives);
+
+        ListBuffer<RequiresDirective> requires = new ListBuffer<>();
+
+        for (ModuleSymbol ms : allModules()) {
+            if (ms == syms.unnamedModule || ms == msym)
+                continue;
+            Set<RequiresFlag> flags = (ms.flags_field & Flags.AUTOMATIC_MODULE) != 0 ?
+                    EnumSet.of(RequiresFlag.PUBLIC) : EnumSet.noneOf(RequiresFlag.class);
+            RequiresDirective d = new RequiresDirective(ms, flags);
+            directives.add(d);
+            requires.add(d);
+        }
+
+        RequiresDirective requiresUnnamed = new RequiresDirective(syms.unnamedModule);
+        directives.add(requiresUnnamed);
+        requires.add(requiresUnnamed);
+
+        msym.requires = requires.toList();
+        msym.directives = directives.toList();
+    }
+
     private Completer getSourceCompleter(JCCompilationUnit tree) {
         return new Completer() {
             @Override
@@ -541,8 +570,8 @@
                 JavaFileObject prev = log.useSource(tree.sourcefile);
                 try {
                     tree.defs.head.accept(v);
+                    checkCyclicDependencies((JCModuleDecl) tree.defs.head);
                     completeModule(msym);
-                    checkCyclicDependencies((JCModuleDecl) tree.defs.head);
                 } finally {
                     log.useSource(prev);
                     msym.flags_field &= ~UNATTRIBUTED;
@@ -660,6 +689,9 @@
     public Completer getUsesProvidesCompleter() {
         return sym -> {
             ModuleSymbol msym = (ModuleSymbol) sym;
+
+            msym.complete();
+
             Env<AttrContext> env = typeEnvs.get(msym);
             UsesProvidesVisitor v = new UsesProvidesVisitor(msym, env);
             JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
@@ -757,7 +789,9 @@
 
         @Override
         public void visitRequires(JCRequires tree) {
-            msym.directives = msym.directives.prepend(tree.directive);
+            if (tree.directive != null) {
+                msym.directives = msym.directives.prepend(tree.directive);
+            }
         }
 
         @Override
@@ -821,19 +855,29 @@
         }
     }
 
-    private Set<ModuleSymbol> allModulesCache;
+    private Set<ModuleSymbol> allModules;
 
-    private Set<ModuleSymbol> allModules() {
-        if (allModulesCache != null)
-            return allModulesCache;
+    public Set<ModuleSymbol> allModules() {
+        Assert.checkNonNull(allModules);
+        return allModules;
+    }
+
+    private void setupAllModules(Collection<String> extraAddMods, Collection<String> extraLimitMods) {
+        Assert.checkNonNull(rootModules);
+        Assert.checkNull(allModules);
 
         Set<ModuleSymbol> observable;
 
-        if (limitModsOpt == null) {
+        if (limitModsOpt == null && extraLimitMods.isEmpty()) {
             observable = null;
         } else {
             Set<ModuleSymbol> limitMods = new HashSet<>();
-            for (String limit : limitModsOpt.split(",")) {
+            if (limitModsOpt != null) {
+                for (String limit : limitModsOpt.split(",")) {
+                    limitMods.add(syms.enterModule(names.fromString(limit)));
+                }
+            }
+            for (String limit : extraLimitMods) {
                 limitMods.add(syms.enterModule(names.fromString(limit)));
             }
             observable = computeTransitiveClosure(limitMods, null);
@@ -868,8 +912,15 @@
 
         enabledRoot.addAll(rootModules);
 
-        if (addModsOpt != null) {
-            for (String added : addModsOpt.split(",")) {
+        if (addModsOpt != null || !extraAddMods.isEmpty()) {
+            Set<String> fullAddMods = new HashSet<>();
+            fullAddMods.addAll(extraAddMods);
+
+            if (addModsOpt != null) {
+                fullAddMods.addAll(Arrays.asList(addModsOpt.split(",")));
+            }
+
+            for (String added : fullAddMods) {
                 Stream<ModuleSymbol> modules;
                 switch (added) {
                     case ALL_SYSTEM:
@@ -898,20 +949,7 @@
 
         result.add(syms.unnamedModule);
 
-        if (!rootModules.isEmpty())
-            allModulesCache = result;
-
-        return result;
-    }
-
-    public void enableAllModules() {
-        allModulesCache = new HashSet<>();
-
-        moduleFinder.findAllModules();
-
-        for (ModuleSymbol msym : syms.getAllModules()) {
-            allModulesCache.add(msym);
-        }
+        allModules = result;
     }
 
     private Set<ModuleSymbol> computeTransitiveClosure(Iterable<? extends ModuleSymbol> base, Set<ModuleSymbol> observable) {
@@ -973,6 +1011,15 @@
     private final Map<ModuleSymbol, Set<ModuleSymbol>> requiresPublicCache = new HashMap<>();
 
     private void completeModule(ModuleSymbol msym) {
+        if (inInitModules) {
+            msym.completer = sym -> completeModule(msym);
+            return ;
+        }
+
+        if ((msym.flags_field & Flags.AUTOMATIC_MODULE) != 0) {
+            completeAutomaticModule(msym);
+        }
+
         Assert.checkNonNull(msym.requires);
 
         initAddReads();
@@ -1214,9 +1261,9 @@
 
     private void checkCyclicDependencies(JCModuleDecl mod) {
         for (JCDirective d : mod.directives) {
-            if (!d.hasTag(Tag.REQUIRES))
+            JCRequires rd;
+            if (!d.hasTag(Tag.REQUIRES) || (rd = (JCRequires) d).directive == null)
                 continue;
-            JCRequires rd = (JCRequires) d;
             Set<ModuleSymbol> nonSyntheticDeps = new HashSet<>();
             List<ModuleSymbol> queue = List.of(rd.directive.module);
             while (queue.nonEmpty()) {
@@ -1224,9 +1271,9 @@
                 queue = queue.tail;
                 if (!nonSyntheticDeps.add(current))
                     continue;
+                current.complete();
                 if ((current.flags() & Flags.ACYCLIC) != 0)
                     continue;
-                current.complete();
                 Assert.checkNonNull(current.requires, () -> current.toString());
                 for (RequiresDirective dep : current.requires) {
                     if (!dep.flags.contains(RequiresFlag.EXTRA))
@@ -1262,5 +1309,7 @@
     }
 
     public void newRound() {
+        rootModules = null;
+        allModules = null;
     }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java	Fri Aug 05 12:03:58 2016 -0700
@@ -95,6 +95,7 @@
         names = Names.instance(context);
         log = Log.instance(context);
         types = Types.instance(context);
+        noOpSymbol = new OperatorSymbol(names.empty, Type.noType, -1, syms.noSymbol);
         initOperatorNames();
         initUnaryOperators();
         initBinaryOperators();
@@ -145,7 +146,7 @@
     /**
      * Entry point for resolving a unary operator given an operator tag and an argument type.
      */
-    Symbol resolveUnary(DiagnosticPosition pos, JCTree.Tag tag, Type op) {
+    OperatorSymbol resolveUnary(DiagnosticPosition pos, JCTree.Tag tag, Type op) {
         return resolve(tag,
                 unaryOperators,
                 unop -> unop.test(op),
@@ -156,7 +157,7 @@
     /**
      * Entry point for resolving a binary operator given an operator tag and a pair of argument types.
      */
-    Symbol resolveBinary(DiagnosticPosition pos, JCTree.Tag tag, Type op1, Type op2) {
+    OperatorSymbol resolveBinary(DiagnosticPosition pos, JCTree.Tag tag, Type op1, Type op2) {
         return resolve(tag,
                 binaryOperators,
                 binop -> binop.test(op1, op2),
@@ -169,8 +170,8 @@
      * map. If there's a matching operator, its resolve routine is called and the result is returned;
      * otherwise the result of a fallback function is returned.
      */
-    private <O> Symbol resolve(Tag tag, Map<Name, List<O>> opMap, Predicate<O> opTestFunc,
-                       Function<O, Symbol> resolveFunc, Supplier<Symbol> noResultFunc) {
+    private <O> OperatorSymbol resolve(Tag tag, Map<Name, List<O>> opMap, Predicate<O> opTestFunc,
+                       Function<O, OperatorSymbol> resolveFunc, Supplier<OperatorSymbol> noResultFunc) {
         return opMap.get(operatorName(tag)).stream()
                 .filter(opTestFunc)
                 .map(resolveFunc)
@@ -181,7 +182,7 @@
     /**
      * Creates an operator symbol.
      */
-    private Symbol makeOperator(Name name, List<OperatorType> formals, OperatorType res, int... opcodes) {
+    private OperatorSymbol makeOperator(Name name, List<OperatorType> formals, OperatorType res, int... opcodes) {
         MethodType opType = new MethodType(
                 formals.stream()
                         .map(o -> o.asType(syms))
@@ -201,10 +202,14 @@
                 ((opcodes[0] << ByteCodes.preShift) | opcodes[1]);
     }
 
+    /** A symbol that stands for a missing operator.
+     */
+    public final OperatorSymbol noOpSymbol;
+
     /**
      * Report an operator lookup error.
      */
-    private Symbol reportErrorIfNeeded(DiagnosticPosition pos, Tag tag, Type... args) {
+    private OperatorSymbol reportErrorIfNeeded(DiagnosticPosition pos, Tag tag, Type... args) {
         if (Stream.of(args).noneMatch(Type::isErroneous)) {
             Name opName = operatorName(tag);
             JCDiagnostic.Error opError = (args.length) == 1 ?
@@ -212,7 +217,7 @@
                     Errors.OperatorCantBeApplied1(opName, args[0], args[1]);
             log.error(pos, opError);
         }
-        return syms.noSymbol;
+        return noOpSymbol;
     }
 
     /**
@@ -263,10 +268,10 @@
         final Name name;
 
         /** The list of symbols associated with this operator (lazily populated). */
-        Optional<Symbol[]> alternatives = Optional.empty();
+        Optional<OperatorSymbol[]> alternatives = Optional.empty();
 
         /** An array of operator symbol suppliers (used to lazily populate the symbol list). */
-        List<Supplier<Symbol>> operatorSuppliers = List.nil();
+        List<Supplier<OperatorSymbol>> operatorSuppliers = List.nil();
 
         @SuppressWarnings("varargs")
         OperatorHelper(Tag tag) {
@@ -278,21 +283,21 @@
          * using an applicability predicate; if the test suceeds that same operator is returned,
          * otherwise a dummy symbol is returned.
          */
-        final Symbol doLookup(Predicate<Symbol> applicabilityTest) {
+        final OperatorSymbol doLookup(Predicate<OperatorSymbol> applicabilityTest) {
             return Stream.of(alternatives.orElseGet(this::initOperators))
                     .filter(applicabilityTest)
                     .findFirst()
-                    .orElse(syms.noSymbol);
+                    .orElse(noOpSymbol);
         }
 
         /**
          * This routine performs lazy instantiation of the operator symbols supported by this helper.
          * After initialization is done, the suppliers are cleared, to free up memory.
          */
-        private Symbol[] initOperators() {
-            Symbol[] operators = operatorSuppliers.stream()
+        private OperatorSymbol[] initOperators() {
+            OperatorSymbol[] operators = operatorSuppliers.stream()
                     .map(op -> op.get())
-                    .toArray(Symbol[]::new);
+                    .toArray(OperatorSymbol[]::new);
             alternatives = Optional.of(operators);
             operatorSuppliers = null; //let GC do its work
             return operators;
@@ -311,10 +316,10 @@
         /**
          * This routine implements the unary operator lookup process. It customizes the behavior
          * of the shared lookup routine in {@link OperatorHelper}, by using an unary applicability test
-         * (see {@link UnaryOperatorHelper#isUnaryOperatorApplicable(OperatorSymbol, Type)}
+         * (see {@link UnaryOperatorHelper#isUnaryOperatorApplicable(OperatorOperatorSymbol, Type)}
          */
-        final Symbol doLookup(Type t) {
-            return doLookup(op -> isUnaryOperatorApplicable((OperatorSymbol)op, t));
+        final OperatorSymbol doLookup(Type t) {
+            return doLookup(op -> isUnaryOperatorApplicable(op, t));
         }
 
         /**
@@ -336,7 +341,7 @@
          * This method will be overridden by unary operator helpers to provide custom resolution
          * logic.
          */
-        abstract Symbol resolve(Type t);
+        abstract OperatorSymbol resolve(Type t);
     }
 
     abstract class BinaryOperatorHelper extends OperatorHelper implements BiPredicate<Type, Type> {
@@ -350,8 +355,8 @@
          * of the shared lookup routine in {@link OperatorHelper}, by using an unary applicability test
          * (see {@link BinaryOperatorHelper#isBinaryOperatorApplicable(OperatorSymbol, Type, Type)}
          */
-        final Symbol doLookup(Type t1, Type t2) {
-            return doLookup(op -> isBinaryOperatorApplicable((OperatorSymbol)op, t1, t2));
+        final OperatorSymbol doLookup(Type t1, Type t2) {
+            return doLookup(op -> isBinaryOperatorApplicable(op, t1, t2));
         }
 
         /**
@@ -375,7 +380,7 @@
          * This method will be overridden by binary operator helpers to provide custom resolution
          * logic.
          */
-        abstract Symbol resolve(Type t1, Type t2);
+        abstract OperatorSymbol resolve(Type t1, Type t2);
     }
 
     /**
@@ -393,7 +398,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg) {
+        public OperatorSymbol resolve(Type arg) {
             return doLookup(syms.objectType);
         }
     }
@@ -421,7 +426,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg) {
+        public OperatorSymbol resolve(Type arg) {
             return doLookup(unaryPromotion(arg));
         }
     }
@@ -442,7 +447,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg) {
+        public OperatorSymbol resolve(Type arg) {
             return doLookup(syms.booleanType);
         }
     }
@@ -458,7 +463,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg) {
+        public OperatorSymbol resolve(Type arg) {
             return doLookup(types.unboxedTypeOrType(arg));
         }
     }
@@ -481,7 +486,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg1, Type arg2) {
+        public OperatorSymbol resolve(Type arg1, Type arg2) {
             Type t = binaryPromotion(arg1, arg2);
             return doLookup(t, t);
         }
@@ -504,7 +509,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg1, Type arg2) {
+        public OperatorSymbol resolve(Type arg1, Type arg2) {
             return doLookup(syms.booleanType, syms.booleanType);
         }
 
@@ -527,7 +532,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg1, Type arg2) {
+        public OperatorSymbol resolve(Type arg1, Type arg2) {
             return doLookup(stringPromotion(arg1), stringPromotion(arg2));
         }
 
@@ -570,7 +575,7 @@
         }
 
         @Override
-        public Symbol resolve(Type arg1, Type arg2) {
+        public OperatorSymbol resolve(Type arg1, Type arg2) {
             return doLookup(unaryPromotion(arg1), unaryPromotion(arg2));
         }
 
@@ -613,7 +618,7 @@
         }
 
         @Override
-        public Symbol resolve(Type t1, Type t2) {
+        public OperatorSymbol resolve(Type t1, Type t2) {
             ComparisonKind kind = getKind(t1, t2);
             Type t = (kind == ComparisonKind.NUMERIC_OR_BOOLEAN) ?
                     binaryPromotion(t1, t2) :
@@ -798,12 +803,12 @@
                     .addBinaryOperator(BOOLEAN, BOOLEAN, BOOLEAN, bool_or));
     }
 
-    Symbol lookupBinaryOp(Predicate<Symbol> applicabilityTest) {
+    OperatorSymbol lookupBinaryOp(Predicate<OperatorSymbol> applicabilityTest) {
         return binaryOperators.values().stream()
                 .flatMap(List::stream)
                 .map(helper -> helper.doLookup(applicabilityTest))
                 .distinct()
-                .filter(sym -> sym != syms.noSymbol)
+                .filter(sym -> sym != noOpSymbol)
                 .findFirst().get();
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1795,7 +1795,7 @@
     }
 
     public void visitAssignop(JCAssignOp tree) {
-        OperatorSymbol operator = (OperatorSymbol) tree.operator;
+        OperatorSymbol operator = tree.operator;
         Item l;
         if (operator.opcode == string_add) {
             l = concat.makeConcat(tree);
@@ -1827,7 +1827,7 @@
     }
 
     public void visitUnary(JCUnary tree) {
-        OperatorSymbol operator = (OperatorSymbol)tree.operator;
+        OperatorSymbol operator = tree.operator;
         if (tree.hasTag(NOT)) {
             CondItem od = genCond(tree.arg, false);
             result = od.negate();
@@ -1909,7 +1909,7 @@
     }
 
     public void visitBinary(JCBinary tree) {
-        OperatorSymbol operator = (OperatorSymbol)tree.operator;
+        OperatorSymbol operator = tree.operator;
         if (operator.opcode == string_add) {
             result = concat.makeConcat(tree);
         } else if (tree.hasTag(AND)) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Fri Aug 05 12:03:58 2016 -0700
@@ -131,8 +131,7 @@
         tree = TreeInfo.skipParens(tree);
         if (tree.hasTag(PLUS) && tree.type.constValue() == null) {
             JCTree.JCBinary op = (JCTree.JCBinary) tree;
-            if (op.operator.kind == MTH &&
-                    ((Symbol.OperatorSymbol) op.operator).opcode == string_add) {
+            if (op.operator.kind == MTH && op.operator.opcode == string_add) {
                 return res
                         .appendList(collect(op.lhs, res))
                         .appendList(collect(op.rhs, res));
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Aug 05 12:03:58 2016 -0700
@@ -27,6 +27,7 @@
 
 import java.io.*;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -1009,15 +1010,10 @@
     }
 
     public List<JCCompilationUnit> initModules(List<JCCompilationUnit> roots) {
-        List<JCCompilationUnit> result = initModules(roots, null);
+        modules.initModules(roots, Collections.emptySet(), Collections.emptySet());
         if (roots.isEmpty()) {
             enterDone = true;
         }
-        return result;
-    }
-
-    List<JCCompilationUnit> initModules(List<JCCompilationUnit> roots, ClassSymbol c) {
-        modules.enter(roots, c);
         return roots;
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -85,6 +85,9 @@
 
     @DefinedBy(Api.LANGUAGE_MODEL)
     public boolean isSameType(TypeMirror t1, TypeMirror t2) {
+        if (t1.getKind() == TypeKind.WILDCARD || t2.getKind() == TypeKind.WILDCARD) {
+            return false;
+        }
         return types.isSameType((Type) t1, (Type) t2);
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -1328,6 +1328,8 @@
 
 compiler.misc.class.file.wrong.class=\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4E0D\u6B63\u306A\u30AF\u30E9\u30B9\u304C\u3042\u308A\u307E\u3059
 
+compiler.misc.module.info.invalid.super.class=\u7121\u52B9\u306A\u30B9\u30FC\u30D1\u30FC\u30FB\u30AF\u30E9\u30B9\u3092\u542B\u3080module-info
+
 compiler.misc.class.file.not.found={0}\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 
 # 0: string (classfile major version), 1: string (classfile minor version)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -1328,6 +1328,8 @@
 
 compiler.misc.class.file.wrong.class=\u7C7B\u6587\u4EF6\u5305\u542B\u9519\u8BEF\u7684\u7C7B: {0}
 
+compiler.misc.module.info.invalid.super.class=\u5E26\u6709\u65E0\u6548\u8D85\u7C7B\u7684 module-info
+
 compiler.misc.class.file.not.found=\u627E\u4E0D\u5230{0}\u7684\u7C7B\u6587\u4EF6
 
 # 0: string (classfile major version), 1: string (classfile minor version)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -91,7 +91,7 @@
 javac.opt.version=\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831
 javac.opt.arg.pathname=<pathname>
 javac.opt.arg.file=<filename>
-javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u4ED8\u52A0\u3059\u308B
+javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u5148\u982D\u306B\u4ED8\u52A0\u3059\u308B
 javac.opt.Xbootclasspath.a=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u8FFD\u52A0\u3059\u308B
 javac.opt.Xlint=\u63A8\u5968\u306E\u8B66\u544A\u3092\u6709\u52B9\u306B\u3059\u308B
 javac.opt.Xlint.all=\u3059\u3079\u3066\u306E\u8B66\u544A\u3092\u6709\u52B9\u306B\u3057\u307E\u3059
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Aug 05 12:03:58 2016 -0700
@@ -1876,8 +1876,8 @@
         private Tag opcode;
         public JCExpression lhs;
         public JCExpression rhs;
-        public Symbol operator;
-        protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, Symbol operator) {
+        public OperatorSymbol operator;
+        protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, OperatorSymbol operator) {
             this.opcode = opcode;
             this.lhs = (JCExpression)lhs;
             this.rhs = (JCExpression)rhs;
@@ -1892,7 +1892,7 @@
         public JCExpression getVariable() { return lhs; }
         @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return rhs; }
-        public Symbol getOperator() {
+        public OperatorSymbol getOperator() {
             return operator;
         }
         @Override @DefinedBy(Api.COMPILER_TREE)
@@ -1911,7 +1911,7 @@
     public static class JCUnary extends JCExpression implements UnaryTree {
         private Tag opcode;
         public JCExpression arg;
-        public Symbol operator;
+        public OperatorSymbol operator;
         protected JCUnary(Tag opcode, JCExpression arg) {
             this.opcode = opcode;
             this.arg = arg;
@@ -1923,7 +1923,7 @@
         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
         @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getExpression() { return arg; }
-        public Symbol getOperator() {
+        public OperatorSymbol getOperator() {
             return operator;
         }
         @Override @DefinedBy(Api.COMPILER_TREE)
@@ -1947,11 +1947,11 @@
         private Tag opcode;
         public JCExpression lhs;
         public JCExpression rhs;
-        public Symbol operator;
+        public OperatorSymbol operator;
         protected JCBinary(Tag opcode,
                          JCExpression lhs,
                          JCExpression rhs,
-                         Symbol operator) {
+                         OperatorSymbol operator) {
             this.opcode = opcode;
             this.lhs = lhs;
             this.rhs = rhs;
@@ -1966,7 +1966,7 @@
         public JCExpression getLeftOperand() { return lhs; }
         @DefinedBy(Api.COMPILER_TREE)
         public JCExpression getRightOperand() { return rhs; }
-        public Symbol getOperator() {
+        public OperatorSymbol getOperator() {
             return operator;
         }
         @Override @DefinedBy(Api.COMPILER_TREE)
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTool.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTool.java	Fri Aug 05 12:03:58 2016 -0700
@@ -28,6 +28,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -44,6 +45,7 @@
 import com.sun.tools.javac.code.ClassFinder;
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -52,6 +54,7 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Name;
 
 
 /**
@@ -183,9 +186,8 @@
 
             // Parse file objects provide via the DocumentationTool API
             parse(fileObjects, classTrees, true);
-            modules.enter(classTrees.toList(), null);
 
-            syms.unnamedModule.complete(); // TEMP to force reading all named modules
+            modules.initModules(classTrees.toList(), Collections.emptySet(), Collections.emptySet());
 
             // Build up the complete list of any packages to be documented
             Location location = modules.multiModuleMode ? StandardLocation.MODULE_SOURCE_PATH
@@ -386,8 +388,16 @@
         private Location getLocation(String packageName) throws IOException {
             if (location == StandardLocation.MODULE_SOURCE_PATH) {
                 // TODO: handle invalid results
-                ModuleSymbol msym = syms.inferModule(names.fromString(packageName));
-                return fm.getModuleLocation(location, msym.name.toString());
+                Name pack = names.fromString(packageName);
+
+                for (ModuleSymbol msym : modules.allModules()) {
+                    PackageSymbol p = syms.getPackage(msym, pack);
+                    if (p != null && !p.members().isEmpty()) {
+                        return fm.getModuleLocation(location, msym.name.toString());
+                    }
+                }
+
+                return null;
             } else {
                 return location;
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -185,6 +185,7 @@
 doclet.Same_package_name_used=\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u5F62\u5F0F\u304C2\u56DE\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 doclet.exception_encountered={1}\u306E\u51E6\u7406\u4E2D\u306B\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n{0}
 
+# option specifiers
 doclet.usage.d.name=d
 doclet.usage.d.parameters=<directory>
 doclet.usage.d.description=\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
@@ -244,7 +245,7 @@
 
 doclet.usage.excludedocfilessubdir.name=excludedocfilessubdir
 doclet.usage.excludedocfilessubdir.parameters=<name>:..
-doclet.usage.excludedocfilessubdir.description=\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3057\u307E\u3059
+doclet.usage.excludedocfilessubdir.description=\n                                  \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3057\u307E\u3059
 
 doclet.usage.group.name=group
 doclet.usage.group.parameters=<name> <p1>:<p2>..
@@ -289,7 +290,7 @@
 
 doclet.usage.tag.name=tag
 doclet.usage.tag.parameters=<name>:<locations>:<header>
-doclet.usage.tag.description=\u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059
+doclet.usage.tag.description=\n                                  \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059
 
 doclet.usage.taglet.name=taglet
 doclet.usage.taglet.description=\u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3057\u307E\u3059
@@ -333,8 +334,8 @@
 doclet.xusage.xdoclint-extended.name=Xdoclint:
 doclet.xusage.xdoclint-extended.parameters=(all|none|[-]<group>)
 # L10N: do not localize these words: all none accessibility html missing reference syntax
-doclet.xusage.xdoclint-extended.description=javadoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u554F\u984C\u306B\u5BFE\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n                                   javadoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u554F\u984C\u306B\u5BFE\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n                                   \u3053\u3053\u3067\u3001<group>\u306Faccessibility\u3001html\u3001missing\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002\n
+doclet.xusage.xdoclint-extended.description=javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\n                                  \u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n                                  \u3053\u3053\u3067\u3001<group>\u306Faccessibility\u3001html\u3001\n                                  missing\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002\n
 
 doclet.xusage.xdoclint-package.name=Xdoclint/package:
 doclet.xusage.xdoclint-package.parameters=([-]<packages>)
-doclet.xusage.xdoclint-package.description=\n        \u7279\u5B9A\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002<packages>\u306F\n        \u30AB\u30F3\u30DE\u3067\u533A\u5207\u3089\u308C\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u6307\u5B9A\u5B50\u306E\u30EA\u30B9\u30C8\u3067\u3059\u3002\u30D1\u30C3\u30B1\u30FC\u30B8\u6307\u5B9A\u5B50\u306F\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n        \u4FEE\u98FE\u3055\u308C\u305F\u540D\u524D\u3001\u307E\u305F\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u306E\u63A5\u982D\u8F9E\u306E\u5F8C\u306B.*'\u6307\u5B9A(\u6307\u5B9A\u3057\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n        \u3059\u3079\u3066\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u62E1\u5F35)\u3057\u305F\u3082\u306E\u3067\u3059\u3002\u30D1\u30C3\u30B1\u30FC\u30B8\u6307\u5B9A\u5B50\u306E\u524D\u306B-\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\n        \u6307\u5B9A\u3057\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u95A2\u3059\u308B\u30C1\u30A7\u30C3\u30AF\u3092\u7121\u52B9\u306B\u3067\u304D\u307E\u3059\u3002\n
+doclet.xusage.xdoclint-package.description=\n                                  \u7279\u5B9A\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002<packages>\u306F\n        \u30AB\u30F3\u30DE\u3067\u533A\u5207\u3089\u308C\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u6307\u5B9A\u5B50\u306E\u30EA\u30B9\u30C8\u3067\u3059\u3002\u30D1\u30C3\u30B1\u30FC\u30B8\u6307\u5B9A\u5B50\u306F\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n        \u4FEE\u98FE\u3055\u308C\u305F\u540D\u524D\u3001\u307E\u305F\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u306E\u63A5\u982D\u8F9E\u306E\u5F8C\u306B.*'\u6307\u5B9A(\u6307\u5B9A\u3057\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n        \u3059\u3079\u3066\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u62E1\u5F35)\u3057\u305F\u3082\u306E\u3067\u3059\u3002\u30D1\u30C3\u30B1\u30FC\u30B8\u6307\u5B9A\u5B50\u306E\u524D\u306B-\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\n        \u6307\u5B9A\u3057\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u95A2\u3059\u308B\u30C1\u30A7\u30C3\u30AF\u3092\u7121\u52B9\u306B\u3067\u304D\u307E\u3059\u3002\n
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -185,6 +185,7 @@
 doclet.Same_package_name_used=\u7A0B\u5E8F\u5305\u540D\u79F0\u5F62\u5F0F\u4F7F\u7528\u4E86\u4E24\u6B21: {0}
 doclet.exception_encountered=\u5904\u7406{1}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\n{0}
 
+# option specifiers
 doclet.usage.d.name=d
 doclet.usage.d.parameters=<directory>
 doclet.usage.d.description=\u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55
@@ -244,7 +245,7 @@
 
 doclet.usage.excludedocfilessubdir.name=excludedocfilessubdir
 doclet.usage.excludedocfilessubdir.parameters=<name>:..
-doclet.usage.excludedocfilessubdir.description=\u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55
+doclet.usage.excludedocfilessubdir.description=\n                                  \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55
 
 doclet.usage.group.name=group
 doclet.usage.group.parameters=<name> <p1>:<p2>..
@@ -289,7 +290,7 @@
 
 doclet.usage.tag.name=tag
 doclet.usage.tag.parameters=<name>:<locations>:<header>
-doclet.usage.tag.description=\u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0
+doclet.usage.tag.description=\n                                  \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0
 
 doclet.usage.taglet.name=taglet
 doclet.usage.taglet.description=\u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0
@@ -313,7 +314,7 @@
 doclet.usage.sourcetab.description=\u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570
 
 doclet.usage.keywords.name=keywords
-doclet.usage.keywords.description=\u968F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u4E00\u8D77\u9644\u5E26 HTML \u5143\u6807\u8BB0
+doclet.usage.keywords.description=\u968F\u7A0B\u5E8F\u5305,\n                                  \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u4E00\u8D77\u9644\u5E26 HTML \u5143\u6807\u8BB0
 
 doclet.usage.stylesheetfile.name=stylesheetfile
 doclet.usage.stylesheetfile.parameters=<path>
@@ -325,16 +326,16 @@
 
 doclet.xusage.xdocrootparent.name=Xdocrootparent
 doclet.xusage.xdocrootparent.parameters=<url>
-doclet.xusage.xdocrootparent.description=\u5C06\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\u6240\u6709\u540E\u8DDF /.. \u7684 @docRoot \u66FF\u6362\u4E3A <url>
+doclet.xusage.xdocrootparent.description=\u5C06\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\u6240\u6709\u540E\u8DDF /..\n                                  \u7684 @docRoot \u66FF\u6362\u4E3A <url>
 
 doclet.xusage.xdoclint.name=Xdoclint
-doclet.xusage.xdoclint.description=\u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5
+doclet.xusage.xdoclint.description=\u4E3A\n                                  javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5
 
 doclet.xusage.xdoclint-extended.name=Xdoclint:
 doclet.xusage.xdoclint-extended.parameters=(all|none|[-]<group>)
 # L10N: do not localize these words: all none accessibility html missing reference syntax
-doclet.xusage.xdoclint-extended.description=\u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n                                   \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n                                   \u5176\u4E2D <group> \u4E3A accessibility, html, missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n
+doclet.xusage.xdoclint-extended.description=\u9488\u5BF9 javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\n                                  \u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n                                  \u5176\u4E2D <\u7EC4> \u4E3A accessibility, html,\n                                  missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n
 
 doclet.xusage.xdoclint-package.name=Xdoclint/package:
 doclet.xusage.xdoclint-package.parameters=([-]<packages>)
-doclet.xusage.xdoclint-package.description=\n        \u5728\u7279\u5B9A\u7684\u7A0B\u5E8F\u5305\u4E2D\u542F\u7528\u6216\u7981\u7528\u68C0\u67E5\u3002<\u7A0B\u5E8F\u5305> \u662F\u9017\u53F7\u5206\u9694\u7684\n        \u7A0B\u5E8F\u5305\u8BF4\u660E\u7B26\u5217\u8868\u3002\u7A0B\u5E8F\u5305\u8BF4\u660E\u7B26\u662F\u7A0B\u5E8F\u5305\u7684\u9650\u5B9A\u540D\u79F0\n        \u6216\u7A0B\u5E8F\u5305\u540D\u79F0\u524D\u7F00\u540E\u8DDF .*, \u5B83\u6269\u5C55\u5230\u7ED9\u5B9A\u7A0B\u5E8F\u5305\u7684\n        \u6240\u6709\u5B50\u7A0B\u5E8F\u5305\u3002\u5728\u7A0B\u5E8F\u5305\u8BF4\u660E\u7B26\u524D\u9762\u52A0\u4E0A - \u53EF\u4EE5\u4E3A\n        \u6307\u5B9A\u7A0B\u5E8F\u5305\u7981\u7528\u68C0\u67E5\u3002\n
+doclet.xusage.xdoclint-package.description=\n                                  \u5728\u7279\u5B9A\u7684\u7A0B\u5E8F\u5305\u4E2D\u542F\u7528\u6216\u7981\u7528\n                                  \u68C0\u67E5\u3002<\u7A0B\u5E8F\u5305> \u662F\u9017\u53F7\u5206\u9694\u7684\n                                  \u7A0B\u5E8F\u5305\u8BF4\u660E\u7B26\u5217\u8868\u3002\n                                  \u7A0B\u5E8F\u5305\u8BF4\u660E\u7B26\u662F\u7A0B\u5E8F\u5305\u7684\u9650\u5B9A\n                                  \u540D\u79F0\u6216\u7A0B\u5E8F\u5305\u540D\u79F0\u524D\u7F00\u540E\u8DDF .*, \n                                  \u5B83\u6269\u5C55\u5230\u7ED9\u5B9A\u7A0B\u5E8F\u5305\u7684\n                                  \u6240\u6709\u5B50\u7A0B\u5E8F\u5305\u3002\u5728\u7A0B\u5E8F\u5305\n                                  \u8BF4\u660E\u7B26\u524D\u9762\u52A0\u4E0A - \u53EF\u4EE5\u4E3A\n                                  \u6307\u5B9A\u7A0B\u5E8F\u5305\u7981\u7528\u68C0\u67E5\u3002\n
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java	Fri Aug 05 12:03:58 2016 -0700
@@ -49,6 +49,7 @@
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -56,6 +57,7 @@
 import com.sun.tools.javac.util.Abort;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Position;
 import jdk.javadoc.doclet.DocletEnvironment;
 
@@ -187,9 +189,8 @@
 
             // Parse file objects provide via the DocumentationTool API
             parse(fileObjects, classTrees, true);
-            modules.enter(classTrees.toList(), null);
 
-            syms.unnamedModule.complete(); // TEMP to force reading all named modules
+            modules.initModules(classTrees.toList(), Collections.emptySet(), Collections.emptySet());
 
             // Build up the complete list of any packages to be documented
             Location location = modules.multiModuleMode ? StandardLocation.MODULE_SOURCE_PATH
@@ -394,11 +395,16 @@
         private Location getLocation(String packageName) throws IOException {
             if (location == StandardLocation.MODULE_SOURCE_PATH) {
                 // TODO: handle invalid results better.
-                ModuleSymbol msym = syms.inferModule(names.fromString(packageName));
-                if (msym == null) {
-                    return null;
+                Name pack = names.fromString(packageName);
+
+                for (ModuleSymbol msym : modules.allModules()) {
+                    PackageSymbol p = syms.getPackage(msym, pack);
+                    if (p != null && !p.members().isEmpty()) {
+                        return fm.getModuleLocation(location, msym.name.toString());
+                    }
                 }
-                return fm.getModuleLocation(location, msym.name.toString());
+
+                return null;
             } else {
                 return location;
             }
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java	Fri Aug 05 12:03:58 2016 -0700
@@ -808,7 +808,7 @@
     }
 
     private String esc(char c, char quote) {
-        if (32 <= c && c <= 126 && c != quote)
+        if (32 <= c && c <= 126 && c != quote && c != '\\')
             return String.valueOf(c);
         else switch (c) {
             case '\b': return "\\b";
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java	Fri Aug 05 12:03:58 2016 -0700
@@ -385,6 +385,10 @@
                         sb.append('\\').append('\\');
                         break;
                     default:
+                        if (Character.isISOControl(c)) {
+                            sb.append(String.format("\\u%04x", (int) c));
+                            break;
+                        }
                         sb.append(c);
                 }
             }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -231,7 +231,7 @@
 
 help.set.format = \u30B9\u30CB\u30DA\u30C3\u30C8\u30FB\u30A4\u30D9\u30F3\u30C8\u3092\u30EC\u30DD\u30FC\u30C8\u3059\u308B\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u3092\u8A2D\u5B9A\u3057\u307E\u3059\u3002\n\n\t/set format <mode> <field> "<format>" <selector>...\n\n<mode>\u306F\u4E8B\u524D\u306B\u5B9A\u7FA9\u3055\u308C\u305F\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u30FB\u30E2\u30FC\u30C9\u306E\u540D\u524D\u3067\u3059 -- '/help /set mode'\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n<field>\u306F\u5B9A\u7FA9\u3059\u308B\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u56FA\u6709\u306E\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u306E\u540D\u524D\u3067\u3059\u3002\n<format>\u306F\u5F15\u7528\u7B26\u306B\u56F2\u307E\u308C\u305F\u6587\u5B57\u5217\u3067\u3001\u6B21\u306E\u5834\u5408\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u5024\u3067\u3059: \n\u30BB\u30EC\u30AF\u30BF\u304C\u4E00\u81F4\u3059\u308B(\u307E\u305F\u306F\u30BB\u30EC\u30AF\u30BF\u304C\u306A\u3044)\u3002\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u304C\u4F7F\u7528\u3055\u308C\u308B\u5834\u5408\u3001\n\u4E2D\u30AB\u30C3\u30B3\u3067\u56F2\u307E\u308C\u3066\u3044\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u540D\u304C\u305D\u306E\u3068\u304D\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u5024\u3067\u7F6E\u63DB\u3055\u308C\u307E\u3059\n\u3053\u308C\u3089\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u3001\u3053\u306E\u30B3\u30DE\u30F3\u30C9\u3067\u4E8B\u524D\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u3082\u3001\n\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u306B\u56FA\u6709\u306E\u3053\u308C\u3089\u306E\u4E8B\u524D\u5B9A\u7FA9\u6E08\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5834\u5408\u3082\u3042\u308A\u307E\u3059:\n\t{name}       == \u540D\u524D\u3001\u4F8B: \u5909\u6570\u540D\u3001 ...\n\t{type}       == \u30BF\u30A4\u30D7\u540D\u3002\u5909\u6570\u307E\u305F\u306F\u5F0F\u306E\u30BF\u30A4\u30D7\u3001\n\t\t\t\u30E1\u30BD\u30C3\u30C9\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30BF\u30A4\u30D7\n\t{value}      == \u5F0F\u307E\u305F\u306F\u5909\u6570\u306E\u521D\u671F\u5316\u306E\u7D50\u679C\u5024\n\t{unresolved} == \u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306E\u30EA\u30B9\u30C8\n\t{errors}     == \u30EA\u30AB\u30D0\u30EA\u53EF\u80FD\u306A\u30A8\u30E9\u30FC\u306E\u30EA\u30B9\u30C8(\u51E6\u7406\u6642-\n\t\t\t"display"\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u307F)\n\t{err}        == \u672A\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30FB\u30A8\u30E9\u30FC\u884C(\u51E6\u7406\u6642-\n\t\t\t"errorline"\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u307F)\n\u6B21\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u30C4\u30FC\u30EB\u306B\u3088\u3063\u3066\u30A2\u30AF\u30BB\u30B9\u3055\u308C\u3001\u8868\u793A\u3055\u308C\u308B\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u3092\u6C7A\u5B9A\u3057\u307E\u3059:\n\t{display}    == \u30B9\u30CB\u30DA\u30C3\u30C8\u30FB\u30A4\u30D9\u30F3\u30C8\u306B\u5BFE\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30E1\u30C3\u30BB\u30FC\u30B8\n\t{errorline}  == \u300Cerrors\u300D\u30D5\u30A3\u30FC\u30EB\u30C9\u5185\u306E\u30A8\u30E9\u30FC\u884C\u306E\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\n\t{pre}        == \u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u63A5\u982D\u8F9E(\u30B3\u30DE\u30F3\u30C9\u30FB\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u3092\u958B\u59CB\u3059\u308B)\n\t{post}       == \u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u63A5\u5C3E\u8F9E(\u30B3\u30DE\u30F3\u30C9\u30FB\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u3092\u7D42\u4E86\u3059\u308B)\n\t{errorpre}   == \u30A8\u30E9\u30FC\u63A5\u982D\u8F9E(\u30A8\u30E9\u30FC\u30FB\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u3092\u958B\u59CB\u3059\u308B)\n\t{errorpost}  == \
 \u30A8\u30E9\u30FC\u63A5\u5C3E\u8F9E(\u30A8\u30E9\u30FC\u30FB\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u3092\u7D42\u4E86\u3059\u308B)\n\u3053\u308C\u3089\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u306F\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u8A2D\u5B9A\u304C\u3042\u308A\u307E\u3059(\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059)\u3002\n<selector>\u306F\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u304C\u9069\u7528\u3055\u308C\u308B\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u3059\u3002\n\u30BB\u30EC\u30AF\u30BF\u69CB\u9020\u306F\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u306E\u30CF\u30A4\u30D5\u30F3\u533A\u5207\u308A\u30EA\u30B9\u30C8\u3067\u3059\u3002\n\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u306F\u30011\u3064\u306E\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306E\u5024\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8\u3067\u3059\u3002\n\u30BB\u30EC\u30AF\u30BF\u306F\u5404\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u304C\u4E00\u81F4\u3059\u308C\u3070\u4E00\u81F4\u3068\u306A\u308A\u307E\u3059\u3002\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u306F\n\u3044\u305A\u308C\u304B\u306E\u5024\u304C\u4E00\u81F4\u3059\u308C\u3070\u4E00\u81F4\u3068\u306A\u308A\u307E\u3059\u3002\n\n\u30B1\u30FC\u30B9\u30FB\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30B9\u30CB\u30DA\u30C3\u30C8\u306E\u7A2E\u985E\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\timport     -- \u30A4\u30F3\u30DD\u30FC\u30C8\u5BA3\u8A00\n\tclass      -- \u30AF\u30E9\u30B9\u5BA3\u8A00\n\tinterface  -- \u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u5BA3\u8A00\n\tenum       -- \u5217\u6319\u578B\u306E\u5BA3\u8A00\n\tannotation -- \u6CE8\u91C8\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u5BA3\u8A00\n\tmethod     -- \u30E1\u30BD\u30C3\u30C9\u5BA3\u8A00 -- \u6CE8\u610F: {type}==parameter-types\n\tvardecl    -- \u521D\u671F\u5316\u3057\u306A\u3044\u5909\u6570\u5BA3\u8A00\n\tvarinit    -- \u521D\u671F\u5316\u3059\u308B\u5909\u6570\u5BA3\u8A00\n\texpression -- \u5F0F -- \u6CE8\u610F: {name}==scratch-variable-name\n\tvarvalue   -- \u5909\u6570\u5024\u5F0F\n\tassignment -- \u5909\u6570\u3092\u5272\u308A\u5F53\u3066\u307E\u3059\n\tstatement  -- \u6587\n\u30A2\u30AF\u30B7\u30E7\u30F3\u30FB\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30B9\u30CB\u30DA\u30C3\u30C8\u306B\u767A\u751F\u3057\u305F\u5185\u5BB9\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tadded     -- \u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F\n\tmodified  -- \u65E2\u5B58\u306E\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u5909\u66F4\u3055\u308C\u307E\u3057\u305F\n\treplaced  -- \u65E2\u5B58\u306E\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u65B0\u898F\u30B9\u30CB\u30DA\u30C3\u30C8\u3067\u7F6E\u63DB\u3055\u308C\u307E\u3057\u305F\n\toverwrote -- \u65E2\u5B58\u306E\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u307E\u3057\u305F\n\tdropped   -- \u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u524A\u9664\u3055\u308C\u307E\u3057\u305F\n\tused      -- \u4F7F\u7528\u3067\u304D\u306A\u3044\u3068\u304D\u306B\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F\n\u767A\u751F\u6642\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u3053\u308C\u304C\u76F4\u63A5\u307E\u305F\u306F\u9593\u63A5\u30A2\u30AF\u30B7\u30E7\u30F3\u3067\u3042\u308B\u304B\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tprimary -- \u5165\u529B\u3057\u305F\u30B9\u30CB\u30DA\u30C3\u30C8\n\tupdate  -- \u4F9D\u5B58\u30B9\u30CB\u30DA\u30C3\u30C8\u3078\u306E\u66F4\u65B0\n\u89E3\u6C7A\u72B6\u614B\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30B9\u30CB\u30DA\u30C3\u30C8\u306E\u89E3\u6C7A/\u5B9A\u7FA9\u306E\u72B6\u614B\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tok         -- \
-\u6B63\u3057\u304F\u89E3\u6C7A\u3055\u308C\u307E\u3057\u305F\n\tdefined    -- \u5FA9\u5143\u53EF\u80FD\u3067\u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306B\u3082\u304B\u304B\u308F\u3089\u305A\u5B9A\u7FA9\u3055\u308C\u307E\u3057\u305F\n\tnotdefined -- \u5FA9\u5143\u53EF\u80FD\u3067\u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306E\u305F\u3081\u5B9A\u7FA9\u3055\u308C\u307E\u305B\u3093\n\u672A\u89E3\u6C7A\u6570\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306E\u6570\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tunresolved0 -- \u672A\u89E3\u6C7A\u306E\u540D\u524D\u306F\u3042\u308A\u307E\u305B\u3093\n\tunresolved1 -- 1\u3064\u306E\u540D\u524D\u304C\u89E3\u6C7A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n\tunresolved2 -- 2\u3064\u4EE5\u4E0A\u306E\u540D\u524D\u304C\u89E3\u6C7A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n\u30A8\u30E9\u30FC\u6570\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30A8\u30E9\u30FC\u306E\u6570\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\terror0 -- \u30A8\u30E9\u30FC\u306A\u3057\n\terror1 -- 1\u3064\u306E\u30A8\u30E9\u30FC\n\terror2 -- 2\u3064\u4EE5\u4E0A\u306E\u30A8\u30E9\u30FC\n\n\u4F8B:\n\t/set format myformat action 'Created' added-primary\n\t/set format myformat action 'Update replaced' replaced-update\n\t/set format myformat display '{pre}{action} class {name}{post}' class-ok\n\t/set format myformat display '{pre}{action} variable {name}, reset to null{post}' replaced-vardecl,varinit-ok-update\n\n\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u5BFE\u3059\u308B\u5F8C\u7D9A\u306E\u30BB\u30EC\u30AF\u30BF\u306B\u3088\u308A\u3001\u4EE5\u524D\u306B\u4F7F\u7528\u3055\u308C\u305F\u30BB\u30EC\u30AF\u30C8\u306E\u4E00\u90E8\u307E\u305F\u306F\u3059\u3079\u3066\u304C\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059 -- \u6700\u5F8C\u306E\u30BB\u30EC\u30AF\u30BF\u304C\u6709\u52B9\u306B\u306A\u308A\u307E\u3059\n
+\u6B63\u3057\u304F\u89E3\u6C7A\u3055\u308C\u307E\u3057\u305F\n\tdefined    -- \u5FA9\u5143\u53EF\u80FD\u3067\u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306B\u3082\u304B\u304B\u308F\u3089\u305A\u5B9A\u7FA9\u3055\u308C\u307E\u3057\u305F\n\tnotdefined -- \u5FA9\u5143\u53EF\u80FD\u3067\u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306E\u305F\u3081\u5B9A\u7FA9\u3055\u308C\u307E\u305B\u3093\n\u672A\u89E3\u6C7A\u6570\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u672A\u89E3\u6C7A\u306E\u53C2\u7167\u306E\u6570\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tunresolved0 -- \u672A\u89E3\u6C7A\u306E\u540D\u524D\u306F\u3042\u308A\u307E\u305B\u3093\n\tunresolved1 -- 1\u3064\u306E\u540D\u524D\u304C\u89E3\u6C7A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n\tunresolved2 -- 2\u3064\u4EE5\u4E0A\u306E\u540D\u524D\u304C\u89E3\u6C7A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n\u30A8\u30E9\u30FC\u6570\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30A8\u30E9\u30FC\u306E\u6570\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\terror0 -- \u30A8\u30E9\u30FC\u306A\u3057\n\terror1 -- 1\u3064\u306E\u30A8\u30E9\u30FC\n\terror2 -- 2\u3064\u4EE5\u4E0A\u306E\u30A8\u30E9\u30FC\n\n\u4F8B:\n\t/set format myformat action 'Created' added-primary\n\t/set format myformat action 'Update replaced' replaced-update\n\t/set format myformat display '{pre}{action} class {name}{post}' class-ok\n\t/set format myformat display '{pre}{action} \u5909\u6570 {name}\u3001null\u306B\u30EA\u30BB\u30C3\u30C8\u3055\u308C\u307E\u3057\u305F{post}' replaced-vardecl,varinit-ok-update\n\n\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u5BFE\u3059\u308B\u5F8C\u7D9A\u306E\u30BB\u30EC\u30AF\u30BF\u306B\u3088\u308A\u3001\u4EE5\u524D\u306B\u4F7F\u7528\u3055\u308C\u305F\u30BB\u30EC\u30AF\u30C8\u306E\u4E00\u90E8\u307E\u305F\u306F\u3059\u3079\u3066\u304C\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059 -- \u6700\u5F8C\u306E\u30BB\u30EC\u30AF\u30BF\u304C\u6709\u52B9\u306B\u306A\u308A\u307E\u3059\n
 
 help.set.truncation = \u8868\u793A\u3055\u308C\u308B\u5024\u306E\u6700\u5927\u9577\u3092\u8A2D\u5B9A\u3057\u307E\u3059\u3002\n\n\t/set truncation <mode> <length> <selector>...\n\n<mode>\u306F\u4E8B\u524D\u306B\u5B9A\u7FA9\u3055\u308C\u305F\u30D5\u30A3\u30FC\u30C9\u30D0\u30C3\u30AF\u30FB\u30E2\u30FC\u30C9\u306E\u540D\u524D\u3067\u3059 -- '/help /set mode'\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\n<length>\u306F\u6700\u5927\u9577\u3092\u8868\u3059\u7B26\u53F7\u306A\u3057\u6574\u6570\u3067\u3059\u3002\n<format>\u306F\u5F15\u7528\u7B26\u306B\u56F2\u307E\u308C\u305F\u6587\u5B57\u5217\u3067\u3001\u6B21\u306E\u5834\u5408\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u5024\u3067\u3059:\n<selector>\u306F\u3001\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u306B\u3088\u3063\u3066\u5207\u6368\u3066\u9577\u306E\u5024\u3092\u5FAE\u8ABF\u6574\u3059\u308B\u5834\u5408\u306B\u306E\u307F\n\u5FC5\u8981\u3067\u3059\u3002<selector>\u306F\u3001\u5207\u6368\u3066\u304C\u9069\u7528\u3055\u308C\u308B\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u3059\u3002\n\u30BB\u30EC\u30AF\u30BF\u69CB\u9020\u306F\u3001\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u306E\u30CF\u30A4\u30D5\u30F3\u533A\u5207\u308A\u306E\u30EA\u30B9\u30C8\u3067\u3059\u3002\n\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u306F\u30011\u3064\u306E\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306E\u5024\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u306E\u30EA\u30B9\u30C8\u3067\u3059\u3002\n\u30BB\u30EC\u30AF\u30BF\u306F\u5404\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u304C\u4E00\u81F4\u3059\u308C\u3070\u4E00\u81F4\u3068\u306A\u308A\u307E\u3059\u3002\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u30EA\u30B9\u30C8\u306F\n\u3044\u305A\u308C\u304B\u306E\u5024\u304C\u4E00\u81F4\u3059\u308C\u3070\u4E00\u81F4\u3068\u306A\u308A\u307E\u3059\u3002\n\n\u6B21\u306B\u793A\u3059\u306E\u306F\u3001\u5207\u6368\u3066\u306B\u95A2\u9023\u3059\u308B\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u3067\u3059\u3002\n\n\u30B1\u30FC\u30B9\u30FB\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30B9\u30CB\u30DA\u30C3\u30C8\u306E\u7A2E\u985E\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tvardecl    -- \u521D\u671F\u5316\u3057\u306A\u3044\u5909\u6570\u5BA3\u8A00\n\tvarinit    -- \u521D\u671F\u5316\u3057\u306A\u3044\u5909\u6570\u5BA3\u8A00\n\texpression -- \u5F0F -- \u6CE8\u610F: {name}==scratch-variable-name\n\tvarvalue   -- \u5909\u6570\u5024\u5F0F\n\tassignment -- \u5909\u6570\u3092\u5272\u308A\u5F53\u3066\u307E\u3059\n\t\u30A2\u30AF\u30B7\u30E7\u30F3\u30FB\u30BB\u30EC\u30AF\u30BF\u7A2E\u985E\u306F\u3001\u30B9\u30CB\u30DA\u30C3\u30C8\u306B\u767A\u751F\u3057\u305F\u5185\u5BB9\u3092\u793A\u3057\u307E\u3059\u3002\u5024\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n\tadded     -- \u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F\n\tmodified  -- \u65E2\u5B58\u306E\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u5909\u66F4\u3055\u308C\u307E\u3057\u305F\n\treplaced  -- \u65E2\u5B58\u306E\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\u65B0\u898F\u30B9\u30CB\u30DA\u30C3\u30C8\u3067\u7F6E\u63DB\u3055\u308C\u307E\u3057\u305F\n\u4F8B:\n\t/set trunc mymode 80\n\t/set truncation mymode 45 expression\n\t/set truncation mymode 0 vardecl-modified,replaced\n\n\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u5BFE\u3059\u308B\u5F8C\u7D9A\u306E\u30BB\u30EC\u30AF\u30BF\u306B\u3088\u308A\u3001\u4EE5\u524D\u306B\u4F7F\u7528\u3055\u308C\u305F\u30BB\u30EC\u30AF\u30BF\u306E\u4E00\u90E8\u307E\u305F\u306F\u3059\u3079\u3066\u304C\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059 -- \u6700\u5F8C\u306E\u30BB\u30EC\u30AF\u30BF\u304C\u6709\u52B9\u306B\u306A\u308A\u307E\u3059\n
 
@@ -253,4 +253,4 @@
 help.retain.start =\u8D77\u52D5\u69CB\u6210\u3092\u8A2D\u5B9A\u3057\u307E\u3059 -- \u8D77\u52D5\u6642\u306B\u8AAD\u307F\u53D6\u3089\u308C\u308B\u30B9\u30CB\u30DA\u30C3\u30C8\u304A\u3088\u3073\u30B3\u30DE\u30F3\u30C9\u306E\n\u30B7\u30FC\u30B1\u30F3\u30B9\u3002\n\n\t/retain start [<file>|-default|-none]\n\n<file>\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\u6307\u5B9A\u3057\u305F<file>\u306E\u5185\u5BB9\u304C\n\u8D77\u52D5\u30B9\u30CB\u30DA\u30C3\u30C8\u304A\u3088\u3073\u30B3\u30DE\u30F3\u30C9\u306B\n\u306A\u308A\u307E\u3059\u3002\n\u304B\u308F\u308A\u306B-default\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\u4E8B\u524D\u306B\u5B9A\u7FA9\u3055\u308C\u305F\u8D77\u52D5\u30B9\u30CB\u30DA\u30C3\u30C8\u304C\n\u8D77\u52D5\u306B\u4F7F\u7528\u3055\u308C\u307E\u3059\u3002\n-none\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3059\u308B\u3068\u3001\u8D77\u52D5\u304C\u7A7A\u306B\u306A\u308A\u307E\u3059 -- \u8D77\u52D5\u30B9\u30CB\u30DA\u30C3\u30C8\u307E\u305F\u306F\n\u30B3\u30DE\u30F3\u30C9\u304C\u4F7F\u7528\u3055\u308C\u307E\u305B\u3093\u3002\n\u3053\u308C\u3089\u3092\u4F55\u3082\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u3001\u8D77\u52D5\u306F'/set start''\u307E\u305F\u306F''/retain start'\u30B3\u30DE\u30F3\u30C9\u3067\n\u6700\u5F8C\u306B\u6307\u5B9A\u3055\u308C\u305F\u3082\u306E\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059\u3002\n\u8D77\u52D5\u306F\u4FDD\u6301\u3055\u308C\u3001jshell\u30C4\u30FC\u30EB\u304C\u8D77\u52D5\u307E\u305F\u306F\u30EA\u30BB\u30C3\u30C8\u3055\u308C\u305F\u3068\u304D\u306B\u4F7F\u7528\u3055\u308C\u307E\u3059
 
 startup.feedback = /set mode verbose -command    \n\n/set prompt verbose '\\njshell> '   '   ...> '    \n\n/set format verbose pre '|  '    \n/set format verbose post '%n'    \n/set format verbose errorpre '|  '    \n/set format verbose errorpost '%n'    \n\n/set format verbose errorline '{post}{pre}    {err}'    \n\n/set format verbose action '\u4F5C\u6210\u6E08' added-primary    \n/set format verbose action '\u5909\u66F4\u6E08' modified-primary    \n/set format verbose action '\u7F6E\u63DB\u6E08' replaced-primary    \n/set format verbose action '\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u6E08' overwrote-primary    \n/set format verbose action '\u524A\u9664\u6E08' dropped-primary    \n/set format verbose action '  \u66F4\u65B0\u4F5C\u6210\u6E08' added-update    \n/set format verbose action '  \u66F4\u65B0\u5909\u66F4\u6E08' modified-update    \n/set format verbose action '  \u66F4\u65B0\u7F6E\u63DB\u6E08' replaced-update    \n/set format verbose action '  \u66F4\u65B0\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u6E08' overwrote-update    \n/set format verbose action '  \u66F4\u65B0\u524A\u9664\u6E08' dropped-update    \n\n/set format verbose until '\u3001\u305F\u3060\u3057\u3001\u6B21\u307E\u3067\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u306A\u3044\u304B\u3001\u305D\u306E\u30E1\u30BD\u30C3\u30C9\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093:'   defined-class-primary    \n/set format verbose until '\u3001\u305F\u3060\u3057\u3001\u6B21\u307E\u3067\u305D\u306E\u30E1\u30BD\u30C3\u30C9\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093:'                      defined-interface-primary    \n/set format verbose until '\u3001\u305F\u3060\u3057\u3001\u6B21\u307E\u3067\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093:'                                  defined-enum,annotation-primary    \n/set format verbose until '\u3001\u305F\u3060\u3057\u3001\u6B21\u307E\u3067\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093:'                               defined-method-primary    \n/set format verbose until '\u3001\u305F\u3060\u3057\u3001\u6B21\u307E\u3067\u53C2\u7167\u3067\u304D\u307E\u305B\u3093:'                            notdefined-primary    \n/set format verbose until ' \u6B21\u307E\u3067\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u306A\u3044\u304B\u3001\u305D\u306E\u30E1\u30BD\u30C3\u30C9\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093:'          defined-class-update    \n/set format verbose until ' \u6B21\u307E\u3067\u30E1\u30BD\u30C3\u30C9\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093:'                              defined-interface-update    \n/set format verbose until ' \u6B21\u307E\u3067\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093:'                                      defined-method-update    \n/set format verbose until ' \u6B21\u307E\u3067\u53C2\u7167\u3067\u304D\u307E\u305B\u3093:'                                   notdefined-update    \n\n/set format verbose unrerr '{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u307E\u3057\u305F'                                           unresolved1-error0    \n/set format verbose unrerr '{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u307E\u3057\u305F'                                          unresolved2-error0    \n/set format verbose unrerr ' \u3053\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}'                                 unresolved0-error1    \n/set format verbose unrerr '{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u3001\u3053\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}'     unresolved1-error1    \n/set format verbose unrerr '{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u3001\u3053\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}'    unresolved2-error1    \n/set format verbose unrerr ' \u3053\u308C\u3089\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}'                              unresolved0-error2    \n/set format verbose unrerr \
-'{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u3001\u3053\u308C\u3089\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}'  unresolved1-error2    \n/set format verbose unrerr '{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u3001\u3053\u308C\u3089\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}' unresolved2-error2    \n\n/set format verbose resolve '{until}{unrerr}'                                                   added,modified,replaced,used    \n\n/set format verbose typeKind '\u30AF\u30E9\u30B9'                  class    \n/set format verbose typeKind '\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9'              interface    \n/set format verbose typeKind '\u5217\u6319\u578B'                   enum    \n/set format verbose typeKind '\u6CE8\u91C8\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9'   annotation    \n\n/set format verbose result '{name} ==> {value}{post}'                                        added,modified,replaced-ok-primary    \n\n/set format verbose display '{result}{pre}\u30B9\u30AF\u30E9\u30C3\u30C1\u5909\u6570{name}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F : {type}{post}'    expression-added,modified,replaced-primary    \n/set format verbose display '{result}{pre}{name}\u306E\u5024 : {type}{post}'                    varvalue-primary    \n/set format verbose display '{result}{pre}{name}\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u307E\u3057\u305F : {type}{post}'                 assignment-primary    \n/set format verbose display '{result}{pre}{action} \u5909\u6570 {name} : {type}{resolve}{post}'  varinit,vardecl    \n/set format verbose display '{pre}{action} \u5909\u6570 {name}{resolve}{post}'                   vardecl,varinit-notdefined    \n/set format verbose display '{pre}{action} \u5909\u6570 {name}{post}'                            dropped-vardecl,varinit,expression    \n/set format verbose display '{pre}{action} \u5909\u6570 {name}\u3001null\u306B\u30EA\u30BB\u30C3\u30C8\u3055\u308C\u307E\u3057\u305F{post}'             replaced-vardecl,varinit-ok-update    \n\n/set format verbose display '{pre}{action} {typeKind} {name}{resolve}{post}'                 class,interface,enum,annotation    \n/set format verbose display '{pre}{action} \u30E1\u30BD\u30C3\u30C9 {name}({type})\u3092\u547C\u3073\u51FA\u305D\u3046\u3068\u3057\u307E\u3057\u305F{resolve}{post}'             method    \n\n/set format verbose display '{pre}{typeKind} {name}\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F{resolve}{post}'         used-class,interface,enum,annotation    \n/set format verbose display '{pre}\u30E1\u30BD\u30C3\u30C9{name}({type})\u3092\u547C\u3073\u51FA\u305D\u3046\u3068\u3057\u307E\u3057\u305F{resolve}{post}'    used-method    \n\n/set truncation verbose 80\n/set truncation verbose 1000                                                                  varvalue,expression\n\n/set mode normal -command verbose    \n/set format normal display ''                                                               added,modified,replaced,overwrote,dropped-update    \n/set format normal display '{pre}{action} variable {name}, reset to null{post}'             replaced-vardecl,varinit-ok-update    \n/set format normal display '{result}'                                                       added,modified,replaced-expression,varvalue,assignment,varinit,vardecl-ok-primary    \n/set mode concise -quiet normal    \n\n/set prompt concise 'jshell> '   '   ...> '    \n\n/set format concise display ''                                                              class,interface,enum,annotation,method,assignment,varinit,vardecl-ok    \n\n/set feedback normal    \n\n/set mode silent -quiet    \n/set prompt silent '-> ' '>> '    \n/set format silent pre '|  '    \n/set format silent post '%n'    \n/set format silent errorpre '|  '    \n/set format silent errorpost '%n'    \n/set format silent display ''    \n
+'{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u3001\u3053\u308C\u3089\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}'  unresolved1-error2    \n/set format verbose unrerr '{unresolved}\u304C\u5BA3\u8A00\u3055\u308C\u3001\u3053\u308C\u3089\u306E\u30A8\u30E9\u30FC\u306F\u4FEE\u6B63\u3055\u308C\u307E\u3057\u305F: {errors}' unresolved2-error2    \n\n/set format verbose resolve '{until}{unrerr}'                                                   added,modified,replaced,used    \n\n/set format verbose typeKind '\u30AF\u30E9\u30B9'                  class    \n/set format verbose typeKind '\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9'              interface    \n/set format verbose typeKind '\u5217\u6319\u578B'                   enum    \n/set format verbose typeKind '\u6CE8\u91C8\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9'   annotation    \n\n/set format verbose result '{name} ==> {value}{post}'                                        added,modified,replaced-ok-primary    \n\n/set format verbose display '{result}{pre}\u30B9\u30AF\u30E9\u30C3\u30C1\u5909\u6570{name}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F : {type}{post}'    expression-added,modified,replaced-primary    \n/set format verbose display '{result}{pre}{name}\u306E\u5024 : {type}{post}'                    varvalue-primary    \n/set format verbose display '{result}{pre}{name}\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u307E\u3057\u305F : {type}{post}'                 assignment-primary    \n/set format verbose display '{result}{pre}{action} \u5909\u6570 {name} : {type}{resolve}{post}'  varinit,vardecl    \n/set format verbose display '{pre}{action} \u5909\u6570 {name}{resolve}{post}'                   vardecl,varinit-notdefined    \n/set format verbose display '{pre}{action} \u5909\u6570 {name}{post}'                            dropped-vardecl,varinit,expression    \n/set format verbose display '{pre}{action} \u5909\u6570 {name}\u3001null\u306B\u30EA\u30BB\u30C3\u30C8\u3055\u308C\u307E\u3057\u305F{post}'             replaced-vardecl,varinit-ok-update    \n\n/set format verbose display '{pre}{action} {typeKind} {name}{resolve}{post}'                 class,interface,enum,annotation    \n/set format verbose display '{pre}{action} \u30E1\u30BD\u30C3\u30C9 {name}({type})\u3092\u547C\u3073\u51FA\u305D\u3046\u3068\u3057\u307E\u3057\u305F{resolve}{post}'             method    \n\n/set format verbose display '{pre}{typeKind} {name}\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F{resolve}{post}'         used-class,interface,enum,annotation    \n/set format verbose display '{pre}\u30E1\u30BD\u30C3\u30C9{name}({type})\u3092\u547C\u3073\u51FA\u305D\u3046\u3068\u3057\u307E\u3057\u305F{resolve}{post}'    used-method    \n\n/set truncation verbose 80\n/set truncation verbose 1000                                                                  varvalue,expression\n\n/set mode normal -command verbose    \n/set format normal display ''                                                               added,modified,replaced,overwrote,dropped-update    \n/set format normal display '{pre}{action} \u5909\u6570 {name}\u3001null\u306B\u30EA\u30BB\u30C3\u30C8\u3055\u308C\u307E\u3057\u305F{post}' replaced-vardecl,varinit-ok-update    \n/set format normal display '{result}'                                                       added,modified,replaced-expression,varvalue,assignment,varinit,vardecl-ok-primary    \n/set mode concise -quiet normal    \n\n/set prompt concise 'jshell> '   '   ...> '    \n\n/set format concise display ''                                                              class,interface,enum,annotation,method,assignment,varinit,vardecl-ok    \n\n/set feedback normal    \n\n/set mode silent -quiet    \n/set prompt silent '-> ' '>> '    \n/set format silent pre '|  '    \n/set format silent post '%n'    \n/set format silent errorpre '|  '    \n/set format silent errorpost '%n'    \n/set format silent display ''    \n
--- a/langtools/test/tools/javac/6330997/T6330997.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/javac/6330997/T6330997.java	Fri Aug 05 12:03:58 2016 -0700
@@ -44,9 +44,7 @@
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.ClassFinder.BadClassFile;
 import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.util.List;
 import javax.tools.ToolProvider;
 
 public class T6330997 {
@@ -57,8 +55,7 @@
         JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, null, null, null, null, null);
         JavaCompiler compiler = JavaCompiler.instance(task.getContext());
         Symtab syms = Symtab.instance(task.getContext());
-        Modules modules = Modules.instance(task.getContext());
-        modules.enter(List.nil(), null);
+        task.ensureEntered();
         try {
             compiler.resolveIdent(syms.unnamedModule, "T1").complete();
         } catch (Exception e) {
--- a/langtools/test/tools/javac/T6435291/T6435291.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/javac/T6435291/T6435291.java	Fri Aug 05 12:03:58 2016 -0700
@@ -38,9 +38,7 @@
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.ClassFinder.BadClassFile;
 import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.util.List;
 import javax.tools.ToolProvider;
 
 public class T6435291 {
@@ -48,8 +46,7 @@
         javax.tools.JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, null, null, null, null, null);
         Symtab syms = Symtab.instance(task.getContext());
-        //initialize unnamed module:
-        Modules.instance(task.getContext()).enter(List.nil(), syms.errSymbol);
+        task.ensureEntered();
         JavaCompiler compiler = JavaCompiler.instance(task.getContext());
         try {
             compiler.resolveIdent(syms.unnamedModule, "T").complete();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8161277/IsSameTypeWildcardTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8161277
+ * @summary javax.lang.model.util.Types.isSameType(...) returns true on wildcards
+ * @library /tools/lib/types
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.comp
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.model
+ * @build TypeHarness
+ * @run main IsSameTypeWildcardTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.model.JavacTypes;
+
+public class IsSameTypeWildcardTest extends TypeHarness {
+    StrToTypeFactory strToTypeFactory;
+    JavacTypes javacTypes;
+
+    public static void main(String... args) throws Exception {
+        new IsSameTypeWildcardTest().runTest();
+    }
+
+    public IsSameTypeWildcardTest() {
+        javacTypes = JavacTypes.instance(context);
+    }
+
+    void runTest() {
+        List<String> imports = new ArrayList<>();
+        imports.add("java.util.*");
+        strToTypeFactory = new StrToTypeFactory(null, imports, null);
+
+        Type listOfWildcard = strToTypeFactory.getType("List<?>");
+        com.sun.tools.javac.util.List<Type> arguments = listOfWildcard.getTypeArguments();
+        Assert.check(!javacTypes.isSameType(arguments.head, arguments.head),
+                "if any argument is a wildcard then result must be false");
+    }
+}
--- a/langtools/test/tools/javac/api/6400303/T6400303.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/javac/api/6400303/T6400303.java	Fri Aug 05 12:03:58 2016 -0700
@@ -41,17 +41,14 @@
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.util.List;
 
 public class T6400303 {
     public static void main(String... args) {
         javax.tools.JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, null, null, null, null, null);
         Symtab syms = Symtab.instance(task.getContext());
-        //initialize unnamed module:
-        Modules.instance(task.getContext()).enter(List.nil(), syms.errSymbol);
+        task.ensureEntered();
         JavaCompiler compiler = JavaCompiler.instance(task.getContext());
         try {
             compiler.resolveIdent(syms.unnamedModule, "Test$1").complete();
--- a/langtools/test/tools/javac/api/TestResolveIdent.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/javac/api/TestResolveIdent.java	Fri Aug 05 12:03:58 2016 -0700
@@ -36,9 +36,7 @@
 
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.util.List;
 import java.io.IOException;
 import javax.tools.ToolProvider;
 
@@ -54,8 +52,7 @@
         JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, null, null, null, null, null);
         JavaCompiler compiler = JavaCompiler.instance(task.getContext());
         Symtab syms = Symtab.instance(task.getContext());
-        Modules modules = Modules.instance(task.getContext());
-        modules.enter(List.nil(), null);
+        task.ensureEntered();
         System.out.println(compiler.resolveIdent(syms.unnamedModule, getDeprecatedClass().getCanonicalName()));
     }
 
--- a/langtools/test/tools/javac/defaultMethods/BadClassfile.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/javac/defaultMethods/BadClassfile.java	Fri Aug 05 12:03:58 2016 -0700
@@ -42,11 +42,9 @@
 import com.sun.tools.javac.code.ClassFinder.BadClassFile;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.JCDiagnostic;
-import com.sun.tools.javac.util.List;
 import java.io.File;
 import java.util.Arrays;
 import java.util.Objects;
@@ -74,8 +72,7 @@
         JavacTaskImpl task = (JavacTaskImpl) c.getTask(null, null, null, Arrays.asList("-classpath", System.getProperty("test.classes", ".")), null, null);
         Symtab syms = Symtab.instance(task.getContext());
 
-        //initialize unnamed module:
-        Modules.instance(task.getContext()).enter(List.nil(), syms.errSymbol);
+        task.ensureEntered();
 
         try {
             Symbol clazz = com.sun.tools.javac.main.JavaCompiler.instance(task.getContext()).resolveIdent(syms.unnamedModule, classname);
--- a/langtools/test/tools/javac/lib/combo/ReusableContext.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/javac/lib/combo/ReusableContext.java	Fri Aug 05 12:03:58 2016 -0700
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.comp.CompileStates;
 import com.sun.tools.javac.comp.Enter;
+import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.main.Arguments;
 import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -92,6 +93,7 @@
             ((ReusableJavaCompiler)ReusableJavaCompiler.instance(this)).clear();
             Types.instance(this).newRound();
             Check.instance(this).newRound();
+            Modules.instance(this).newRound();
             CompileStates.instance(this).clear();
             MultiTaskListener.instance(this).clear();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/T8158224/Processor.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.SourceVersion;
+
+@SupportedAnnotationTypes("Blah")
+@SupportedSourceVersion(SourceVersion.RELEASE_6)
+public class Processor extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> tE, RoundEnvironment env) {
+        return true;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/T8158224/T8158224.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8158224
+ * @summary NullPointerException in com.sun.tools.javac.comp.Modules.checkCyclicDependencies when module missing
+ * @build Processor
+ * @compile/fail/ref=T8158224.out -XDrawDiagnostics -processor Processor mods/foo/module-info.java
+ */
+
+// No code here, this file is just to host test description.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/T8158224/T8158224.out	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,2 @@
+module-info.java:4:14: compiler.err.module.not.found: nonexistent
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/T8158224/mods/foo/module-info.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,5 @@
+/* /nodynamiccopyright/ */
+
+module foo {
+    requires nonexistent;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/ControlCharTest.java	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8143366
+ * @summary Check that control chars are displayed correctly
+ * @modules jdk.jdeps/com.sun.tools.javap
+ * @run testng ControlCharTest
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Scanner;
+import java.util.regex.Pattern;
+
+public class ControlCharTest {
+    private String classpath;
+    private Path output;
+    private Pattern ptrn;
+
+    @BeforeClass
+    public void initialize() throws Exception {
+        String testClasses = System.getProperty("test.classes", ".");
+        classpath = "-classpath " + testClasses + " ControlCharTest$Strings";
+        String userdir = System.getProperty("user.dir", ".");
+        output = Paths.get(userdir, "output.txt");
+        String regex = Pattern.quote("\\u0001\\u0002\\u0003")  // \u0001\u0002\u0003
+                + ".+123.+"                   // 123
+                + Pattern.quote("\\\\u0000")  // \\u0000
+                + ".+"
+                + Pattern.quote("\\u0000")    // \u0000
+                ;
+        ptrn = Pattern.compile(regex, Pattern.DOTALL);
+    }
+
+    @AfterClass
+    public void close() throws IOException {
+        Files.deleteIfExists(output);
+    }
+
+    @DataProvider(name = "options")
+    public Object[][] createData() {
+        return new Object[][] {
+                { "-v", ""},
+                { "-constants", ""}
+        };
+    }
+    @Test(dataProvider = "options")
+    public void test(String option, String ignore) throws Exception {
+        String cmdline = option + " " + classpath;
+        javap(cmdline.split(" +"));
+        try (Scanner scnr = new Scanner(output)) {
+            Assert.assertNotNull(scnr.findWithinHorizon(ptrn, 0));
+        }
+    }
+
+    private void javap(String... args) throws Exception {
+        try (PrintWriter out = new PrintWriter(output.toFile())) {
+            int rc = com.sun.tools.javap.Main.run(args, out);
+            if (rc < 0)
+                throw new Exception("javap exited, rc=" + rc);
+        }
+    }
+
+    // small class to test
+    static class Strings {
+        static final String s = "\1\2\3";
+        static final String s1 = "123";
+        static final String s2 = "\\u0000";
+        static final String s3 = "\0";
+        static String f() { return s + s1 + s2 + s3; }
+    }
+}
+
+
--- a/langtools/test/tools/lib/types/TypeHarness.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/langtools/test/tools/lib/types/TypeHarness.java	Fri Aug 05 12:03:58 2016 -0700
@@ -22,6 +22,7 @@
  */
 
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
@@ -40,6 +41,7 @@
 import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.comp.Infer;
 import com.sun.tools.javac.comp.InferenceContext;
+import com.sun.tools.javac.comp.Modules;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Name;
@@ -82,6 +84,7 @@
  * The code then verifies that {@code [X:=Object,Y:=Object]A<X,Y> == A<Object,Object>}.
  *
  * @author mcimadamore
+ * @author vromero
  */
 public class TypeHarness {
 
@@ -91,19 +94,20 @@
     protected Names names;
     protected ReusableJavaCompiler tool;
     protected Infer infer;
+    protected Context context;
 
     protected Factory fac;
 
     protected TypeHarness() {
-        Context ctx = new Context();
-        JavacFileManager.preRegister(ctx);
-        MyAttr.preRegister(ctx);
-        tool = new ReusableJavaCompiler(ctx);
-        types = Types.instance(ctx);
-        infer = Infer.instance(ctx);
-        chk = Check.instance(ctx);
-        predef = Symtab.instance(ctx);
-        names = Names.instance(ctx);
+        context = new Context();
+        JavacFileManager.preRegister(context);
+        MyAttr.preRegister(context);
+        tool = new ReusableJavaCompiler(context);
+        types = Types.instance(context);
+        infer = Infer.instance(context);
+        chk = Check.instance(context);
+        predef = Symtab.instance(context);
+        names = Names.instance(context);
         fac = new Factory();
     }
 
@@ -411,8 +415,8 @@
         public StrToTypeFactory(String pkg, java.util.List<String> imports, java.util.List<String> typeVarDecls) {
             this.pkg = pkg;
             this.imports = imports;
-            this.typeVarDecls = typeVarDecls;
-            this.typeVariables = from(typeVarDecls.stream()
+            this.typeVarDecls = typeVarDecls == null ? new ArrayList<>() : typeVarDecls;
+            this.typeVariables = from(this.typeVarDecls.stream()
                     .map(this::typeVarName)
                     .map(this::getType)
                     .collect(Collectors.toList())
@@ -420,7 +424,7 @@
         }
 
         TypeVar getTypeVarFromStr(String name) {
-            if (typeVarDecls == null) {
+            if (typeVarDecls.isEmpty()) {
                 return null;
             }
             int index = typeVarDecls.indexOf(name);
@@ -476,7 +480,7 @@
             public CharSequence getCharContent(boolean ignoreEncodingErrors) {
                 String impStmts = imports.size() > 0 ?
                         imports.stream().map(i -> "import " + i + ";").collect(Collectors.joining("\n")) : "";
-                String tvars = typeVarDecls.size() > 0 ?
+                String tvars = !typeVarDecls.isEmpty() ?
                         typeVarDecls.stream().collect(Collectors.joining(",", "<", ">")) : "";
                 return template
                         .replace("#Package", (pkg == null) ? "" : "package " + pkg + ";")
@@ -534,6 +538,7 @@
 
         void clear() {
             newRound();
+            Modules.instance(context).newRound();
         }
     }
     // </editor-fold>
--- a/make/common/Modules.gmk	Fri Aug 05 16:20:02 2016 +0300
+++ b/make/common/Modules.gmk	Fri Aug 05 12:03:58 2016 -0700
@@ -55,16 +55,12 @@
     java.naming \
     java.prefs \
     java.rmi \
-    java.security.jgss \
     java.security.sasl \
     java.xml \
-    java.xml.crypto \
     jdk.httpserver \
     jdk.management \
     jdk.net \
     jdk.sctp \
-    jdk.security.auth \
-    jdk.security.jgss \
     jdk.unsupported \
     jdk.vm.ci \
     #
@@ -103,19 +99,23 @@
 PLATFORM_MODULES += \
     java.compiler \
     java.scripting \
+    java.security.jgss \
     java.smartcardio \
     java.sql \
     java.sql.rowset \
+    java.xml.crypto \
     jdk.accessibility \
     jdk.charsets \
     jdk.crypto.ec \
     jdk.crypto.pkcs11 \
     jdk.dynalink \
     jdk.jsobject \
-    jdk.xml.dom \
     jdk.localedata \
     jdk.naming.dns \
     jdk.scripting.nashorn \
+    jdk.security.auth \
+    jdk.security.jgss \
+    jdk.xml.dom \
     jdk.zipfs \
     #
 
--- a/nashorn/.hgtags	Fri Aug 05 16:20:02 2016 +0300
+++ b/nashorn/.hgtags	Fri Aug 05 12:03:58 2016 -0700
@@ -362,3 +362,4 @@
 ee90c69a18409533df8f7b602044bf966a28381a jdk-9+126
 ff07be6106fa56b72c163244f45a3ecb4c995564 jdk-9+127
 5a189c5b396c353786343b590f6c19a5d929f01d jdk-9+128
+68020a486500422e2c8b94b0f35cafe54c9e219a jdk-9+129
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Fri Aug 05 12:03:58 2016 -0700
@@ -3057,6 +3057,7 @@
 
         LexicalScope(final Global global) {
             super(global, PropertyMap.newMap());
+            setIsInternal();
         }
 
         @Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Aug 05 12:03:58 2016 -0700
@@ -123,6 +123,9 @@
     /** Is this a builtin object? */
     public static final int IS_BUILTIN             = 1 << 3;
 
+    /** Is this an internal object that should not be visible to scripts? */
+    public static final int IS_INTERNAL            = 1 << 4;
+
     /**
      * Spill growth rate - by how many elements does {@link ScriptObject#primitiveSpill} and
      * {@link ScriptObject#objectSpill} when full
@@ -1668,6 +1671,21 @@
     }
 
     /**
+     * Tag this script object as internal object that should not be visible to script code.
+     */
+    public final void setIsInternal() {
+        flags |= IS_INTERNAL;
+    }
+
+    /**
+     * Check if this script object is an internal object that should not be visible to script code.
+     * @return true if internal
+     */
+    public final boolean isInternal() {
+        return (flags & IS_INTERNAL) != 0;
+    }
+
+    /**
      * Clears the properties from a ScriptObject
      * (java.util.Map-like method to help ScriptObjectMirror implementation)
      *
@@ -2045,7 +2063,13 @@
     private Object megamorphicGet(final String key, final boolean isMethod, final boolean isScope) {
         final FindProperty find = findProperty(key, true, isScope, this);
         if (find != null) {
-            return find.getObjectValue();
+            // If this is a method invocation, and found property has a different self object then this,
+            // then return a function bound to the self object. This is the case for functions in with expressions.
+            final Object value = find.getObjectValue();
+            if (isMethod && value instanceof ScriptFunction && find.getSelf() != this && !find.getSelf().isInternal()) {
+                return ((ScriptFunction) value).createBound(find.getSelf(), ScriptRuntime.EMPTY_ARRAY);
+            }
+            return value;
         }
 
         return isMethod ? getNoSuchMethod(key, isScope, INVALID_PROGRAM_POINT) : invokeNoSuchProperty(key, isScope, INVALID_PROGRAM_POINT);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Fri Aug 05 12:03:58 2016 -0700
@@ -66,6 +66,7 @@
     WithObject(final ScriptObject scope, final ScriptObject expression) {
         super(scope, null);
         this.expression = expression;
+        setIsInternal();
     }
 
     /**
@@ -99,37 +100,23 @@
         // With scopes can never be observed outside of Nashorn code, so all call sites that can address it will of
         // necessity have a Nashorn descriptor - it is safe to cast.
         final NashornCallSiteDescriptor ndesc = (NashornCallSiteDescriptor)desc;
-        FindProperty find = null;
         GuardedInvocation link = null;
-        ScriptObject self;
-
-        final boolean isNamedOperation;
-        final String name;
         final Operation op = desc.getOperation();
-        if (op instanceof NamedOperation) {
-            isNamedOperation = true;
-            name = ((NamedOperation)op).getName().toString();
-        } else {
-            isNamedOperation = false;
-            name = null;
-        }
 
-        self = expression;
-        if (isNamedOperation) {
-             find = self.findProperty(name, true);
-        }
+        assert op instanceof NamedOperation; // WithObject is a scope object, access is always named
+        final String name = ((NamedOperation)op).getName().toString();
+
+        FindProperty find = expression.findProperty(name, true);
 
         if (find != null) {
-            link = self.lookup(desc, request);
+            link = expression.lookup(desc, request);
             if (link != null) {
                 return fixExpressionCallSite(ndesc, link);
             }
         }
 
         final ScriptObject scope = getProto();
-        if (isNamedOperation) {
-            find = scope.findProperty(name, true);
-        }
+        find = scope.findProperty(name, true);
 
         if (find != null) {
             return fixScopeCallSite(scope.lookup(desc, request), name, find.getOwner());
@@ -137,43 +124,41 @@
 
         // the property is not found - now check for
         // __noSuchProperty__ and __noSuchMethod__ in expression
-        if (self != null) {
-            final String fallBack;
+        final String fallBack;
 
-            final StandardOperation firstOp = ndesc.getFirstOperation();
-            switch (firstOp) {
-            case GET_METHOD:
-                fallBack = NO_SUCH_METHOD_NAME;
-                break;
-            case GET_PROPERTY:
-            case GET_ELEMENT:
-                fallBack = NO_SUCH_PROPERTY_NAME;
-                break;
-            default:
-                fallBack = null;
-                break;
-            }
+        final StandardOperation firstOp = ndesc.getFirstOperation();
+        switch (firstOp) {
+        case GET_METHOD:
+            fallBack = NO_SUCH_METHOD_NAME;
+            break;
+        case GET_PROPERTY:
+        case GET_ELEMENT:
+            fallBack = NO_SUCH_PROPERTY_NAME;
+            break;
+        default:
+            fallBack = null;
+            break;
+        }
 
-            if (fallBack != null) {
-                find = self.findProperty(fallBack, true);
-                if (find != null) {
-                    switch (firstOp) {
-                    case GET_METHOD:
-                        link = self.noSuchMethod(desc, request);
-                        break;
-                    case GET_PROPERTY:
-                    case GET_ELEMENT:
-                        link = self.noSuchProperty(desc, request);
-                        break;
-                    default:
-                        break;
-                    }
+        if (fallBack != null) {
+            find = expression.findProperty(fallBack, true);
+            if (find != null) {
+                switch (firstOp) {
+                case GET_METHOD:
+                    link = expression.noSuchMethod(desc, request);
+                    break;
+                case GET_PROPERTY:
+                case GET_ELEMENT:
+                    link = expression.noSuchProperty(desc, request);
+                    break;
+                default:
+                    break;
                 }
             }
+        }
 
-            if (link != null) {
-                return fixExpressionCallSite(ndesc, link);
-            }
+        if (link != null) {
+            return fixExpressionCallSite(ndesc, link);
         }
 
         // still not found, may be scope can handle with it's own
@@ -204,7 +189,7 @@
         // (as opposed from another non-scope object in the proto chain such as Object.prototype).
         final FindProperty exprProperty = expression.findProperty(key, true, false, expression);
         if (exprProperty != null) {
-             return exprProperty;
+            return exprProperty;
         }
         return super.findProperty(key, deep, isScope, start);
     }
@@ -295,14 +280,14 @@
     private GuardedInvocation fixScopeCallSite(final GuardedInvocation link, final String name, final ScriptObject owner) {
         final GuardedInvocation newLink             = fixReceiverType(link, WITHSCOPEFILTER);
         final MethodHandle      expressionGuard     = expressionGuard(name, owner);
-        final MethodHandle      filterGuardReceiver = filterGuardReceiver(newLink, WITHSCOPEFILTER);
+        final MethodHandle      filteredGuard       = filterGuardReceiver(newLink, WITHSCOPEFILTER);
         return link.replaceMethods(
                 filterReceiver(
                         newLink.getInvocation(),
                         WITHSCOPEFILTER),
                 NashornGuards.combineGuards(
                         expressionGuard,
-                        filterGuardReceiver));
+                        filteredGuard));
     }
 
     private static MethodHandle filterGuardReceiver(final GuardedInvocation link, final MethodHandle receiverFilter) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Fri Aug 05 16:20:02 2016 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Fri Aug 05 12:03:58 2016 -0700
@@ -140,7 +140,7 @@
         if (!needsGuard(property, desc)) {
             return null;
         }
-        if (NashornCallSiteDescriptor.isScope(desc)) {
+        if (NashornCallSiteDescriptor.isScope(desc) && sobj.isScope()) {
             if (property != null && property.isBound() && !property.canChangeType()) {
                 // This is a declared top level variables in main script or eval, use identity guard.
                 return getIdentityGuard(sobj);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Fri Aug 05 16:20:02 2016 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Fri Aug 05 12:03:58 2016 -0700
@@ -135,3 +135,41 @@
 Math.sqrt=returns an approximation to the square root of given argument
 
 Math.tan=returns an approximation to the tangent of given argument
+
+String.fromCharCode=returns a string value containing the characters corresponding to the sequence of unicode values given as arguments
+
+String.prototype.toString=returns string value of calling object, returns TypeError if calling object is not a string object
+
+String.prototype.valueOf=returns string value of calling object, returns TypeError if calling object is not a string object
+
+String.prototype.charAt=returns string value representing the character at the index given as argument, empty string if the index is out of range
+
+String.prototype.concat=returns the string resulting from appending the argument string value to the calling object
+
+String.prototype.indexOf=returns the index of first occurrence of specified string, starting the search from position given as argument, returns -1 if the string is not found
+
+String.prototype.lastIndexOf=returns the index of last occurrence of specified string, searching backwards from position given as argument, returns -1 if the string is not found
+
+String.prototype.localeCompare=returns negative, zero, or positive value if calling string value comes before, equal, or after argument string value in the locale-sensitive sort order
+
+String.prototype.match=returns an array containing entire match result when matching calling string value against regular expression given as argument
+
+String.prototype.replace=returns a new string with some or all matches of pattern argument replaced by the given replacement argument
+
+String.prototype.search=returns index of the first occurrence of the match between regular expression given as argument and the calling string, returns -1 if not found
+
+String.prototype.slice=returns a new string by extracting a section of the string according to given arguments
+
+String.prototype.split=returns an array of strings split at each point where the separator given as argument occurs in the calling string, number of array elements is limited by second argument
+
+String.prototype.substring=returns a new string value extracted from the calling string starting from first argument position to position before the second argument position
+
+String.prototype.toLowerCase=returns a new string representing the calling string value converted to lower case
+
+String.prototype.toLocaleLowerCase=returns a new string representing the calling string value converted to lower case according to any locale specific case mappings
+
+String.prototype.toUpperCase=returns a new string representing the calling string value converted to upper case
+
+String.prototype.toLocaleUpperCase=returns a new string representing the calling string value converted to upper case according to any locale specific case mappings
+
+String.prototype.trim=returns a new string representing the calling string with white space removed from both ends
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8160034.js	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8160034.js: The `this` value in the `with` is broken by the repetition of a function call
+ *
+ * @test
+ * @option --unstable-relink-threshold=4
+ * @run
+ */
+
+
+var bar = "BAR";
+
+function Foo() {
+    this.bar = "bar";
+    this.baz = "baz";
+}
+
+function foo_proto_h() {
+    print(this.bar);
+    delete Foo.prototype._h;
+}
+
+function foo_proto_e() {
+    print(this.baz);
+}
+
+function _h() {
+    print(this.bar);
+    Foo.prototype._h = foo_proto_h;
+}
+
+Foo.prototype._e = foo_proto_e;
+Foo.prototype._h = foo_proto_h;
+
+
+var fn = new Function("with(this) { _h(); _e(); }");
+
+for (var i = 0; i < 20; i++) {
+    fn.call(new Foo());
+}
+
+for (var i = 0; i < 20; i++) {
+    foo = new Foo();
+    foo['e' + Math.random()] = 1; // force new map
+    fn.call(foo);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8160034.js.EXPECTED	Fri Aug 05 12:03:58 2016 -0700
@@ -0,0 +1,80 @@
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz
+bar
+baz
+BAR
+baz