Merge
authorduke
Wed, 05 Jul 2017 22:01:14 +0200
changeset 39912 2a5e25f03b54
parent 39911 86902ef5ff79 (current diff)
parent 39910 af46336cbca4 (diff)
child 39921 69e23f5892a7
Merge
jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/FeatureManager.java
jdk/src/java.base/linux/classes/sun/nio/fs/GioFileTypeDetector.java
jdk/src/java.base/linux/classes/sun/nio/fs/MagicFileTypeDetector.java
jdk/src/java.base/linux/native/libnio/fs/GioFileTypeDetector.c
jdk/src/java.base/linux/native/libnio/fs/MagicFileTypeDetector.c
jdk/src/java.base/windows/conf/security/java.policy
jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/AccessibilityEventMonitor.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractModuleEntry.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ArchiveEntryModuleEntry.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ByteArrayModuleEntry.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModuleEntryFactory.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModulePoolImpl.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PathModuleEntry.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/LinkModule.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModulePool.java
jdk/test/java/util/SplittableRandom/SplittableRandomTest.java
jdk/test/java/util/concurrent/ThreadLocalRandom/ThreadLocalRandomTest.java
--- a/.hgtags-top-repo	Thu Jul 28 16:08:15 2016 +0000
+++ b/.hgtags-top-repo	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/corba/.hgtags	Wed Jul 05 22:01:14 2017 +0200
@@ -371,3 +371,4 @@
 c7f5ba08fcd4b8416e62c21229f9a07c95498919 jdk-9+126
 8fab452b6f4710762ba1d8e55fd62db00b1355fe jdk-9+127
 1f093d3f8cd99cd37c3b0af4cf5c3bffaa9c8b98 jdk-9+128
+c3e83ccab3bb1733ae903d681879a33f85ed465c jdk-9+129
--- a/hotspot/.hgtags	Thu Jul 28 16:08:15 2016 +0000
+++ b/hotspot/.hgtags	Wed Jul 05 22:01:14 2017 +0200
@@ -531,3 +531,4 @@
 adc8c84b7cf8c540d920182f78a2bc982366432a jdk-9+126
 352357128f602dcf0426b1cbe011a4685a4d9f97 jdk-9+127
 22bf6db9767b1b3a1994cbf32eb3331f31ae2093 jdk-9+128
+e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129
--- a/jaxp/.hgtags	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/.hgtags	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/XalanConstants.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ /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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/LiteralElement.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XslElement.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xni/parser/XMLInputSource.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathImplUtil.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/test/TEST.ROOT	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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/jdk/.hgtags	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/.hgtags	Wed Jul 05 22:01:14 2017 +0200
@@ -371,3 +371,4 @@
 6fda66a5bdf2da8994032b9da2078a4137f4d954 jdk-9+126
 7a97b89ba83077ca62e4aa5a05437adc8f315343 jdk-9+127
 9446c534f0222b4eecfd9d9e25ab37c4fd4400a5 jdk-9+128
+47699aa2e69ec2702542dc73eb01de3bfb61aea0 jdk-9+129
--- a/jdk/make/copy/Copy-java.base.gmk	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/copy/Copy-java.base.gmk	Wed Jul 05 22:01:14 2017 +0200
@@ -166,18 +166,7 @@
 POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
 POLICY_DST := $(CONF_DST_DIR)/security/java.policy
 
-POLICY_SRC_LIST :=
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
-endif
-
-# Allow imported modules to modify the java.policy
-ifneq ($(IMPORT_MODULES_CONF), )
-  POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
-endif
-
-POLICY_SRC_LIST += $(POLICY_SRC)
+POLICY_SRC_LIST := $(POLICY_SRC)
 
 $(POLICY_DST): $(POLICY_SRC_LIST)
 	$(MKDIR) -p $(@D)
@@ -189,6 +178,30 @@
 
 ################################################################################
 
+DEF_POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/lib/security/default.policy
+DEF_POLICY_DST := $(LIB_DST_DIR)/security/default.policy
+
+DEF_POLICY_SRC_LIST := $(DEF_POLICY_SRC)
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  DEF_POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/lib/security/default.policy
+endif
+
+# Allow imported modules to modify the java.policy
+ifneq ($(IMPORT_MODULES_CONF), )
+  DEF_POLICY_SRC_LIST += $(wildcard $(IMPORT_MODULES_CONF)/java.base/security/java.policy.extra)
+endif
+
+$(DEF_POLICY_DST): $(DEF_POLICY_SRC_LIST)
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	$(foreach f,$(DEF_POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
+	$(MV) $@.tmp $@
+
+TARGETS += $(DEF_POLICY_DST)
+
+################################################################################
+
 ifeq ($(CACERTS_FILE), )
   CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
 endif
--- a/jdk/make/data/tzdata/VERSION	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/VERSION	Wed Jul 05 22:01:14 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2016d
+tzdata2016f
--- a/jdk/make/data/tzdata/africa	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/africa	Wed Jul 05 22:01:14 2017 +0200
@@ -366,6 +366,12 @@
 # decision to abandon DST permanently.  See Ahram Online 2015-04-24.
 # http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx
 
+# From Steffen Thorsen (2016-04-29):
+# Egypt will have DST from July 7 until the end of October....
+# http://english.ahram.org.eg/NewsContentP/1/204655/Egypt/Daylight-savings-time-returning-to-Egypt-on--July.aspx
+# From Mina Samuel (2016-07-04):
+# Egyptian government took the decision to cancel the DST,
+
 Rule	Egypt	2008	only	-	Aug	lastThu	24:00	0	-
 Rule	Egypt	2009	only	-	Aug	20	24:00	0	-
 Rule	Egypt	2010	only	-	Aug	10	24:00	0	-
@@ -881,11 +887,11 @@
 Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
 Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 Rule	Morocco	2011	only	-	Apr	 3	 0:00	1:00	S
-Rule	Morocco	2011	only	-	Jul	31	 0	0	-
+Rule	Morocco	2011	only	-	Jul	31	 0:00	0	-
 Rule	Morocco	2012	2013	-	Apr	lastSun	 2:00	1:00	S
-Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
 Rule	Morocco	2012	only	-	Jul	20	 3:00	0	-
 Rule	Morocco	2012	only	-	Aug	20	 2:00	1:00	S
+Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
 Rule	Morocco	2013	only	-	Jul	 7	 3:00	0	-
 Rule	Morocco	2013	only	-	Aug	10	 2:00	1:00	S
 Rule	Morocco	2013	max	-	Oct	lastSun	 3:00	0	-
--- a/jdk/make/data/tzdata/antarctica	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/antarctica	Wed Jul 05 22:01:14 2017 +0200
@@ -36,7 +36,7 @@
 #
 # Except for the French entries,
 # I made up all time zone abbreviations mentioned here; corrections welcome!
-# FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited.
+# FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited.
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -90,22 +90,22 @@
 # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Casey	0	-	zzz	1969
+Zone Antarctica/Casey	0	-	-00	1969
 			8:00	-	AWST	2009 Oct 18  2:00
 						# Australian Western Std Time
 			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
 			8:00	-	AWST	2011 Oct 28  2:00
 			11:00	-	CAST	2012 Feb 21 17:00u
 			8:00	-	AWST
-Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
+Zone Antarctica/Davis	0	-	-00	1957 Jan 13
 			7:00	-	DAVT	1964 Nov    # Davis Time
-			0	-	zzz	1969 Feb
+			0	-	-00	1969 Feb
 			7:00	-	DAVT	2009 Oct 18  2:00
 			5:00	-	DAVT	2010 Mar 10 20:00u
 			7:00	-	DAVT	2011 Oct 28  2:00
 			5:00	-	DAVT	2012 Feb 21 20:00u
 			7:00	-	DAVT
-Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
+Zone Antarctica/Mawson	0	-	-00	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
 			5:00	-	MAWT
 # References:
@@ -160,7 +160,7 @@
 #	fishing stations operated variously 1819/1931
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Kerguelen	0	-	zzz	1950 # Port-aux-Français
+Zone Indian/Kerguelen	0	-	-00	1950 # Port-aux-Français
 			5:00	-	TFT	# ISO code TF Time
 #
 # year-round base in the main continent
@@ -171,9 +171,9 @@
 # It was destroyed by fire on 1952-01-14.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/DumontDUrville 0 -	zzz	1947
+Zone Antarctica/DumontDUrville 0 -	-00	1947
 			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
-			0	-	zzz	1956 Nov
+			0	-	-00	1956 Nov
 			10:00	-	DDUT	# Dumont-d'Urville Time
 
 # France & Italy - year-round base
@@ -199,7 +199,7 @@
 # was established on 1957-01-29.  Since Syowa station is still the main
 # station of Japan, it's appropriate for the principal location.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Syowa	0	-	zzz	1957 Jan 29
+Zone Antarctica/Syowa	0	-	-00	1957 Jan 29
 			3:00	-	SYOT	# Syowa Time
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
@@ -249,7 +249,7 @@
 # Remove the following line when uncommenting the above '#Rule' lines.
 Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Troll	0	-	zzz	2005 Feb 12
+Zone Antarctica/Troll	0	-	-00	2005 Feb 12
 			0:00	Troll	%s
 
 # Poland - year-round base
@@ -290,7 +290,7 @@
 # happened to be during their visit.  So we still don't really know what time
 # it is at Vostok.  But we'll guess UTC+6.
 #
-Zone Antarctica/Vostok	0	-	zzz	1957 Dec 16
+Zone Antarctica/Vostok	0	-	-00	1957 Dec 16
 			6:00	-	VOST	# Vostok time
 
 # S Africa - year-round bases
@@ -323,7 +323,7 @@
 # <http://webexhibits.org/daylightsaving/g.html> says Rothera is -03 all year.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Rothera	0	-	zzz	1976 Dec  1
+Zone Antarctica/Rothera	0	-	-00	1976 Dec  1
 			-3:00	-	ROTT	# Rothera time
 
 # Uruguay - year round base
--- a/jdk/make/data/tzdata/asia	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/asia	Wed Jul 05 22:01:14 2017 +0200
@@ -169,7 +169,7 @@
 			3:00	-	BAKT	1957 Mar    # Baku Time
 			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
 			3:00	1:00	BAKST	1991 Aug 30 # independence
-			3:00 RussiaAsia	AZ%sT	1992 Sep lastSat 23:00
+			3:00 RussiaAsia	AZ%sT	1992 Sep lastSun  2:00s
 			4:00	-	AZT	1996     # Azerbaijan Time
 			4:00	EUAsia	AZ%sT	1997
 			4:00	Azer	AZ%sT
--- a/jdk/make/data/tzdata/australasia	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/australasia	Wed Jul 05 22:01:14 2017 +0200
@@ -266,11 +266,11 @@
 # will produce a binary file with an [A]EST-type as the first 32-bit type;
 # this is required for correct handling of times before 1916 by
 # pre-2013 versions of localtime.
-Zone Antarctica/Macquarie 0	-	zzz	1899 Nov
+Zone Antarctica/Macquarie 0	-	-00	1899 Nov
 			10:00	-	AEST	1916 Oct  1  2:00
 			10:00	1:00	AEDT	1917 Feb
 			10:00	Aus	AE%sT	1919 Apr  1  0:00s
-			0	-	zzz	1948 Mar 25
+			0	-	-00	1948 Mar 25
 			10:00	Aus	AE%sT	1967
 			10:00	AT	AE%sT	2010 Apr  4  3:00
 			11:00	-	MIST	# Macquarie I Standard Time
--- a/jdk/make/data/tzdata/europe	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/europe	Wed Jul 05 22:01:14 2017 +0200
@@ -778,6 +778,14 @@
 			1:00	EU	CE%sT
 
 # Belarus
+#
+# From Stepan Golosunov (2016-07-02):
+# http://www.lawbelarus.com/repub/sub30/texf9611.htm
+# (Act of the Cabinet of Ministers of the Republic of Belarus from
+# 1992-03-25 No. 157) ... says clocks were to be moved forward at 2:00
+# on last Sunday of March and backward at 3:00 on last Sunday of September
+# (the same as previous USSR and contemporary Russian regulations).
+#
 # From Yauhen Kharuzhy (2011-09-16):
 # By latest Belarus government act Europe/Minsk timezone was changed to
 # GMT+3 without DST (was GMT+2 with DST).
@@ -801,9 +809,6 @@
 			1:00	C-Eur	CE%sT	1944 Jul  3
 			3:00	Russia	MSK/MSD	1990
 			3:00	-	MSK	1991 Mar 31  2:00s
-			2:00	1:00	EEST	1991 Sep 29  2:00s
-			2:00	-	EET	1992 Mar 29  0:00s
-			2:00	1:00	EEST	1992 Sep 27  0:00s
 			2:00	Russia	EE%sT	2011 Mar 27  2:00s
 			3:00	-	FET	2014 Oct 26  1:00s
 			3:00	-	MSK
@@ -2746,14 +2751,22 @@
 # Asia/Novosibirsk covers:
 # 54	RU-NVS	Novosibirsk Oblast
 
+# From Stepan Golosunov (2016-05-30):
+# http://asozd2.duma.gov.ru/main.nsf/(Spravka)?OpenAgent&RN=1085784-6
+# moves Novosibirsk oblast from UTC+6 to UTC+7.
+# From Stepan Golosunov (2016-07-04):
+# The law was signed yesterday and published today on
+# http://publication.pravo.gov.ru/Document/View/0001201607040064
+
 Zone Asia/Novosibirsk	 5:31:40 -	LMT	1919 Dec 14  6:00
-			 6:00	-	NOVT	1930 Jun 21 # Novosibirsk Time
-			 7:00	Russia	NOV%sT	1991 Mar 31  2:00s
-			 6:00	Russia	NOV%sT	1992 Jan 19  2:00s
-			 7:00	Russia	NOV%sT	1993 May 23 # say Shanks & P.
-			 6:00	Russia	NOV%sT	2011 Mar 27  2:00s
-			 7:00	-	NOVT	2014 Oct 26  2:00s
-			 6:00	-	NOVT
+			 6:00	-	+06	1930 Jun 21
+			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
+			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
+			 7:00	Russia	+07/+08	1993 May 23 # say Shanks & P.
+			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
+			 7:00	-	+07	2014 Oct 26  2:00s
+			 6:00	-	+06	2016 Jul 24  2:00s
+			 7:00	-	+07
 
 # From Paul Eggert (2016-03-18):
 # Asia/Tomsk covers:
@@ -2794,6 +2807,9 @@
 # approved by the Federation Council on 2016-04-20, signed by the President and
 # published as a law around 2016-04-26.
 
+# From Matt Johnson (2016-04-26):
+# http://publication.pravo.gov.ru/Document/View/0001201604260048
+
 Zone	Asia/Tomsk	 5:39:51 -	LMT	1919 Dec 22
 			 6:00	-	+06	1930 Jun 21
 			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
@@ -2833,14 +2849,12 @@
 # realigning itself with KRAT.
 
 Zone Asia/Novokuznetsk	 5:48:48 -	LMT	1924 May  1
-			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
-			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
-			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
-			 7:00	Russia	KRA%sT	2010 Mar 28  2:00s
-			 6:00	Russia	NOV%sT	2011 Mar 27  2:00s # Novosibirsk
-			 7:00	-	NOVT	2014 Oct 26  2:00s
-			 7:00	-	KRAT	# Krasnoyarsk Time
-
+			 6:00	-	+06	1930 Jun 21
+			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
+			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
+			 7:00	Russia	+07/+08	2010 Mar 28  2:00s
+			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
+			 7:00	-	+07
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
 # Asia/Krasnoyarsk covers...
--- a/jdk/make/data/tzdata/northamerica	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/northamerica	Wed Jul 05 22:01:14 2017 +0200
@@ -2214,39 +2214,39 @@
 Rule	NT_YK	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # aka Panniqtuuq
-Zone America/Pangnirtung 0	-	zzz	1921 # trading post est.
+Zone America/Pangnirtung 0	-	-00	1921 # trading post est.
 			-4:00	NT_YK	A%sT	1995 Apr Sun>=1  2:00
 			-5:00	Canada	E%sT	1999 Oct 31  2:00
 			-6:00	Canada	C%sT	2000 Oct 29  2:00
 			-5:00	Canada	E%sT
 # formerly Frobisher Bay
-Zone America/Iqaluit	0	-	zzz	1942 Aug # Frobisher Bay est.
+Zone America/Iqaluit	0	-	-00	1942 Aug # Frobisher Bay est.
 			-5:00	NT_YK	E%sT	1999 Oct 31  2:00
 			-6:00	Canada	C%sT	2000 Oct 29  2:00
 			-5:00	Canada	E%sT
 # aka Qausuittuq
-Zone America/Resolute	0	-	zzz	1947 Aug 31 # Resolute founded
+Zone America/Resolute	0	-	-00	1947 Aug 31 # Resolute founded
 			-6:00	NT_YK	C%sT	2000 Oct 29  2:00
 			-5:00	-	EST	2001 Apr  1  3:00
 			-6:00	Canada	C%sT	2006 Oct 29  2:00
 			-5:00	-	EST	2007 Mar 11  3:00
 			-6:00	Canada	C%sT
 # aka Kangiqiniq
-Zone America/Rankin_Inlet 0	-	zzz	1957 # Rankin Inlet founded
+Zone America/Rankin_Inlet 0	-	-00	1957 # Rankin Inlet founded
 			-6:00	NT_YK	C%sT	2000 Oct 29  2:00
 			-5:00	-	EST	2001 Apr  1  3:00
 			-6:00	Canada	C%sT
 # aka Iqaluktuuttiaq
-Zone America/Cambridge_Bay 0	-	zzz	1920 # trading post est.?
+Zone America/Cambridge_Bay 0	-	-00	1920 # trading post est.?
 			-7:00	NT_YK	M%sT	1999 Oct 31  2:00
 			-6:00	Canada	C%sT	2000 Oct 29  2:00
 			-5:00	-	EST	2000 Nov  5  0:00
 			-6:00	-	CST	2001 Apr  1  3:00
 			-7:00	Canada	M%sT
-Zone America/Yellowknife 0	-	zzz	1935 # Yellowknife founded?
+Zone America/Yellowknife 0	-	-00	1935 # Yellowknife founded?
 			-7:00	NT_YK	M%sT	1980
 			-7:00	Canada	M%sT
-Zone America/Inuvik	0	-	zzz	1953 # Inuvik founded
+Zone America/Inuvik	0	-	-00	1953 # Inuvik founded
 			-8:00	NT_YK	P%sT	1979 Apr lastSun  2:00
 			-7:00	NT_YK	M%sT	1980
 			-7:00	Canada	M%sT
--- a/jdk/make/data/tzdata/southamerica	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/data/tzdata/southamerica	Wed Jul 05 22:01:14 2017 +0200
@@ -1332,7 +1332,7 @@
 # Palmer used to be supplied from Argentina.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Palmer	0	-	zzz	1965
+Zone Antarctica/Palmer	0	-	-00	1965
 			-4:00	Arg	AR%sT	1969 Oct  5
 			-3:00	Arg	AR%sT	1982 May
 			-4:00	Chile	CL%sT
@@ -1782,16 +1782,16 @@
 # https://actualidad.rt.com/actualidad/204758-venezuela-modificar-huso-horario-sequia-elnino
 #
 # From Paul Eggert (2016-04-15):
-# Clocks advance 30 minutes on 2016-05-01 at 02:30. See:
-# Barboza AD. Huso horario en Venezuela volverá a 4 horas menos con
-# respecto al "Greenwich". Panorama 2016-04-15 12:20 -0430.
-# http://www.panorama.com.ve/ciudad/Huso-horario-en-Venezuela-volvera-a-4-horas-menos-con-respecto-al-Greenwich-20160415-0032.html
-#
+# Clocks advance 30 minutes on 2016-05-01 at 02:30....
 # "'Venezuela's new time-zone: hours without light, hours without water,
-# hours of presidential broadcasts, hours of lines," quipped comedian
-# Jean Mary Curro ...". See: Cawthorne A, Kai D. Venezuela scraps
+# hours of presidential broadcasts, hours of lines,' quipped comedian
+# Jean Mary Curró ...". See: Cawthorne A, Kai D. Venezuela scraps
 # half-hour time difference set by Chavez. Reuters 2016-04-15 14:50 -0400
 # http://www.reuters.com/article/us-venezuela-timezone-idUSKCN0XC2BE
+#
+# From Matt Johnson (2016-04-20):
+# ... published in the official Gazette [2016-04-18], here:
+# http://historico.tsj.gob.ve/gaceta_ext/abril/1842016/E-1842016-4551.pdf
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Caracas	-4:27:44 -	LMT	1890
--- a/jdk/make/lib/Awt2dLibraries.gmk	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Wed Jul 05 22:01:14 2017 +0200
@@ -917,7 +917,7 @@
     LIBSPLASHSCREEN_LDFLAGS := -delayload:user32.dll
     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
   else
-    LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread
+    LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
   endif
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBSPLASHSCREEN, \
--- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Wed Jul 05 22:01:14 2017 +0200
@@ -164,6 +164,7 @@
         Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
         Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
         Java_sun_awt_X11_XRobotPeer_setup;
+        Java_sun_awt_X11_XRobotPeer_loadNativeLibraries;
         Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
         Java_java_awt_Component_initIDs;
         Java_java_awt_Container_initIDs;
--- a/jdk/make/mapfiles/libnio/mapfile-linux	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/make/mapfiles/libnio/mapfile-linux	Wed Jul 05 22:01:14 2017 +0200
@@ -136,10 +136,6 @@
 		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
 		Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
 		Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
-		Java_sun_nio_fs_GioFileTypeDetector_initializeGio;
-		Java_sun_nio_fs_GioFileTypeDetector_probeGio;
-		Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
-		Java_sun_nio_fs_MagicFileTypeDetector_probe0;
 		Java_sun_nio_fs_LinuxWatchService_eventSize;
 		Java_sun_nio_fs_LinuxWatchService_eventOffsets;
 		Java_sun_nio_fs_LinuxWatchService_inotifyInit;
--- a/jdk/src/java.base/linux/classes/sun/nio/fs/GioFileTypeDetector.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 sun.nio.fs;
-
-import java.nio.file.Path;
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * File type detector that uses the GNOME I/O library to guess the
- * MIME type of a file.
- */
-
-public class GioFileTypeDetector
-    extends AbstractFileTypeDetector
-{
-    // true if GIO is available
-    private final boolean gioAvailable;
-
-    public GioFileTypeDetector() {
-        gioAvailable = initializeGio();
-    }
-
-    @Override
-    public String implProbeContentType(Path obj) throws IOException {
-        if (!gioAvailable)
-            return null;
-        if (!(obj instanceof UnixPath))
-            return null;
-
-        UnixPath path = (UnixPath)obj;
-        NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
-        try {
-            // GIO may access file so need permission check
-            path.checkRead();
-            byte[] type = probeGio(buffer.address());
-            return (type == null) ? null : Util.toString(type);
-        } finally {
-            buffer.release();
-        }
-
-    }
-
-    // GIO
-    private static native boolean initializeGio();
-    //
-    // The probeGIO() method is synchronized to avert potential problems
-    // such as crashes due to a suspected lack of thread safety in GIO.
-    //
-    private static synchronized native byte[] probeGio(long pathAddress);
-
-    static {
-        AccessController.doPrivileged(new PrivilegedAction<>() {
-            public Void run() {
-                System.loadLibrary("nio");
-                return null;
-        }});
-    }
-}
--- a/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, 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
@@ -106,9 +106,7 @@
         Path userMimeTypes = Paths.get(userHome, ".mime.types");
         Path etcMimeTypes = Paths.get("/etc/mime.types");
 
-        return chain(new GioFileTypeDetector(),
-                     new MimeTypesFileTypeDetector(userMimeTypes),
-                     new MimeTypesFileTypeDetector(etcMimeTypes),
-                     new MagicFileTypeDetector());
+        return chain(new MimeTypesFileTypeDetector(userMimeTypes),
+                     new MimeTypesFileTypeDetector(etcMimeTypes));
     }
 }
--- a/jdk/src/java.base/linux/classes/sun/nio/fs/MagicFileTypeDetector.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2012, 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 sun.nio.fs;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * File type detector that uses the libmagic to guess the MIME type of a file.
- */
-
-class MagicFileTypeDetector extends AbstractFileTypeDetector {
-
-    private static final String UNKNOWN_MIME_TYPE = "application/octet-stream";
-
-    // true if libmagic is available and successfully loaded
-    private final boolean libmagicAvailable;
-
-    public MagicFileTypeDetector() {
-        libmagicAvailable = initialize0();
-    }
-
-    @Override
-    protected String implProbeContentType(Path obj) throws IOException {
-        if (!libmagicAvailable || !(obj instanceof UnixPath))
-            return null;
-
-        UnixPath path = (UnixPath) obj;
-        path.checkRead();
-
-        NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
-        try {
-            byte[] type = probe0(buffer.address());
-            String mimeType = (type == null) ? null : new String(type);
-            return UNKNOWN_MIME_TYPE.equals(mimeType) ? null : mimeType;
-        } finally {
-            buffer.release();
-        }
-    }
-
-    private static native boolean initialize0();
-
-    private static native byte[] probe0(long pathAddress);
-
-    static {
-        AccessController.doPrivileged(new PrivilegedAction<>() {
-            @Override
-            public Void run() {
-                System.loadLibrary("nio");
-                return null;
-            }
-        });
-    }
-}
--- a/jdk/src/java.base/linux/native/libnio/fs/GioFileTypeDetector.c	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "jlong.h"
-
-#include <stdlib.h>
-#include <dlfcn.h>
-
-#ifdef __solaris__
-#include <strings.h>
-#endif
-
-#if defined(__linux__)
-#include <string.h>
-#endif
-
-/*
- * For reference see for example the GFileInfo section at
- * https://developer.gnome.org/gio/unstable/.
- */
-
-/* Definitions for GIO */
-
-#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type"
-
-typedef void* gpointer;
-typedef struct _GFile GFile;
-typedef struct _GFileInfo GFileInfo;
-typedef struct _GCancellable GCancellable;
-typedef struct _GError GError;
-
-typedef enum {
-  G_FILE_QUERY_INFO_NONE = 0
-} GFileQueryInfoFlags;
-
-typedef void (*g_type_init_func)(void);
-typedef void (*g_object_unref_func)(gpointer object);
-typedef GFile* (*g_file_new_for_path_func)(const char* path);
-typedef GFileInfo* (*g_file_query_info_func)(GFile *file,
-    const char *attributes, GFileQueryInfoFlags flags,
-    GCancellable *cancellable, GError **error);
-typedef char* (*g_file_info_get_content_type_func)(GFileInfo *info);
-
-static g_type_init_func g_type_init;
-static g_object_unref_func g_object_unref;
-static g_file_new_for_path_func g_file_new_for_path;
-static g_file_query_info_func g_file_query_info;
-static g_file_info_get_content_type_func g_file_info_get_content_type;
-
-
-#include "sun_nio_fs_GioFileTypeDetector.h"
-
-
-JNIEXPORT jboolean JNICALL
-Java_sun_nio_fs_GioFileTypeDetector_initializeGio
-    (JNIEnv* env, jclass this)
-{
-    void* gio_handle;
-
-    gio_handle = dlopen("libgio-2.0.so", RTLD_LAZY);
-    if (gio_handle == NULL) {
-        gio_handle = dlopen("libgio-2.0.so.0", RTLD_LAZY);
-        if (gio_handle == NULL) {
-            return JNI_FALSE;
-        }
-    }
-
-    g_type_init = (g_type_init_func)dlsym(gio_handle, "g_type_init");
-
-    g_object_unref = (g_object_unref_func)dlsym(gio_handle, "g_object_unref");
-
-    g_file_new_for_path =
-        (g_file_new_for_path_func)dlsym(gio_handle, "g_file_new_for_path");
-
-    g_file_query_info =
-        (g_file_query_info_func)dlsym(gio_handle, "g_file_query_info");
-
-    g_file_info_get_content_type = (g_file_info_get_content_type_func)
-        dlsym(gio_handle, "g_file_info_get_content_type");
-
-    if (g_object_unref == NULL ||
-        g_file_new_for_path == NULL ||
-        g_file_query_info == NULL ||
-        g_file_info_get_content_type == NULL)
-    {
-        dlclose(gio_handle);
-        return JNI_FALSE;
-    }
-
-    if (g_type_init != NULL) {
-        (*g_type_init)();
-    }
-
-    return JNI_TRUE;
-}
-
-JNIEXPORT jbyteArray JNICALL
-Java_sun_nio_fs_GioFileTypeDetector_probeGio
-    (JNIEnv* env, jclass this, jlong pathAddress)
-{
-    char* path = (char*)jlong_to_ptr(pathAddress);
-    GFile* gfile;
-    GFileInfo* gfileinfo;
-    jbyteArray result = NULL;
-
-    gfile = (*g_file_new_for_path)(path);
-    gfileinfo = (*g_file_query_info)(gfile, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
-        G_FILE_QUERY_INFO_NONE, NULL, NULL);
-    if (gfileinfo != NULL) {
-        const char* mime = (*g_file_info_get_content_type)(gfileinfo);
-        if (mime != NULL) {
-            jsize len = strlen(mime);
-            result = (*env)->NewByteArray(env, len);
-            if (result != NULL) {
-                (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)mime);
-            }
-        }
-        (*g_object_unref)(gfileinfo);
-    }
-    (*g_object_unref)(gfile);
-
-    return result;
-}
--- a/jdk/src/java.base/linux/native/libnio/fs/MagicFileTypeDetector.c	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "jlong.h"
-
-#include <dlfcn.h>
-#include <string.h>
-
-#define MAGIC_MIME_TYPE 0x000010 /* Return the MIME type */
-
-typedef struct magic_set magic_t;
-
-typedef magic_t* (*magic_open_func)(int flags);
-typedef int (*magic_load_func)(magic_t* cookie, const char* filename);
-typedef const char* (*magic_file_func)(magic_t* cookie, const char* filename);
-typedef void (*magic_close_func)(magic_t* cookie);
-
-static void* magic_handle;
-static magic_open_func magic_open;
-static magic_load_func magic_load;
-static magic_file_func magic_file;
-static magic_close_func magic_close;
-
-#include "sun_nio_fs_MagicFileTypeDetector.h"
-
-JNIEXPORT jboolean JNICALL
-Java_sun_nio_fs_MagicFileTypeDetector_initialize0
-    (JNIEnv* env, jclass this)
-{
-    magic_handle = dlopen("libmagic.so", RTLD_LAZY);
-    if (magic_handle == NULL) {
-        magic_handle = dlopen("libmagic.so.1", RTLD_LAZY);
-        if (magic_handle == NULL) {
-            return JNI_FALSE;
-        }
-    }
-
-    magic_open = (magic_open_func)dlsym(magic_handle, "magic_open");
-
-    magic_load = (magic_load_func)dlsym(magic_handle, "magic_load");
-
-    magic_file = (magic_file_func)dlsym(magic_handle, "magic_file");
-
-    magic_close = (magic_close_func)dlsym(magic_handle, "magic_close");
-
-    if (magic_open == NULL ||
-        magic_load == NULL ||
-        magic_file == NULL ||
-        magic_close == NULL)
-    {
-        dlclose(magic_handle);
-        return JNI_FALSE;
-    }
-
-    return JNI_TRUE;
-}
-
-JNIEXPORT jbyteArray JNICALL
-Java_sun_nio_fs_MagicFileTypeDetector_probe0
-    (JNIEnv* env, jclass this, jlong pathAddress)
-{
-    char* path = (char*)jlong_to_ptr(pathAddress);
-    magic_t* cookie;
-    jbyteArray result = NULL;
-
-    cookie = (*magic_open)(MAGIC_MIME_TYPE);
-
-    if (cookie != NULL) {
-        if ((*magic_load)(cookie, NULL) != -1) {
-            const char* type = (*magic_file)(cookie, path);
-            if (type != NULL) {
-                jsize len = strlen(type);
-                result = (*env)->NewByteArray(env, len);
-                if (result != NULL) {
-                    (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)type);
-                }
-            }
-        }
-        (*magic_close)(cookie);
-    }
-
-    return result;
-}
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_ja.java	Wed Jul 05 22:01:14 2017 +0200
@@ -61,17 +61,25 @@
                 "\u4F7F\u7528\u65B9\u6CD5:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar",
                 "",
                 "\u5727\u7E2E\u30AA\u30D7\u30B7\u30E7\u30F3",
-                "  -g\u3001--no-gzip                   \u30D7\u30EC\u30FC\u30F3\u306A*.pack\u30D5\u30A1\u30A4\u30EB\u3092\u5727\u7E2E\u305B\u305A\u306B\u51FA\u529B\u3057\u307E\u3059",
-                "  --gzip                          (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5727\u7E2E\u51FA\u529B\u3092gzip\u3067\u5F8C\u51E6\u7406\u3057\u307E\u3059",
-                "  -G\u3001--strip-debug               \u5727\u7E2E\u4E2D\u306B\u30C7\u30D0\u30C3\u30B0\u5C5E\u6027\u3092\u524A\u9664\u3057\u307E\u3059",
+                "  -r\u3001--repack                    jar\u3092\u518D\u5727\u7E2E\u307E\u305F\u306F\u6B63\u898F\u5316\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3001",
+                "                                  jarsigner\u306B\u3088\u308B\u7F72\u540D\u306B\u9069\u3057\u307E\u3059",
+                "  -g\u3001--no-gzip                   \u30D7\u30EC\u30FC\u30F3\u306A\u5727\u7E2E\u30D5\u30A1\u30A4\u30EB\u3092\u51FA\u529B\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3001",
+                "                                  \u30D5\u30A1\u30A4\u30EB\u5727\u7E2E\u30E6\u30FC\u30C6\u30A3\u30EA\u30C6\u30A3\u306B\u3088\u308B\u5727\u7E2E\u306B\u9069\u3057\u307E\u3059",
+                "  --gzip                          (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5727\u7E2E\u51FA\u529B\u3092gzip\u3067",
+                "                                  \u5727\u7E2E\u306E\u5F8C\u51E6\u7406\u3092\u884C\u3044\u307E\u3059",
+                "  -G\u3001--strip-debug               \u5727\u7E2E\u4E2D\u306B\u30C7\u30D0\u30C3\u30B0\u5C5E\u6027(SourceFile\u3001",
+                "                                  LineNumberTable\u3001LocalVariableTable",
+                "                                  \u3001LocalVariableTypeTable)\u3092\u524A\u9664\u3057\u307E\u3059",
                 "  -O\u3001--no-keep-file-order        \u30D5\u30A1\u30A4\u30EB\u306E\u9806\u5E8F\u4ED8\u3051\u60C5\u5831\u3092\u8EE2\u9001\u3057\u307E\u305B\u3093",
                 "  --keep-file-order               (\u30C7\u30D5\u30A9\u30EB\u30C8)\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u9806\u5E8F\u4ED8\u3051\u3092\u4FDD\u6301\u3057\u307E\u3059",
-                "  -S{N}\u3001--segment-limit={N}       \u30BB\u30B0\u30E1\u30F3\u30C8\u5236\u9650\u3092\u51FA\u529B\u3057\u307E\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8N=1Mb)",
+                "  -S{N}\u3001--segment-limit={N}      \u30BB\u30B0\u30E1\u30F3\u30C8\u30FB\u30B5\u30A4\u30BA\u3092\u5236\u9650\u3057\u307E\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u7121\u5236\u9650)",
                 "  -E{N}\u3001--effort={N}             \u5727\u7E2E\u306E\u8A66\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8N=5)",
-                "  -H{h}\u3001--deflate-hint={h}       \u30C7\u30D5\u30EC\u30FC\u30C8\u30FB\u30D2\u30F3\u30C8\u3092\u8EE2\u9001\u3057\u307E\u3059: true\u3001false\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)",
+                "  -H{h}\u3001--deflate-hint={h}       \u30C7\u30D5\u30EC\u30FC\u30C8\u30FB\u30D2\u30F3\u30C8\u3092\u8EE2\u9001\u3057\u307E\u3059: true\u3001false",
+                "                                  \u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)",
                 "  -m{V}\u3001--modification-time={V}  \u5909\u66F4\u6642\u9593\u3092\u8EE2\u9001\u3057\u307E\u3059: latest\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)",
-                "  -P{F}\u3001--pass-file={F}          \u6307\u5B9A\u3055\u308C\u305F\u5727\u7E2E\u3055\u308C\u3066\u3044\u306A\u3044\u5165\u529B\u8981\u7D20\u3092\u8EE2\u9001\u3057\u307E\u3059",
-                "  -U{a}\u3001--unknown-attribute={a}  \u4E0D\u660E\u306E\u5C5E\u6027\u30A2\u30AF\u30B7\u30E7\u30F3: error\u3001strip\u307E\u305F\u306Fpass(\u30C7\u30D5\u30A9\u30EB\u30C8)",
+                "  -P{F}\u3001--pass-file={F}          \u6307\u5B9A\u3055\u308C\u305F\u5165\u529B\u8981\u7D20\u3092\u305D\u306E\u307E\u307E\u8EE2\u9001\u3057\u307E\u3059",
+                "  -U{a}\u3001--unknown-attribute={a}  \u4E0D\u660E\u306E\u5C5E\u6027\u30A2\u30AF\u30B7\u30E7\u30F3: error\u3001strip",
+                "                                  \u307E\u305F\u306Fpass(\u30C7\u30D5\u30A9\u30EB\u30C8)",
                 "  -C{N}={L}\u3001--class-attribute={N}={L}  (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)",
                 "  -F{N}={L}\u3001--field-attribute={N}={L}  (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)",
                 "  -M{N}={L}\u3001--method-attribute={N}={L} (\u30E6\u30FC\u30B6\u30FC\u5B9A\u7FA9\u5C5E\u6027)",
@@ -79,7 +87,8 @@
                 "  -f{F}\u3001--config-file={F}        Pack200.Packer\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u30D5\u30A1\u30A4\u30EBF\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3059",
                 "  -v\u3001--verbose                   \u30D7\u30ED\u30B0\u30E9\u30E0\u306E\u5197\u9577\u6027\u3092\u9AD8\u3081\u307E\u3059",
                 "  -q\u3001--quiet                     \u5197\u9577\u6027\u3092\u6700\u4F4E\u30EC\u30D9\u30EB\u306B\u8A2D\u5B9A\u3057\u307E\u3059",
-                "  -l{F}\u3001--log-file={F}           \u6307\u5B9A\u306E\u30ED\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306FSystem.out ('-'\u306E\u5834\u5408)\u306B\u51FA\u529B\u3057\u307E\u3059",
+                "  -l{F}\u3001--log-file={F}           \u6307\u5B9A\u306E\u30ED\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306FSystem.out ",
+                "                                  ('-'\u306E\u5834\u5408)\u306B\u51FA\u529B\u3057\u307E\u3059",
                 "  -?\u3001-h\u3001--help                  \u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3057\u307E\u3059",
                 "  -V\u3001--version                   \u30D7\u30ED\u30B0\u30E9\u30E0\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u307E\u3059",
                 "  -J{X}                           \u30AA\u30D7\u30B7\u30E7\u30F3X\u3092\u57FA\u790E\u3068\u306A\u308BJava VM\u306B\u6E21\u3057\u307E\u3059",
@@ -92,18 +101,23 @@
                 "  \u30EC\u30A4\u30A2\u30A6\u30C8\u5B9A\u7FA9(RUH\u306A\u3069)\u306FJSR 200\u306B\u3088\u3063\u3066\u5B9A\u7FA9\u3055\u308C\u307E\u3059\u3002",
                 "",
                 "\u518D\u5727\u7E2E\u30E2\u30FC\u30C9\u3067\u306F\u3001JAR\u30D5\u30A1\u30A4\u30EB\u304C\u5727\u7E2E/\u89E3\u51CD\u30B5\u30A4\u30AF\u30EB\u3067\u66F4\u65B0\u3055\u308C\u307E\u3059:",
-                "    pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n"
+                "    pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n",
+                "",
+                "\u7D42\u4E86\u30B9\u30C6\u30FC\u30BF\u30B9:",
+                "  0 (\u6210\u529F\u3057\u305F\u5834\u5408)\u3001>0 (\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u305F\u5834\u5408)"
             }
         },
         {UNPACK_HELP, new String[] {
                 "\u4F7F\u7528\u65B9\u6CD5:  unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar\n",
                 "",
                 "\u89E3\u51CD\u30AA\u30D7\u30B7\u30E7\u30F3",
-                "  -H{h}\u3001--deflate-hint={h}     \u8EE2\u9001\u3055\u308C\u305F\u30C7\u30D5\u30EC\u30FC\u30C8\u30FB\u30D2\u30F3\u30C8\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059: true\u3001false\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)",
+                "  -H{h}\u3001--deflate-hint={h}     \u8EE2\u9001\u3055\u308C\u305F\u30C7\u30D5\u30EC\u30FC\u30C8\u30FB\u30D2\u30F3\u30C8\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059:",
+                "                                 true\u3001false\u307E\u305F\u306Fkeep(\u30C7\u30D5\u30A9\u30EB\u30C8)",
                 "  -r\u3001--remove-pack-file        \u89E3\u51CD\u5F8C\u306B\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u524A\u9664\u3057\u307E\u3059",
                 "  -v\u3001--verbose                 \u30D7\u30ED\u30B0\u30E9\u30E0\u306E\u5197\u9577\u6027\u3092\u9AD8\u3081\u307E\u3059",
                 "  -q\u3001--quiet                   \u5197\u9577\u6027\u3092\u6700\u4F4E\u30EC\u30D9\u30EB\u306B\u8A2D\u5B9A\u3057\u307E\u3059",
-                "  -l{F}\u3001--log-file={F}         \u6307\u5B9A\u306E\u30ED\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306FSystem.out ('-'\u306E\u5834\u5408)\u306B\u51FA\u529B\u3057\u307E\u3059",
+                "  -l{F}\u3001--log-file={F}           \u6307\u5B9A\u306E\u30ED\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F",
+                "                                  System.out ('-'\u306E\u5834\u5408)\u306B\u51FA\u529B\u3057\u307E\u3059",
                 "  -?\u3001-h\u3001--help                \u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3057\u307E\u3059",
                 "  -V\u3001--version                 \u30D7\u30ED\u30B0\u30E9\u30E0\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u307E\u3059",
                 "  -J{X}                         \u30AA\u30D7\u30B7\u30E7\u30F3X\u3092\u57FA\u790E\u3068\u306A\u308BJava VM\u306B\u6E21\u3057\u307E\u3059"
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_zh_CN.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/DriverResource_zh_CN.java	Wed Jul 05 22:01:14 2017 +0200
@@ -56,22 +56,30 @@
         {SKIP_FOR_REPACKED, "\u7531\u4E8E\u5DF2\u91CD\u65B0\u6253\u5305\u800C\u8DF3\u8FC7: {0}"}, // parameter 0:filename
         {WRITE_PACK_FILE, "\u8981\u5199\u5165 *.pack \u6587\u4EF6, \u8BF7\u6307\u5B9A --no-gzip: {0}"}, // parameter 0:filename
         {WRITE_PACKGZ_FILE, "\u8981\u5199\u5165 *.pack.gz \u6587\u4EF6, \u8BF7\u6307\u5B9A --gzip: {0}"}, // parameter 0:filename
-        {SKIP_FOR_MOVE_FAILED, "\u7531\u4E8E\u79FB\u52A8\u5931\u8D25\u800C\u8DF3\u8FC7\u91CD\u65B0\u6253\u5305: {0}"}, // parameter 0:filename
+        {SKIP_FOR_MOVE_FAILED, "\u7531\u4E8E\u79FB\u52A8\u5931\u8D25\u800C\u8DF3\u8FC7\u89E3\u5305: {0}"}, // parameter 0:filename
         {PACK_HELP, new String[] {
                 "\u7528\u6CD5:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar",
                 "",
                 "\u6253\u5305\u9009\u9879",
-                "  -g, --no-gzip                   \u8F93\u51FA\u65E0\u683C\u5F0F\u7684 *.pack \u6587\u4EF6, \u4E0D\u538B\u7F29",
-                "  --gzip                          (\u9ED8\u8BA4\u503C) \u4F7F\u7528 gzip \u5BF9\u6253\u5305\u8FDB\u884C\u540E\u5904\u7406",
-                "  -G, --strip-debug               \u6253\u5305\u65F6\u5220\u9664\u8C03\u8BD5\u5C5E\u6027",
+                "  -r, --repack                    \u518D\u6B21\u6253\u5305\u6216\u89C4\u8303\u5316 jar, \u9002\u5408\u4E8E ",
+                "                                  \u4F7F\u7528 jarsigner \u8FDB\u884C\u7B7E\u540D",
+                "  -g, --no-gzip                   \u8F93\u51FA\u65E0\u683C\u5F0F\u7684\u5305\u6587\u4EF6, \u9002\u5408\u4E8E",
+                "                                  \u4F7F\u7528\u6587\u4EF6\u538B\u7F29\u5B9E\u7528\u7A0B\u5E8F\u8FDB\u884C\u538B\u7F29",
+                "  --gzip                          (\u9ED8\u8BA4\u503C) \u4F7F\u7528 gzip \u5BF9\u5305\u8F93\u51FA\u8FDB\u884C",
+                "                                  \u538B\u7F29\u540E\u5904\u7406",
+                "  -G, --strip-debug               \u6253\u5305\u65F6\u5220\u9664\u8C03\u8BD5\u5C5E\u6027 (SourceFile,",
+                "                                  LineNumberTable, LocalVariableTable",
+                "                                  \u548C LocalVariableTypeTable)",
                 "  -O, --no-keep-file-order        \u4E0D\u4F20\u8F93\u6587\u4EF6\u6392\u5E8F\u4FE1\u606F",
                 "  --keep-file-order               (\u9ED8\u8BA4\u503C) \u4FDD\u7559\u8F93\u5165\u6587\u4EF6\u6392\u5E8F",
-                "  -S{N}, --segment-limit={N}      \u8F93\u51FA\u6BB5\u9650\u5236 (\u9ED8\u8BA4\u503C N=1Mb)",
+                "  -S{N}, --segment-limit={N}      \u9650\u5236\u6BB5\u5927\u5C0F (\u9ED8\u8BA4\u4E3A\u65E0\u9650\u5236)",
                 "  -E{N}, --effort={N}             \u6253\u5305\u6548\u679C (\u9ED8\u8BA4\u503C N=5)",
-                "  -H{h}, --deflate-hint={h}       \u4F20\u8F93\u538B\u7F29\u63D0\u793A: true, false \u6216 keep (\u9ED8\u8BA4\u503C)",
+                "  -H{h}, --deflate-hint={h}       \u4F20\u8F93\u538B\u7F29\u63D0\u793A: true, false",
+                "                                   \u6216 keep (\u9ED8\u8BA4\u503C)",
                 "  -m{V}, --modification-time={V}  \u4F20\u8F93 modtimes: latest \u6216 keep (\u9ED8\u8BA4\u503C)",
-                "  -P{F}, --pass-file={F}          \u4F20\u8F93\u672A\u89E3\u538B\u7F29\u7684\u7ED9\u5B9A\u8F93\u5165\u5143\u7D20",
-                "  -U{a}, --unknown-attribute={a}  \u672A\u77E5\u5C5E\u6027\u64CD\u4F5C: error, strip \u6216 pass (\u9ED8\u8BA4\u503C)",
+                "  -P{F}, --pass-file={F}          \u4F20\u8F93\u672A\u66F4\u6539\u7684\u7ED9\u5B9A\u8F93\u5165\u5143\u7D20",
+                "  -U{a}, --unknown-attribute={a}  \u672A\u77E5\u5C5E\u6027\u64CD\u4F5C: error, strip",
+                "                                  \u6216 pass (\u9ED8\u8BA4\u503C)",
                 "  -C{N}={L}, --class-attribute={N}={L}  (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)",
                 "  -F{N}={L}, --field-attribute={N}={L}  (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)",
                 "  -M{N}={L}, --method-attribute={N}={L} (\u7528\u6237\u5B9A\u4E49\u7684\u5C5E\u6027)",
@@ -79,7 +87,8 @@
                 "  -f{F}, --config-file={F}        \u8BFB\u53D6\u6587\u4EF6 F \u7684 Pack200.Packer \u5C5E\u6027",
                 "  -v, --verbose                   \u63D0\u9AD8\u7A0B\u5E8F\u8BE6\u7EC6\u7A0B\u5EA6",
                 "  -q, --quiet                     \u5C06\u8BE6\u7EC6\u7A0B\u5EA6\u8BBE\u7F6E\u4E3A\u6700\u4F4E\u7EA7\u522B",
-                "  -l{F}, --log-file={F}           \u8F93\u51FA\u5230\u7ED9\u5B9A\u65E5\u5FD7\u6587\u4EF6, \u6216\u5BF9\u4E8E System.out \u6307\u5B9A '-'",
+                "  -l{F}, --log-file={F}           \u8F93\u51FA\u5230\u7ED9\u5B9A\u65E5\u5FD7\u6587\u4EF6, ",
+                "                                  \u6216\u5BF9\u4E8E System.out \u6307\u5B9A '-'",
                 "  -?, -h, --help                  \u8F93\u51FA\u6B64\u6D88\u606F",
                 "  -V, --version                   \u8F93\u51FA\u7A0B\u5E8F\u7248\u672C",
                 "  -J{X}                           \u5C06\u9009\u9879 X \u4F20\u9012\u7ED9\u57FA\u7840 Java VM",
@@ -92,18 +101,23 @@
                 "  \u5E03\u5C40\u5B9A\u4E49 (\u4F8B\u5982 RUH) \u7531 JSR 200 \u5B9A\u4E49\u3002",
                 "",
                 "\u91CD\u65B0\u6253\u5305\u6A21\u5F0F\u901A\u8FC7\u6253\u5305/\u89E3\u5305\u5468\u671F\u66F4\u65B0 JAR \u6587\u4EF6:",
-                "    pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n"
+                "    pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n",
+                "",
+                "\u9000\u51FA\u72B6\u6001:",
+                "  \u5982\u679C\u6210\u529F\u5219\u4E3A 0; \u5982\u679C\u51FA\u73B0\u9519\u8BEF, \u5219\u4E3A\u5927\u4E8E 0 \u7684\u503C"
             }
         },
         {UNPACK_HELP, new String[] {
                 "\u7528\u6CD5:  unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar\n",
                 "",
                 "\u89E3\u5305\u9009\u9879",
-                "  -H{h}, --deflate-hint={h}     \u8986\u76D6\u5DF2\u4F20\u8F93\u7684\u538B\u7F29\u63D0\u793A: true, false \u6216 keep (\u9ED8\u8BA4\u503C)",
+                "  -H{h}, --deflate-hint={h}     \u8986\u76D6\u5DF2\u4F20\u8F93\u7684\u538B\u7F29\u63D0\u793A:",
+                "                                true, false \u6216 keep (\u9ED8\u8BA4\u503C)",
                 "  -r, --remove-pack-file        \u89E3\u5305\u4E4B\u540E\u5220\u9664\u8F93\u5165\u6587\u4EF6",
                 "  -v, --verbose                   \u63D0\u9AD8\u7A0B\u5E8F\u8BE6\u7EC6\u7A0B\u5EA6",
                 "  -q, --quiet                     \u5C06\u8BE6\u7EC6\u7A0B\u5EA6\u8BBE\u7F6E\u4E3A\u6700\u4F4E\u7EA7\u522B",
-                "  -l{F}, --log-file={F}         \u8F93\u51FA\u5230\u7ED9\u5B9A\u65E5\u5FD7\u6587\u4EF6, \u6216\u5BF9\u4E8E System.out \u6307\u5B9A '-'",
+                "  -l{F}, --log-file={F}         \u8F93\u51FA\u5230\u7ED9\u5B9A\u65E5\u5FD7\u6587\u4EF6, \u6216",
+                "                                \u5BF9\u4E8E System.out \u6307\u5B9A '-'",
                 "  -?, -h, --help                \u8F93\u51FA\u6B64\u6D88\u606F",
                 "  -V, --version                 \u8F93\u51FA\u7A0B\u5E8F\u7248\u672C",
                 "  -J{X}                         \u5C06\u9009\u9879 X \u4F20\u9012\u7ED9\u57FA\u7840 Java VM"
--- a/jdk/src/java.base/share/classes/java/lang/Runtime.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Runtime.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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/lang/SecurityManager.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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
@@ -227,9 +227,10 @@
      *
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This field is subject to removal in a
+     *  future version of Java SE.
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected boolean inCheck;
 
     /*
@@ -260,9 +261,10 @@
      * @see     java.lang.SecurityManager#inCheck
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     public boolean getInCheck() {
         return inCheck;
     }
@@ -340,12 +342,13 @@
      *
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      *
      * @see  java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
      * @see  #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected ClassLoader currentClassLoader() {
         ClassLoader cl = currentClassLoader0();
         if ((cl != null) && hasAllPermission())
@@ -386,12 +389,13 @@
      *
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      *
      * @see  java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
      * @see  #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected Class<?> currentLoadedClass() {
         Class<?> c = currentLoadedClass0();
         if ((c != null) && hasAllPermission())
@@ -408,10 +412,10 @@
      *          <code>-1</code> if such a frame cannot be found.
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
-     *
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected native int classDepth(String name);
 
     /**
@@ -444,12 +448,13 @@
      *
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      *
      * @see   java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
      * @see   #checkPermission(java.security.Permission) checkPermission
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected int classLoaderDepth() {
         int depth = classLoaderDepth0();
         if (depth != -1) {
@@ -472,9 +477,10 @@
      *         name is on the execution stack; <code>false</code> otherwise.
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected boolean inClass(String name) {
         return classDepth(name) >= 0;
     }
@@ -488,10 +494,11 @@
      *
      * @deprecated This type of security checking is not recommended.
      *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead.
+     *  call be used instead. This method is subject to removal in a
+     *  future version of Java SE.
      * @see        #currentClassLoader() currentClassLoader
      */
-    @Deprecated(since="1.2")
+    @Deprecated(since="1.2", forRemoval=true)
     protected boolean inClassLoader() {
         return currentClassLoader() != null;
     }
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Wed Jul 05 22:01:14 2017 +0200
@@ -236,10 +236,12 @@
      * @since   1.6
      */
      public static Console console() {
-         Console c = cons;
-         if (c == null) {
+         Console c;
+         if ((c = cons) == null) {
              synchronized (System.class) {
-                 cons = c = SharedSecrets.getJavaIOAccess().console();
+                 if ((c = cons) == null) {
+                     cons = c = SharedSecrets.getJavaIOAccess().console();
+                 }
              }
          }
          return c;
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Executable.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Executable.java	Wed Jul 05 22:01:14 2017 +0200
@@ -122,7 +122,7 @@
             sb.append(')');
 
             if (exceptionTypes.length > 0) {
-                StringJoiner joiner = new StringJoiner(",", "throws ", "");
+                StringJoiner joiner = new StringJoiner(",", " throws ", "");
                 for (Class<?> exceptionType : exceptionTypes) {
                     joiner.add(exceptionType.getTypeName());
                 }
--- a/jdk/src/java.base/share/classes/java/time/LocalDate.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/time/LocalDate.java	Wed Jul 05 22:01:14 2017 +0200
@@ -338,6 +338,7 @@
      * @throws DateTimeException if the epoch day exceeds the supported date range
      */
     public static LocalDate ofEpochDay(long epochDay) {
+        EPOCH_DAY.checkValidValue(epochDay);
         long zeroDay = epochDay + DAYS_0000_TO_1970;
         // find the march-based year
         zeroDay -= 60;  // adjust to 0000-03-01 so leap day is at end of four year cycle
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -928,7 +928,24 @@
      * second if non-zero, no colon
      * <li>{@code +HH:mm:ss} - hour, with minute if non-zero or with minute and
      * second if non-zero, with colon
+     * <li>{@code +H} - hour only, ignoring minute and second
+     * <li>{@code +Hmm} - hour, with minute if non-zero, ignoring second, no colon
+     * <li>{@code +H:mm} - hour, with minute if non-zero, ignoring second, with colon
+     * <li>{@code +HMM} - hour and minute, ignoring second, no colon
+     * <li>{@code +H:MM} - hour and minute, ignoring second, with colon
+     * <li>{@code +HMMss} - hour and minute, with second if non-zero, no colon
+     * <li>{@code +H:MM:ss} - hour and minute, with second if non-zero, with colon
+     * <li>{@code +HMMSS} - hour, minute and second, no colon
+     * <li>{@code +H:MM:SS} - hour, minute and second, with colon
+     * <li>{@code +Hmmss} - hour, with minute if non-zero or with minute and
+     * second if non-zero, no colon
+     * <li>{@code +H:mm:ss} - hour, with minute if non-zero or with minute and
+     * second if non-zero, with colon
      * </ul>
+     * Patterns containing "HH" will format and parse a two digit hour,
+     * zero-padded if necessary. Patterns containing "H" will format with no
+     * zero-padding, and parse either one or two digits.
+     * In lenient mode, the parser will be greedy and parse the maximum digits possible.
      * The "no offset" text controls what text is printed when the total amount of
      * the offset fields to be output is zero.
      * Example values would be 'Z', '+00:00', 'UTC' or 'GMT'.
@@ -3475,13 +3492,15 @@
      */
     static final class OffsetIdPrinterParser implements DateTimePrinterParser {
         static final String[] PATTERNS = new String[] {
-            "+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS", "+HHmmss", "+HH:mm:ss",
+                "+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS", "+HHmmss", "+HH:mm:ss",
+                "+H",  "+Hmm",  "+H:mm",  "+HMM",  "+H:MM",  "+HMMss",  "+H:MM:ss",  "+HMMSS",  "+H:MM:SS",  "+Hmmss",  "+H:mm:ss",
         };  // order used in pattern builder
         static final OffsetIdPrinterParser INSTANCE_ID_Z = new OffsetIdPrinterParser("+HH:MM:ss", "Z");
         static final OffsetIdPrinterParser INSTANCE_ID_ZERO = new OffsetIdPrinterParser("+HH:MM:ss", "0");
 
         private final String noOffsetText;
         private final int type;
+        private final int style;
 
         /**
          * Constructor.
@@ -3493,6 +3512,7 @@
             Objects.requireNonNull(pattern, "pattern");
             Objects.requireNonNull(noOffsetText, "noOffsetText");
             this.type = checkPattern(pattern);
+            this.style = type % 11;
             this.noOffsetText = noOffsetText;
         }
 
@@ -3505,6 +3525,14 @@
             throw new IllegalArgumentException("Invalid zone offset pattern: " + pattern);
         }
 
+        private boolean isPaddedHour() {
+            return type < 11;
+        }
+
+        private boolean isColon() {
+            return style > 0 && (style % 2) == 0;
+        }
+
         @Override
         public boolean format(DateTimePrintContext context, StringBuilder buf) {
             Long offsetSecs = context.getValue(OFFSET_SECONDS);
@@ -3520,15 +3548,17 @@
                 int absSeconds = Math.abs(totalSecs % 60);
                 int bufPos = buf.length();
                 int output = absHours;
-                buf.append(totalSecs < 0 ? "-" : "+")
-                    .append((char) (absHours / 10 + '0')).append((char) (absHours % 10 + '0'));
-                if ((type >= 3 && type < 9) || (type >= 9 && absSeconds > 0) || (type >= 1 && absMinutes > 0)) {
-                    buf.append((type % 2) == 0 ? ":" : "")
-                        .append((char) (absMinutes / 10 + '0')).append((char) (absMinutes % 10 + '0'));
+                buf.append(totalSecs < 0 ? "-" : "+");
+                if (isPaddedHour() || absHours >= 10) {
+                    formatZeroPad(false, absHours, buf);
+                } else {
+                    buf.append((char) (absHours + '0'));
+                }
+                if ((style >= 3 && style <= 8) || (style >= 9 && absSeconds > 0) || (style >= 1 && absMinutes > 0)) {
+                    formatZeroPad(isColon(), absMinutes, buf);
                     output += absMinutes;
-                    if (type == 7  || type == 8 || (type >= 5 && absSeconds > 0)) {
-                        buf.append((type % 2) == 0 ? ":" : "")
-                            .append((char) (absSeconds / 10 + '0')).append((char) (absSeconds % 10 + '0'));
+                    if (style == 7 || style == 8 || (style >= 5 && absSeconds > 0)) {
+                        formatZeroPad(isColon(), absSeconds, buf);
                         output += absSeconds;
                     }
                 }
@@ -3540,19 +3570,16 @@
             return true;
         }
 
+        private void formatZeroPad(boolean colon, int value, StringBuilder buf) {
+            buf.append(colon ? ":" : "")
+                    .append((char) (value / 10 + '0'))
+                    .append((char) (value % 10 + '0'));
+        }
+
         @Override
         public int parse(DateTimeParseContext context, CharSequence text, int position) {
             int length = text.length();
             int noOffsetLen = noOffsetText.length();
-            int parseType = type;
-            if (context.isStrict() == false) {
-                if ((parseType > 0 && (parseType % 2) == 0) ||
-                    (parseType == 0 && length > position + 3 && text.charAt(position + 3) == ':')) {
-                    parseType = 10;
-                } else {
-                    parseType = 9;
-                }
-            }
             if (noOffsetLen == 0) {
                 if (position == length) {
                     return context.setParsedField(OFFSET_SECONDS, 0, position, position);
@@ -3571,12 +3598,87 @@
             if (sign == '+' || sign == '-') {
                 // starts
                 int negative = (sign == '-' ? -1 : 1);
+                boolean isColon = isColon();
+                boolean paddedHour = isPaddedHour();
                 int[] array = new int[4];
                 array[0] = position + 1;
-                if ((parseNumber(array, 1, text, true, parseType) ||
-                        parseNumber(array, 2, text, parseType >= 3 && parseType < 9, parseType) ||
-                        parseNumber(array, 3, text, parseType == 7 || parseType == 8, parseType)) == false) {
-                    // success
+                int parseType = type;
+                // select parse type when lenient
+                if (!context.isStrict()) {
+                    if (paddedHour) {
+                        if (isColon || (parseType == 0 && length > position + 3 && text.charAt(position + 3) == ':')) {
+                            isColon = true; // needed in cases like ("+HH", "+01:01")
+                            parseType = 10;
+                        } else {
+                            parseType = 9;
+                        }
+                    } else {
+                        if (isColon || (parseType == 11 && length > position + 3 && (text.charAt(position + 2) == ':' || text.charAt(position + 3) == ':'))) {
+                            isColon = true;
+                            parseType = 21;  // needed in cases like ("+H", "+1:01")
+                        } else {
+                            parseType = 20;
+                        }
+                    }
+                }
+                // parse according to the selected pattern
+                switch (parseType) {
+                    case 0: // +HH
+                    case 11: // +H
+                        parseHour(text, paddedHour, array);
+                        break;
+                    case 1: // +HHmm
+                    case 2: // +HH:mm
+                    case 13: // +H:mm
+                        parseHour(text, paddedHour, array);
+                        parseMinute(text, isColon, false, array);
+                        break;
+                    case 3: // +HHMM
+                    case 4: // +HH:MM
+                    case 15: // +H:MM
+                        parseHour(text, paddedHour, array);
+                        parseMinute(text, isColon, true, array);
+                        break;
+                    case 5: // +HHMMss
+                    case 6: // +HH:MM:ss
+                    case 17: // +H:MM:ss
+                        parseHour(text, paddedHour, array);
+                        parseMinute(text, isColon, true, array);
+                        parseSecond(text, isColon, false, array);
+                        break;
+                    case 7: // +HHMMSS
+                    case 8: // +HH:MM:SS
+                    case 19: // +H:MM:SS
+                        parseHour(text, paddedHour, array);
+                        parseMinute(text, isColon, true, array);
+                        parseSecond(text, isColon, true, array);
+                        break;
+                    case 9: // +HHmmss
+                    case 10: // +HH:mm:ss
+                    case 21: // +H:mm:ss
+                        parseHour(text, paddedHour, array);
+                        parseOptionalMinuteSecond(text, isColon, array);
+                        break;
+                    case 12: // +Hmm
+                        parseVariableWidthDigits(text, 1, 4, array);
+                        break;
+                    case 14: // +HMM
+                        parseVariableWidthDigits(text, 3, 4, array);
+                        break;
+                    case 16: // +HMMss
+                        parseVariableWidthDigits(text, 3, 6, array);
+                        break;
+                    case 18: // +HMMSS
+                        parseVariableWidthDigits(text, 5, 6, array);
+                        break;
+                    case 20: // +Hmmss
+                        parseVariableWidthDigits(text, 1, 6, array);
+                        break;
+                }
+                if (array[0] > 0) {
+                    if (array[1] > 23 || array[2] > 59 || array[3] > 59) {
+                        throw new DateTimeException("Value out of range: Hour[0-23], Minute[0-59], Second[0-59]");
+                    }
                     long offsetSecs = negative * (array[1] * 3600L + array[2] * 60L + array[3]);
                     return context.setParsedField(OFFSET_SECONDS, offsetSecs, position, array[0]);
                 }
@@ -3588,42 +3690,118 @@
             return ~position;
         }
 
-        /**
-         * Parse a two digit zero-prefixed number.
-         *
-         * @param array  the array of parsed data, 0=pos,1=hours,2=mins,3=secs, not null
-         * @param arrayIndex  the index to parse the value into
-         * @param parseText  the offset ID, not null
-         * @param required  whether this number is required
-         * @param parseType the offset pattern type
-         * @return true if an error occurred
-         */
-        private boolean parseNumber(int[] array, int arrayIndex, CharSequence parseText, boolean required, int parseType) {
-            if ((parseType + 3) / 2 < arrayIndex) {
-                return false;  // ignore seconds/minutes
+        private void parseHour(CharSequence parseText, boolean paddedHour, int[] array) {
+            if (paddedHour) {
+                // parse two digits
+                if (!parseDigits(parseText, false, 1, array)) {
+                    array[0] = ~array[0];
+                }
+            } else {
+                // parse one or two digits
+                parseVariableWidthDigits(parseText, 1, 2, array);
+            }
+        }
+
+        private void parseMinute(CharSequence parseText, boolean isColon, boolean mandatory, int[] array) {
+            if (!parseDigits(parseText, isColon, 2, array)) {
+                if (mandatory) {
+                    array[0] = ~array[0];
+                }
             }
+        }
+
+        private void parseSecond(CharSequence parseText, boolean isColon, boolean mandatory, int[] array) {
+            if (!parseDigits(parseText, isColon, 3, array)) {
+                if (mandatory) {
+                    array[0] = ~array[0];
+                }
+            }
+        }
+
+        private void parseOptionalMinuteSecond(CharSequence parseText, boolean isColon, int[] array) {
+            if (parseDigits(parseText, isColon, 2, array)) {
+                parseDigits(parseText, isColon, 3, array);
+            }
+        }
+
+        private boolean parseDigits(CharSequence parseText, boolean isColon, int arrayIndex, int[] array) {
             int pos = array[0];
-            if ((parseType % 2) == 0 && arrayIndex > 1) {
+            if (pos < 0) {
+                return true;
+            }
+            if (isColon && arrayIndex != 1) { //  ':' will precede only in case of minute/second
                 if (pos + 1 > parseText.length() || parseText.charAt(pos) != ':') {
-                    return required;
+                    return false;
                 }
                 pos++;
             }
             if (pos + 2 > parseText.length()) {
-                return required;
+                return false;
             }
             char ch1 = parseText.charAt(pos++);
             char ch2 = parseText.charAt(pos++);
             if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
-                return required;
+                return false;
             }
             int value = (ch1 - 48) * 10 + (ch2 - 48);
             if (value < 0 || value > 59) {
-                return required;
+                return false;
             }
             array[arrayIndex] = value;
             array[0] = pos;
-            return false;
+            return true;
+        }
+
+        private void parseVariableWidthDigits(CharSequence parseText, int minDigits, int maxDigits, int[] array) {
+            // scan the text to find the available number of digits up to maxDigits
+            // so long as the number available is minDigits or more, the input is valid
+            // then parse the number of available digits
+            int pos = array[0];
+            int available = 0;
+            char[] chars = new char[maxDigits];
+            for (int i = 0; i < maxDigits; i++) {
+                if (pos + 1  > parseText.length()) {
+                    break;
+                }
+                char ch = parseText.charAt(pos++);
+                if (ch < '0' || ch > '9') {
+                    pos--;
+                    break;
+                }
+                chars[i] = ch;
+                available++;
+            }
+            if (available < minDigits) {
+                array[0] = ~array[0];
+                return;
+            }
+            switch (available) {
+                case 1:
+                    array[1] = (chars[0] - 48);
+                    break;
+                case 2:
+                    array[1] = ((chars[0] - 48) * 10 + (chars[1] - 48));
+                    break;
+                case 3:
+                    array[1] = (chars[0] - 48);
+                    array[2] = ((chars[1] - 48) * 10 + (chars[2] - 48));
+                    break;
+                case 4:
+                    array[1] = ((chars[0] - 48) * 10 + (chars[1] - 48));
+                    array[2] = ((chars[2] - 48) * 10 + (chars[3] - 48));
+                    break;
+                case 5:
+                    array[1] = (chars[0] - 48);
+                    array[2] = ((chars[1] - 48) * 10 + (chars[2] - 48));
+                    array[3] = ((chars[3] - 48) * 10 + (chars[4] - 48));
+                    break;
+                case 6:
+                    array[1] = ((chars[0] - 48) * 10 + (chars[1] - 48));
+                    array[2] = ((chars[2] - 48) * 10 + (chars[3] - 48));
+                    array[3] = ((chars[4] - 48) * 10 + (chars[5] - 48));
+                    break;
+            }
+            array[0] = pos;
         }
 
         @Override
--- a/jdk/src/java.base/share/classes/java/time/temporal/ChronoField.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/time/temporal/ChronoField.java	Wed Jul 05 22:01:14 2017 +0200
@@ -427,8 +427,11 @@
      * <p>
      * This field is strictly defined to have the same meaning in all calendar systems.
      * This is necessary to ensure interoperation between calendars.
+     * <p>
+     * Range of EpochDay is between (LocalDate.MIN.toEpochDay(), LocalDate.MAX.toEpochDay())
+     * both inclusive.
      */
-    EPOCH_DAY("EpochDay", DAYS, FOREVER, ValueRange.of((long) (Year.MIN_VALUE * 365.25), (long) (Year.MAX_VALUE * 365.25))),
+    EPOCH_DAY("EpochDay", DAYS, FOREVER, ValueRange.of(-365243219162L, 365241780471L)),
     /**
      * The aligned week within a month.
      * <p>
--- a/jdk/src/java.base/share/classes/javax/crypto/CryptoPermissions.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/crypto/CryptoPermissions.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -37,9 +37,7 @@
 import java.io.BufferedReader;
 import java.io.ObjectStreamField;
 import java.io.ObjectInputStream;
-import java.io.ObjectInputStream.GetField;
 import java.io.ObjectOutputStream;
-import java.io.ObjectOutputStream.PutField;
 import java.io.IOException;
 
 /**
@@ -132,15 +130,18 @@
      *
      * @see isReadOnly
      */
+    @Override
     public void add(Permission permission) {
 
-        if (isReadOnly())
+        if (isReadOnly()) {
             throw new SecurityException("Attempt to add a Permission " +
                                         "to a readonly CryptoPermissions " +
                                         "object");
+        }
 
-        if (!(permission instanceof CryptoPermission))
+        if (!(permission instanceof CryptoPermission)) {
             return;
+        }
 
         CryptoPermission cryptoPerm = (CryptoPermission)permission;
         PermissionCollection pc =
@@ -161,6 +162,7 @@
      * in the PermissionCollection it belongs to, false if not.
      *
      */
+    @Override
     public boolean implies(Permission permission) {
         if (!(permission instanceof CryptoPermission)) {
             return false;
@@ -170,7 +172,13 @@
 
         PermissionCollection pc =
             getPermissionCollection(cryptoPerm.getAlgorithm());
-        return pc.implies(cryptoPerm);
+
+        if (pc != null) {
+            return pc.implies(cryptoPerm);
+        } else {
+            // none found
+            return false;
+        }
     }
 
     /**
@@ -179,6 +187,7 @@
      *
      * @return an enumeration of all the Permissions.
      */
+    @Override
     public Enumeration<Permission> elements() {
         // go through each Permissions in the hash table
         // and call their elements() function.
@@ -453,7 +462,7 @@
 final class PermissionsEnumerator implements Enumeration<Permission> {
 
     // all the perms
-    private Enumeration<PermissionCollection> perms;
+    private final Enumeration<PermissionCollection> perms;
     // the current set
     private Enumeration<Permission> permset;
 
@@ -462,17 +471,20 @@
         permset = getNextEnumWithMore();
     }
 
+    @Override
     public synchronized boolean hasMoreElements() {
         // if we enter with permissionimpl null, we know
         // there are no more left.
 
-        if (permset == null)
+        if (permset == null) {
             return  false;
+        }
 
         // try to see if there are any left in the current one
 
-        if (permset.hasMoreElements())
+        if (permset.hasMoreElements()) {
             return true;
+        }
 
         // get the next one that has something in it...
         permset = getNextEnumWithMore();
@@ -481,6 +493,7 @@
         return (permset != null);
     }
 
+    @Override
     public synchronized Permission nextElement() {
         // hasMoreElements will update permset to the next permset
         // with something in it...
@@ -496,8 +509,9 @@
         while (perms.hasMoreElements()) {
             PermissionCollection pc = perms.nextElement();
             Enumeration<Permission> next = pc.elements();
-            if (next.hasMoreElements())
+            if (next.hasMoreElements()) {
                 return next;
+            }
         }
         return null;
     }
--- a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java	Wed Jul 05 22:01:14 2017 +0200
@@ -153,10 +153,11 @@
      * @exception SSLPeerUnverifiedException if the peer is not verified.
      * @see #getPeerPrincipal()
      * @deprecated The {@link #getPeerCertificates()} method that returns an
-     *               array of {@code java.security.cert.Certificate} should
-     *               be used instead.
+     *          array of {@code java.security.cert.Certificate} should
+     *          be used instead.  This method is subject to removal in
+     *          a future version of Java SE.
      */
-    @Deprecated
+    @Deprecated(since="9", forRemoval=true)
     public javax.security.cert.X509Certificate [] getPeerCertificateChain()
             throws SSLPeerUnverifiedException
     {
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java	Wed Jul 05 22:01:14 2017 +0200
@@ -273,10 +273,11 @@
      *          has not been verified
      * @see #getPeerPrincipal()
      * @deprecated The {@link #getPeerCertificates()} method that returns an
-     *               array of {@code java.security.cert.Certificate} should
-     *               be used instead.
+     *          array of {@code java.security.cert.Certificate} should
+     *          be used instead.  This method is subject to removal in
+     *          a future version of Java SE.
      */
-    @Deprecated
+    @Deprecated(since="9", forRemoval=true)
     public javax.security.cert.X509Certificate [] getPeerCertificateChain()
             throws SSLPeerUnverifiedException;
 
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  weil die Ausf\u00FChrung auf einem Server-Class-Rechner erfolgt.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n    -classpath <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n                  und ZIP-Archiven zur Suche nach Klassendateien.\n    -mp <Modulpfad>\n    -modulepath <Modulpfad>...\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, in der jedes Verzeichnis\n                  ein Modulverzeichnis darstellt.\n    -upgrademodulepath <Modulpfad>...\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, in der jedes Verzeichnis\n                  ein Verzeichnis von Modulen darstellt, die upgradef\u00E4hige\n                  Module im Laufzeitimage ersetzen\n    -m <modulename>[/<mainclass>]\n                  Das anf\u00E4ngliche Modul, das aufgel\u00F6st werden soll, und der Name der Hauptklasse,\n                  die ausgef\u00FChrt werden soll, wenn keine Angabe durch das Modul erfolgt\n    -addmods <modulename>[,<modulename>...]\n                  Root-Module, die zus\u00E4tzlich zum anf\u00E4nglichen Modul aufgel\u00F6st werden sollen\n    -limitmods <modulename>[,<modulename>...]\n                  Schr\u00E4nkt die Gesamtzahl der beobachtbaren Module ein\n    -listmods[:<modulename>[,<modulename>...]]\n                  Listet die beobachtbaren Module auf und beendet den Vorgang\n    -D<name>=<value>\n                  Legt eine Systemeigenschaft fest\n    -verbose:[class|gc|jni]\n                  Aktiviert die Verbose-Ausgabe\n    -version      Druckt Produktversion und beendet das Programm\n    -showversion  Druckt Produktversion und f\u00E4hrt fort\n    -? -help      Druckt diese Hilfemeldung\n    -X            Druckt Hilfe zu Nicht-Standardoptionen\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  Aktiviert Assertions mit angegebener Granularit\u00E4t\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  Deaktiviert Assertions mit angegebener Granularit\u00E4t\n    -esa | -enablesystemassertions\n                  Aktiviert System-Assertions\n    -dsa | -disablesystemassertions\n                  Deaktiviert System-Assertions\n    -agentlib:<libname>[=<options>]\n                  L\u00E4dt native Agent Library <libname>, z.B. -agentlib:jdwp\n                  siehe auch -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  L\u00E4dt native Agent Library nach vollem Pfadnamen\n    -javaagent:<jarpath>[=<options>]\n                  L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n    -splash:<imagepath>\n                  Zeigt Startbildschirm mit angegebenem Bild an\n    @<filepath>   Liest Optionen aus der angegebenen Datei\n
+java.launcher.opt.footer     =-cp <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n    -classpath <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n                  und ZIP-Archiven zur Suche nach Klassendateien.\n    -mp <Modulpfad>\n    -modulepath <Modulpfad>...\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, in der jedes Verzeichnis\n                  ein Modulverzeichnis darstellt.\n    -upgrademodulepath <Modulpfad>...\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, in der jedes Verzeichnis\n                  ein Verzeichnis von Modulen darstellt, die upgradef\u00E4hige\n                  Module im Laufzeitimage ersetzen\n    -m <modulename>[/<mainclass>]\n                  Das aufzul\u00F6sende anf\u00E4ngliche Modul und der Name der auszuf\u00FChrenden Hauptklasse,\n                  wenn nicht durch das Modul angegeben\n    -addmods <modulename>[,<modulename>...]\n                  Root-Module, die zus\u00E4tzlich zum anf\u00E4nglichen Modul aufgel\u00F6st werden sollen\n    -limitmods <modulename>[,<modulename>...]\n                  Gesamtzahl der beobachtbaren Module einschr\u00E4nken\n    -listmods[:<modulename>[,<modulename>...]]\n                  Beobachtbare Module auflisten und Vorgang beenden\n    --dry-run     VM erstellen, aber Hauptmethode nicht ausf\u00FChren.\n                  Diese dry-run-Option kann n\u00FCtzlich sein, um\n                  Befehlszeilenoptionen wie die Modulsystemkonfiguration zu validieren.\n    -D<name>=<value>\n                  Systemeigenschaft festlegen\n    -verbose:[class|gc|jni]\n                  Verbose-Ausgabe aktivieren\n    -version      Produktversion drucken und Vorgang beenden\n    -showversion  Produktversion drucken und fortfahren\n    -? -help      Diese Hilfemeldung drucken\n    -X            Hilfe zu Nicht-Standardoptionen drucken\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  Assertions mit angegebener Granularit\u00E4t aktivieren\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  Assertions mit angegebener Granularit\u00E4t deaktivieren\n    -esa | -enablesystemassertions\n                  System-Assertions aktivieren\n    -dsa | -disablesystemassertions\n                  System-Assertions deaktivieren\n    -agentlib:<libname>[=<options>]\n                  Native Agent Library <libname> laden, z.\u00A0B. -agentlib:jdwp,\n                  siehe auch -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  Native Agent Library nach vollst\u00E4ndigem Pfadnamen laden\n    -javaagent:<jarpath>[=<options>]\n                  Agent f\u00FCr Java-Programmiersprachen laden, siehe java.lang.instrument\n    -splash:<imagepath>\n                  Startbildschirm mit angegebenem Bild anzeigen\n    @<filepath>   Optionen aus der angegebenen Datei lesen\n
 See Weitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           Ausf\u00FChrung im gemischten Modus (Standard)\n    -Xint             Nur Ausf\u00FChrung im interpretierten Modus\n    -Xbootclasspath/a:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n                      H\u00E4ngt an das Ende des Bootstrap Classpath an\n    -Xdiag            Zeigt zus\u00E4tzliche Diagnosemeldungen an\n    -Xdiag:resolver   Zeigt Resolver-Diagnosemeldungen an\n    -Xnoclassgc       Deaktiviert Klassen-Garbage Collection\n    -Xincgc           Aktiviert inkrementelle Garbage Collection\n    -Xloggc:<file>    Protokolliert GC-Status in einer Datei mit Zeitstempeln\n    -Xbatch           Deaktiviert Hintergrundkompilierung\n    -Xms<size>        Legt anf\u00E4ngliche Java-Heap-Gr\u00F6\u00DFe fest\n    -Xmx<size>        Legt maximale Java-Heap-Gr\u00F6\u00DFe fest\n    -Xss<size>        Legt Java-Threadstackgr\u00F6\u00DFe fest\n    -Xprof            Gibt CPU-Profilingdaten aus\n    -Xfuture          Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n    -Xrs              Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n    -Xcheck:jni       F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n    -Xshare:off       Kein Versuch, gemeinsame Klassendaten zu verwenden\n    -Xshare:auto      Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n    -Xshare:on        Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n    -XshowSettings    Zeigt alle Einstellungen an und f\u00E4hrt fort\n    -XshowSettings:all\n                      Zeigt alle Einstellungen an und f\u00E4hrt fort\n    -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen an und f\u00E4hrt fort\n    -XshowSettings:properties\n                      Zeigt alle Eigenschaftseinstellungen an und f\u00E4hrt fort\n    -XshowSettings:locale\n                      Zeigt alle gebietsschemabezogenen Einstellungen an und f\u00E4hrt fort\n    -XaddReads:<module>=<other-module>(,<other-module>)*\n                      <module> liest andere Module\n                      unabh\u00E4ngig von der Moduldeklaration\n    -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n                      <module> exportiert <package> in andere Module\n                      unabh\u00E4ngig von der Moduldeklaration\n    -Xpatch:<module>=<file>({0}<file>)*\n                      Modul mit Klassen und Ressourcen in JAR-Dateien oder Verzeichnissen\n                      au\u00DFer Kraft setzen oder erg\u00E4nzen\n    -Xdisable-@files  Deaktiviert weitere Argumentdateierweiterung\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\nDie folgenden Optionen sind f\u00FCr Mac OS X spezifisch:\n    -XstartOnFirstThread\n                      f\u00FChrt die main()-Methode f\u00FCr den ersten (AppKit) Thread aus\n    -Xdock:name=<Anwendungsname>"\n                      \u00DCberschreibt den in der Uhr angezeigten Standardanwendungsnamen\n    -Xdock:icon=<Pfad zu Symboldatei>\n                      \u00DCberschreibt das in der Uhr angezeigte Standardsymbol\n\n
+java.launcher.X.macosx.usage=\nDie folgenden Optionen sind f\u00FCr Mac OS X spezifisch:\n    -XstartOnFirstThread\n                      main()-Methode f\u00FCr den ersten (AppKit) Thread ausf\u00FChren\n    -Xdock:name=<application name>\n                      Den im Dock angezeigten Standardanwendungsnamen \u00FCberschreiben\n    -Xdock:icon=<Pfad zu Symboldatei>\n                      Das im Dock angezeigte Standardsymbol \u00FCberschreiben\n\n
 
 java.launcher.cls.error1=Fehler: Hauptklasse {0} konnte nicht gefunden oder geladen werden
 java.launcher.cls.error2=Fehler: Hauptmethode ist nicht {0} in Klasse {1}. Definieren Sie die Hauptmethode als:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_es.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_es.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  porque la ejecuci\u00F3n se est\u00E1 llevando a cabo en una m\u00E1quina de clase de servidor.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y archivos zip/jar>\n    -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y archivos zip/jar>\n                  Lista separada por {0} de directorios, archivos JAR\n                  y archivos ZIP para buscar archivos de clase.\n    -mp <ruta_m\u00F3dulo>\n    -modulepath <ruta_m\u00F3dulo>...\n                  Lista separada por {0} de directorios, cada directorio\n                  es un directorio de m\u00F3dulos.\n    -upgrademodulepath <ruta_m\u00F3dulo>...\n                  Lista separada por {0} de directorios, cada directorio\n                  es un directorio de m\u00F3dulos que sustituye a los m\u00F3dulos\n                  actualizables en la imagen de tiempo de ejecuci\u00F3n\n    -m <nombre_m\u00F3dulo>[/<clase_principal>]\n                  m\u00F3dulo inicial que resolver y nombre de la clase principal\n                  que ejecutar si el m\u00F3dulo no la especifica\n    -addmods <nombre_m\u00F3dulo>[,<nombre_modulo>...]\n                  m\u00F3dulos ra\u00EDz que resolver, adem\u00E1s del m\u00F3dulo inicial\n    -limitmods <nombre_m\u00F3dulo>[,<nombre_m\u00F3dulo>...]\n                  limitar el universo de los m\u00F3dulos observables\n    -listmods[:<nombre_m\u00F3dulo>[,<nombre_m\u00F3dulo>...]]\n                  mostrar los m\u00F3dulos observables y sale\n    -D<nombre>=<valor>\n                  definir una propiedad del sistema\n    -verbose:[class|gc|jni]\n                  activar la salida verbose\n    -version      imprimir la versi\u00F3n del producto y sale\n    -showversion  imprimir la versi\u00F3n del producto y sale\n    -? -help      imprimir este mensaje de ayuda\n    -X            imprimir la ayuda de opciones no est\u00E1ndar\n    -ea[:<nombre_paquete>...|:<nombre_clase>]\n    -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n                  activar afirmaciones con la granularidad especificada\n    -da[:<nombre_paquete>...|:<nombre_clase>]\n    -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n                  desactivar afirmaciones con la granularidad especificada\n    -esa | -enablesystemassertions\n                  activar afirmaciones del sistema\n    -dsa | -disablesystemassertions\n                  desactivar afirmaciones del sistema\n    -agentlib:<nombre_bib>[=<opciones>]\n                  cargar biblioteca de agentes nativos <nombre_bib>, por ejemplo, -agentlib:jdwp\n                  ver tambi\u00E9n -agentlib:jdwp=help\n    -agentpath:<nombre_ruta>[=<opciones>]\n                  cargar biblioteca de agentes nativos por ruta completa\n    -javaagent:<ruta_jar>[=<opciones>]\n                  cargar agente de lenguaje de programaci\u00F3n Java, ver java.lang.instrument\n    -splash:<ruta_imagen>\n                  mostrar pantalla de bienvenida con la imagen especificada\n    @<ruta_archivo>   leer opciones del archivo especificado\n
+java.launcher.opt.footer     =\    -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y archivos zip/jar>\n    -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y archivos zip/jar>\n                  Lista separada por {0} de directorios, archivos JAR\n                  y archivos ZIP para buscar archivos de clase.\n    -mp <ruta_m\u00F3dulo>\n    -modulepath <ruta_m\u00F3dulo>...\n                  Lista separada por {0} de directorios, cada directorio\n                  es un directorio de m\u00F3dulos.\n    -upgrademodulepath <ruta_m\u00F3dulo>...\n                  Lista separada por {0} de directorios, cada directorio\n                  es un directorio de m\u00F3dulos que sustituye a los m\u00F3dulos\n                  actualizables en la imagen de tiempo de ejecuci\u00F3n\n    -m <nombre_m\u00F3dulo>[/<clase_principal>]\n                  m\u00F3dulo inicial que resolver y nombre de la clase principal\n                  que ejecutar si el m\u00F3dulo no la especifica\n    -addmods <nombre_m\u00F3dulo>[,<nombre_modulo>...]\n                  m\u00F3dulos ra\u00EDz que resolver, adem\u00E1s del m\u00F3dulo inicial\n    -limitmods <nombre_m\u00F3dulo>[,<nombre_m\u00F3dulo>...]\n                  limitar el universo de los m\u00F3dulos observables\n    -listmods[:<nombre_m\u00F3dulo>[,<nombre_m\u00F3dulo>...]]\n                  mostrar los m\u00F3dulos observables y salir\n    --dry-run     crear VM pero no ejecutar m\u00E9todo principal.\n                  Esta opci\u00F3n --dry-run puede ser \u00FAtil para validar las\n                  opciones de l\u00EDnea de comandos como la configuraci\u00F3n del sistema de m\u00F3dulo.\n    -D<nombre>=<valor>\n                  definir una propiedad del sistema\n    -verbose:[class|gc|jni]\n                  activar la salida detallada\n    -version      imprimir la versi\u00F3n del producto y salir\n    -showversion  imprimir la versi\u00F3n del producto y continuar\n    -? -help      imprimir este mensaje de ayuda\n    -X            imprimir la ayuda de opciones no est\u00E1ndar\n    -ea[:<nombre_paquete>...|:<nombre_clase>]\n    -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n                  activar afirmaciones con la granularidad especificada\n    -da[:<nombre_paquete>...|:<nombre_clase>]\n    -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n                  desactivar afirmaciones con la granularidad especificada\n    -esa | -enablesystemassertions\n                  activar afirmaciones del sistema\n    -dsa | -disablesystemassertions\n                  desactivar afirmaciones del sistema\n    -agentlib:<nombre_bib>[=<opciones>]\n                  cargar biblioteca de agentes nativos <nombre_bib>, por ejemplo, -agentlib:jdwp\n                  ver tambi\u00E9n -agentlib:jdwp=help\n    -agentpath:<nombre_ruta>[=<opciones>]\n                  cargar biblioteca de agentes nativos por ruta completa\n    -javaagent:<ruta_jar>[=<opciones>]\n                  cargar agente de lenguaje de programaci\u00F3n Java, ver java.lang.instrument\n    -splash:<ruta_imagen>\n                  mostrar pantalla de bienvenida con la imagen especificada\n    @<ruta_archivo>   leer opciones del archivo especificado\n
 See http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           ejecuci\u00F3n de modo mixto (por defecto)\n    -Xint             solo ejecuci\u00F3n de modo interpretado\n    -Xbootclasspath/a:<directorios y archivos zip/jar separados por {0}>\n                       agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n    -Xdiag             mostrar mensajes de diagn\u00F3stico adicionales\n    -Xdiag:resolver   mostrar mensajes de diagn\u00F3stico de resoluci\u00F3n\n    -Xnoclassgc        desactivar la recolecci\u00F3n de basura de clases\n    -Xloggc:<archivo>     registrar el estado de GC en un archivo con registros de hora\n    -Xbatch           desactivar compilaci\u00F3n en segundo plano\n    -Xms<tama\u00F1o>        definir tama\u00F1o de pila Java inicial\n    -Xmx<tama\u00F1o>        definir tama\u00F1o de pila Java m\u00E1ximo\n    -Xss<tama\u00F1o>        definir tama\u00F1o de la pila del thread de Java\n    -Xprof            datos de salida de creaci\u00F3n de perfil de CPU\n    -Xfuture          activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n    -Xrs              reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n    -Xcheck:jni       realizar comprobaciones adicionales para las funciones de JNI\n    -Xshare:off       no intentar usar datos de clase compartidos\n    -Xshare:auto      usar datos de clase compartidos si es posible (valor por defecto)\n    -Xshare:on         es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n    -XshowSettings    show all settings and continue\n    -XshowSettings:all\n                      mostrar todos los valores y continuar\n    -XshowSettings:vm show all vm related settings and continue\n    -XshowSettings:properties\n                      mostrar todos los valores y continuar\n    -XshowSettings:locale\n                       mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n    -XaddReads:<m\u00F3dulo>=<otro_m\u00F3dulo>(,<otro_m\u00F3dulo>)*\n                      <module> lee otros m\u00F3dulos,\n                      independientemente de la declaraci\u00F3n del m\u00F3dulo\n    -XaddExports:<m\u00F3dulo>/<paquete>=<otro_m\u00F3dulo>(,<otro_m\u00F3dulo>)*\n                      <m\u00F3dulo> exporta <paquete> a otros m\u00F3dulos,\n                      independientemente de la declaraci\u00F3n del m\u00F3dulo\n    -Xpatch:<m\u00F3dulo>=<archivo>({0}<archivo>)*\n                      Anular o aumentar un m\u00F3dulo con clases y recursos\n                      en directorios o archivos JAR\n    -Xdisable-@files  desactivar la ampliaci\u00F3n de archivos de argumentos\n\nLas opciones -X no son est\u00E1ndar y est\u00E1n sujetas a cambios sin previo aviso.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\nLas siguientes opciones son espec\u00EDficas para Mac OS X:\n    -XstartOnFirstThread\n                      ejecuta el m\u00E9todo main() del primer thread (AppKit)\n    -Xdock:name=<nombre de aplicaci\u00F3n>"\n                      sustituye al nombre por defecto de la aplicaci\u00F3n que se muestra en el Dock\n    -Xdock:icon=<ruta de acceso a archivo de icono>\n                      sustituye al icono por defecto que se muestra en el Dock\n\n
+java.launcher.X.macosx.usage=\nLas siguientes opciones son espec\u00EDficas para Mac OS X:\n    -XstartOnFirstThread\n                      ejecutar el m\u00E9todo main() del primer thread (AppKit)\n    -Xdock:name=<application name>\n                      sustituir al nombre por defecto de la aplicaci\u00F3n que se muestra en el Dock\n    -Xdock:icon=<ruta de acceso a archivo de icono>\n                      sustituir al icono por defecto que se muestra en el Dock\n\n
 
 java.launcher.cls.error1=Error: no se ha encontrado o cargado la clase principal {0}
 java.launcher.cls.error2=Error: el m\u00E9todo principal no es {0} en la clase {1}, defina el m\u00E9todo principal del siguiente modo:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_fr.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_fr.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  car vous ex\u00E9cutez une machine de classe de serveur.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <chemin de recherche de classe de r\u00E9pertoires et de fichiers ZIP/JAR>\n    -classpath <chemin de recherche de classe de r\u00E9pertoires et de fichiers ZIP/JAR>\n                  Liste de r\u00E9pertoires, d''archives JAR\n                  et d''archives ZIP s\u00E9par\u00E9s par des {0} dans laquelle rechercher les fichiers de classe.\n    -mp <chemin de module>\n    -modulepath <chemin de module>...\n                  Liste de r\u00E9pertoires s\u00E9par\u00E9s par des {0}, chaque r\u00E9pertoire\n                  est un r\u00E9pertoire de modules.\n    -upgrademodulepath <chemin de module>...\n                  Liste de r\u00E9pertoires s\u00E9par\u00E9s par des {0}, chaque r\u00E9pertoire\n                  est un r\u00E9pertoire de modules qui remplace des modules\n                  pouvant \u00EAtre mis \u00E0 niveau dans l''image d''ex\u00E9cution\n    -m <modulename>[/<mainclass>]\n                  module initial \u00E0 r\u00E9soudre et nom de la classe principale\n                  \u00E0 ex\u00E9cuter si elle n''est pas indiqu\u00E9e par le module\n    -addmods <modulename>[,<modulename>...]\n                  modules racines \u00E0 r\u00E9soudre en plus du module initial\n    -limitmods <modulename>[,<modulename>...]\n                  limitation de l''univers de modules observables\n    -listmods[:<modulename>[,<modulename>...]]\n                  \u00E9num\u00E9ration des modules observables et fin de l''op\u00E9ration\n    -D<name>=<value>\n                  d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n    -verbose:[class|gc|jni]\n                  activation de la sortie en mode verbose\n    -version      impression de la version du produit et fin de l''op\u00E9ration\n    -showversion  impression de la version du produit et poursuite de l''op\u00E9ration\n    -? -help      impression du message d''aide\n    -X            impression de l''aide sur les options non standard\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n    -esa | -enablesystemassertions\n                  activation des assertions syst\u00E8me\n    -dsa | -disablesystemassertions\n                  d\u00E9sactivation des assertions syst\u00E8me\n    -agentlib:<libname>[=<options>]\n                  chargement de la biblioth\u00E8que d''agent natif <libname>, par exemple : -agentlib:jdwp\n                  voir aussi -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n    -javaagent:<jarpath>[=<options>]\n                  chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n    -splash:<imagepath>\n                  affichage de l''\u00E9cran d''accueil avec l''image indiqu\u00E9e\n    @<filepath>   lire les options \u00E0 partir du fichier indiqu\u00E9\n
+java.launcher.opt.footer     =\    -cp <chemin de recherche de classe de r\u00E9pertoires et de fichiers ZIP/JAR>\n    -classpath <chemin de recherche de classe de r\u00E9pertoires et de fichiers ZIP/JAR>\n                  Liste de r\u00E9pertoires, d''archives JAR\n                  et d''archives ZIP s\u00E9par\u00E9s par des {0} dans laquelle rechercher les fichiers de classe.\n    -mp <chemin de module>\n    -modulepath <chemin de module>...\n                  Liste de r\u00E9pertoires s\u00E9par\u00E9s par des {0}, chaque r\u00E9pertoire\n                  est un r\u00E9pertoire de modules.\n    -upgrademodulepath <chemin de module>...\n                  Liste de r\u00E9pertoires s\u00E9par\u00E9s par des {0}, chaque r\u00E9pertoire\n                  est un r\u00E9pertoire de modules qui remplace des modules\n                  pouvant \u00EAtre mis \u00E0 niveau dans l''image d''ex\u00E9cution\n    -m <modulename>[/<mainclass>]\n                  module initial \u00E0 r\u00E9soudre et nom de la classe principale\n                  \u00E0 ex\u00E9cuter si elle n''est pas indiqu\u00E9e par le module\n    -addmods <modulename>[,<modulename>...]\n                  modules racine \u00E0 r\u00E9soudre en plus du module initial\n    -limitmods <modulename>[,<modulename>...]\n                  limitation de l''univers de modules observables\n    -listmods[:<modulename>[,<modulename>...]]\n                  \u00E9num\u00E9ration des modules observables et fin de l''op\u00E9ration\n    --dry-run     cr\u00E9e une machine virtuelle mais n''ex\u00E9cute pas la m\u00E9thode principale.\n                  Cette option --dry-run peut s''av\u00E9rer utile pour la validation des\n                  options de ligne de commandes telles que la configuration syst\u00E8me de module.\n    -D<nom>=<valeur>\n                  d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n    -verbose:[class|gc|jni]\n                  activation de la sortie en mode verbose\n    -version      affichage de la version du produit et fin de l''op\u00E9ration\n    -showversion  affichage de la version du produit et poursuite de l''op\u00E9ration\n    -? -help      affichage du message d''aide\n    -X            affichage de l''aide sur les options non standard\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n    -esa | -enablesystemassertions\n                  activation des assertions syst\u00E8me\n    -dsa | -disablesystemassertions\n                  d\u00E9sactivation des assertions syst\u00E8me\n    -agentlib:<libname>[=<options>]\n                  chargement de la biblioth\u00E8que d''agent natif <libname>, par exemple : -agentlib:jdwp\n                  voir aussi -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n    -javaagent:<jarpath>[=<options>]\n                  chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n    -splash:<imagepath>\n                  affichage de l''\u00E9cran d''accueil avec l''image indiqu\u00E9e\n    @<filepath>   lire les options \u00E0 partir du fichier indiqu\u00E9\n
 See http://www.oracle.com/technetwork/java/javase/documentation/index.html pour plus de d\u00E9tails.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           ex\u00E9cution en mode mixte (valeur par d\u00E9faut)\n    -Xint             ex\u00E9cution en mode interpr\u00E9t\u00E9 uniquement\n    -Xbootclasspath/a:<r\u00E9pertoires et fichiers ZIP/JAR s\u00E9par\u00E9s par des {0}>\n                      ajout \u00E0 la fin du chemin de classe bootstrap\n    -Xdiag            affichage de messages de diagnostic suppl\u00E9mentaires\n    -Xdiag:resolver   affichage de messages de diagnostic du r\u00E9solveur\n    -Xnoclassgc       d\u00E9sactivation du nettoyage de la m\u00E9moire de la classe\n    -Xloggc:<file>    journalisation du statut de nettoyage de la m\u00E9moire dans un fichier avec horodatage\n    -Xbatch           d\u00E9sactivation de la compilation en arri\u00E8re-plan\n    -Xms<size>        d\u00E9finition de la taille initiale des portions de m\u00E9moire Java\n    -Xmx<size>        d\u00E9finition de la taille maximale des portions de m\u00E9moire Java\n    -Xss<size>        d\u00E9finition de la taille de pile de threads Java\n    -Xprof            sortie des donn\u00E9es de profilage d''UC\n    -Xfuture          activation des contr\u00F4les les plus stricts en vue d''anticiper la future valeur par d\u00E9faut\n    -Xrs              r\u00E9duction de l''utilisation des signaux d''OS par Java/la machine virtuelle (voir documentation)\n    -Xcheck:jni       ex\u00E9cution de contr\u00F4les suppl\u00E9mentaires pour les fonctions JNI\n    -Xshare:off       aucune tentative d''utilisation des donn\u00E9es de classe partag\u00E9e\n    -Xshare:auto      utilisation des donn\u00E9es de classe partag\u00E9e si possible (valeur par d\u00E9faut)\n    -Xshare:on        utilisation des donn\u00E9es de classe partag\u00E9e obligatoire ou \u00E9chec de l''op\u00E9ration\n    -XshowSettings    affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n    -XshowSettings:all\n                      affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n    -XshowSettings:vm affichage de tous les param\u00E8tres de machine virtuelle et poursuite de l''op\u00E9ration\n    -XshowSettings:properties\n                      affichage de tous les param\u00E8tres de propri\u00E9t\u00E9 et poursuite de l''op\u00E9ration\n    -XshowSettings:locale\n                      affichage de tous les param\u00E8tres d''environnement local et poursuite de l''op\u00E9ration\n    -XaddReads:<module>=<other-module>(,<other-module>)*\n                      <module> lecture de tous les modules,\n                      quelle que soit la d\u00E9claration de module\n    -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n                      <module> exporte <package> vers d''autres modules,\n                      quelle que soit la d\u00E9claration de module\n    -Xpatch:<module>=<file>({0}<file>)*\n                      Remplacement ou augmentation d''un module avec des classes et des ressources\n                      dans des fichiers ou r\u00E9pertoires JAR\n    -Xdisable-@files  d\u00E9sactivation d''autres d\u00E9veloppements de fichier d''argument\n\nLes options -X ne sont pas standard et sont susceptibles de modification sans pr\u00E9avis.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\nLes options suivantes sont propres \u00E0 Mac OS X :\n    -XstartOnFirstThread\n                      ex\u00E9cute la m\u00E9thode main() sur le premier thread (AppKit)\n    -Xdock:name=<application name>"\n                      remplace le nom d'application par d\u00E9faut affich\u00E9 dans l'ancrage\n    -Xdock:icon=<path to icon file>\n                      remplace l'ic\u00F4ne par d\u00E9faut affich\u00E9e dans l'ancrage\n\n
+java.launcher.X.macosx.usage=\nLes options suivantes sont propres \u00E0 Mac OS X :\n    -XstartOnFirstThread\n                      ex\u00E9cute la m\u00E9thode main() sur le premier thread (AppKit)\n    -Xdock:name=<nom d'application>\n                      remplace le nom d'application par d\u00E9faut affich\u00E9 dans l'ancrage\n    -Xdock:icon=<chemin vers le fichier d'ic\u00F4ne>\n                      remplace l'ic\u00F4ne par d\u00E9faut affich\u00E9e dans l'ancrage\n\n
 
 java.launcher.cls.error1=Erreur : impossible de trouver ou charger la classe principale {0}
 java.launcher.cls.error2=Erreur : la m\u00E9thode principale n''est pas {0} dans la classe {1}, d\u00E9finissez la m\u00E9thode principale comme suit :\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_it.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_it.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  perch\u00E9 si utilizza un computer di classe server.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <classpath di ricerca di directory e file zip/jar>\n    -classpath <classpath di ricerca di directory e file zip/jar>\n                  Una lista separata da {0} di directory, archivi JAR\n                  e ZIP utilizzata per la ricerca di file di classe.\n    -mp <percorso modulo>\n    -modulepath <percorso modulo>...\n                  Una lista separata da {0} di directory; ciascuna directory\n                  \u00E8 una directory di moduli.\n    -upgrademodulepath <percorso modulo>...\n                  Una lista separata da {0} di directory; ciascuna directory\n                  \u00E8 una directory dei moduli che sostituiscono i moduli\n                  aggiornabili nell''immagine in fase di esecuzione\n    -m <nomemodulo>[/<classeprincipale>]\n                  il modulo iniziale da risolvere e il nome della classe principale\n                  da eseguire se non viene specificata dal modulo\n    -addmods <nomemodulo>[,<nomemodulo>...]\n                  moduli root da risolvere in aggiunta al modulo iniziale\n    -limitmods <nomemodulo>[,<nomemodulo>...]\n                  limita l''universe dei moduli osservabili\n    -listmods[:<nomemodulo>[,<nomemodulo>...]]\n                  elenca i moduli osservabili ed esce\n    -D<nome>=<valore>\n                  imposta una propriet\u00E0 di sistema\n    -verbose:[class|gc|jni]\n                  abilita l''output descrittivo\n    -version      stampa la versione del prodotto ed esce\n    -showversion  stampa la versione del prodotto e continua\n    -? -help      stampa questo messaggio della Guida\n    -X            stampa la Guida sulle opzioni non standard\n    -ea[:<nomepackage>...|:<nomeclasse>]\n    -enableassertions[:<nomepackage>...|:<nomeclasse>]\n                  abilita le asserzioni con la granularit\u00E0 specificata\n    -da[:<nomepackage>...|:<nomeclasse>]\n    -disableassertions[:<nomepackage>...|:<nomeclasse>]\n                  disabilita le asserzioni con la granularit\u00E0 specificata\n    -esa | -enablesystemassertions\n                  abilita le asserzioni di sistema\n    -dsa | -disablesystemassertions\n                  disabilita le asserzioni di sistema\n    -agentlib:<nomelibreria>[=<opzioni>]\n                  load native agent library <nomelibreria>, ad esempio -agentlib:jdwp\n                  vedere anche -agentlib:jdwp=help\n    -agentpath:<nomepercorso>[=<opzioni>]\n                  carica la libreria agenti nativa con il percorso completo\n    -javaagent:<percorsojar>[=<opzioni>]\n                  carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n    -splash:<percorsoimmagine>\n                  mostra la schermata iniziale con l''immagine specificata\n    @<percorsofile>   legge le opzioni dal file specificato\n
+java.launcher.opt.footer     =\    -cp <classpath di ricerca di directory e file zip/jar>\n    -classpath <classpath di ricerca di directory e file zip/jar>\n                  Lista separata da {0} di directory e di archivi JAR\n                  e ZIP utilizzata per la ricerca di file di classe.\n    -mp <percorso modulo>\n    -modulepath <percorso modulo>...\n                  Lista separata da {0} di directory; ciascuna directory\n                  \u00E8 una directory di moduli.\n    -upgrademodulepath <percorso modulo>...\n                  Lista separata da {0} di directory; ciascuna directory\n                  \u00E8 una directory dei moduli che sostituiscono i moduli\n                  aggiornabili nell''immagine in fase di esecuzione.\n    -m <nome modulo>[/<classe principale>]\n                  Il modulo iniziale da risolvere e il nome della classe\n                  principale da eseguire se non specificata dal modulo.\n    -addmods <nome modulo>[,<nome modulo>...]\n                  Moduli root da risolvere in aggiunta al modulo iniziale.\n    -limitmods <nome modulo>[,<nome modulo>...]\n                  Limita l''universe dei moduli osservabili.\n    -listmods[:<nome modulo>[,<nome modulo>...]]\n                  Elenca i moduli osservabili ed esce.\n    --dry-run     Crea la VM ma non esegue il metodo principale.\n                  Pu\u00F2 essere utile, ad esempio, per la convalida delle opzioni della\n                  riga di comando utilizzate per la configurazione del sistema di moduli.\n    -D<nome>=<valore>\n                  Imposta una propriet\u00E0 di sistema.\n    -verbose:[class|gc|jni]\n                  Abilita l''output descrittivo.\n    -version      Visualizza la versione del prodotto ed esce.\n    -showversion  Visualizza la versione del prodotto e continua\n    -? -help      Visualizza questo messaggio della Guida.\n    -X            Visualizza la Guida relativa alle opzioni non standard.\n    -ea[:<nome package>...|:<nome classe>]\n    -enableassertions[:<nome package>...|:<nome classe>]\n                  Abilita le asserzioni con la granularit\u00E0 specificata.\n    -da[:<nome package>...|:<nome classe>]\n    -disableassertions[:<nome package>...|:<nome classe>]\n                  Disabilita le asserzioni con la granularit\u00E0 specificata.\n    -esa | -enablesystemassertions\n                  Abilita le asserzioni di sistema.\n    -dsa | -disablesystemassertions\n                  Disabilita le asserzioni di sistema.\n    -agentlib:<nome libreria>[=<opzioni>]\n                  Carica la libreria agenti nativa <nome libreria>, ad esempio -agentlib:jdwp.\n                  Vedere anche -agentlib:jdwp=help.\n    -agentpath:<nome percorso>[=<opzioni>]\n                  Carica la libreria agenti nativa con il percorso completo.\n    -javaagent:<percorso jar>[=<opzioni>]\n                  Carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument.\n    -splash:<percorso immagine>\n                  Mostra la schermata iniziale con l''immagine specificata.\n    @<percorso file>   Legge le opzioni dal file specificato.\n
 See Per ulteriori dettagli, vedere http://www.oracle.com/technetwork/java/javase/documentation/index.html.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           esecuzione in modalit\u00E0 mista (impostazione predefinita)\n    -Xint             esecuzione solo in modalit\u00E0 convertita\n    -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n                      aggiunge alla fine del classpath di bootstrap\n     -Xdiag            mostra messaggi di diagnostica aggiuntivi\n    -Xdiag:resolver   mostra i messaggi di diagnostica del resolver\n    -Xnoclassgc       disabilita la garbage collection della classe\n    -Xloggc:<file>    registra lo stato GC in un file con indicatori orari\n    -Xbatch           disabilita la compilazione in background\n    -Xms<size>        imposta la dimensione heap Java iniziale\n    -Xmx<size>        imposta la dimensione heap Java massima\n    -Xss<size>        imposta la dimensione dello stack di thread Java\n    -Xprof            visualizza i dati di profilo della CPU\n    -Xfuture          abilita i controlli pi\u00F9 limitativi anticipando le impostazioni predefinite future\n    -Xrs              riduce l''uso di segnali del sistema operativo da Java/VM (vedere la documentazione)\n    -Xcheck:jni       esegue controlli aggiuntivi per le funzioni JNI\n    -Xshare:off       non tenta di utilizzare i dati della classe condivisi\n    -Xshare:auto      utilizza i dati di classe condivisi se possibile (impostazione predefinita)\n    -Xshare:on        richiede l''uso dei dati di classe condivisi, altrimenti l''esecuzione non riesce.\n    -XshowSettings    mostra tutte le impostazioni e continua\n    -XshowSettings:all\n                      mostra tutte le impostazioni e continua\n    -XshowSettings:vm mostra tutte le impostazioni correlate alla VM e continua\n    -XshowSettings:properties\n                      mostra tutte le impostazioni delle propriet\u00E0 e continua\n    -XshowSettings:locale\n                      mostra tutte le impostazioni correlate alle impostazioni nazionali e continua\n   -XaddReads:<module>=<other-module>(,<other-module>)*\n                      <module> legge altri moduli,\n                      indipendentemente dalla dichiarazione del modulo\n   -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n                      <module> esporta il <package> in altri moduli,\n                      indipendentemente dalla dichiarazione del modulo\n    -Xpatch:<module>=<file>({0}<file>)*\n                      sostituisce o migliora un modulo con classi e risorse\n                      in file JAR o directory\n    -Xdisable-@files  disabilita l''ulteriore espansione del file di argomenti\n\nLe opzioni -X non sono opzioni standard e sono soggette a modifiche senza preavviso.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\nLe opzioni riportate di seguito sono specifiche del sistema operativo Mac OS X:\n    -XstartOnFirstThread\n                      Esegue il metodo main() sul primo thread (AppKit).\n    -Xdock:name=<nome applicazione>"\n                      Sostituisce il nome applicazione predefinito visualizzato nel dock\n    -Xdock:icon=<percorso file icona>\n                      Sostituisce l'icona predefinita visualizzata nel dock\n\n
+java.launcher.X.macosx.usage=\nLe opzioni riportate di seguito sono specifiche del sistema operativo Mac OS X:\n    -XstartOnFirstThread\n                      Esegue il metodo main() sul primo thread (AppKit).\n    -Xdock:name=<nome applicazione>\n                      Sostituisce il nome applicazione predefinito visualizzato nel dock\n    -Xdock:icon=<percorso file icona>\n                      Sostituisce l'icona predefinita visualizzata nel dock\n\n
 
 java.launcher.cls.error1=Errore: impossibile trovare o caricare la classe principale {0}
 java.launcher.cls.error2=Errore: il metodo principale non \u00E8 {0} nella classe {1}. Definire il metodo principale come:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2014, 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
@@ -34,8 +34,8 @@
 java.launcher.ergo.message2  =\                  \u3053\u308C\u306F\u30B5\u30FC\u30D0\u30FC\u30AF\u30E9\u30B9\u306E\u30DE\u30B7\u30F3\u3067\u5B9F\u884C\u3057\u3066\u3044\u308B\u305F\u3081\u3067\u3059\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n    -classpath <class search path of directories and zip/jar files>\n                  \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n                  JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3002\n    -mp <module path>\n    -modulepath <module path>...\n                  \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3002\u5404\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\n                  \u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u3059\u3002\n    -upgrademodulepath <module path>...\n                  \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3002\u5404\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\n                  \u30E9\u30F3\u30BF\u30A4\u30E0\u30FB\u30A4\u30E1\u30FC\u30B8\u3067\u30A2\u30C3\u30D7\u30B0\u30EC\u30FC\u30C9\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u7F6E\u63DB\u3059\u308B\n                  \u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u3059\n    -m <modulename>[/<mainclass>]\n                  \u89E3\u6C7A\u3059\u308B\u521D\u671F\u30E2\u30B8\u30E5\u30FC\u30EB\u304A\u3088\u3073\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u306B\n                  \u5B9F\u884C\u3059\u308B\u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9\u306E\u540D\u524D\n    -addmods <modulename>[,<modulename>...]\n                  \u521D\u671F\u30E2\u30B8\u30E5\u30FC\u30EB\u306B\u52A0\u3048\u3066\u89E3\u6C7A\u3059\u308B\u30EB\u30FC\u30C8\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\n    -limitmods <modulename>[,<modulename>...]\n                  \u76E3\u8996\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30E6\u30CB\u30D0\u30FC\u30B9\u3092\u5236\u9650\u3059\u308B\n    -listmods[:<modulename>[,<modulename>...]]\n                  \u76E3\u8996\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30EA\u30B9\u30C8\u3057\u3066\u7D42\u4E86\u3059\u308B\n    -D<name>=<value>\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n    -verbose:[class|gc|jni]\n                  \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n    -version      \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n    -showversion  \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -? -help      \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n    -X            \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -esa | -enablesystemassertions\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -dsa | -disablesystemassertions\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -agentlib:<libname>[=<options>]\n                  \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA<libname>\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: \
--agentlib:jdwp\n                  -agentlib:jdwp=help\u3082\u53C2\u7167\n    -agentpath:<pathname>[=<options>]\n                  \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n    -javaagent:<jarpath>[=<options>]\n                  Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n    -splash:<imagepath>\n                  \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n    @<filepath>   \u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8AAD\u307F\u53D6\u308B\n
+java.launcher.opt.footer     =\    -cp <\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB\u306E\u30AF\u30E9\u30B9\u691C\u7D22\u30D1\u30B9>\n    -classpath <\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304A\u3088\u3073zip/jar\u30D5\u30A1\u30A4\u30EB\u306E\u30AF\u30E9\u30B9\u691C\u7D22\u30D1\u30B9>\n                  \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n                  JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3002\n    -mp <\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9>\n    -modulepath <\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9>...\n                  \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3002\u5404\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\n                  \u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u3059\u3002\n    -upgrademodulepath <\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9>...\n                  \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3002\u5404\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\n                  \u30E9\u30F3\u30BF\u30A4\u30E0\u30FB\u30A4\u30E1\u30FC\u30B8\u3067\u30A2\u30C3\u30D7\u30B0\u30EC\u30FC\u30C9\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u7F6E\u63DB\u3059\u308B\n                  \u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u3059\n    -m <modulename>[/<mainclass>]\n                  \u89E3\u6C7A\u3059\u308B\u521D\u671F\u30E2\u30B8\u30E5\u30FC\u30EB\u304A\u3088\u3073\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u306B\n                  \u5B9F\u884C\u3059\u308B\u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9\u306E\u540D\u524D\n    -addmods <modulename>[,<modulename>...]\n                  \u521D\u671F\u30E2\u30B8\u30E5\u30FC\u30EB\u306B\u52A0\u3048\u3066\u89E3\u6C7A\u3059\u308B\u30EB\u30FC\u30C8\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\n    -limitmods <modulename>[,<modulename>...]\n                  \u76E3\u8996\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30E6\u30CB\u30D0\u30FC\u30B9\u3092\u5236\u9650\u3059\u308B\n    -listmods[:<modulename>[,<modulename>...]]\n                  \u76E3\u8996\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u30EA\u30B9\u30C8\u3057\u3066\u7D42\u4E86\u3059\u308B\n    --dry-run     VM\u3092\u4F5C\u6210\u3059\u308B\u304C\u3001\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u306F\u5B9F\u884C\u3057\u306A\u3044\u3002\n                  \u3053\u306E--dry-run\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u3001\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30B7\u30B9\u30C6\u30E0\u69CB\u6210\u306A\u3069\u306E\n                  \u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u691C\u8A3C\u3059\u308B\u5834\u5408\u306B\u4FBF\u5229\u3067\u3059\u3002\n    -D<name>=<value>\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n    -verbose:[class|gc|jni]\n                  \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n    -version      \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n    -showversion  \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -? -help      \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n    -X            \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \
+\u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -esa | -enablesystemassertions\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -dsa | -disablesystemassertions\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -agentlib:<libname>[=<options>]\n                  \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA<libname>\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:jdwp\n                  -agentlib:jdwp=help\u3082\u53C2\u7167\n    -agentpath:<pathname>[=<options>]\n                  \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n    -javaagent:<jarpath>[=<options>]\n                  Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n    -splash:<imagepath>\n                  \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n    @<filepath>   \u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8AAD\u307F\u53D6\u308B\n
 See \u8A73\u7D30\u306F\u3001http://www.oracle.com/technetwork/java/javase/documentation/index.html\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 
 # Translators please note do not translate the options themselves
@@ -43,7 +43,7 @@
        <module>\u306F<package>\u3092\u4ED6\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306B\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u3059\u308B\n    -Xpatch:<module>=<file>({0}<file>)*\n                      JAR\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30EA\u30BD\u30FC\u30B9\u3067\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\n                      \u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u307E\u305F\u306F\u62E1\u5F35\u3059\u308B\n    -Xdisable-@files  \u3055\u3089\u306A\u308B\u30D5\u30A1\u30A4\u30EB\u62E1\u5F35\u3092\u7121\u52B9\u306B\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\n\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306FMac OS X\u56FA\u6709\u3067\u3059\u3002\n    -XstartOnFirstThread\n                      main()\u30E1\u30BD\u30C3\u30C9\u3092\u6700\u521D(AppKit)\u306E\u30B9\u30EC\u30C3\u30C9\u3067\u5B9F\u884C\u3059\u308B\n    -Xdock:name=<application name>"\n                      Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u540D\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n    -Xdock:icon=<path to icon file>\n                      Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n\n
+java.launcher.X.macosx.usage=\n\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306FMac OS X\u56FA\u6709\u3067\u3059:\n    -XstartOnFirstThread\n                      main()\u30E1\u30BD\u30C3\u30C9\u3092\u6700\u521D(AppKit)\u306E\u30B9\u30EC\u30C3\u30C9\u3067\u5B9F\u884C\u3059\u308B\n    -Xdock:name=<application name>\n                      Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u540D\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n    -Xdock:icon=<path to icon file>\n                      Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n\n
 
 java.launcher.cls.error1=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u3089\u306A\u304B\u3063\u305F\u304B\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
 java.launcher.cls.error2=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{1}\u306E{0}\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_ko.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_ko.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2014, 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
@@ -34,8 +34,8 @@
 java.launcher.ergo.message2  =\                  \uC11C\uBC84\uAE09 \uC2DC\uC2A4\uD15C\uC5D0\uC11C \uC2E4\uD589 \uC911\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n    -classpath <class search path of directories and zip/jar files>\n                  \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n                  JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n    -mp <module path>\n    -modulepath <module path>...\n                  {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC785\uB2C8\uB2E4. \uAC01 \uB514\uB809\uD1A0\uB9AC\uB294\n                  \uBAA8\uB4C8\uC758 \uB514\uB809\uD1A0\uB9AC\uC785\uB2C8\uB2E4.\n    -upgrademodulepath <module path>...\n                  {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC785\uB2C8\uB2E4. \uAC01 \uB514\uB809\uD1A0\uB9AC\uB294\n                  \uB7F0\uD0C0\uC784 \uC774\uBBF8\uC9C0\uC5D0\uC11C \uC5C5\uADF8\uB808\uC774\uB4DC \uAC00\uB2A5\uD55C \uBAA8\uB4C8\uC744\n                  \uB300\uCCB4\uD558\uB294 \uBAA8\uB4C8\uC758 \uB514\uB809\uD1A0\uB9AC\uC785\uB2C8\uB2E4.\n    -m <modulename>[/<mainclass>]\n                  \uBD84\uC11D\uD560 \uCD08\uAE30 \uBAA8\uB4C8 \uBC0F \uBAA8\uB4C8\uC5D0\uC11C \uC9C0\uC815\uB418\uC9C0 \uC54A\uC740 \uACBD\uC6B0 \uC2E4\uD589\uD560\n                  \uAE30\uBCF8 \uD074\uB798\uC2A4\uC758 \uC774\uB984\uC785\uB2C8\uB2E4.\n    -addmods <modulename>[,<modulename>...]\n                  \uCD08\uAE30 \uBAA8\uB4C8 \uC678\uC5D0 \uBD84\uC11D\uD560 \uB8E8\uD2B8 \uBAA8\uB4C8\uC785\uB2C8\uB2E4.\n    -limitmods <modulename>[,<modulename>...]\n                  \uAD00\uCC30 \uAC00\uB2A5\uD55C \uBAA8\uB4C8\uC758 \uBC94\uC704\uB97C \uC81C\uD55C\uD569\uB2C8\uB2E4.\n    -listmods[:<modulename>[,<modulename>...]]\n                  \uAD00\uCC30 \uAC00\uB2A5\uD55C \uBAA8\uB4C8\uC744 \uB098\uC5F4\uD558\uACE0 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n    -D<name>=<value>\n                  \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n    -verbose:[class|gc|jni]\n                  \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -version      \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD558\uACE0 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n    -showversion  \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD558\uACE0 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n    -? -help      \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n    -X            \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -esa | -enablesystemassertions\n                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -dsa | -disablesystemassertions\n                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -agentlib:<libname>[=<options>]\n                  \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC <libname>\uC744 \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:jdwp)\n                  -agentlib:jdwp=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n    -agentpath:<pathname>[=<options>]\n                  \uC804\uCCB4 \uACBD\uB85C \uC774\uB984\uC744 \uC0AC\uC6A9\uD574\uC11C \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n    -javaagent:<jarpath>[=<options>]\n \
-                 Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n    -splash:<imagepath>\n                  \uC9C0\uC815\uB41C \uC774\uBBF8\uC9C0\uB85C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n    @<filepath>   \uC9C0\uC815\uB41C \uD30C\uC77C\uC5D0\uC11C \uC635\uC158\uC744 \uC77D\uC2B5\uB2C8\uB2E4.\n
+java.launcher.opt.footer     =\    -cp <\uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C\uC758 \uD074\uB798\uC2A4 \uAC80\uC0C9 \uACBD\uB85C>\n    -classpath <\uB514\uB809\uD1A0\uB9AC \uBC0F zip/jar \uD30C\uC77C\uC758 \uD074\uB798\uC2A4 \uAC80\uC0C9 \uACBD\uB85C>\n                  \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n                  JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n    -mp <\uBAA8\uB4C8 \uACBD\uB85C>\n    -modulepath <\uBAA8\uB4C8 \uACBD\uB85C>...\n                  {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC785\uB2C8\uB2E4. \uAC01 \uB514\uB809\uD1A0\uB9AC\uB294\n                  \uBAA8\uB4C8\uC758 \uB514\uB809\uD1A0\uB9AC\uC785\uB2C8\uB2E4.\n    -upgrademodulepath <\uBAA8\uB4C8 \uACBD\uB85C>...\n                  {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC \uBAA9\uB85D\uC785\uB2C8\uB2E4. \uAC01 \uB514\uB809\uD1A0\uB9AC\uB294\n                  \uBAA8\uB4C8\uC758 \uB514\uB809\uD1A0\uB9AC\uB85C, \uB7F0\uD0C0\uC784 \uC774\uBBF8\uC9C0\uC5D0\uC11C \uC5C5\uADF8\uB808\uC774\uB4DC\n                  \uAC00\uB2A5\uD55C \uBAA8\uB4C8\uC744 \uB300\uCCB4\uD569\uB2C8\uB2E4.\n    -m <\uBAA8\uB4C8 \uC774\uB984>[/<\uAE30\uBCF8 \uD074\uB798\uC2A4>]\n                  \uBD84\uC11D\uD560 \uCD08\uAE30 \uBAA8\uB4C8 \uBC0F \uBAA8\uB4C8\uC5D0\uC11C \uC9C0\uC815\uB418\uC9C0 \uC54A\uC740 \uACBD\uC6B0 \uC2E4\uD589\uD560\n                  \uAE30\uBCF8 \uD074\uB798\uC2A4\uC758 \uC774\uB984\uC785\uB2C8\uB2E4.\n    -addmods <\uBAA8\uB4C8 \uC774\uB984>[,<\uBAA8\uB4C8 \uC774\uB984>...]\n                  \uCD08\uAE30 \uBAA8\uB4C8 \uC678\uC5D0 \uBD84\uC11D\uD560 \uB8E8\uD2B8 \uBAA8\uB4C8\uC785\uB2C8\uB2E4.\n    -limitmods <\uBAA8\uB4C8 \uC774\uB984>[,<\uBAA8\uB4C8 \uC774\uB984>...]\n                  \uAD00\uCC30 \uAC00\uB2A5\uD55C \uBAA8\uB4C8\uC758 \uBC94\uC704\uB97C \uC81C\uD55C\uD569\uB2C8\uB2E4.\n    -listmods[:<\uBAA8\uB4C8 \uC774\uB984>[,<\uBAA8\uB4C8 \uC774\uB984>...]]\n                  \uAD00\uCC30 \uAC00\uB2A5\uD55C \uBAA8\uB4C8\uC744 \uB098\uC5F4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n    --dry-run     VM\uC744 \uC0DD\uC131\uD558\uC9C0\uB9CC \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n                  \uC774 --dry-run \uC635\uC158\uC740 \uBAA8\uB4C8 \uC2DC\uC2A4\uD15C \uAD6C\uC131\uACFC \uAC19\uC740 \uBA85\uB839\uD589\n                  \uC635\uC158\uC744 \uAC80\uC99D\uD558\uB294 \uB370 \uC720\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n    -D<\uC774\uB984>=<\uAC12>\n                  \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n    -verbose:[class|gc|jni]\n                  \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -version      \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n    -showversion  \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n    -? -help      \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n    -X            \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n    -ea[:<\uD328\uD0A4\uC9C0 \uC774\uB984>...|:<\uD074\uB798\uC2A4 \uC774\uB984>]\n    -enableassertions[:<\uD328\uD0A4\uC9C0 \uC774\uB984>...|:<\uD074\uB798\uC2A4 \uC774\uB984>]\n                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -da[:<\uD328\uD0A4\uC9C0 \uC774\uB984>...|:<\uD074\uB798\uC2A4 \uC774\uB984>]\n    -disableassertions[:<\uD328\uD0A4\uC9C0 \uC774\uB984>...|:<\uD074\uB798\uC2A4 \uC774\uB984>]\n                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -esa \
+| -enablesystemassertions\n                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -dsa | -disablesystemassertions\n                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -agentlib:<\uB77C\uC774\uBE0C\uB7EC\uB9AC \uC774\uB984>[=<\uC635\uC158>]\n                  \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC <\uB77C\uC774\uBE0C\uB7EC\uB9AC \uC774\uB984>\uC744 \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:jdwp).\n                  -agentlib:jdwp=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n    -agentpath:<\uACBD\uB85C \uC774\uB984>[=<\uC635\uC158>]\n                  \uC804\uCCB4 \uACBD\uB85C \uC774\uB984\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n    -javaagent:<jar \uACBD\uB85C>[=<\uC635\uC158>]\n                  Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n    -splash:<\uC774\uBBF8\uC9C0 \uACBD\uB85C>\n                  \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n    @<\uD30C\uC77C \uACBD\uB85C>   \uC9C0\uC815\uB41C \uD30C\uC77C\uC5D0\uC11C \uC635\uC158\uC744 \uC77D\uC2B5\uB2C8\uB2E4.\n
 See \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
 
 # Translators please note do not translate the options themselves
@@ -43,7 +43,7 @@
 \uBB34\uD6A8\uD654\uD558\uAC70\uB098 \uC778\uC218\uD654\uD569\uB2C8\uB2E4.\n    -Xdisable-@files  \uCD94\uAC00 \uC778\uC218 \uD30C\uC77C \uD655\uC7A5\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n    -XstartOnFirstThread\n                      \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n    -Xdock:name=<application name>"\n                      \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC560\uD50C\uB9AC\uCF00\uC774\uC158 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n    -Xdock:icon=<path to icon file>\n                      \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n
+java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n    -XstartOnFirstThread\n                      \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n    -Xdock:name=<application name>\n                      \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC560\uD50C\uB9AC\uCF00\uC774\uC158 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n    -Xdock:icon=<path to icon file>\n                      \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n
 
 java.launcher.cls.error1=\uC624\uB958: \uAE30\uBCF8 \uD074\uB798\uC2A4 {0}\uC744(\uB97C) \uCC3E\uAC70\uB098 \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
 java.launcher.cls.error2=\uC624\uB958: {1} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uAC00 {0}\uC774(\uAC00) \uC544\uB2D9\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_pt_BR.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_pt_BR.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  porque a execu\u00E7\u00E3o est\u00E1 sendo feita em uma m\u00E1quina de classe de servidor.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <caminho de pesquisa de classe de diret\u00F3rios e arquivos zip/jar>\n    -classpath <caminho de pesquisa de classe de diret\u00F3rios e arquivos zip/jar>\n                  Uma lista separada por {0} de diret\u00F3rios, arquivos compactados JAR\n                  e arquivos compactados ZIP para procurar arquivos de classe.\n    -mp <caminho do m\u00F3dulo>\n    -modulepath <caminho do m\u00F3dulo>...\n                  Uma lista separada por {0} de diret\u00F3rios, cada um\n                  sendo um diret\u00F3rio de m\u00F3dulos.\n    -upgrademodulepath <caminho do m\u00F3dulo>...\n                  Uma lista separada por {0} de diret\u00F3rios, cada um\n                  sendo um diret\u00F3rio de m\u00F3dulos que substituem m\u00F3dulos\n                  pass\u00EDveis de upgrade na imagem de runtime\n    -m <modulename>[/<mainclass>]\n                  o m\u00F3dulo inicial ou principal a ser resolvido e o nome da classe principal\n                  a ser executada se n\u00E3o for especificada pelo m\u00F3dulo\n    -addmods <modulename>[,<modulename>...]\n                  m\u00F3dulos raiz a serem resolvidos al\u00E9m do m\u00F3dulo inicial\n    -limitmods <modulename>[,<modulename>...]\n                  limita o universo de m\u00F3dulos observ\u00E1veis\n    -listmods[:<modulename>[,<modulename>...]]\n                  lista os m\u00F3dulos observ\u00E1veis e sai\n    -D<name>=<value>\n                  define uma propriedade de sistema\n    -verbose:[class|gc|jni]\n                  ativa sa\u00EDda detalhada\n    -version      imprime a vers\u00E3o do produto e sai\n    -showversion  imprime a vers\u00E3o do produto e continua\n    -? -help      imprime esta mensagem de ajuda\n    -X            imprime a ajuda em op\u00E7\u00F5es n\u00E3o padronizadas\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  ativa asser\u00E7\u00F5es com granularidade especificada\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  desativa asser\u00E7\u00F5es com granularidade especificada\n    -esa | -enablesystemassertions\n                  ativa asser\u00E7\u00F5es do sistema\n    -dsa | -disablesystemassertions\n                  desativa asser\u00E7\u00F5es do sistema\n    -agentlib:<libname>[=<options>]\n                  carrega a biblioteca de agente nativo <libname>, por exemplo, -agentlib:jdwp\n                  consulte tamb\u00E9m -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  carrega a biblioteca de agente nativo por nome do caminho completo\n    -javaagent:<jarpath>[=<options>]\n                  carrega o agente de linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n    -splash:<imagepath>\n                  mostra a tela inicial com a imagem especificada\n    @<filepath>   op\u00E7\u00F5es de leitura do arquivo especificado\n
+java.launcher.opt.footer     =\    -cp <caminho de pesquisa de classe de diret\u00F3rios e arquivos zip/jar>\n    -classpath <caminho de pesquisa de classe de diret\u00F3rios e arquivos zip/jar>\n                  Uma lista separada por {0} de diret\u00F3rios, arquivos compactados JAR\n                  e arquivos compactados ZIP para procurar arquivos de classe.\n    -mp <caminho do m\u00F3dulo>\n    -modulepath <caminho do m\u00F3dulo>...\n                  Uma lista separada por {0} de diret\u00F3rios, cada um\n                  sendo um diret\u00F3rio de m\u00F3dulos.\n    -upgrademodulepath <caminho do m\u00F3dulo>...\n                  Uma lista separada por {0} de diret\u00F3rios, cada um\n                  sendo um diret\u00F3rio de m\u00F3dulos que substituem m\u00F3dulos\n                  pass\u00EDveis de upgrade na imagem de runtime\n    -m <modulename>[/<mainclass>]\n                  o m\u00F3dulo inicial a ser resolvido e o nome da classe principal\n                  a ser executada se n\u00E3o for especificada pelo m\u00F3dulo\n    -addmods <modulename>[,<modulename>...]\n                  m\u00F3dulos raiz a serem resolvidos al\u00E9m do m\u00F3dulo inicial\n    -limitmods <modulename>[,<modulename>...]\n                  limita o universo de m\u00F3dulos observ\u00E1veis\n    -listmods[:<modulename>[,<modulename>...]]\n                  lista os m\u00F3dulos observ\u00E1veis e sai\n    --dry-run     cria a VM, mas n\u00E3o executa o m\u00E9todo principal.\n                  Esta op\u00E7\u00E3o -dry-run pode ser \u00FAtil para validar as\n                  op\u00E7\u00F5es de linha de comando como a configura\u00E7\u00E3o do sistema do m\u00F3dulo\n    -D<name>=<value>\n                  define uma propriedade de sistema\n    -verbose:[class|gc|jni]\n                  ativa sa\u00EDda detalhada\n    -version      imprime a vers\u00E3o do produto e sai\n    -showversion  imprime a vers\u00E3o do produto e continua\n    -? -help      imprime esta mensagem de ajuda\n    -X            imprime a ajuda em op\u00E7\u00F5es n\u00E3o padronizadas\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  ativa asser\u00E7\u00F5es com granularidade especificada\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  desativa asser\u00E7\u00F5es com granularidade especificada\n    -esa | -enablesystemassertions\n                  ativa asser\u00E7\u00F5es do sistema\n    -dsa | -disablesystemassertions\n                  desativa asser\u00E7\u00F5es do sistema\n    -agentlib:<libname>[=<options>]\n                  carrega a biblioteca de agente nativo <libname>, por exemplo, -agentlib:jdwp\n                  consulte tamb\u00E9m -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  carrega a biblioteca de agente nativo por nome do caminho completo\n    -javaagent:<jarpath>[=<options>]\n                  carrega o agente de linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n    -splash:<imagepath>\n                  mostra a tela inicial com a imagem especificada\n    @<filepath>   op\u00E7\u00F5es de leitura do arquivo especificado\n
 See http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           execu\u00E7\u00E3o no modo misto (padr\u00E3o)\n    -Xint             execu\u00E7\u00E3o somente no modo interpretado\n    -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      anexos ao final do caminho de classe de inicializa\u00E7\u00E3o\n    -Xdiag            mostra mensagens de diagn\u00F3stico adicionais\n    -Xdiag:resolver   mostra mensagens de diagn\u00F3stico do resolvedor\n    -Xnoclassgc       desativa a coleta de lixo da classe\n    -Xloggc:<arquivo>    registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n    -Xbatch           desativa a compila\u00E7\u00E3o em segundo plano\n    -Xms<tamanho>        define o tamanho inicial do heap Java\n    -Xmx<tamanho>        define o tamanho m\u00E1ximo do heap Java\n    -Xss<tamanho>        define o tamanho da pilha de threads java\n    -Xprof            produz dados de perfil da cpu\n    -Xfuture          ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor padr\u00E3o futuro\n    -Xrs              reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n    -Xcheck:jni       executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n    -Xshare:off       n\u00E3o tenta usar dados da classe compartilhada\n    -Xshare:auto      se poss\u00EDvel, usa dados da classe compartilhada (padr\u00E3o)\n    -Xshare:on        requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n    -XshowSettings    mostra todas as defini\u00E7\u00F5es e continua\n    -XshowSettings:all\n                      mostra todas as defini\u00E7\u00F5es e continua\n    -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n    -XshowSettings:properties\n                      mostra todas as defini\u00E7\u00F5es da propriedade e continua\n    -XshowSettings:locale\n                      mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n    -XaddReads:<module>=<other-module>(,<other-module>)*\n                      <module> l\u00EA outros m\u00F3dulos,\n                      n\u00E3o importando a declara\u00E7\u00E3o do m\u00F3dulo\n    -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n                      <module> exporta <package> para outros m\u00F3dulos,\n                      n\u00E3o importando a declara\u00E7\u00E3o do m\u00F3dulo\n    -Xpatch:<module>=<file>({0}<file>)*\n                      Substitui ou aumenta um m\u00F3dulo com classes e recursos\n                      em arquivos JAR ou diret\u00F3rios\n    -Xdisable-@files  desativa uma expans\u00E3o adicional de arquivo de argumentos\n\nAs op\u00E7\u00F5es -X n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n    -XstartOnFirstThread\n                      executa o m\u00E9todo main() no primeiro thread (AppKit)\n    -Xdock:name=<nome do aplicativo>"\n                      substitui o nome do aplicativo padr\u00E3o exibido no encaixe\n    -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n                      substitui o \u00EDcone exibido no encaixe\n\n
+java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n    -XstartOnFirstThread\n                      executa o m\u00E9todo main() no primeiro thread (AppKit)\n    -Xdock:name=<nome do aplicativo>\n                      substitui o nome do aplicativo padr\u00E3o exibido no encaixe\n    -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n                      substitui o \u00EDcone exibido no encaixe\n\n
 
 java.launcher.cls.error1=Erro: N\u00E3o foi poss\u00EDvel localizar nem carregar a classe principal {0}
 java.launcher.cls.error2=Erro: o m\u00E9todo main n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo main como:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_sv.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_sv.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  eftersom du k\u00F6r en serverklassmaskin.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <klass\u00F6kv\u00E4g till kataloger och zip-/jar-filer>\n    -classpath <klass\u00F6kv\u00E4g till kataloger och zip-/jar-filer>\n                  En {0}-avgr\u00E4nsad lista \u00F6ver kataloger, JAR-arkiv\n                  och ZIP-arkiv att s\u00F6ka efter klassfiler i.\n    -mp <moduls\u00F6kv\u00E4g>\n    -modulepath <moduls\u00F6kv\u00E4g>...\n                  En {0}-avgr\u00E4nsad lista \u00F6ver kataloger, d\u00E4r varje\n                  katalog \u00E4r en katalog med moduler.\n    -upgrademodulepath <moduls\u00F6kv\u00E4g>...\n                  En {0}-avgr\u00E4nsad lista \u00F6ver kataloger, d\u00E4r varje\n                  katalog \u00E4r en katalog med moduler som ers\u00E4tter\n                  uppgraderingsbara moduler i exekveringsavbilden\n    -m <modulnamn>[/<huvudklass>]\n                  den ursprungliga modulen att k\u00F6ra, och namnet p\u00E5\n                  huvudklassen att k\u00F6ra om den inte anges av modulen\n    -addmods <modulnamn>[,<modulnamn>...]\n                  rotmoduler att l\u00F6sa f\u00F6rutom den ursprungliga modulen\n    -limitmods <modulnamn>[,<modulnamn>...]\n                  begr\u00E4nsar universumet med observerbara moduler\n    -listmods[:<modulnamn>[,<modulnamn>...]]\n                  lista observerbara moduler och avsluta\n    -D<namn>=<v\u00E4rde>\n                  ange en systemegenskap\n    -verbose:[class|gc|jni]\n                  aktivera utf\u00F6rliga utdata\n    -version      skriv ut produktversion och avsluta\n    -showversion  skriv ut produktversion och forts\u00E4tt\n    -? -help      skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n    -X            skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n    -ea[:<paketnamn>...|:<klassnamn>]\n    -enableassertions[:<paketnamn>...|:<klassnamn>]\n                  aktivera verifieringar med den angivna detaljgraden\n    -da[:<paketnamn>...|:<klassnamn>]\n    -disableassertions[:<paketnamn>...|:<klassnamn>]\n                  avaktivera verifieringar med den angivna detaljgraden\n    -esa | -enablesystemassertions\n                  aktivera systemverifieringar\n    -dsa | -disablesystemassertions\n                  avaktivera systemverifieringar\n    -agentlib:<biblioteksnamn>[=<alternativnamn>]\n                  ladda det ursprungliga agentbiblioteket <biblioteksnamn>, exempel: -agentlib:jdwp\n                  se \u00E4ven -agentlib:jdwp=help\n    -agentpath:<s\u00F6kv\u00E4gsnamn>[=<alternativ>]\n                  ladda det ursprungliga agentbiblioteket med fullst\u00E4ndigt s\u00F6kv\u00E4gsnamn\n    -javaagent:<jar-s\u00F6kv\u00E4g>[=<alternativ>]\n                  ladda agenten f\u00F6r programmeringsspr\u00E5ket Java, se java.lang.instrument\n    -splash:<bilds\u00F6kv\u00E4g>\n                  visa v\u00E4lkomstsk\u00E4rmen med den angivna bilden\n    @<fils\u00F6kv\u00E4g>   l\u00E4s alternativ fr\u00E5n den angivna filen\n
+java.launcher.opt.footer     =\    -cp <klass\u00F6kv\u00E4g till kataloger och zip-/jar-filer>\n    -classpath <klass\u00F6kv\u00E4g till kataloger och zip-/jar-filer>\n                  En {0}-avgr\u00E4nsad lista \u00F6ver kataloger, JAR-arkiv och\n                  ZIP-arkiv att s\u00F6ka efter klassfiler i.\n    -mp <moduls\u00F6kv\u00E4g>\n    -modulepath <moduls\u00F6kv\u00E4g>...\n                  En {0}-avgr\u00E4nsad lista \u00F6ver kataloger, d\u00E4r varje katalog\n                  \u00E4r en katalog med moduler.\n    -upgrademodulepath <moduls\u00F6kv\u00E4g>...\n                  En {0}-avgr\u00E4nsad lista \u00F6ver kataloger, d\u00E4r varje katalog\n                  \u00E4r en katalog med moduler som ers\u00E4tter uppgraderingsbara\n                  moduler i exekveringsavbilden \n    -m <modulnamn>[/<huvudklass>]\n                  den ursprungliga modulen att l\u00F6sa och namnet p\u00E5 huvudklassen\n                  att k\u00F6ra om den inte anges av modulen\n    -addmods <modulnamn>[,<modulnamn>...]\n                  rotmoduler att l\u00F6sa f\u00F6rutom den ursprungliga modulen\n    -limitmods <modulnamn>[,<modulnamn>...]\n                  begr\u00E4nsa universumet med observerbara moduler\n    -listmods[:<modulnamn>[,<modulnamn>...]]\n                  lista de observerbara modulerna och avsluta\n    --dry-run     skapa VM:en men k\u00F6r inte huvudmetoden.\n                  Det h\u00E4r alternativet kan vara anv\u00E4ndbart f\u00F6r att validera\n                  kommandoradsalternativen, som modulsystemkonfigurationen.\n    -D<name>=<v\u00E4rde>\n                  ange en systemvariabel\n    -verbose:[class|gc|jni]\n                  aktivera utf\u00F6rliga utdata\n    -version      skriv ut produktversion och avsluta\n    -showversion  skriv ut produktversion och forts\u00E4tt\n    -? -help      skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n    -X            skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n    -ea[:<paketnamn>...|:<klassnamn>]\n    -enableassertions[:<paketnamn>...|:<klassnamn>]\n                  aktivera verifieringar med den angivna detaljgraden\n    -da[:<paketnamn>...|:<klassnamn>]\n    -disableassertions[:<paketnamn>...|:<klassnamn>]\n                  avaktivera verifieringar med den angivna detaljgraden\n    -esa | -enablesystemassertions\n                  aktivera systemverifieringar\n    -dsa | -disablesystemassertions\n                  avaktivera systemverifieringar\n    -agentlib:<biblioteksnamn>[=<alternativ>]\n                  ladda det ursprungliga agentbiblioteket <biblioteksnamn>, exempel: -agentlib:jdwp\n                  se \u00E4ven -agentlib:jdwp=help\n    -agentpath:<s\u00F6kv\u00E4gsnamn>[=<alternativ>]\n                  ladda det ursprungliga agentbiblioteket med fullst\u00E4ndigt s\u00F6kv\u00E4gsnamn\n    -javaagent:<jar-s\u00F6kv\u00E4g>[=<alternativ>]\n                  ladda agenten f\u00F6r programmeringsspr\u00E5ket Java, se java.lang.instrument\n    -splash:<bilds\u00F6kv\u00E4g>\n                  visa v\u00E4lkomstsk\u00E4rmen med den angivna bilden\n    @<fils\u00F6kv\u00E4g>   l\u00E4s alternativ fr\u00E5n den angivna filen\n
 See Se http://www.oracle.com/technetwork/java/javase/documentation/index.html f\u00F6r mer information.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           exekvering i blandat l\u00E4ge (standard)\n    -Xint             endast exekvering i tolkat l\u00E4ge\n    -Xbootclasspath/a:<kataloger och zip-/jar-filer avgr\u00E4nsade med {0}>\n                      l\u00E4gg till sist i klass\u00F6kv\u00E4gen f\u00F6r programladdning\n    -Xdiag            visa fler diagnostiska meddelanden\n    -Xdiag:resolver   visa diagnostiska meddelanden f\u00F6r matchning\n    -Xnoclassgc       avaktivera klasskr\u00E4pinsamling\n    -Xloggc:<fil>    logga GC-status till en fil med tidsst\u00E4mplar\n    -Xbatch           avaktivera bakgrundskompilering\n    -Xms<storlek>        ange ursprunglig storlek f\u00F6r Java-heap-utrymmet\n    -Xmx<storlek>        ange st\u00F6rsta storlek f\u00F6r Java-heap-utrymmet\n    -Xss<storlek>        ange storlek f\u00F6r java-tr\u00E5dsstacken\n    -Xprof            utdata f\u00F6r processorprofilering\n    -Xfuture          aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n    -Xrs              minska operativsystemssignalanv\u00E4ndning f\u00F6r Java/VM (se dokumentationen)\n    -Xcheck:jni       utf\u00F6r fler kontroller f\u00F6r JNI-funktioner\n    -Xshare:off       f\u00F6rs\u00F6k inte anv\u00E4nda delade klassdata\n    -Xshare:auto      anv\u00E4nd delade klassdata om m\u00F6jligt (standard)\n    -Xshare:on        kr\u00E4v anv\u00E4ndning av delade klassdata, utf\u00F6r inte i annat fall.\n    -XshowSettings    visa alla inst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:all\n                      visa alla inst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:properties\n                      visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:locale\n                      visa alla spr\u00E5kkonventionsrelaterade inst\u00E4llningar och forts\u00E4tt\n    -XaddReads:<modul>=<annan modul>(,<annan modul>)*\n                      <modul> l\u00E4ser andra moduler,\n                      oavsett moduldeklarationen\n    -XaddExports:<modul>/<paket>=<annan modul>(,<annan modul>)*\n                      <modul> exporterar <packet> till andra moduler,\n                      oavsett moduldeklarationen\n    -Xpatch:<modul>=<fil>({0}<fil>)*\n                      \u00C5sidos\u00E4tt eller ut\u00F6ka en modul med klasser och resurser\n                      i JAR-filer eller kataloger\n    -Xdisable-@files  avaktivera framtida argumentfilsut\u00F6kning\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\nF\u00F6ljande alternativ \u00E4r specifika f\u00F6r Mac OS X:\n    -XstartOnFirstThread\n                      k\u00F6r huvudmetoden() p\u00E5 den f\u00F6rsta (AppKit) tr\u00E5den\n    -Xdock:name=<application name>"\n                      \u00E5sidosatt standardapplikationsnamn visas i docka\n    -Xdock:icon=<path to icon file>\n                      \u00E5sidosatt standardikon visas i docka\n\n
+java.launcher.X.macosx.usage=\nF\u00F6ljande alternativ \u00E4r Mac OS X-specifika:\n    -XstartOnFirstThread\n                      k\u00F6r main()-metoden p\u00E5 den f\u00F6rsta (AppKit)-tr\u00E5den\n    -Xdock:name=<applikationsnamn>\n                      \u00E5sidos\u00E4tt det standardapplikationsnamn som visas i dockan\n    -Xdock:icon=<s\u00F6kv\u00E4g till ikonfil>\n                      \u00E5sidos\u00E4tt den standardikon som visas i dockan\n\n
 
 java.launcher.cls.error1=Fel: Kan inte hitta eller kan inte ladda huvudklassen {0}
 java.launcher.cls.error2=Fel: Huvudmetoden \u00E4r inte {0} i klassen {1}, definiera huvudmetoden som:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -34,14 +34,15 @@
 java.launcher.ergo.message2  =\                  \u56E0\u4E3A\u60A8\u662F\u5728\u670D\u52A1\u5668\u7C7B\u8BA1\u7B97\u673A\u4E0A\u8FD0\u884C\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n    -classpath <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n                  \u7528\u4E8E\u641C\u7D22\u7C7B\u6587\u4EF6\u7684\u76EE\u5F55, JAR \u6863\u6848\n                  \u548C ZIP \u6863\u6848\u7684\u5217\u8868, \u4F7F\u7528 {0} \u5206\u9694\u3002\n    -mp <\u6A21\u5757\u8DEF\u5F84>\n    -modulepath <\u6A21\u5757\u8DEF\u5F84>...\n                  \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u5217\u8868, \u6BCF\u4E2A\u76EE\u5F55\n                  \u90FD\u662F\u4E00\u4E2A\u5305\u542B\u6A21\u5757\u7684\u76EE\u5F55\u3002\n    -upgrademodulepath <\u6A21\u5757\u8DEF\u5F84>...\n                  \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u5217\u8868, \u6BCF\u4E2A\u76EE\u5F55\n                  \u90FD\u662F\u4E00\u4E2A\u5305\u542B\u6A21\u5757\u7684\u76EE\u5F55, \u8FD9\u4E9B\u6A21\u5757\n                  \u7528\u4E8E\u66FF\u6362\u8FD0\u884C\u65F6\u6620\u50CF\u4E2D\u7684\u53EF\u5347\u7EA7\u6A21\u5757\n    -m <\u6A21\u5757\u540D\u79F0>[/<\u4E3B\u7C7B>]\n                  \u8981\u89E3\u6790\u7684\u521D\u59CB\u6A21\u5757, \u4EE5\u53CA\u5728\u672A\u7531\u6A21\u5757\u6307\u5B9A\u65F6\n                  \u8981\u6267\u884C\u7684\u4E3B\u7C7B\u540D\u79F0\n    -addmods <\u6A21\u5757\u540D\u79F0>[,<\u6A21\u5757\u540D\u79F0>...]\n                  \u9664\u4E86\u521D\u59CB\u6A21\u5757\u4E4B\u5916\u8981\u89E3\u6790\u7684\u6839\u6A21\u5757\n    -limitmods <\u6A21\u5757\u540D\u79F0>[,<\u6A21\u5757\u540D\u79F0>...]\n                  \u9650\u5236\u53EF\u89C2\u5BDF\u6A21\u5757\u7684\u9886\u57DF\n    -listmods[:<\u6A21\u5757\u540D\u79F0>[,<\u6A21\u5757\u540D\u79F0>...]]\n                  \u5217\u51FA\u53EF\u89C2\u5BDF\u6A21\u5757\u5E76\u9000\u51FA\n    -D<\u540D\u79F0>=<\u503C>\n                  \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n    -verbose:[class|gc|jni]\n                  \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n    -version      \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u9000\u51FA\n    -showversion  \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u7EE7\u7EED\n    -? -help      \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\n    -X            \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u5E2E\u52A9\n    -ea[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7C7B\u540D>]\n    -enableassertions[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7C7B\u540D>]\n                  \u6309\u6307\u5B9A\u7684\u7C92\u5EA6\u542F\u7528\u65AD\u8A00\n    -da[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7A0B\u5E8F\u5305\u540D\u79F0>]\n    -disableassertions[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7C7B\u540D>]\n                  \u7981\u7528\u5177\u6709\u6307\u5B9A\u7C92\u5EA6\u7684\u65AD\u8A00\n    -esa | -enablesystemassertions\n                  \u542F\u7528\u7CFB\u7EDF\u65AD\u8A00\n    -dsa | -disablesystemassertions\n                  \u7981\u7528\u7CFB\u7EDF\u65AD\u8A00\n    -agentlib:<\u5E93\u540D>[=<\u9009\u9879>]\n                  \u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93 <\u5E93\u540D>, \u4F8B\u5982 -agentlib:jdwp\n                  \u53E6\u8BF7\u53C2\u9605 -agentlib:jdwp=help\n    -agentpath:<\u8DEF\u5F84\u540D>[=<\u9009\u9879>]\n                  \u6309\u5B8C\u6574\u8DEF\u5F84\u540D\u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93\n    -javaagent:<jar \u8DEF\u5F84>[=<\u9009\u9879>]\n                  \u52A0\u8F7D Java \u7F16\u7A0B\u8BED\u8A00\u4EE3\u7406, \u8BF7\u53C2\u9605 java.lang.instrument\n    -splash:<\u56FE\u50CF\u8DEF\u5F84>\n                  \u4F7F\u7528\u6307\u5B9A\u7684\u56FE\u50CF\u663E\u793A\u542F\u52A8\u5C4F\u5E55\n    @<\u6587\u4EF6\u8DEF\u5F84>   \u4ECE\u6307\u5B9A\u6587\u4EF6\u4E2D\u8BFB\u53D6\u9009\u9879\n
+java.launcher.opt.footer     =\    -cp <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n    -classpath <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n                  \u7528\u4E8E\u641C\u7D22\u7C7B\u6587\u4EF6\u7684\u76EE\u5F55, JAR \u6863\u6848\n                  \u548C ZIP \u6863\u6848\u7684\u5217\u8868, \u4F7F\u7528 {0} \u5206\u9694\u3002\n    -mp <\u6A21\u5757\u8DEF\u5F84>\n    -modulepath <\u6A21\u5757\u8DEF\u5F84>...\n                  \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u5217\u8868, \u6BCF\u4E2A\u76EE\u5F55\n                  \u90FD\u662F\u4E00\u4E2A\u5305\u542B\u6A21\u5757\u7684\u76EE\u5F55\u3002\n    -upgrademodulepath <\u6A21\u5757\u8DEF\u5F84>...\n                  \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u5217\u8868, \u6BCF\u4E2A\u76EE\u5F55\n                  \u90FD\u662F\u4E00\u4E2A\u5305\u542B\u6A21\u5757\u7684\u76EE\u5F55, \u8FD9\u4E9B\u6A21\u5757\n                  \u7528\u4E8E\u66FF\u6362\u8FD0\u884C\u65F6\u6620\u50CF\u4E2D\u7684\u53EF\u5347\u7EA7\u6A21\u5757\n    -m <\u6A21\u5757\u540D\u79F0>[/<\u4E3B\u7C7B>]\n                  \u8981\u89E3\u6790\u7684\u521D\u59CB\u6A21\u5757, \u4EE5\u53CA\u5728\u672A\u7531\u6A21\u5757\u6307\u5B9A\u65F6\n                  \u8981\u6267\u884C\u7684\u4E3B\u7C7B\u540D\u79F0\n    -addmods <\u6A21\u5757\u540D\u79F0>[,<\u6A21\u5757\u540D\u79F0>...]\n                  \u9664\u4E86\u521D\u59CB\u6A21\u5757\u4E4B\u5916\u8981\u89E3\u6790\u7684\u6839\u6A21\u5757\n    -limitmods <\u6A21\u5757\u540D\u79F0>[,<\u6A21\u5757\u540D\u79F0>...]\n                  \u9650\u5236\u53EF\u89C2\u5BDF\u6A21\u5757\u7684\u9886\u57DF\n    -listmods[:<\u6A21\u5757\u540D\u79F0>[,<\u6A21\u5757\u540D\u79F0>...]]\n                  \u5217\u51FA\u53EF\u89C2\u5BDF\u6A21\u5757\u5E76\u9000\u51FA\n    --dry-run     \u521B\u5EFA VM \u4F46\u4E0D\u6267\u884C\u4E3B\u65B9\u6CD5\u3002\n                  \u6B64 --dry-run \u9009\u9879\u5BF9\u4E8E\u9A8C\u8BC1\u8BF8\u5982\n                  \u6A21\u5757\u7CFB\u7EDF\u914D\u7F6E\u8FD9\u6837\u7684\u547D\u4EE4\u884C\u9009\u9879\u53EF\u80FD\u662F\u975E\u5E38\u6709\u7528\u7684\u3002\n    -D<\u540D\u79F0>=<\u503C>\n                  \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n    -verbose:[class|gc|jni]\n                  \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n    -version      \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u9000\u51FA\n    -showversion  \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u7EE7\u7EED\n    -? -help      \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\n    -X            \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u5E2E\u52A9\n    -ea[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7C7B\u540D>]\n    -enableassertions[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7C7B\u540D>]\n                  \u6309\u6307\u5B9A\u7684\u7C92\u5EA6\u542F\u7528\u65AD\u8A00\n    -da[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7A0B\u5E8F\u5305\u540D\u79F0>]\n    -disableassertions[:<\u7A0B\u5E8F\u5305\u540D\u79F0>...|:<\u7C7B\u540D>]\n                  \u7981\u7528\u5177\u6709\u6307\u5B9A\u7C92\u5EA6\u7684\u65AD\u8A00\n    -esa | -enablesystemassertions\n                  \u542F\u7528\u7CFB\u7EDF\u65AD\u8A00\n    -dsa | -disablesystemassertions\n                  \u7981\u7528\u7CFB\u7EDF\u65AD\u8A00\n    -agentlib:<\u5E93\u540D>[=<\u9009\u9879>]\n                  \u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93 <\u5E93\u540D>, \u4F8B\u5982 -agentlib:jdwp\n                  \u53E6\u8BF7\u53C2\u9605 -agentlib:jdwp=help\n    -agentpath:<\u8DEF\u5F84\u540D>[=<\u9009\u9879>]\n                  \u6309\u5B8C\u6574\u8DEF\u5F84\u540D\u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93\n    -javaagent:<jar \u8DEF\u5F84>[=<\u9009\u9879>]\n                  \u52A0\u8F7D Java \u7F16\u7A0B\u8BED\u8A00\u4EE3\u7406, \u8BF7\u53C2\u9605 java.lang.instrument\n    -splash:<\u56FE\u50CF\u8DEF\u5F84>\n                  \u4F7F\u7528\u6307\u5B9A\u7684\u56FE\u50CF\u663E\u793A\u542F\u52A8\u5C4F\u5E55\n    @<\u6587\u4EF6\u8DEF\u5F84>   \
+\u4ECE\u6307\u5B9A\u6587\u4EF6\u4E2D\u8BFB\u53D6\u9009\u9879\n
 See \u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605 http://www.oracle.com/technetwork/java/javase/documentation/index.html\u3002
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u6A21\u5F0F\u6267\u884C (\u9ED8\u8BA4\u503C)\n    -Xint             \u4EC5\u89E3\u91CA\u6A21\u5F0F\u6267\u884C\n    -Xbootclasspath/a:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n                      \u9644\u52A0\u5728\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u672B\u5C3E\n    -Xdiag            \u663E\u793A\u9644\u52A0\u8BCA\u65AD\u6D88\u606F\n    -Xdiag:resolver   \u663E\u793A\u89E3\u6790\u5668\u8BCA\u65AD\u6D88\u606F\n    -Xnoclassgc       \u7981\u7528\u7C7B\u5783\u573E\u6536\u96C6\n    -Xloggc:<\u6587\u4EF6>    \u5C06 GC \u72B6\u6001\u8BB0\u5F55\u5728\u6587\u4EF6\u4E2D (\u5E26\u65F6\u95F4\u6233)\n    -Xbatch           \u7981\u7528\u540E\u53F0\u7F16\u8BD1\n    -Xms<\u5927\u5C0F>        \u8BBE\u7F6E\u521D\u59CB Java \u5806\u5927\u5C0F\n    -Xmx<\u5927\u5C0F>        \u8BBE\u7F6E\u6700\u5927 Java \u5806\u5927\u5C0F\n    -Xss<\u5927\u5C0F>        \u8BBE\u7F6E Java \u7EBF\u7A0B\u5806\u6808\u5927\u5C0F\n    -Xprof            \u8F93\u51FA cpu \u5206\u6790\u6570\u636E\n    -Xfuture          \u542F\u7528\u6700\u4E25\u683C\u7684\u68C0\u67E5, \u9884\u671F\u5C06\u6765\u7684\u9ED8\u8BA4\u503C\n    -Xrs              \u51CF\u5C11 Java/VM \u5BF9\u64CD\u4F5C\u7CFB\u7EDF\u4FE1\u53F7\u7684\u4F7F\u7528 (\u8BF7\u53C2\u9605\u6587\u6863)\n    -Xcheck:jni       \u5BF9 JNI \u51FD\u6570\u6267\u884C\u5176\u4ED6\u68C0\u67E5\n    -Xshare:off       \u4E0D\u5C1D\u8BD5\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E\n    -Xshare:auto      \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E (\u9ED8\u8BA4\u503C)\n    -Xshare:on        \u8981\u6C42\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E, \u5426\u5219\u5C06\u5931\u8D25\u3002\n    -XshowSettings    \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:all\n                      \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:vm \u663E\u793A\u6240\u6709\u4E0E vm \u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:properties\n                      \u663E\u793A\u6240\u6709\u5C5E\u6027\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:locale\n                      \u663E\u793A\u6240\u6709\u4E0E\u533A\u57DF\u8BBE\u7F6E\u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XaddReads:<\u6A21\u5757>=<\u5176\u4ED6\u6A21\u5757>(,<\u5176\u4ED6\u6A21\u5757>)*\n                      <\u6A21\u5757> \u8BFB\u53D6\u5176\u4ED6\u6A21\u5757,\n                      \u800C\u65E0\u8BBA\u6A21\u5757\u58F0\u660E\u5982\u4F55\n    -XaddExports:<\u6A21\u5757>/<\u7A0B\u5E8F\u5305>=<\u5176\u4ED6\u6A21\u5757>(,<\u5176\u4ED6\u6A21\u5757>)*\n                      <\u6A21\u5757> \u5C06 <\u7A0B\u5E8F\u5305> \u5BFC\u51FA\u5230\u5176\u4ED6\u6A21\u5757,\n                      \u800C\u65E0\u8BBA\u6A21\u5757\u58F0\u660E\u5982\u4F55\n    -Xpatch:<\u6A21\u5757>=<\u6587\u4EF6>({0}<\u6587\u4EF6>)*\n                      \u4F7F\u7528 JAR \u6587\u4EF6\u6216\u76EE\u5F55\u4E2D\u7684\u7C7B\u548C\u8D44\u6E90\n                      \u8986\u76D6\u6216\u589E\u5F3A\u6A21\u5757\n    -Xdisable-@files  \u7981\u6B62\u8FDB\u4E00\u6B65\u6269\u5C55\u53C2\u6570\u6587\u4EF6\n\n-X \u9009\u9879\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\n\u4EE5\u4E0B\u9009\u9879\u4E3A Mac OS X \u7279\u5B9A\u7684\u9009\u9879:\n    -XstartOnFirstThread\n                      \u5728\u7B2C\u4E00\u4E2A (AppKit) \u7EBF\u7A0B\u4E0A\u8FD0\u884C main() \u65B9\u6CD5\n    -Xdock:name=<\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0>"\n                      \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0\n    -Xdock:icon=<\u56FE\u6807\u6587\u4EF6\u7684\u8DEF\u5F84>\n                      \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u56FE\u6807\n\n
+java.launcher.X.macosx.usage=\n\u4EE5\u4E0B\u9009\u9879\u4E3A Mac OS X \u7279\u5B9A\u7684\u9009\u9879:\n    -XstartOnFirstThread\n                      \u5728\u7B2C\u4E00\u4E2A (AppKit) \u7EBF\u7A0B\u4E0A\u8FD0\u884C main() \u65B9\u6CD5\n    -Xdock:name=<\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0>\n                      \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0\n    -Xdock:icon=<\u56FE\u6807\u6587\u4EF6\u7684\u8DEF\u5F84>\n                      \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u56FE\u6807\n\n
 
 java.launcher.cls.error1=\u9519\u8BEF: \u627E\u4E0D\u5230\u6216\u65E0\u6CD5\u52A0\u8F7D\u4E3B\u7C7B {0}
 java.launcher.cls.error2=\u9519\u8BEF: main \u65B9\u6CD5\u4E0D\u662F\u7C7B {1} \u4E2D\u7684{0}, \u8BF7\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_zh_TW.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher_zh_TW.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2014, 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
@@ -34,14 +34,14 @@
 java.launcher.ergo.message2  =\                  \u56E0\u70BA\u60A8\u6B63\u5728\u4F3A\u670D\u5668\u985E\u5225\u6A5F\u5668\u4E0A\u57F7\u884C\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n    -classpath <class search path of directories and zip/jar files>\n                  \u7528\u4F86\u641C\u5C0B\u985E\u5225\u6A94\u6848\u4E4B\u4EE5 {0} \u5340\u9694\u7684\u76EE\u9304\u3001\n                  JAR \u5B58\u6A94\u4EE5\u53CA ZIP \u5B58\u6A94\u6E05\u55AE\u3002\n    -mp <module path>\n    -modulepath <module path>...\n                  \u4EE5 {0} \u5340\u9694\u7684\u76EE\u9304\u6E05\u55AE\uFF0C\u6BCF\u500B\u76EE\u9304\n                  \u5747\u70BA\u6A21\u7D44\u76EE\u9304\u3002\n    -upgrademodulepath <module path>...\n                  \u4EE5 {0} \u5340\u9694\u7684\u76EE\u9304\u6E05\u55AE\uFF0C\u6BCF\u500B\u76EE\u9304\n                  \u5747\u70BA\u6A21\u7D44\u76EE\u9304\uFF0C\u4E14\u7576\u4E2D\u7684\u6A21\u7D44\u53EF\u53D6\u4EE3\n                  \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C\u5F71\u50CF\u4E2D\u7684\u53EF\u5347\u7D1A\u6A21\u7D44\n    -m <modulename>[/<mainclass>]\n                  \u8981\u89E3\u6790\u7684\u8D77\u59CB\u6A21\u7D44, \u4EE5\u53CA\u6A21\u7D44\u672A\u6307\u5B9A\u6642\n                  \u6240\u8981\u57F7\u884C\u7684\u4E3B\u8981\u985E\u5225\u540D\u7A31\n    -addmods <modulename>[,<modulename>...]\n                  \u9664\u4E86\u8D77\u59CB\u6A21\u7D44\u5916\uFF0C\u8981\u89E3\u6790\u7684\u6839\u6A21\u7D44\n    -limitmods <modulename>[,<modulename>...]\n                  \u9650\u5236\u53EF\u76E3\u6E2C\u6A21\u7D44\u7684\u7BC4\u570D\n    -listmods[:<modulename>[,<modulename>...]]\n                  \u5217\u51FA\u53EF\u76E3\u6E2C\u6A21\u7D44\u4E26\u7D50\u675F\n    -D<name>=<value>\n                  \u8A2D\u5B9A\u7CFB\u7D71\u5C6C\u6027\n    -verbose:[class|gc|jni]\n                  \u555F\u7528\u8A73\u7D30\u8CC7\u8A0A\u8F38\u51FA\n    -version     \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7D50\u675F\n    -showversion  \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7E7C\u7E8C\n    -? -help      \u5217\u5370\u6B64\u8AAA\u660E\u8A0A\u606F\n    -X            \u5217\u5370\u975E\u6A19\u6E96\u9078\u9805\u7684\u8AAA\u660E\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \u555F\u7528\u542B\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \u505C\u7528\u542B\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n    -esa | -enablesystemassertions\n                  \u555F\u7528\u7CFB\u7D71\u5BA3\u544A\n    -dsa | -disablesystemassertions\n                  \u505C\u7528\u7CFB\u7D71\u5BA3\u544A\n    -agentlib:<libname>[=<options>]\n                  \u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB <libname>\uFF0C\u4F8B\u5982 -agentlib:jdwp\n                  \u53E6\u8ACB\u53C3\u95B1 -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  \u4F7F\u7528\u5B8C\u6574\u8DEF\u5F91\u540D\u7A31\u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB\n    -javaagent:<jarpath>[=<options>]\n                  \u8F09\u5165 Java \u7A0B\u5F0F\u8A9E\u8A00\u4EE3\u7406\u7A0B\u5F0F\uFF0C\u8ACB\u53C3\u95B1 java.lang.instrument\n    -splash:<imagepath>\n                   \u4EE5\u6307\u5B9A\u5F71\u50CF\u986F\u793A\u8EDF\u9AD4\u8CC7\u8A0A\u756B\u9762\n    @<filepath>   \u5F9E\u6307\u5B9A\u6A94\u6848\u8B80\u53D6\u9078\u9805\n
+java.launcher.opt.footer     =\   -cp <\u76EE\u9304\u53CA zip/jar \u6A94\u6848\u7684\u985E\u5225\u641C\u5C0B\u8DEF\u5F91>\n    -classpath <\u76EE\u9304\u53CA zip/jar \u6A94\u6848\u7684\u985E\u5225\u641C\u5C0B\u8DEF\u5F91>\n                  \u5C07\u5728\u5176\u4E2D\u641C\u5C0B\u985E\u5225\u6A94\u6848\u4E4B\u4EE5 {0} \u5340\u9694\u7684\u76EE\u9304\u3001JAR \u5B58\u6A94\u4EE5\u53CA ZIP \u5B58\u6A94\u6E05\u55AE\u3002\n    -mp <module path>\n    -modulepath <module path>...\n                  \u4EE5 {0} \u5340\u9694\u7684\u76EE\u9304\u6E05\u55AE\uFF0C\u6BCF\u500B\u76EE\u9304\u90FD\u662F\u4E00\u500B\u6A21\u7D44\u76EE\u9304\u3002\n    -upgrademodulepath <module path>...\n                  \u4EE5 {0} \u5340\u9694\u7684\u76EE\u9304\u6E05\u55AE\uFF0C\u6BCF\u500B\u76EE\u9304\u90FD\u662F\u4E00\u500B\u6A21\u7D44\u76EE\u9304\uFF0C\u7576\u4E2D\u7684\u6A21\u7D44\u53EF\u53D6\u4EE3\u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C\u5F71\u50CF\u4E2D\u7684\u53EF\u5347\u7D1A\u6A21\u7D44\n    -m <modulename>[/<mainclass>]\n                  \u8981\u89E3\u6790\u7684\u8D77\u59CB\u6A21\u7D44\uFF0C\u4EE5\u53CA\u6A21\u7D44\u672A\u6307\u5B9A\u6642\u6240\u8981\u57F7\u884C\u4E4B\u4E3B\u8981\u985E\u5225\u7684\u540D\u7A31\n    -addmods <modulename>[,<modulename>...]\n                  \u9664\u4E86\u8D77\u59CB\u6A21\u7D44\u5916\uFF0C\u8981\u89E3\u6790\u7684\u6839\u6A21\u7D44\n    -limitmods <modulename>[,<modulename>...]\n                  \u9650\u5236\u53EF\u76E3\u6E2C\u6A21\u7D44\u7684\u7BC4\u570D\n    -listmods[:<modulename>[,<modulename>...]]\n                  \u5217\u51FA\u53EF\u76E3\u6E2C\u6A21\u7D44\u4E26\u7D50\u675F\n    --dry-run     \u5EFA\u7ACB VM \u4F46\u4E0D\u57F7\u884C\u4E3B\u8981\u65B9\u6CD5\u3002\n                  \u6B64 --dry-run \u9078\u9805\u5C0D\u65BC\u9A57\u8B49\u547D\u4EE4\u884C\u9078\u9805 (\u4F8B\u5982\u6A21\u7D44\u7CFB\u7D71\u7D44\u614B) \u6703\u5F88\u6709\u7528\u3002\n    -D<name>=<value>\n                  \u8A2D\u5B9A\u7CFB\u7D71\u5C6C\u6027\n    -verbose:[class|gc|jni]\n                  \u555F\u7528\u8A73\u7D30\u8CC7\u8A0A\u8F38\u51FA\n    -version      \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7D50\u675F\n    -showversion  \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7E7C\u7E8C\n    -? -help      \u5217\u5370\u672C\u8AAA\u660E\u8A0A\u606F\n    -X            \u5217\u5370\u975E\u6A19\u6E96\u9078\u9805\u7684\u8AAA\u660E\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \u555F\u7528\u6307\u5B9A\u4E4B\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \u505C\u7528\u6307\u5B9A\u4E4B\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n    -esa | -enablesystemassertions\n                  \u555F\u7528\u7CFB\u7D71\u5BA3\u544A\n    -dsa | -disablesystemassertions\n                  \u505C\u7528\u7CFB\u7D71\u5BA3\u544A\n    -agentlib:<libname>[=<options>]\n                  \u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB <libname>\uFF0C\u4F8B\u5982 -agentlib:jdwp\n                  \u53E6\u8ACB\u53C3\u95B1 -agentlib:jdwp=help\n    -agentpath:<pathname>[=<options>]\n                  \u4F7F\u7528\u5B8C\u6574\u8DEF\u5F91\u540D\u7A31\u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB\n    -javaagent:<jarpath>[=<options>]\n                  \u8F09\u5165 Java \u7A0B\u5F0F\u8A9E\u8A00\u4EE3\u7406\u7A0B\u5F0F\uFF0C\u8ACB\u53C3\u95B1 java.lang.instrument\n    -splash:<imagepath>\n                  \u986F\u793A\u542B\u6307\u5B9A\u5F71\u50CF\u7684\u8EDF\u9AD4\u8CC7\u8A0A\u756B\u9762\n    @<filepath>   \u5F9E\u6307\u5B9A\u7684\u6A94\u6848\u8B80\u53D6\u9078\u9805\n
 See \u8ACB\u53C3\u95B1 http://www.oracle.com/technetwork/java/javase/documentation/index.html \u66B8\u89E3\u8A73\u7D30\u8CC7\u8A0A\u3002
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u6A21\u5F0F\u57F7\u884C (\u9810\u8A2D)\n    -Xint             \u50C5\u9650\u89E3\u8B6F\u6A21\u5F0F\u57F7\u884C\n    -Xbootclasspath/a:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n                      \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u7D50\u5C3E\n    -Xdiag            \u986F\u793A\u5176\u4ED6\u7684\u8A3A\u65B7\u8A0A\u606F\n    -Xdiag:resolver   \u986F\u793A\u89E3\u6790\u5668\u8A3A\u65B7\u8A0A\u606F\n    -Xnoclassgc       \u505C\u7528\u985E\u5225\u8CC7\u6E90\u56DE\u6536\n    -Xloggc:<file>    \u5C07 GC \u72C0\u614B\u548C\u6642\u6233\u8A18\u9304\u81F3\u6A94\u6848\n    -Xbatch           \u505C\u7528\u80CC\u666F\u7DE8\u8B6F\n    -Xms<size>        \u8A2D\u5B9A\u8D77\u59CB Java \u5806\u96C6\u5927\u5C0F\n    -Xmx<size>        \u8A2D\u5B9A Java \u5806\u96C6\u5927\u5C0F\u4E0A\u9650\n    -Xss<size>        \u8A2D\u5B9A Java \u57F7\u884C\u7DD2\u5806\u758A\u5927\u5C0F\n    -Xprof            \u8F38\u51FA CPU \u5206\u6790\u8CC7\u6599\n    -Xfuture          \u555F\u7528\u6700\u56B4\u683C\u7684\u6AA2\u67E5\uFF0C\u9810\u5148\u4F5C\u70BA\u5C07\u4F86\u7684\u9810\u8A2D\n    -Xrs              \u6E1B\u5C11 Java/VM \u4F7F\u7528\u4F5C\u696D\u7CFB\u7D71\u4FE1\u865F (\u8ACB\u53C3\u95B1\u6587\u4EF6)\n    -Xcheck:jni       \u57F7\u884C\u5176\u4ED6\u7684 JNI \u51FD\u6578\u6AA2\u67E5\n    -Xshare:off       \u4E0D\u5617\u8A66\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\n    -Xshare:auto      \u5118\u53EF\u80FD\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599 (\u9810\u8A2D)\n    -Xshare:on        \u9700\u8981\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\uFF0C\u5426\u5247\u5931\u6557\u3002\n    -XshowSettings    \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:all\n                      \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:vm \u986F\u793A\u6240\u6709 VM \u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:properties\n                      \u986F\u793A\u6240\u6709\u5C6C\u6027\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:locale\n                      \u986F\u793A\u6240\u6709\u5730\u5340\u8A2D\u5B9A\u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XaddReads:<module>=<other-module>(,<other-module>)*\n                      \u7121\u8AD6\u6A21\u7D44\u5BA3\u544A\u70BA\u4F55\uFF0C\n                      <module> \u6703\u8B80\u53D6\u5176\u4ED6\u6A21\u7D44\n    -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n                      \u7121\u8AD6\u6A21\u7D44\u5BA3\u544A\u70BA\u4F55\uFF0C<module> \u6703\u5C07 <package>\n                      \u532F\u51FA\u81F3\u5176\u4ED6\u6A21\u7D44\n    -Xpatch:<module>=<file>({0}<file>)*\n                      \u8986\u5BEB\u6216\u52A0\u5F37 JAR \u6A94\u6848\u6216\u76EE\u9304\u4E2D\u7684\n                      \u6A21\u7D44\u985E\u578B\u548C\u8CC7\u6E90\n    -Xdisable-@files  \u505C\u7528\u9032\u4E00\u6B65\u7684\u5F15\u6578\u6A94\u6848\u64F4\u5145\n\n-X  \u9078\u9805\u4E0D\u662F\u6A19\u6E96\u9078\u9805\uFF0C\u82E5\u6709\u8B8A\u66F4\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.macosx.usage=\n\u4E0B\u5217\u662F Mac OS X \u7279\u5B9A\u9078\u9805:\n    -XstartOnFirstThread\n                      \u5728\u7B2C\u4E00\u500B (AppKit) \u57F7\u884C\u7DD2\u57F7\u884C main() \u65B9\u6CD5\n    -Xdock:name=<application name>"\n                      \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u61C9\u7528\u7A0B\u5F0F\u540D\u7A31\n    -Xdock:icon=<path to icon file>\n                      \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u5716\u793A\n\n
+java.launcher.X.macosx.usage=\n\u4E0B\u5217\u662F Mac OS X \u7279\u5B9A\u9078\u9805:\n    -XstartOnFirstThread\n                      \u5728\u7B2C\u4E00\u500B (AppKit) \u57F7\u884C\u7DD2\u57F7\u884C main() \u65B9\u6CD5\n    -Xdock:name=<application name>\n                      \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u61C9\u7528\u7A0B\u5F0F\u540D\u7A31\n    -Xdock:icon=<path to icon file>\n                      \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u5716\u793A\n\n
 
 java.launcher.cls.error1=\u932F\u8AA4: \u627E\u4E0D\u5230\u6216\u7121\u6CD5\u8F09\u5165\u4E3B\u8981\u985E\u5225 {0}
 java.launcher.cls.error2=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u4E0D\u662F\u985E\u5225 {1} \u4E2D\u7684 {0}\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n   public static void main(String[] args)
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 05 22:01:14 2017 +0200
@@ -30,6 +30,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URI;
+import java.nio.file.Paths;
 import java.util.*;
 import java.text.MessageFormat;
 import java.security.*;
@@ -52,18 +53,17 @@
 import sun.net.www.ParseUtil;
 
 /**
- * This class represents a default implementation for
- * <code>java.security.Policy</code>.
+ * This class represents a default Policy implementation for the
+ * "JavaPolicy" type.
  *
  * Note:
  * For backward compatibility with JAAS 1.0 it loads
- * both java.auth.policy and java.policy. However it
- * is recommended that java.auth.policy be not used
- * and the java.policy contain all grant entries including
- * that contain principal-based entries.
+ * both java.auth.policy and java.policy. However, it
+ * is recommended that java.auth.policy not be used
+ * and that java.policy contain all grant entries including
+ * those that contain principal-based entries.
  *
- *
- * <p> This object stores the policy for entire Java runtime,
+ * <p> This object stores the policy for the entire Java runtime,
  * and is the amalgamation of multiple static policy
  * configurations that resides in files.
  * The algorithm for locating the policy file(s) and reading their
@@ -71,6 +71,14 @@
  *
  * <ol>
  * <li>
+ *   Read in and load the default policy file named
+ *   &lt;JAVA_HOME&gt;/lib/security/default.policy. &lt;JAVA_HOME&gt; refers
+ *   to the value of the java.home system property, and specifies the directory
+ *   where the JRE is installed. This policy file grants permissions to the
+ *   modules loaded by the platform class loader. If the default policy file
+ *   cannot be loaded, a fatal InternalError is thrown as these permissions
+ *   are needed in order for the runtime to operate correctly.
+ * <li>
  *   Loop through the <code>java.security.Security</code> properties,
  *   <i>policy.url.1</i>, <i>policy.url.2</i>, ...,
  *   <i>policy.url.X</i>" and
@@ -78,13 +86,14 @@
  *   <i>auth.policy.url.X</i>".  These properties are set
  *   in the Java security properties file, which is located in the file named
  *   &lt;JAVA_HOME&gt;/conf/security/java.security.
- *   &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
- *   and specifies the directory where the JRE is installed.
  *   Each property value specifies a <code>URL</code> pointing to a
  *   policy file to be loaded.  Read in and load each policy.
  *
  *   <i>auth.policy.url</i> is supported only for backward compatibility.
  *
+ *   If none of these could be loaded, use a builtin static policy
+ *   equivalent to the conf/security/java.policy file.
+ *
  * <li>
  *   The <code>java.lang.System</code> property <i>java.security.policy</i>
  *   may also be set to a <code>URL</code> pointing to another policy file
@@ -107,10 +116,13 @@
  *   <i>java.security.auth.policy</i> is supported only for backward
  *   compatibility.
  *
- *   If the  <i>java.security.policy</i> or
+ *   If the <i>java.security.policy</i> or
  *   <i>java.security.auth.policy</i> property is defined using
- *   "==" (rather than "="), then ignore all other specified
- *   policies and only load this policy.
+ *   "==" (rather than "="), then load the specified policy file and ignore
+ *   all other configured policies. Note, that the default.policy file is
+ *   also loaded, as specified in the first step of the algorithm above.
+ *   If the specified policy file cannot be loaded, use a builtin static policy
+ *   equivalent to the default conf/security/java.policy file.
  * </ol>
  *
  * Each policy file consists of one or more grant entries, each of
@@ -178,7 +190,6 @@
  * "FooSoft" alias, or if XXX <code>Foo.class</code> is a
  * system class (i.e., is found on the CLASSPATH).
  *
- *
  * <p> Items that appear in an entry must appear in the specified order
  * (<code>permission</code>, <i>Type</i>, "<i>name</i>", and
  * "<i>action</i>"). An entry is terminated with a semicolon.
@@ -246,7 +257,6 @@
  *  with all the principals associated with the <code>Subject</code>
  *  in the current <code>AccessControlContext</code>.
  *
- *
  * <p> For PrivateCredentialPermissions, you can also use "<b>self</b>"
  * instead of "<b>${{self}}</b>". However the use of "<b>self</b>" is
  * deprecated in favour of "<b>${{self}}</b>".
@@ -278,7 +288,6 @@
     private URL url;
 
     // for use with the reflection API
-
     private static final Class<?>[] PARAMS0 = { };
     private static final Class<?>[] PARAMS1 = { String.class };
     private static final Class<?>[] PARAMS2 = { String.class, String.class };
@@ -294,6 +303,23 @@
     private static AtomicReference<Set<URL>> badPolicyURLs =
         new AtomicReference<>(new HashSet<>());
 
+    // The default.policy file
+    private static final URL DEFAULT_POLICY_URL =
+        AccessController.doPrivileged(new PrivilegedAction<>() {
+            @Override
+            public URL run() {
+                String sep = File.separator;
+                try {
+                    return Paths.get(System.getProperty("java.home"),
+                                     "lib", "security",
+                                     "default.policy").toUri().toURL();
+                } catch (MalformedURLException mue) {
+                    // should not happen
+                    throw new Error("Malformed default.policy URL: " + mue);
+                }
+            }
+        });
+
     /**
      * Initializes the Policy object and reads the default policy
      * configuration file(s) into the Policy object.
@@ -315,108 +341,15 @@
      * Initializes the Policy object and reads the default policy
      * configuration file(s) into the Policy object.
      *
-     * The algorithm for locating the policy file(s) and reading their
-     * information into the Policy object is:
-     * <pre>
-     *   loop through the Security Properties named "policy.url.1",
-     *  ""policy.url.2", "auth.policy.url.1",  "auth.policy.url.2" etc, until
-     *   you don't find one. Each of these specify a policy file.
-     *
-     *   if none of these could be loaded, use a builtin static policy
-     *      equivalent to the default conf/security/java.policy file.
-     *
-     *   if the system property "java.policy" or "java.auth.policy" is defined
-     * (which is the
-     *      case when the user uses the -D switch at runtime), and
-     *     its use is allowed by the security property file,
-     *     also load it.
-     * </pre>
-     *
-     * Each policy file consists of one or more grant entries, each of
-     * which consists of a number of permission entries.
-     * <pre>
-     *   grant signedBy "<i>alias</i>", codeBase "<i>URL</i>" {
-     *     permission <i>Type</i> "<i>name</i>", "<i>action</i>",
-     *         signedBy "<i>alias</i>";
-     *     ....
-     *     permission <i>Type</i> "<i>name</i>", "<i>action</i>",
-     *         signedBy "<i>alias</i>";
-     *   };
-     *
-     * </pre>
-     *
-     * All non-italicized items above must appear as is (although case
-     * doesn't matter and some are optional, as noted below).
-     * Italicized items represent variable values.
-     *
-     * <p> A grant entry must begin with the word <code>grant</code>.
-     * The <code>signedBy</code> and <code>codeBase</code> name/value
-     * pairs are optional.
-     * If they are not present, then any signer (including unsigned code)
-     * will match, and any codeBase will match.
-     *
-     * <p> A permission entry must begin with the word <code>permission</code>.
-     * The word <code><i>Type</i></code> in the template above would actually
-     * be a specific permission type, such as
-     * <code>java.io.FilePermission</code> or
-     * <code>java.lang.RuntimePermission</code>.
-     *
-     * <p>The "<i>action</i>" is required for
-     * many permission types, such as <code>java.io.FilePermission</code>
-     * (where it specifies what type of file access is permitted).
-     * It is not required for categories such as
-     * <code>java.lang.RuntimePermission</code>
-     * where it is not necessary - you either have the
-     * permission specified by the <code>"<i>name</i>"</code>
-     * value following the type name or you don't.
-     *
-     * <p>The <code>signedBy</code> name/value pair for a permission entry
-     * is optional. If present, it indicates a signed permission. That is,
-     * the permission class itself must be signed by the given alias in
-     * order for it to be granted. For example,
-     * suppose you have the following grant entry:
-     *
-     * <pre>
-     *   grant {
-     *     permission Foo "foobar", signedBy "FooSoft";
-     *   }
-     * </pre>
-     *
-     * <p>Then this permission of type <i>Foo</i> is granted if the
-     * <code>Foo.class</code> permission has been signed by the
-     * "FooSoft" alias, or if <code>Foo.class</code> is a
-     * system class (i.e., is found on the CLASSPATH).
-     *
-     * <p>Items that appear in an entry must appear in the specified order
-     * (<code>permission</code>, <i>Type</i>, "<i>name</i>", and
-     * "<i>action</i>"). An entry is terminated with a semicolon.
-     *
-     * <p>Case is unimportant for the identifiers (<code>permission</code>,
-     * <code>signedBy</code>, <code>codeBase</code>, etc.) but is
-     * significant for the <i>Type</i>
-     * or for any string that is passed in as a value.
-     *
-     * <p>An example of two entries in a policy configuration file is
-     * <pre>
-     *   //  if the code is signed by "Duke", grant it read/write to all
-     *   // files in /tmp.
-     *
-     *   grant signedBy "Duke" {
-     *          permission java.io.FilePermission "/tmp/*", "read,write";
-     *   };
-     *
-     *   // grant everyone the following permission
-     *
-     *   grant {
-     *     permission java.util.PropertyPermission "java.vendor";
-     *   };
-     *  </pre>
+     * See the class description for details on the algorithm used to
+     * initialize the Policy object.
      */
     private void init(URL url) {
         // Properties are set once for each init(); ignore changes between
         // between diff invocations of initPolicyFile(policy, url, info).
         String numCacheStr =
-          AccessController.doPrivileged(new PrivilegedAction<String>() {
+          AccessController.doPrivileged(new PrivilegedAction<>() {
+            @Override
             public String run() {
                 expandProperties = "true".equalsIgnoreCase
                     (Security.getProperty("policy.expandProperties"));
@@ -445,19 +378,32 @@
 
     private void initPolicyFile(final PolicyInfo newInfo, final URL url) {
 
+        // always load default.policy
+        if (debug != null) {
+            debug.println("reading " + DEFAULT_POLICY_URL);
+        }
+        AccessController.doPrivileged(new PrivilegedAction<>() {
+            @Override
+            public Void run() {
+                init(DEFAULT_POLICY_URL, newInfo, true);
+                return null;
+            }
+        });
+
         if (url != null) {
 
             /**
              * If the caller specified a URL via Policy.getInstance,
-             * we only read from that URL
+             * we only read from default.policy and that URL.
              */
 
             if (debug != null) {
-                debug.println("reading "+url);
+                debug.println("reading " + url);
             }
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            AccessController.doPrivileged(new PrivilegedAction<>() {
+                @Override
                 public Void run() {
-                    if (init(url, newInfo) == false) {
+                    if (init(url, newInfo, false) == false) {
                         // use static policy if all else fails
                         initStaticPolicy(newInfo);
                     }
@@ -472,7 +418,7 @@
              * Read from URLs listed in the java.security properties file.
              *
              * We call initPolicyFile with POLICY, POLICY_URL and then
-             * call it with AUTH_POLICY and AUTH_POLICY_URL
+             * call it with AUTH_POLICY and AUTH_POLICY_URL.
              * So first we will process the JAVA standard policy
              * and then process the JAVA AUTH Policy.
              * This is for backward compatibility as well as to handle
@@ -493,9 +439,10 @@
     }
 
     private boolean initPolicyFile(final String propname, final String urlname,
-                                final PolicyInfo newInfo) {
-        Boolean loadedPolicy =
-            AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+                                   final PolicyInfo newInfo) {
+        boolean loadedPolicy =
+            AccessController.doPrivileged(new PrivilegedAction<>() {
+            @Override
             public Boolean run() {
                 boolean loaded_policy = false;
 
@@ -519,10 +466,12 @@
                             } else {
                                 policyURL = new URL(extra_policy);
                             }
-                            if (debug != null)
+                            if (debug != null) {
                                 debug.println("reading "+policyURL);
-                            if (init(policyURL, newInfo))
+                            }
+                            if (init(policyURL, newInfo, false)) {
                                 loaded_policy = true;
+                            }
                         } catch (Exception e) {
                             // ignore.
                             if (debug != null) {
@@ -560,10 +509,12 @@
                             policy_url = new URI(expanded_uri).toURL();
                         }
 
-                        if (debug != null)
-                            debug.println("reading "+policy_url);
-                        if (init(policy_url, newInfo))
+                        if (debug != null) {
+                            debug.println("reading " + policy_url);
+                        }
+                        if (init(policy_url, newInfo, false)) {
                             loaded_policy = true;
+                        }
                     } catch (Exception e) {
                         if (debug != null) {
                             debug.println("error reading policy "+e);
@@ -577,7 +528,7 @@
             }
         });
 
-        return loadedPolicy.booleanValue();
+        return loadedPolicy;
     }
 
     /**
@@ -586,7 +537,7 @@
      *
      * @param policyFile the policy Reader object.
      */
-    private boolean init(URL policy, PolicyInfo newInfo) {
+    private boolean init(URL policy, PolicyInfo newInfo, boolean defPolicy) {
 
         // skip parsing policy file if it has been previously parsed and
         // has syntax errors
@@ -597,24 +548,10 @@
             return false;
         }
 
-        boolean success = false;
-        PolicyParser pp = new PolicyParser(expandProperties);
-        InputStreamReader isr = null;
-        try {
+        try (InputStreamReader isr =
+                 getInputStreamReader(PolicyUtil.getInputStream(policy))) {
 
-            // read in policy using UTF-8 by default
-            //
-            // check non-standard system property to see if
-            // the default encoding should be used instead
-
-            if (notUtf8) {
-                isr = new InputStreamReader
-                                (PolicyUtil.getInputStream(policy));
-            } else {
-                isr = new InputStreamReader
-                                (PolicyUtil.getInputStream(policy), "UTF-8");
-            }
-
+            PolicyParser pp = new PolicyParser(expandProperties);
             pp.read(isr);
 
             KeyStore keyStore = null;
@@ -638,7 +575,11 @@
                 PolicyParser.GrantEntry ge = enum_.nextElement();
                 addGrantEntry(ge, keyStore, newInfo);
             }
+            return true;
         } catch (PolicyParser.ParsingException pe) {
+            if (defPolicy) {
+                throw new InternalError("Failed to load default.policy", pe);
+            }
             // record bad policy file to avoid later reparsing it
             badPolicyURLs.updateAndGet(k -> {
                 k.add(policy);
@@ -652,29 +593,38 @@
                 pe.printStackTrace();
             }
         } catch (Exception e) {
+            if (defPolicy) {
+                throw new InternalError("Failed to load default.policy", e);
+            }
             if (debug != null) {
                 debug.println("error parsing "+policy);
                 debug.println(e.toString());
                 e.printStackTrace();
             }
-        } finally {
-            if (isr != null) {
-                try {
-                    isr.close();
-                    success = true;
-                } catch (IOException e) {
-                    // ignore the exception
-                }
-            } else {
-                success = true;
-            }
         }
 
-        return success;
+        return false;
+    }
+
+    private InputStreamReader getInputStreamReader(InputStream is)
+                              throws IOException {
+        /*
+         * Read in policy using UTF-8 by default.
+         *
+         * Check non-standard system property to see if the default encoding
+         * should be used instead.
+         */
+        return (notUtf8)
+            ? new InputStreamReader(is)
+            : new InputStreamReader(is, "UTF-8");
     }
 
     private void initStaticPolicy(final PolicyInfo newInfo) {
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+        if (debug != null) {
+            debug.println("Initializing with static permissions");
+        }
+        AccessController.doPrivileged(new PrivilegedAction<>() {
+            @Override
             public Void run() {
                 PolicyEntry pe = new PolicyEntry(new CodeSource(null,
                     (Certificate[]) null));
@@ -1193,7 +1143,8 @@
             return perms;
 
         CodeSource canonCodeSource = AccessController.doPrivileged(
-            new java.security.PrivilegedAction<CodeSource>(){
+            new java.security.PrivilegedAction<>(){
+                @Override
                 public CodeSource run() {
                     return canonicalizeCodebase(cs, true);
                 }
@@ -1220,7 +1171,8 @@
             return perms;
 
         CodeSource canonCodeSource = AccessController.doPrivileged(
-            new java.security.PrivilegedAction<CodeSource>(){
+            new PrivilegedAction<>(){
+                @Override
                 public CodeSource run() {
                     return canonicalizeCodebase(cs, true);
                 }
@@ -1254,7 +1206,8 @@
 
         // check to see if the CodeSource implies
         Boolean imp = AccessController.doPrivileged
-            (new PrivilegedAction<Boolean>() {
+            (new PrivilegedAction<>() {
+            @Override
             public Boolean run() {
                 return entry.getCodeSource().implies(cs);
             }
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Wed Jul 05 22:01:14 2017 +0200
@@ -129,6 +129,7 @@
     private Set<Pair <String, String>> providerClasses = null;
     private String storetype = null;
     private boolean hasStoretypeOption = false;
+    private boolean hasSrcStoretypeOption = false;
     private String srcProviderName = null;
     private String providerName = null;
     private String pathlist = null;
@@ -492,7 +493,7 @@
                 passwords.add(srcstorePass);
             } else if (collator.compare(flags, "-srcstoretype") == 0) {
                 srcstoretype = args[++i];
-                hasStoretypeOption = true;
+                hasSrcStoretypeOption = true;
             } else if (collator.compare(flags, "-srckeypass") == 0) {
                 srckeyPass = getPass(modifier, args[++i]);
                 passwords.add(srckeyPass);
@@ -1936,7 +1937,7 @@
         try {
             // Probe for keystore type when filename is available
             if (srcksfile != null && is != null && srcProviderName == null &&
-                hasStoretypeOption == false) {
+                hasSrcStoretypeOption == false) {
                 store = KeyStore.getInstance(srcksfile, srcstorePass);
             } else {
                 if (srcProviderName == null) {
--- a/jdk/src/java.base/share/conf/security/java.policy	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/conf/security/java.policy	Wed Jul 05 22:01:14 2017 +0200
@@ -1,171 +1,31 @@
-// permissions required by each component
-
-grant codeBase "jrt:/java.activation" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/java.corba" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/java.compiler" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.charsets" {
-        permission java.io.FilePermission "${java.home}/-", "read";
-        permission java.util.PropertyPermission "os.name", "read";
-        permission java.util.PropertyPermission "sun.nio.cs.map", "read";
-        permission java.lang.RuntimePermission "charsetProvider";
-        permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.cs";
-};
-
-grant codeBase "jrt:/jdk.crypto.ucrypto" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
-        permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
-        // need "com.oracle.security.ucrypto.debug" for debugging
-        permission java.util.PropertyPermission "*", "read";
-        permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
-        permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
-        permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
-        // Needed for reading Ucrypto config file
-        permission java.io.FilePermission "<<ALL FILES>>", "read";
-};
-
-grant codeBase "jrt:/java.sql" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/java.sql.rowset" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.crypto.ec" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-        permission java.lang.RuntimePermission "loadLibrary.sunec";
-        permission java.util.PropertyPermission "*", "read";
-        permission java.security.SecurityPermission "putProviderProperty.SunEC";
-        permission java.security.SecurityPermission "clearProviderProperties.SunEC";
-        permission java.security.SecurityPermission "removeProviderProperty.SunEC";
-};
-
-grant codeBase "jrt:/jdk.crypto.pkcs11" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
-        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
-        // needs "security.pkcs11.allowSingleThreadedModules"
-        permission java.util.PropertyPermission "*", "read";
-        permission java.security.SecurityPermission "putProviderProperty.*";
-        permission java.security.SecurityPermission "clearProviderProperties.*";
-        permission java.security.SecurityPermission "removeProviderProperty.*";
-        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
-        permission java.security.SecurityPermission "authProvider.*";
-        // Needed for reading PKCS11 config file and NSS library check
-        permission java.io.FilePermission "<<ALL FILES>>", "read";
-};
-
-grant codeBase "jrt:/jdk.dynalink" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.internal.le" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.jsobject" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.localedata" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
-        permission java.util.PropertyPermission "*", "read";
-};
-
-grant codeBase "jrt:/jdk.naming.dns" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/java.scripting" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.scripting.nashorn" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/jdk.scripting.nashorn.shell" {
-        permission java.security.AllPermission;
-};
-
-grant codeBase "jrt:/java.smartcardio" {
-        permission javax.smartcardio.CardPermission "*", "*";
-        permission java.lang.RuntimePermission "loadLibrary.j2pcsc";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-        permission java.util.PropertyPermission "*", "read";
-        // needed for looking up native PC/SC library
-        permission java.io.FilePermission "<<ALL FILES>>","read";
-        permission java.security.SecurityPermission "putProviderProperty.SunPCSC";
-        permission java.security.SecurityPermission "clearProviderProperties.SunPCSC";
-        permission java.security.SecurityPermission "removeProviderProperty.SunPCSC";
-};
-
-grant codeBase "jrt:/java.xml.bind" {
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal";
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal.*";
-        permission java.lang.RuntimePermission "accessDeclaredMembers";
-        permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
-        permission java.util.PropertyPermission "*", "read";
-};
-
-grant codeBase "jrt:/java.xml.ws" {
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal";
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.istack.internal.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.*";
-        permission java.lang.RuntimePermission "accessDeclaredMembers";
-        permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
-        permission java.util.PropertyPermission "*", "read";
-};
-
-grant codeBase "jrt:/jdk.zipfs" {
-        permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
-        permission java.lang.RuntimePermission "fileSystemProvider";
-        permission java.util.PropertyPermission "*", "read";
-};
-
 // default permissions granted to all domains
 
 grant {
-        // allows anyone to listen on dynamic ports
-        permission java.net.SocketPermission "localhost:0", "listen";
-
-        // "standard" properies that can be read by anyone
+    // allows anyone to listen on dynamic ports
+    permission java.net.SocketPermission "localhost:0", "listen";
 
-        permission java.util.PropertyPermission "java.version", "read";
-        permission java.util.PropertyPermission "java.vendor", "read";
-        permission java.util.PropertyPermission "java.vendor.url", "read";
-        permission java.util.PropertyPermission "java.class.version", "read";
-        permission java.util.PropertyPermission "os.name", "read";
-        permission java.util.PropertyPermission "os.version", "read";
-        permission java.util.PropertyPermission "os.arch", "read";
-        permission java.util.PropertyPermission "file.separator", "read";
-        permission java.util.PropertyPermission "path.separator", "read";
-        permission java.util.PropertyPermission "line.separator", "read";
-
-        permission java.util.PropertyPermission "java.specification.version", "read";
-        permission java.util.PropertyPermission "java.specification.vendor", "read";
-        permission java.util.PropertyPermission "java.specification.name", "read";
-
-        permission java.util.PropertyPermission "java.vm.specification.version", "read";
-        permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
-        permission java.util.PropertyPermission "java.vm.specification.name", "read";
-        permission java.util.PropertyPermission "java.vm.version", "read";
-        permission java.util.PropertyPermission "java.vm.vendor", "read";
-        permission java.util.PropertyPermission "java.vm.name", "read";
+    // "standard" properies that can be read by anyone
+    permission java.util.PropertyPermission "java.version", "read";
+    permission java.util.PropertyPermission "java.vendor", "read";
+    permission java.util.PropertyPermission "java.vendor.url", "read";
+    permission java.util.PropertyPermission "java.class.version", "read";
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.util.PropertyPermission "os.version", "read";
+    permission java.util.PropertyPermission "os.arch", "read";
+    permission java.util.PropertyPermission "file.separator", "read";
+    permission java.util.PropertyPermission "path.separator", "read";
+    permission java.util.PropertyPermission "line.separator", "read";
+    permission java.util.PropertyPermission
+                   "java.specification.version", "read";
+    permission java.util.PropertyPermission "java.specification.vendor", "read";
+    permission java.util.PropertyPermission "java.specification.name", "read";
+    permission java.util.PropertyPermission
+                   "java.vm.specification.version", "read";
+    permission java.util.PropertyPermission
+                   "java.vm.specification.vendor", "read";
+    permission java.util.PropertyPermission
+                   "java.vm.specification.name", "read";
+    permission java.util.PropertyPermission "java.vm.version", "read";
+    permission java.util.PropertyPermission "java.vm.vendor", "read";
+    permission java.util.PropertyPermission "java.vm.name", "read";
 };
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/lib/security/default.policy	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,172 @@
+//
+// Permissions required by modules stored in a run-time image and loaded
+// by the platform class loader.
+//
+// NOTE that this file is not intended to be modified. If additional
+// permissions need to be granted to the modules in this file, it is
+// recommended that they be configured in a separate policy file or
+// ${java.home}/conf/security/java.policy.
+//
+
+grant codeBase "jrt:/java.activation" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.compiler" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.corba" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.scripting" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.security.jgss" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.smartcardio" {
+    permission javax.smartcardio.CardPermission "*", "*";
+    permission java.lang.RuntimePermission "loadLibrary.j2pcsc";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.sun.security.*";
+    permission java.util.PropertyPermission "*", "read";
+    // needed for looking up native PC/SC library
+    permission java.io.FilePermission "<<ALL FILES>>","read";
+    permission java.security.SecurityPermission "putProviderProperty.SunPCSC";
+    permission java.security.SecurityPermission
+                   "clearProviderProperties.SunPCSC";
+    permission java.security.SecurityPermission
+                   "removeProviderProperty.SunPCSC";
+};
+
+grant codeBase "jrt:/java.sql" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.sql.rowset" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/java.xml.bind" {
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.xml.internal.*";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.istack.internal";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.istack.internal.*";
+    permission java.lang.RuntimePermission "accessDeclaredMembers";
+    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+    permission java.util.PropertyPermission "*", "read";
+};
+
+grant codeBase "jrt:/java.xml.crypto" {
+    permission java.util.PropertyPermission "*", "read";
+    permission java.security.SecurityPermission "putProviderProperty.XMLDSig";
+    permission java.security.SecurityPermission
+                   "clearProviderProperties.XMLDSig";
+    permission java.security.SecurityPermission
+                   "removeProviderProperty.XMLDSig";
+    permission java.security.SecurityPermission
+                   "com.sun.org.apache.xml.internal.security.register";
+};
+
+grant codeBase "jrt:/java.xml.ws" {
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.xml.internal.*";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.istack.internal";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.istack.internal.*";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.com.sun.org.apache.xerces.internal.*";
+    permission java.lang.RuntimePermission "accessDeclaredMembers";
+    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+    permission java.util.PropertyPermission "*", "read";
+};
+
+grant codeBase "jrt:/jdk.charsets" {
+    permission java.io.FilePermission "${java.home}/-", "read";
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.util.PropertyPermission "sun.nio.cs.map", "read";
+    permission java.lang.RuntimePermission "charsetProvider";
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.jdk.internal.misc";
+    permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.cs";
+};
+
+grant codeBase "jrt:/jdk.crypto.ec" {
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.sun.security.*";
+    permission java.lang.RuntimePermission "loadLibrary.sunec";
+    permission java.util.PropertyPermission "*", "read";
+    permission java.security.SecurityPermission "putProviderProperty.SunEC";
+    permission java.security.SecurityPermission "clearProviderProperties.SunEC";
+    permission java.security.SecurityPermission "removeProviderProperty.SunEC";
+};
+
+grant codeBase "jrt:/jdk.crypto.pkcs11" {
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.sun.security.*";
+    permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+    permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+    permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+    // needs "security.pkcs11.allowSingleThreadedModules"
+    permission java.util.PropertyPermission "*", "read";
+    permission java.security.SecurityPermission "putProviderProperty.*";
+    permission java.security.SecurityPermission "clearProviderProperties.*";
+    permission java.security.SecurityPermission "removeProviderProperty.*";
+    permission java.security.SecurityPermission
+                   "getProperty.auth.login.defaultCallbackHandler";
+    permission java.security.SecurityPermission "authProvider.*";
+    // Needed for reading PKCS11 config file and NSS library check
+    permission java.io.FilePermission "<<ALL FILES>>", "read";
+};
+
+grant codeBase "jrt:/jdk.dynalink" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.internal.le" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.jsobject" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.localedata" {
+    permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
+    permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
+    permission java.util.PropertyPermission "*", "read";
+};
+
+grant codeBase "jrt:/jdk.naming.dns" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.scripting.nashorn" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.scripting.nashorn.shell" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.security.auth" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.security.jgss" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.zipfs" {
+    permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
+    permission java.lang.RuntimePermission "fileSystemProvider";
+    permission java.util.PropertyPermission "*", "read";
+};
+
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp	Wed Jul 05 22:01:14 2017 +0200
@@ -74,8 +74,8 @@
  * meaning that the resource is equivalent to the not compressed resource.
  * In each iteration, the name of the compressor located in the current header
  * is used to retrieve the associated instance of ImageDecompressor.
- * For example “zip” is the name of the compressor that compresses resources
- * using the zip algorithm. The ZipDecompressor class name is also “zip”.
+ * For example "zip" is the name of the compressor that compresses resources
+ * using the zip algorithm. The ZipDecompressor class name is also "zip".
  * ImageDecompressor instances are retrieved from a static array in which
  * they are registered.
  */
--- a/jdk/src/java.base/share/native/libjimage/jimage.hpp	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/share/native/libjimage/jimage.hpp	Wed Jul 05 22:01:14 2017 +0200
@@ -101,7 +101,7 @@
  * Ex.
  *  const char* package = (*JImagePackageToModule)(image, "java/lang");
  *  tty->print_cr(package);
- *  —> java.base
+ *  -> java.base
  */
 
 extern "C" const char * JIMAGE_PackageToModule(JImageFile* jimage, const char* package_name);
@@ -133,7 +133,7 @@
 
 
 /*
- * JImageGetResource - Given an open image file (see JImageOpen), a resource’s
+ * JImageGetResource - Given an open image file (see JImageOpen), a resource's
  * location information (see JImageFindResource), a buffer of appropriate
  * size and the size, retrieve the bytes associated with the
  * resource. If the size is less than the resource size then the read is truncated.
@@ -165,7 +165,7 @@
  * Ex.
  *   bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version,
  *                  const char* package, const char* name, const char* extension, void* arg) {
- *     if (strcmp(extension, “class”) == 0) {
+ *     if (strcmp(extension, "class") == 0) {
  *       char path[JIMAGE_MAX_PATH];
  *       Thread* THREAD = Thread::current();
  *       jio_snprintf(path, JIMAGE_MAX_PATH - 1, "/%s/%s", package, name);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/solaris/lib/security/default.policy	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,16 @@
+grant codeBase "jrt:/jdk.crypto.ucrypto" {
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.sun.security.*";
+    permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+    permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
+    // need "com.oracle.security.ucrypto.debug" for debugging
+    permission java.util.PropertyPermission "*", "read";
+    permission java.security.SecurityPermission
+                   "putProviderProperty.OracleUcrypto";
+    permission java.security.SecurityPermission
+                   "clearProviderProperties.OracleUcrypto";
+    permission java.security.SecurityPermission
+                   "removeProviderProperty.OracleUcrypto";
+    // Needed for reading Ucrypto config file
+    permission java.io.FilePermission "<<ALL FILES>>", "read";
+};
--- a/jdk/src/java.base/unix/native/libjava/TimeZone_md.c	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.base/unix/native/libjava/TimeZone_md.c	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -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;
@@ -822,18 +844,21 @@
 {
     time_t offset;
     char sign, buf[32];
-    struct tm *local_tm;
+    struct tm local_tm;
     time_t clock;
-    time_t currenttime;
 
     clock = time(NULL);
-    tzset();
-    local_tm = localtime(&clock);
-    if (local_tm->tm_gmtoff >= 0) {
-        offset = (time_t) local_tm->tm_gmtoff;
+    if (localtime_r(&clock, &local_tm) == NULL) {
+        return strdup("GMT");
+    }
+    offset = (time_t)local_tm.tm_gmtoff;
+    if (offset == 0) {
+        return strdup("GMT");
+    }
+    if (offset > 0) {
         sign = '+';
     } else {
-        offset = (time_t) -local_tm->tm_gmtoff;
+        offset = -offset;
         sign = '-';
     }
     sprintf(buf, (const char *)"GMT%c%02d:%02d",
@@ -854,7 +879,7 @@
 
     currenttime = time(NULL);
     if (localtime_r(&currenttime, &localtm) == NULL) {
-        return NULL;
+        return strdup("GMT");
     }
 
     offset = localtm.tm_isdst ? altzone : timezone;
--- a/jdk/src/java.base/windows/conf/security/java.policy	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-grant codeBase "jrt:/jdk.crypto.mscapi" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-        permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
-        permission java.util.PropertyPermission "*", "read";
-        permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
-        permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
-        permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
-};
-
-grant codeBase "jrt:/jdk.accessibility" {
-        permission java.security.AllPermission;
-};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/windows/lib/security/default.policy	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,15 @@
+grant codeBase "jrt:/jdk.accessibility" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.crypto.mscapi" {
+    permission java.lang.RuntimePermission
+                   "accessClassInPackage.sun.security.*";
+    permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
+    permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
+    permission java.security.SecurityPermission
+                   "clearProviderProperties.SunMSCAPI";
+    permission java.security.SecurityPermission
+                   "removeProviderProperty.SunMSCAPI";
+    permission java.util.PropertyPermission "*", "read";
+};
--- a/jdk/src/java.datatransfer/share/classes/module-info.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.datatransfer/share/classes/module-info.java	Wed Jul 05 22:01:14 2017 +0200
@@ -23,6 +23,11 @@
  * questions.
  */
 
+/**
+ * Provides interfaces and classes for transferring data between and
+ * within applications.
+ */
+
 module java.datatransfer {
     exports java.awt.datatransfer;
     exports sun.datatransfer to java.desktop;
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/AccessibilityEventMonitor.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +0,0 @@
-/*
- * 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
- * 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 sun.lwawt.macosx;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import javax.accessibility.Accessible;
-import javax.accessibility.AccessibleContext;
-import javax.accessibility.AccessibleRole;
-import javax.accessibility.AccessibleState;
-import javax.accessibility.AccessibleStateSet;
-import javax.swing.event.EventListenerList;
-
-/**
- * <P>{@code AccessibilityEventMonitor} implements a PropertyChange listener
- * on every UI object that implements interface {@code Accessible} in the Java
- * Virtual Machine.  The events captured by these listeners are made available
- * through listeners supported by {@code AccessibilityEventMonitor}.
- * With this, all the individual events on each of the UI object
- * instances are funneled into one set of PropertyChange listeners.
- *
- * This code is a subset of com.sun.java.accessibility.util.AccessibilityEventMonitor
- * which resides in module jdk.accessibility.  Due to modularization the code in
- * this package, java.desktop, can not be dependent on code in jdk.accessibility.
- */
-
-class AccessibilityEventMonitor {
-
-    /**
-     * The current list of registered {@link java.beans.PropertyChangeListener
-     * PropertyChangeListener} classes.
-     *
-     * @see #addPropertyChangeListener
-     */
-    private static final EventListenerList listenerList =
-        new EventListenerList();
-
-
-    /**
-     * The actual listener that is installed on the component instances.
-     * This listener calls the other registered listeners when an event
-     * occurs.  By doing things this way, the actual number of listeners
-     * installed on a component instance is drastically reduced.
-     */
-    private static final AccessibilityEventListener accessibilityListener =
-        new AccessibilityEventListener();
-
-    /**
-     * Adds the specified listener to receive all PropertyChange events on
-     * each UI object instance in the Java Virtual Machine as they occur.
-     * <P>Note: This listener is automatically added to all component
-     * instances created after this method is called.  In addition, it
-     * is only added to UI object instances that support this listener type.
-     *
-     * @param l the listener to add
-     * @param a  the Accessible object to add the PropertyChangeListener to
-     */
-
-    static void addPropertyChangeListener(PropertyChangeListener l, Accessible a) {
-        if (listenerList.getListenerCount(PropertyChangeListener.class) == 0) {
-            accessibilityListener.installListeners(a);
-        }
-        listenerList.add(PropertyChangeListener.class, l);
-    }
-
-    /**
-     * AccessibilityEventListener is the class that does all the work for
-     * AccessibilityEventMonitor.  It is not intended for use by any other
-     * class except AccessibilityEventMonitor.
-     */
-
-    private static class AccessibilityEventListener implements PropertyChangeListener {
-
-        /**
-         * Installs PropertyChange listeners to the Accessible object, and its
-         * children (so long as the object isn't of TRANSIENT state).
-         *
-         * @param a the Accessible object to add listeners to
-         */
-        private void installListeners(Accessible a) {
-            installListeners(a.getAccessibleContext());
-        }
-
-        /**
-         * Installs PropertyChange listeners to the AccessibleContext object,
-         * and its * children (so long as the object isn't of TRANSIENT state).
-         *
-         * @param ac the AccessibleContext to add listeners to
-         */
-        private void installListeners(AccessibleContext ac) {
-
-            if (ac != null) {
-                AccessibleStateSet states = ac.getAccessibleStateSet();
-                if (!states.contains(AccessibleState.TRANSIENT)) {
-                    ac.addPropertyChangeListener(this);
-                    /*
-                     * Don't add listeners to transient children. Components
-                     * with transient children should return an AccessibleStateSet
-                     * containing AccessibleState.MANAGES_DESCENDANTS. Components
-                     * may not explicitly return the MANAGES_DESCENDANTS state.
-                     * In this case, don't add listeners to the children of
-                     * lists, tables and trees.
-                     */
-                    AccessibleStateSet set = ac.getAccessibleStateSet();
-                    if (set.contains(AccessibleState.MANAGES_DESCENDANTS)) {
-                        return;
-                    }
-                    AccessibleRole role = ac.getAccessibleRole();
-                    if ( role == AccessibleRole.LIST ||
-                         role == AccessibleRole.TREE ) {
-                        return;
-                    }
-                    if (role == AccessibleRole.TABLE) {
-                        // handle Oracle tables containing tables
-                        Accessible child = ac.getAccessibleChild(0);
-                        if (child != null) {
-                            AccessibleContext ac2 = child.getAccessibleContext();
-                            if (ac2 != null) {
-                                role = ac2.getAccessibleRole();
-                                if (role != null && role != AccessibleRole.TABLE) {
-                                    return;
-                                }
-                            }
-                        }
-                    }
-                    int count = ac.getAccessibleChildrenCount();
-                    for (int i = 0; i < count; i++) {
-                        Accessible child = ac.getAccessibleChild(i);
-                        if (child != null) {
-                            installListeners(child);
-                        }
-                    }
-                }
-            }
-        }
-
-        /**
-         * Removes PropertyChange listeners for the given Accessible object,
-         * its children (so long as the object isn't of TRANSIENT state).
-         *
-         * @param a the Accessible object to remove listeners from
-         */
-        private void removeListeners(Accessible a) {
-            removeListeners(a.getAccessibleContext());
-        }
-
-        /**
-         * Removes PropertyChange listeners for the given AccessibleContext
-         * object, its children (so long as the object isn't of TRANSIENT
-         * state).
-         *
-         * @param a the Accessible object to remove listeners from
-         */
-        private void removeListeners(AccessibleContext ac) {
-
-            if (ac != null) {
-                // Listeners are not added to transient components.
-                AccessibleStateSet states = ac.getAccessibleStateSet();
-                if (!states.contains(AccessibleState.TRANSIENT)) {
-                    ac.removePropertyChangeListener(this);
-                    /*
-                     * Listeners are not added to transient children. Components
-                     * with transient children should return an AccessibleStateSet
-                     * containing AccessibleState.MANAGES_DESCENDANTS. Components
-                     * may not explicitly return the MANAGES_DESCENDANTS state.
-                     * In this case, don't remove listeners from the children of
-                     * lists, tables and trees.
-                     */
-                    if (states.contains(AccessibleState.MANAGES_DESCENDANTS)) {
-                        return;
-                    }
-                    AccessibleRole role = ac.getAccessibleRole();
-                    if ( role == AccessibleRole.LIST ||
-                         role == AccessibleRole.TABLE ||
-                         role == AccessibleRole.TREE ) {
-                        return;
-                    }
-                    int count = ac.getAccessibleChildrenCount();
-                    for (int i = 0; i < count; i++) {
-                        Accessible child = ac.getAccessibleChild(i);
-                        if (child != null) {
-                            removeListeners(child);
-                        }
-                    }
-                }
-            }
-        }
-
-        @Override
-        public void propertyChange(PropertyChangeEvent e) {
-            // propogate the event
-            Object[] listeners =
-                AccessibilityEventMonitor.listenerList.getListenerList();
-            for (int i = listeners.length-2; i>=0; i-=2) {
-                if (listeners[i]==PropertyChangeListener.class) {
-                    ((PropertyChangeListener)listeners[i+1]).propertyChange(e);
-                }
-            }
-
-            // handle childbirth/death
-            String name = e.getPropertyName();
-            if (name.compareTo(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY) == 0) {
-                Object oldValue = e.getOldValue();
-                Object newValue = e.getNewValue();
-
-                if ((oldValue == null) ^ (newValue == null)) { // one null, not both
-                    if (oldValue != null) {
-                        // this Accessible is a child that's going away
-                        if (oldValue instanceof Accessible) {
-                            Accessible a = (Accessible) oldValue;
-                            removeListeners(a.getAccessibleContext());
-                        } else if (oldValue instanceof AccessibleContext) {
-                            removeListeners((AccessibleContext) oldValue);
-                        }
-                    } else if (newValue != null) {
-                        // this Accessible is a child was just born
-                        if (newValue instanceof Accessible) {
-                            Accessible a = (Accessible) newValue;
-                            installListeners(a.getAccessibleContext());
-                        } else if (newValue instanceof AccessibleContext) {
-                            installListeners((AccessibleContext) newValue);
-                        }
-                    }
-                } else {
-                    System.out.println("ERROR in usage of PropertyChangeEvents for: " + e.toString());
-                }
-            }
-        }
-    }
-}
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java	Wed Jul 05 22:01:14 2017 +0200
@@ -285,7 +285,7 @@
     }
 
     public static int getAccessibleIndexInParent(final Accessible a, final Component c) {
-        if (a == null) return 0;
+        if (a == null) return -1;
 
         return invokeAndWait(new Callable<Integer>() {
             public Integer call() throws Exception {
@@ -468,6 +468,24 @@
         }, c);
     }
 
+    public static void requestSelection(final Accessible a, final Component c) {
+        if (a == null) return;
+        invokeLater(new Runnable() {
+            public void run() {
+                AccessibleContext ac = a.getAccessibleContext();
+                if (ac == null) return;
+                int i = ac.getAccessibleIndexInParent();
+                if (i == -1) return;
+                Accessible parent = ac.getAccessibleParent();
+                AccessibleContext pac = parent.getAccessibleContext();
+                if (pac == null) return;
+                AccessibleSelection as = pac.getAccessibleSelection();
+                if (as == null) return;
+                as.addAccessibleSelection(i);
+            }
+        }, c);
+    }
+
     public static Number getMaximumAccessibleValue(final Accessible a, final Component c) {
         if (a == null) return null;
 
@@ -572,9 +590,57 @@
         if (a == null) return null;
         return invokeAndWait(new Callable<Object[]>() {
             public Object[] call() throws Exception {
-                final ArrayList<Object> childrenAndRoles = new ArrayList<Object>();
+                ArrayList<Object> childrenAndRoles = new ArrayList<Object>();
                 _addChildren(a, whichChildren, allowIgnored, childrenAndRoles);
 
+                /* In the case of fetching a selection, need to check to see if
+                 * the active descendant is at the beginning of the list.  If it
+                 * is not it needs to be moved to the beginning of the list so
+                 * VoiceOver will annouce it correctly.  The list returned
+                 * from Java is always in order from top to bottom, but when shift
+                 * selecting downward (extending the list) or multi-selecting using
+                 * the VO keys control+option+command+return the active descendant
+                 * is not at the top of the list in the shift select down case and
+                 * may not be in the multi select case.
+                 */
+                if (whichChildren == JAVA_AX_SELECTED_CHILDREN) {
+                    if (!childrenAndRoles.isEmpty()) {
+                        AccessibleContext activeDescendantAC =
+                            CAccessible.getActiveDescendant(a);
+                        if (activeDescendantAC != null) {
+                            String activeDescendantName =
+                                activeDescendantAC.getAccessibleName();
+                            AccessibleRole activeDescendantRole =
+                                activeDescendantAC.getAccessibleRole();
+                            // Move active descendant to front of list.
+                            // List contains pairs of each selected item's
+                            // Accessible and AccessibleRole.
+                            ArrayList<Object> newArray  = new ArrayList<Object>();
+                            int count = childrenAndRoles.size();
+                            Accessible currentAccessible = null;
+                            AccessibleContext currentAC = null;
+                            String currentName = null;
+                            AccessibleRole currentRole = null;
+                            for (int i = 0; i < count; i+=2) {
+                                // Is this the active descendant?
+                                currentAccessible = (Accessible)childrenAndRoles.get(i);
+                                currentAC = currentAccessible.getAccessibleContext();
+                                currentName = currentAC.getAccessibleName();
+                                currentRole = (AccessibleRole)childrenAndRoles.get(i+1);
+                                if ( currentName.equals(activeDescendantName) &&
+                                     currentRole.equals(activeDescendantRole) ) {
+                                    newArray.add(0, currentAccessible);
+                                    newArray.add(1, currentRole);
+                                } else {
+                                    newArray.add(currentAccessible);
+                                    newArray.add(currentRole);
+                                }
+                            }
+                            childrenAndRoles = newArray;
+                        }
+                    }
+                }
+
                 if ((whichChildren < 0) || (whichChildren * 2 >= childrenAndRoles.size())) {
                     return childrenAndRoles.toArray();
                 }
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java	Wed Jul 05 22:01:14 2017 +0200
@@ -37,7 +37,11 @@
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
-import sun.lwawt.macosx.CFRetainedResource;
+import static javax.accessibility.AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY;
+import static javax.accessibility.AccessibleContext.ACCESSIBLE_CARET_PROPERTY;
+import static javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY;
+import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY;
+
 
 class CAccessible extends CFRetainedResource implements Accessible {
     static Field getNativeAXResourceField() {
@@ -71,10 +75,13 @@
 
     private static native void unregisterFromCocoaAXSystem(long ptr);
     private static native void valueChanged(long ptr);
+    private static native void selectedTextChanged(long ptr);
     private static native void selectionChanged(long ptr);
 
     private Accessible accessible;
 
+    private AccessibleContext activeDescendant;
+
     private CAccessible(final Accessible accessible) {
         super(0L, true); // real pointer will be poked in by native
 
@@ -98,9 +105,9 @@
     }
 
     public void addNotificationListeners(Component c) {
-        AXTextChangeNotifier listener = new AXTextChangeNotifier();
         if (c instanceof Accessible) {
-            AccessibilityEventMonitor.addPropertyChangeListener(listener, (Accessible)c);
+            AccessibleContext ac = ((Accessible)c).getAccessibleContext();
+            ac.addPropertyChangeListener(new AXChangeNotifier());
         }
         if (c instanceof JProgressBar) {
             JProgressBar pb = (JProgressBar) c;
@@ -112,16 +119,23 @@
     }
 
 
-    private class AXTextChangeNotifier implements PropertyChangeListener {
+    private class AXChangeNotifier implements PropertyChangeListener {
 
         @Override
         public void propertyChange(PropertyChangeEvent e) {
             String name = e.getPropertyName();
             if ( ptr != 0 ) {
-                if (name.compareTo(AccessibleContext.ACCESSIBLE_CARET_PROPERTY) == 0) {
+                if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) {
+                    selectedTextChanged(ptr);
+                } else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0 ) {
+                    valueChanged(ptr);
+                } else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0 ) {
                     selectionChanged(ptr);
-                } else if (name.compareTo(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY) == 0 ) {
-                    valueChanged(ptr);
+                }  else if (name.compareTo(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0 ) {
+                    Object nv = e.getNewValue();
+                    if (nv instanceof AccessibleContext) {
+                        activeDescendant = (AccessibleContext)nv;
+                    }
                 }
             }
         }
@@ -137,4 +151,9 @@
     static Accessible getSwingAccessible(final Accessible a) {
         return (a instanceof CAccessible) ? ((CAccessible)a).accessible : a;
     }
+
+    static AccessibleContext getActiveDescendant(final Accessible a) {
+        return (a instanceof CAccessible) ? ((CAccessible)a).activeDescendant : null;
+    }
+
 }
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -135,6 +135,7 @@
         int jkeyCode = KeyEvent.VK_UNDEFINED;
         int jkeyLocation = KeyEvent.KEY_LOCATION_UNKNOWN;
         boolean postsTyped = false;
+        boolean spaceKeyTyped = false;
 
         char testChar = KeyEvent.CHAR_UNDEFINED;
         boolean isDeadChar = (chars!= null && chars.length() == 0);
@@ -151,6 +152,11 @@
         } else {
             if (chars != null && chars.length() > 0) {
                 testChar = chars.charAt(0);
+
+                //Check if String chars contains SPACE character.
+                if (chars.trim().isEmpty()) {
+                    spaceKeyTyped = true;
+                }
             }
 
             char testCharIgnoringModifiers = charsIgnoringModifiers != null && charsIgnoringModifiers.length() > 0 ?
@@ -187,7 +193,7 @@
                                            NSEvent.nsToJavaEventType(eventType);
         }
 
-        char javaChar = NSEvent.nsToJavaChar(testChar, modifierFlags);
+        char javaChar = NSEvent.nsToJavaChar(testChar, modifierFlags, spaceKeyTyped);
         // Some keys may generate a KEY_TYPED, but we can't determine
         // what that character is. That's likely a bug, but for now we
         // just check for CHAR_UNDEFINED.
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/NSEvent.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/NSEvent.java	Wed Jul 05 22:01:14 2017 +0200
@@ -254,7 +254,7 @@
      * There is a small number of NS characters that need to be converted
      * into other characters before we pass them to AWT.
      */
-    static native char nsToJavaChar(char nsChar, int modifierFlags);
+    static native char nsToJavaChar(char nsChar, int modifierFlags, boolean spaceKeyTyped);
 
     static boolean isPopupTrigger(int jmodifiers) {
         final boolean isRightButtonDown = ((jmodifiers & InputEvent.BUTTON3_DOWN_MASK) != 0);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Wed Jul 05 22:01:14 2017 +0200
@@ -278,6 +278,16 @@
         java_awt_event_KeyEvent_VK_CONTROL
     },
     {
+        NSCommandKeyMask,
+        //kCGSFlagsMaskAppleLeftCommandKey,
+        //kCGSFlagsMaskAppleRightCommandKey,
+        55,
+        54,
+        java_awt_event_InputEvent_META_DOWN_MASK,
+        java_awt_event_InputEvent_META_MASK,
+        java_awt_event_KeyEvent_VK_META
+    },
+    {
         NSAlternateKeyMask,
         //kCGSFlagsMaskAppleLeftAlternateKey,
         //kCGSFlagsMaskAppleRightAlternateKey,
@@ -295,16 +305,6 @@
         java_awt_event_InputEvent_ALT_MASK | java_awt_event_InputEvent_ALT_GRAPH_MASK,
         java_awt_event_KeyEvent_VK_ALT | java_awt_event_KeyEvent_VK_ALT_GRAPH
     },
-	{
-		NSCommandKeyMask,
-		//kCGSFlagsMaskAppleLeftCommandKey,
-		//kCGSFlagsMaskAppleRightCommandKey,
-		55,
-		54,
-		java_awt_event_InputEvent_META_DOWN_MASK,
-		java_awt_event_InputEvent_META_MASK,
-		java_awt_event_KeyEvent_VK_META
-	},
     // NSNumericPadKeyMask
     {
         NSHelpKeyMask,
@@ -319,6 +319,7 @@
 };
 
 static BOOL leftAltKeyPressed;
+static BOOL altGRPressed = NO;
 
 /*
  * Almost all unicode characters just go from NS to Java with no translation.
@@ -349,7 +350,7 @@
     {0, 0, 0}
 };
 
-unichar NsCharToJavaChar(unichar nsChar, NSUInteger modifiers)
+unichar NsCharToJavaChar(unichar nsChar, NSUInteger modifiers, BOOL spaceKeyTyped)
 {
     const struct _char *cur;
     // Mask off just the keyboard modifiers from the event modifier mask.
@@ -382,6 +383,11 @@
         return java_awt_event_KeyEvent_CHAR_UNDEFINED;
     }
 
+    // nsChar receives value 0 when SPACE key is typed.
+    if (nsChar == 0 && spaceKeyTyped == YES) {
+        return java_awt_event_KeyEvent_VK_SPACE;
+    }
+	
     // otherwise return character unchanged
     return nsChar;
 }
@@ -554,20 +560,28 @@
  */
 jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods)
 {
-	jint javaModifiers = 0;
-	const struct _nsKeyToJavaModifier* cur;
+    jint javaModifiers = 0;
+    const struct _nsKeyToJavaModifier* cur;
 	
-	for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
-		if ((cur->nsMask & nsFlags) != 0) {
-				javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask;
-				if (cur->nsMask == NSAlternateKeyMask && leftAltKeyPressed == NO) {
-					continue;
-			}
-			break;
-		}
-	}
+    for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
+        if ((cur->nsMask & nsFlags) != 0) {
+			
+            if (cur->nsMask == NSAlternateKeyMask) {
+                if (leftAltKeyPressed == YES) {
+                    javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask;
+                    if (altGRPressed == NO)
+                        break;
+                    } else {
+                        leftAltKeyPressed = YES;
+                        altGRPressed = YES;
+                        continue;
+                    }
+                }
+            javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask;
+        }
+    }
 
-	return javaModifiers;
+    return javaModifiers;
 }
 
 /*
@@ -757,13 +771,13 @@
  */
 JNIEXPORT jint JNICALL
 Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
-(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
+(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags, jboolean spaceKeyTyped)
 {
     jchar javaChar = 0;
 
 JNF_COCOA_ENTER(env);
 
-    javaChar = NsCharToJavaChar(nsChar, modifierFlags);
+    javaChar = NsCharToJavaChar(nsChar, modifierFlags, spaceKeyTyped);
 
 JNF_COCOA_EXIT(env);
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m	Wed Jul 05 22:01:14 2017 +0200
@@ -261,27 +261,10 @@
 {
     CGKeyCode keyCode = GetCGKeyCode(javaKeyCode);
 
-    if ((javaKeyCode >= java_awt_event_KeyEvent_VK_0) &&
-		(javaKeyCode <= java_awt_event_KeyEvent_VK_9))
-    {
-        AXUIElementRef elem = AXUIElementCreateSystemWide();
-        AXUIElementPostKeyboardEvent(elem, (CGCharCode)0, keyCode, keyPressed);
-        CFRelease(elem);
-    } else {
-        /*
-         * JDK-8155740: AXUIElementPostKeyboardEvent posts correct key codes for
-         * number keys whereas CGEventPost posts Numpad keys for corresponding
-         * number key. Hence AXUIElementPostKeyboardEvent is used for posting
-         * numbers and CGEventCreateKeyboardEvent/CGEventPost is used for other
-         * keys.
-         * Key code for modifier key is required to distinguish between ALT and
-         * ALT-GR key for fixing issue 8155740.
-         */
-        CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
-        if (event != NULL) {
-            CGEventPost(kCGSessionEventTap, event);
-            CFRelease(event);
-        }
+    CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, keyPressed);
+    if (event != NULL) {
+        CGEventPost(kCGSessionEventTap, event);
+        CFRelease(event);
     }
 }
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.m	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.m	Wed Jul 05 22:01:14 2017 +0200
@@ -63,16 +63,20 @@
 
     jobject fCompLocal = (*env)->NewLocalRef(env, fComponent);
     if ((*env)->IsSameObject(env, fCompLocal, NULL)) {
-        return @"unknown";
+        return nil;
     }
     NSString *str = nil;
-    jobject jstr = JNFCallStaticObjectMethod(env, jm_getAccessibleActionDescription, fAccessibleAction, fIndex, fCompLocal);
+    jstring jstr = JNFCallStaticObjectMethod( env,
+                                              jm_getAccessibleActionDescription,
+                                              fAccessibleAction,
+                                              fIndex,
+                                              fCompLocal );
     if (jstr != NULL) {
-        NSString *str = JNFJavaToNSString(env, jstr); // AWT_THREADING Safe (AWTRunLoopMode)
+        str = JNFJavaToNSString(env, jstr); // AWT_THREADING Safe (AWTRunLoopMode)
         (*env)->DeleteLocalRef(env, jstr);
     }
     (*env)->DeleteLocalRef(env, fCompLocal);
-    return str == nil ? @"unknown" : str;
+    return str;
 }
 
 - (void)perform
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.h	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.h	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -55,6 +55,7 @@
 BOOL isVertical(JNIEnv *env, jobject axContext, jobject component);
 BOOL isHorizontal(JNIEnv *env, jobject axContext, jobject component);
 BOOL isShowing(JNIEnv *env, jobject axContext, jobject component);
+BOOL isSelectable(JNIEnv *env, jobject axContext, jobject component);
 NSPoint getAxComponentLocationOnScreen(JNIEnv *env, jobject axComponent, jobject component);
 jint getAxTextCharCount(JNIEnv *env, jobject axText, jobject component);
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m	Wed Jul 05 22:01:14 2017 +0200
@@ -151,6 +151,18 @@
     return showing;
 }
 
+BOOL isSelectable(JNIEnv *env, jobject axContext, jobject component)
+{
+    static JNF_STATIC_MEMBER_CACHE( jm_SELECTABLE,
+                                    sjc_AccessibleState,
+                                    "SELECTABLE",
+                                    "Ljavax/accessibility/AccessibleState;" );
+    jobject axSelectableState = JNFGetStaticObjectField(env, jm_SELECTABLE);
+    BOOL selectable = containsAxState(env, axContext, axSelectableState, component);
+    (*env)->DeleteLocalRef(env, axSelectableState);
+    return selectable;
+}
+
 NSPoint getAxComponentLocationOnScreen(JNIEnv *env, jobject axComponent, jobject component)
 {
     static JNF_STATIC_MEMBER_CACHE(jm_getLocationOnScreen, sjc_CAccessibility, "getLocationOnScreen", "(Ljavax/accessibility/AccessibleComponent;Ljava/awt/Component;)Ljava/awt/Point;");
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h	Wed Jul 05 22:01:14 2017 +0200
@@ -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
@@ -50,6 +50,7 @@
 - (id)initWithParent:(NSObject*)parent withEnv:(JNIEnv *)env withAccessible:(jobject)accessible withIndex:(jint)index withView:(NSView *)view withJavaRole:(NSString *)javaRole;
 - (void)unregisterFromCocoaAXSystem;
 - (void)postValueChanged;
+- (void)postSelectedTextChanged;
 - (void)postSelectionChanged;
 - (BOOL)isEqual:(id)anObject;
 - (BOOL)isAccessibleWithEnv:(JNIEnv *)env forAccessible:(jobject)accessible;
@@ -71,6 +72,7 @@
 - (NSString *)javaRole;
 - (BOOL)isMenu;
 - (BOOL)isSelected:(JNIEnv *)env;
+- (BOOL)isSelectable:(JNIEnv *)env;
 - (BOOL)isVisible:(JNIEnv *)env;
 
 // attribute names
@@ -85,6 +87,8 @@
 - (NSArray *)accessibilityChildrenAttribute;
 - (BOOL)accessibilityIsChildrenAttributeSettable;
 - (NSUInteger)accessibilityIndexOfChild:(id)child;
+- (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute
+    index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
 - (NSNumber *)accessibilityEnabledAttribute;
 - (BOOL)accessibilityIsEnabledAttributeSettable;
 - (NSNumber *)accessibilityFocusedAttribute;
@@ -92,6 +96,8 @@
 - (void)accessibilitySetFocusedAttribute:(id)value;
 - (NSString *)accessibilityHelpAttribute;
 - (BOOL)accessibilityIsHelpAttributeSettable;
+- (NSValue *)accessibilityIndexAttribute;
+- (BOOL)accessibilityIsIndexAttributeSettable;
 - (id)accessibilityMaxValueAttribute;
 - (BOOL)accessibilityIsMaxValueAttributeSettable;
 - (id)accessibilityMinValueAttribute;
@@ -108,6 +114,9 @@
 - (BOOL)accessibilityIsRoleDescriptionAttributeSettable;
 - (NSArray *)accessibilitySelectedChildrenAttribute;
 - (BOOL)accessibilityIsSelectedChildrenAttributeSettable;
+- (NSNumber *)accessibilitySelectedAttribute;
+- (BOOL)accessibilityIsSelectedAttributeSettable;
+- (void)accessibilitySetSelectedAttribute:(id)value;
 - (NSValue *)accessibilitySizeAttribute;
 - (BOOL)accessibilityIsSizeAttributeSettable;
 - (NSString *)accessibilitySubroleAttribute;
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m	Wed Jul 05 22:01:14 2017 +0200
@@ -201,10 +201,16 @@
     NSAccessibilityPostNotification(self, NSAccessibilityValueChangedNotification);
 }
 
+- (void)postSelectedTextChanged
+{
+    AWT_ASSERT_APPKIT_THREAD;
+    NSAccessibilityPostNotification(self, NSAccessibilitySelectedTextChangedNotification);
+}
+
 - (void)postSelectionChanged
 {
     AWT_ASSERT_APPKIT_THREAD;
-    NSAccessibilityPostNotification(self, NSAccessibilitySelectedTextChangedNotification);
+    NSAccessibilityPostNotification(self, NSAccessibilitySelectedChildrenChangedNotification);
 }
 
 - (BOOL)isEqual:(id)anObject
@@ -225,7 +231,7 @@
 {
     if (sAttributeNamesForRoleCache == nil) {
         sAttributeNamesLOCK = [[NSObject alloc] init];
-        sAttributeNamesForRoleCache = [[NSMutableDictionary alloc] initWithCapacity:10];
+        sAttributeNamesForRoleCache = [[NSMutableDictionary alloc] initWithCapacity:60];
     }
 
     if (sRoles == nil) {
@@ -281,6 +287,7 @@
 
 + (NSArray *)childrenOfParent:(JavaComponentAccessibility *)parent withEnv:(JNIEnv *)env withChildrenCode:(NSInteger)whichChildren allowIgnored:(BOOL)allowIgnored
 {
+    if (parent->fAccessible == NULL) return nil;
     jobjectArray jchildrenAndRoles = (jobjectArray)JNFCallStaticObjectMethod(env, jm_getChildrenAndRoles, parent->fAccessible, parent->fComponent, whichChildren, allowIgnored); // AWT_THREADING Safe (AWTRunLoop)
     if (jchildrenAndRoles == NULL) return nil;
 
@@ -370,7 +377,7 @@
 {
     static JNF_STATIC_MEMBER_CACHE(jm_getInitialAttributeStates, sjc_CAccessibility, "getInitialAttributeStates", "(Ljavax/accessibility/Accessible;Ljava/awt/Component;)[Z");
 
-    NSMutableArray *attributeNames = [NSMutableArray arrayWithCapacity:10];
+    NSMutableArray *attributeNames = [NSMutableArray arrayWithCapacity:20];
     [attributeNames retain];
 
     // all elements respond to parent, role, role description, window, topLevelUIElement, help
@@ -449,6 +456,12 @@
     // children
     if (attributeStatesArray[6]) {
         [attributeNames addObject:NSAccessibilityChildrenAttribute];
+        if ([javaRole isEqualToString:@"list"]) {
+            [attributeNames addObject:NSAccessibilitySelectedChildrenAttribute];
+            [attributeNames addObject:NSAccessibilityVisibleChildrenAttribute];
+        }
+        // Just above, the below mentioned support has been added back in for lists.
+        // However, the following comments may still be useful for future fixes.
 //        [attributeNames addObject:NSAccessibilitySelectedChildrenAttribute];
 //        [attributeNames addObject:NSAccessibilityVisibleChildrenAttribute];
                 //According to AXRoles.txt:
@@ -567,6 +580,14 @@
     return isChildSelected(env, ((JavaComponentAccessibility *)[self parent])->fAccessible, fIndex, fComponent);
 }
 
+- (BOOL)isSelectable:(JNIEnv *)env
+{
+    jobject axContext = [self axContextWithEnv:env];
+    BOOL selectable = isSelectable(env, axContext, fComponent);
+    (*env)->DeleteLocalRef(env, axContext);
+    return selectable;
+}
+
 - (BOOL)isVisible:(JNIEnv *)env
 {
     if (fIndex == -1) {
@@ -586,18 +607,32 @@
 
     @synchronized(sAttributeNamesLOCK) {
         NSString *javaRole = [self javaRole];
-        NSArray *names = (NSArray *)[sAttributeNamesForRoleCache objectForKey:javaRole];
-        if (names != nil) return names;
-
-        names = [self initializeAttributeNamesWithEnv:env];
-        if (names != nil) {
+        NSArray *names =
+            (NSArray *)[sAttributeNamesForRoleCache objectForKey:javaRole];
+        if (names == nil) {
+            names = [self initializeAttributeNamesWithEnv:env];
 #ifdef JAVA_AX_DEBUG
             NSLog(@"Initializing: %s for %@: %@", __FUNCTION__, javaRole, names);
 #endif
             [sAttributeNamesForRoleCache setObject:names forKey:javaRole];
-            return names;
         }
-    }
+        // The above set of attributes is immutable per role, but some objects, if
+        // they are the child of a list, need to add the selected and index attributes.
+        id myParent = [self accessibilityParentAttribute];
+        if ([myParent isKindOfClass:[JavaComponentAccessibility class]]) {
+            NSString *parentRole = [(JavaComponentAccessibility *)myParent javaRole];
+            if ([parentRole isEqualToString:@"list"]) {
+                NSMutableArray *moreNames =
+                    [[NSMutableArray alloc] initWithCapacity: [names count] + 2];
+                [moreNames addObjectsFromArray: names];
+                [moreNames addObject:NSAccessibilitySelectedAttribute];
+                [moreNames addObject:NSAccessibilityIndexAttribute];
+                return moreNames;
+            }
+        }
+        return names;
+
+    }  // end @synchronized
 
 #ifdef JAVA_AX_DEBUG
     NSLog(@"Warning in %s: could not find attribute names for role: %@", __FUNCTION__, [self javaRole]);
@@ -656,7 +691,10 @@
 - (NSArray *)accessibilityChildrenAttribute
 {
     JNIEnv* env = [ThreadUtilities getJNIEnv];
-    NSArray *children = [JavaComponentAccessibility childrenOfParent:self withEnv:env withChildrenCode:JAVA_AX_VISIBLE_CHILDREN allowIgnored:NO];
+    NSArray *children = [JavaComponentAccessibility childrenOfParent:self
+                                                    withEnv:env
+                                                    withChildrenCode:JAVA_AX_ALL_CHILDREN
+                                                    allowIgnored:NO];
 
     NSArray *value = nil;
     if ([children count] > 0) {
@@ -680,7 +718,12 @@
         return [super accessibilityIndexOfChild:child];
     }
 
-    return JNFCallStaticIntMethod([ThreadUtilities getJNIEnv], sjm_getAccessibleIndexInParent, ((JavaComponentAccessibility *)child)->fAccessible, ((JavaComponentAccessibility *)child)->fComponent);
+    jint returnValue =
+        JNFCallStaticIntMethod( [ThreadUtilities getJNIEnv],
+                                sjm_getAccessibleIndexInParent,
+                                ((JavaComponentAccessibility *)child)->fAccessible,
+                                ((JavaComponentAccessibility *)child)->fComponent );
+    return (returnValue == -1) ? NSNotFound : returnValue;
 }
 
 // Without this optimization accessibilityChildrenAttribute is called in order to get the entire array of children.
@@ -754,7 +797,7 @@
 
     jobject val = JNFCallStaticObjectMethod(env, sjm_getAccessibleDescription, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (val == NULL) {
-        return @"unknown";
+        return nil;
     }
     NSString* str = JNFJavaToNSString(env, val);
     (*env)->DeleteLocalRef(env, val);
@@ -766,6 +809,18 @@
     return NO;
 }
 
+- (NSValue *)accessibilityIndexAttribute
+{
+    NSInteger index = fIndex;
+    NSValue *returnValue = [NSValue value:&index withObjCType:@encode(NSInteger)];
+    return returnValue;
+}
+
+- (BOOL)accessibilityIsIndexAttributeSettable
+{
+    return NO;
+}
+
 // Element's maximum value (id)
 - (id)accessibilityMaxValueAttribute
 {
@@ -939,6 +994,33 @@
     return NO; // cmcnote: actually it should be. so need to write accessibilitySetSelectedChildrenAttribute also
 }
 
+- (NSNumber *)accessibilitySelectedAttribute
+{
+    return [NSNumber numberWithBool:[self isSelected:[ThreadUtilities getJNIEnv]]];
+}
+
+- (BOOL)accessibilityIsSelectedAttributeSettable
+{
+    if ([self isSelectable:[ThreadUtilities getJNIEnv]]) {
+        return YES;
+    } else {
+        return NO;
+    }
+}
+
+- (void)accessibilitySetSelectedAttribute:(id)value
+{
+    static JNF_STATIC_MEMBER_CACHE( jm_requestSelection,
+                                    sjc_CAccessibility,
+                                    "requestSelection",
+                                    "(Ljavax/accessibility/Accessible;Ljava/awt/Component;)V" );
+    
+    if ([(NSNumber*)value boolValue]) {
+        JNIEnv* env = [ThreadUtilities getJNIEnv];
+        JNFCallStaticVoidMethod(env, jm_requestSelection, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
+    }
+}
+
 // Element size (NSValue)
 - (NSValue *)accessibilitySizeAttribute {
     JNIEnv* env = [ThreadUtilities getJNIEnv];
@@ -1005,7 +1087,7 @@
 
     jobject val = JNFCallStaticObjectMethod(env, sjm_getAccessibleName, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
     if (val == NULL) {
-        return @"unknown";
+        return nil;
     }
     NSString* str = JNFJavaToNSString(env, val);
     (*env)->DeleteLocalRef(env, val);
@@ -1210,14 +1292,11 @@
 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessibility_focusChanged
 (JNIEnv *env, jobject jthis)
 {
-
 JNF_COCOA_ENTER(env);
     [ThreadUtilities performOnMainThread:@selector(postFocusChanged:) on:[JavaComponentAccessibility class] withObject:nil waitUntilDone:NO];
 JNF_COCOA_EXIT(env);
 }
 
-
-
 /*
  * Class:     sun_lwawt_macosx_CAccessible
  * Method:    valueChanged
@@ -1233,6 +1312,22 @@
 
 /*
  * Class:     sun_lwawt_macosx_CAccessible
+ * Method:    selectedTextChanged
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessible_selectedTextChanged
+(JNIEnv *env, jclass jklass, jlong element)
+{
+JNF_COCOA_ENTER(env);
+    [ThreadUtilities performOnMainThread:@selector(postSelectedTextChanged)
+                     on:(JavaComponentAccessibility *)jlong_to_ptr(element)
+                     withObject:nil
+                     waitUntilDone:NO];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     sun_lwawt_macosx_CAccessible
  * Method:    selectionChanged
  * Signature: (I)V
  */
@@ -1244,7 +1339,6 @@
 JNF_COCOA_EXIT(env);
 }
 
-
 /*
  * Class:     sun_lwawt_macosx_CAccessible
  * Method:    unregisterFromCocoaAXSystem
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.h	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.h	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -60,6 +60,4 @@
 - (NSValue *)accessibilityRangeForPositionAttributeForParameter:(id)parameter;
 - (NSValue *)accessibilityRangeForIndexAttributeForParameter:(id)parameter;
 
-// actions
-- (NSDictionary *)getActions:(JNIEnv *)env;
 @end
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m	Wed Jul 05 22:01:14 2017 +0200
@@ -427,13 +427,15 @@
     return javaIntArrayToNSRangeValue(env, axTextRange);
 }
 
-- (NSDictionary *)getActions:(JNIEnv *)env {
-    // cmcnote: this isn't correct; text can have actions. Not yet implemented. radr://3941691
-    // Editable text has AXShowMenu. Textfields have AXConfirm. Static text has no actions.
-#ifdef JAVA_AX_DEBUG
-    NSLog(@"Not yet implemented: %s\n", __FUNCTION__);
-#endif
-    return nil;
-}
+/* 
+ * - (NSDictionary *)getActions:(JNIEnv *)env { ... }
+ *
+ * In the future, possibly add support: Editable text has AXShowMenu.
+ * Textfields have AXConfirm.
+ *
+ * Note: JLabels (static text) in JLists have a press/click selection action
+ *   which is currently handled in superclass JavaComponentAccessibility.
+ *   If function is added here be sure to use [super getActions:env] for JLabels.
+ */
 
 @end
--- a/jdk/src/java.desktop/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/accessibility/internal/resources/accessibility_ko.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -14,8 +14,8 @@
 # accessible roles
 #
 alert=\uACBD\uBCF4
-awtcomponent=AWT \uAD6C\uC131 \uC694\uC18C
-checkbox=\uCCB4\uD06C \uBC15\uC2A4
+awtcomponent=AWT \uAD6C\uC131\uC694\uC18C
+checkbox=\uCCB4\uD06C\uBC15\uC2A4
 colorchooser=\uC0C9\uC0C1 \uC120\uD0DD\uAE30
 columnheader=\uC5F4 \uBA38\uB9AC\uAE00
 combobox=\uCF64\uBCF4 \uC0C1\uC790
@@ -52,7 +52,7 @@
 separator=\uAD6C\uBD84 \uAE30\uD638
 slider=\uC2AC\uB77C\uC774\uB354
 splitpane=\uBD84\uD560 \uCC3D
-swingcomponent=\uD68C\uC804 \uAD6C\uC131 \uC694\uC18C
+swingcomponent=\uD68C\uC804 \uAD6C\uC131\uC694\uC18C
 table=\uD14C\uC774\uBE14
 text=\uD14D\uC2A4\uD2B8
 tree=\uD2B8\uB9AC
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1339,14 +1339,14 @@
             Graphics g, int state, int x, int y, int w, int h) {
         ENGINE.paintExpander(g, context, Region.TREE,
                 GTKLookAndFeel.synthStateToGTKState(context.getRegion(), state),
-                ExpanderStyle.EXPANDED, "treeview", x, y, w, h);
+                ExpanderStyle.EXPANDED, "expander", x, y, w, h);
     }
 
     public void paintTreeCollapsedIcon(SynthContext context,
             Graphics g, int state, int x, int y, int w, int h) {
         ENGINE.paintExpander(g, context, Region.TREE,
                 GTKLookAndFeel.synthStateToGTKState(context.getRegion(), state),
-                ExpanderStyle.COLLAPSED, "treeview", x, y, w, h);
+                ExpanderStyle.COLLAPSED, "expander", x, y, w, h);
     }
 
     public void paintCheckBoxIcon(SynthContext context,
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Wed Jul 05 22:01:14 2017 +0200
@@ -854,6 +854,12 @@
             return indicatorSpacing + focusSize + focusPad;
         } else if (GTKLookAndFeel.is3() && "ComboBox.forceOpaque".equals(key)) {
             return true;
+        } else if ("Tree.expanderSize".equals(key)) {
+            Object value = getClassSpecificValue("expander-size");
+            if (value instanceof Integer) {
+                return (Integer)value + 4;
+            }
+            return null;
         }
 
         // Is it a stock icon ?
@@ -1136,7 +1142,6 @@
         CLASS_SPECIFIC_MAP.put("Slider.thumbWidth", "slider-length");
         CLASS_SPECIFIC_MAP.put("Slider.trackBorder", "trough-border");
         CLASS_SPECIFIC_MAP.put("SplitPane.size", "handle-size");
-        CLASS_SPECIFIC_MAP.put("Tree.expanderSize", "expander-size");
         CLASS_SPECIFIC_MAP.put("ScrollBar.thumbHeight", "slider-width");
         CLASS_SPECIFIC_MAP.put("ScrollBar.width", "slider-width");
         CLASS_SPECIFIC_MAP.put("TextArea.caretForeground", "cursor-color");
--- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1013,8 +1013,8 @@
      * @param file the file
      * @return returns true if successfully moved the file to the trash.
      * @throws SecurityException If a security manager exists and its
-     *         {@link SecurityManager#checkWrite(java.lang.String)} method
-     *         denies write access to the file
+     *         {@link SecurityManager#checkDelete(java.lang.String)} method
+     *         denies deletion of the file
      * @throws UnsupportedOperationException if the current platform
      *         does not support the {@link Desktop.Action#MOVE_TO_TRASH} action
      * @throws NullPointerException if {@code file} is {@code null}
--- a/jdk/src/java.desktop/share/classes/java/awt/Font.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Font.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1813,35 +1813,31 @@
             return true;
         }
 
-        if (obj != null) {
-            try {
-                Font font = (Font)obj;
-                if (size == font.size &&
-                    style == font.style &&
-                    nonIdentityTx == font.nonIdentityTx &&
-                    hasLayoutAttributes == font.hasLayoutAttributes &&
-                    pointSize == font.pointSize &&
-                    name.equals(font.name)) {
+        if (obj instanceof Font) {
+            Font font = (Font)obj;
+            if (size == font.size &&
+                style == font.style &&
+                nonIdentityTx == font.nonIdentityTx &&
+                hasLayoutAttributes == font.hasLayoutAttributes &&
+                pointSize == font.pointSize &&
+                name.equals(font.name)) {
 
-                    /* 'values' is usually initialized lazily, except when
-                     * the font is constructed from a Map, or derived using
-                     * a Map or other values. So if only one font has
-                     * the field initialized we need to initialize it in
-                     * the other instance and compare.
-                     */
-                    if (values == null) {
-                        if (font.values == null) {
-                            return true;
-                        } else {
-                            return getAttributeValues().equals(font.values);
-                        }
+                /* 'values' is usually initialized lazily, except when
+                 * the font is constructed from a Map, or derived using
+                 * a Map or other values. So if only one font has
+                 * the field initialized we need to initialize it in
+                 * the other instance and compare.
+                 */
+                if (values == null) {
+                    if (font.values == null) {
+                        return true;
                     } else {
-                        return values.equals(font.getAttributeValues());
+                        return getAttributeValues().equals(font.values);
                     }
+                } else {
+                    return values.equals(font.getAttributeValues());
                 }
             }
-            catch (ClassCastException e) {
-            }
         }
         return false;
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java	Wed Jul 05 22:01:14 2017 +0200
@@ -356,7 +356,7 @@
      *
      * Some platforms do not support string values and accept only integer
      * values. In this case, pass an integer represented as a string as parameter.
-     * This can be tested by {@code Feature.ICON_BADGE_STRING} and
+     * This can be tested by {@code Feature.ICON_BADGE_TEXT} and
      * {@code Feature.ICON_BADGE_NUMBER}.
      *
      * Passing {@code null} as parameter hides the badge.
@@ -364,7 +364,8 @@
      * @throws SecurityException if a security manager exists and it denies the
      * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
      * @throws UnsupportedOperationException if the current platform
-     * does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER} feature
+     * does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
+     * or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
      */
     public void setIconBadge(final String badge) {
         checkAWTPermission();
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1388,9 +1388,7 @@
         // ensure that the proper libraries are loaded
         loadLibraries();
         initAssistiveTechnologies();
-        if (!GraphicsEnvironment.isHeadless()) {
-            initIDs();
-        }
+        initIDs();
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java	Wed Jul 05 22:01:14 2017 +0200
@@ -168,6 +168,9 @@
     // Flag to ensure the we don't get multiple ActionEvents on item selection.
     private boolean selectingItem = false;
 
+    // Flag to indicate UI update is in progress
+    private transient boolean updateInProgress;
+
     /**
      * Creates a <code>JComboBox</code> that takes its items from an
      * existing <code>ComboBoxModel</code>.  Since the
@@ -268,11 +271,18 @@
      * @see JComponent#updateUI
      */
     public void updateUI() {
-        setUI((ComboBoxUI)UIManager.getUI(this));
+        if (!updateInProgress) {
+            updateInProgress = true;
+            try {
+                setUI((ComboBoxUI)UIManager.getUI(this));
 
-        ListCellRenderer<? super E> renderer = getRenderer();
-        if (renderer instanceof Component) {
-            SwingUtilities.updateComponentTreeUI((Component)renderer);
+                ListCellRenderer<? super E> renderer = getRenderer();
+                if (renderer instanceof Component) {
+                    SwingUtilities.updateComponentTreeUI((Component)renderer);
+                }
+            } finally {
+                updateInProgress = false;
+            }
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -338,6 +338,11 @@
     private transient DropLocation dropLocation;
 
     /**
+     * Flag to indicate UI update is in progress
+     */
+    private transient boolean updateInProgress;
+
+    /**
      * A subclass of <code>TransferHandler.DropLocation</code> representing
      * a drop location for a <code>JList</code>.
      *
@@ -531,11 +536,18 @@
      * @see SwingUtilities#updateComponentTreeUI
      */
     public void updateUI() {
-        setUI((ListUI)UIManager.getUI(this));
-
-        ListCellRenderer<? super E> renderer = getCellRenderer();
-        if (renderer instanceof Component) {
-            SwingUtilities.updateComponentTreeUI((Component)renderer);
+        if (!updateInProgress) {
+            updateInProgress = true;
+            try {
+                setUI((ListUI)UIManager.getUI(this));
+
+                ListCellRenderer<? super E> renderer = getCellRenderer();
+                if (renderer instanceof Component) {
+                    SwingUtilities.updateComponentTreeUI((Component)renderer);
+                }
+            } finally {
+                updateInProgress = false;
+            }
         }
     }
 
@@ -3046,7 +3058,7 @@
         public Accessible getAccessibleAt(Point p) {
             int i = locationToIndex(p);
             if (i >= 0) {
-                return new AccessibleJListChild(JList.this, i);
+                return new ActionableAccessibleJListChild(JList.this, i);
             } else {
                 return null;
             }
@@ -3073,7 +3085,7 @@
             if (i >= getModel().getSize()) {
                 return null;
             } else {
-                return new AccessibleJListChild(JList.this, i);
+                return new ActionableAccessibleJListChild(JList.this, i);
             }
         }
 
@@ -3178,7 +3190,7 @@
         protected class AccessibleJListChild extends AccessibleContext
                 implements Accessible, AccessibleComponent {
             private JList<E>     parent = null;
-            private int       indexInParent;
+            int indexInParent;
             private Component component = null;
             private AccessibleContext accessibleContext = null;
             private ListModel<E> listModel;
@@ -3203,7 +3215,7 @@
                 return getComponentAtIndex(indexInParent);
             }
 
-            private AccessibleContext getCurrentAccessibleContext() {
+            AccessibleContext getCurrentAccessibleContext() {
                 Component c = getComponentAtIndex(indexInParent);
                 if (c instanceof Accessible) {
                     return c.getAccessibleContext();
@@ -3369,10 +3381,6 @@
                 }
             }
 
-            public AccessibleAction getAccessibleAction() {
-                return getCurrentAccessibleContext().getAccessibleAction();
-            }
-
            /**
             * Get the AccessibleComponent associated with this object.  In the
             * implementation of the Java Accessibility API for this class,
@@ -3587,7 +3595,13 @@
 
             public Point getLocationOnScreen() {
                 if (parent != null) {
-                    Point listLocation = parent.getLocationOnScreen();
+                    Point listLocation;
+                    try {
+                        listLocation = parent.getLocationOnScreen();
+                    } catch (IllegalComponentStateException e) {
+                        // This can happen if the component isn't visisble
+                        return null;
+                    }
                     Point componentLocation = parent.indexToLocation(indexInParent);
                     if (componentLocation != null) {
                         componentLocation.translate(listLocation.x, listLocation.y);
@@ -3728,6 +3742,57 @@
                     return null;
                 }
             }
+
         } // inner class AccessibleJListChild
+
+        private class ActionableAccessibleJListChild
+            extends AccessibleJListChild
+            implements AccessibleAction {
+
+            ActionableAccessibleJListChild(JList<E> parent, int indexInParent) {
+                super(parent, indexInParent);
+            }
+
+            @Override
+            public AccessibleAction getAccessibleAction() {
+                AccessibleContext ac = getCurrentAccessibleContext();
+                if (ac == null) {
+                    return null;
+                } else {
+                    AccessibleAction aa = ac.getAccessibleAction();
+                    if (aa != null) {
+                        return aa;
+                    } else {
+                        return this;
+                    }
+                }
+            }
+
+            @Override
+            public boolean doAccessibleAction(int i) {
+                if (i == 0) {
+                    JList.this.setSelectedIndex(indexInParent);
+                    return true;
+                } else {
+                    return false;
+                }
+            }
+
+            @Override
+            public String getAccessibleActionDescription(int i) {
+                if (i == 0) {
+                    return UIManager.getString("AbstractButton.clickText");
+                } else {
+                    return null;
+                }
+            }
+
+            @Override
+            public int getAccessibleActionCount() {
+                return 1;
+            }
+
+        } // inner class ActionableAccessibleJListChild
+
     } // inner class AccessibleJList
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java	Wed Jul 05 22:01:14 2017 +0200
@@ -455,6 +455,11 @@
     private transient DropLocation dropLocation;
 
     /**
+     * Flag to indicate UI update is in progress
+     */
+    private transient boolean updateInProgress;
+
+    /**
      * A subclass of <code>TransferHandler.DropLocation</code> representing
      * a drop location for a <code>JTable</code>.
      *
@@ -3621,36 +3626,46 @@
      * @see JComponent#updateUI
      */
     public void updateUI() {
-        // Update the UIs of the cell renderers, cell editors and header renderers.
-        TableColumnModel cm = getColumnModel();
-        for(int column = 0; column < cm.getColumnCount(); column++) {
-            TableColumn aColumn = cm.getColumn(column);
-            SwingUtilities.updateRendererOrEditorUI(aColumn.getCellRenderer());
-            SwingUtilities.updateRendererOrEditorUI(aColumn.getCellEditor());
-            SwingUtilities.updateRendererOrEditorUI(aColumn.getHeaderRenderer());
-        }
-
-        // Update the UIs of all the default renderers.
-        Enumeration<?> defaultRenderers = defaultRenderersByColumnClass.elements();
-        while (defaultRenderers.hasMoreElements()) {
-            SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement());
-        }
-
-        // Update the UIs of all the default editors.
-        Enumeration<?> defaultEditors = defaultEditorsByColumnClass.elements();
-        while (defaultEditors.hasMoreElements()) {
-            SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement());
-        }
-
-        // Update the UI of the table header
-        if (tableHeader != null && tableHeader.getParent() == null) {
-            tableHeader.updateUI();
-        }
-
-        // Update UI applied to parent ScrollPane
-        configureEnclosingScrollPaneUI();
-
-        setUI((TableUI)UIManager.getUI(this));
+        if (updateInProgress) {
+            return;
+        }
+
+        updateInProgress = true;
+
+        try {
+            // Update the UIs of the cell renderers, cell editors and header renderers.
+            TableColumnModel cm = getColumnModel();
+            for(int column = 0; column < cm.getColumnCount(); column++) {
+                TableColumn aColumn = cm.getColumn(column);
+                SwingUtilities.updateRendererOrEditorUI(aColumn.getCellRenderer());
+                SwingUtilities.updateRendererOrEditorUI(aColumn.getCellEditor());
+                SwingUtilities.updateRendererOrEditorUI(aColumn.getHeaderRenderer());
+            }
+
+            // Update the UIs of all the default renderers.
+            Enumeration<?> defaultRenderers = defaultRenderersByColumnClass.elements();
+            while (defaultRenderers.hasMoreElements()) {
+                SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement());
+            }
+
+            // Update the UIs of all the default editors.
+            Enumeration<?> defaultEditors = defaultEditorsByColumnClass.elements();
+            while (defaultEditors.hasMoreElements()) {
+                SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement());
+            }
+
+            // Update the UI of the table header
+            if (tableHeader != null && tableHeader.getParent() == null) {
+                tableHeader.updateUI();
+            }
+
+            // Update UI applied to parent ScrollPane
+            configureEnclosingScrollPaneUI();
+
+            setUI((TableUI)UIManager.getUI(this));
+        } finally {
+            updateInProgress = false;
+        }
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -321,6 +321,11 @@
     private transient DropLocation dropLocation;
 
     /**
+     * Flag to indicate UI update is in progress
+     */
+    private transient boolean updateInProgress;
+
+    /**
      * A subclass of <code>TransferHandler.DropLocation</code> representing
      * a drop location for a <code>JTree</code>.
      *
@@ -713,10 +718,19 @@
      * @see JComponent#updateUI
      */
     public void updateUI() {
-        setUI((TreeUI)UIManager.getUI(this));
-
-        SwingUtilities.updateRendererOrEditorUI(getCellRenderer());
-        SwingUtilities.updateRendererOrEditorUI(getCellEditor());
+        if (!updateInProgress) {
+
+            updateInProgress = true;
+
+            try {
+                setUI((TreeUI)UIManager.getUI(this));
+
+                SwingUtilities.updateRendererOrEditorUI(getCellRenderer());
+                SwingUtilities.updateRendererOrEditorUI(getCellEditor());
+            } finally {
+                updateInProgress = false;
+            }
+        }
     }
 
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -118,6 +118,11 @@
       */
     private TableCellRenderer defaultRenderer;
 
+    /**
+     * Flag to indicate UI update is in progress
+     */
+    private transient boolean updateInProgress;
+
 //
 // Constructors
 //
@@ -475,11 +480,18 @@
      * @see JComponent#updateUI
      */
     public void updateUI(){
-        setUI((TableHeaderUI)UIManager.getUI(this));
+        if (!updateInProgress) {
+            updateInProgress = true;
+            try {
+                setUI((TableHeaderUI)UIManager.getUI(this));
 
-        TableCellRenderer renderer = getDefaultRenderer();
-        if (renderer instanceof Component) {
-            SwingUtilities.updateComponentTreeUI((Component)renderer);
+                TableCellRenderer renderer = getDefaultRenderer();
+                if (renderer instanceof Component) {
+                    SwingUtilities.updateComponentTreeUI((Component)renderer);
+                }
+            } finally {
+                updateInProgress = false;
+            }
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/module-info.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/module-info.java	Wed Jul 05 22:01:14 2017 +0200
@@ -23,6 +23,10 @@
  * questions.
  */
 
+/**
+  * java.desktop defines and exports the user interface, graphics
+  * and imaging APIs of the Java SE platform.
+  */
 module java.desktop {
     requires public java.datatransfer;
     requires public java.xml;
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/OffScreenImageSource.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/OffScreenImageSource.java	Wed Jul 05 22:01:14 2017 +0200
@@ -187,17 +187,19 @@
             sendPixels();
             theConsumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
 
-            try {
-                theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
-            } catch (RuntimeException e) {
-                // We did not previously call this method here and
-                // some image consumer filters were not prepared for it to be
-                // called at this time. We allow them to have runtime issues
-                // for this one call only without triggering the IMAGEERROR
-                // condition below.
-                e.printStackTrace();
+            // If 'theconsumer' has not unregistered itself after previous call
+            if (theConsumer != null) {
+                try {
+                    theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
+                } catch (RuntimeException e) {
+                    // We did not previously call this method here and
+                    // some image consumer filters were not prepared for it to be
+                    // called at this time. We allow them to have runtime issues
+                    // for this one call only without triggering the IMAGEERROR
+                    // condition below.
+                    e.printStackTrace();
+                }
             }
-
         } catch (NullPointerException e) {
             e.printStackTrace();
 
--- a/jdk/src/java.desktop/share/classes/sun/font/GlyphList.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/font/GlyphList.java	Wed Jul 05 22:01:14 2017 +0200
@@ -28,6 +28,7 @@
 import java.awt.Font;
 import java.awt.font.GlyphVector;
 import java.awt.font.FontRenderContext;
+import java.util.concurrent.atomic.AtomicBoolean;
 import sun.java2d.loops.FontInfo;
 
 /*
@@ -151,8 +152,8 @@
      * occur and if it did, it would just lead to some extra garbage being
      * created.
      */
-    private static GlyphList reusableGL = new GlyphList();
-    private static boolean inUse;
+    private static final GlyphList reusableGL = new GlyphList();
+    private static final AtomicBoolean inUse = new AtomicBoolean();
 
 
     void ensureCapacity(int len) {
@@ -184,24 +185,10 @@
 //     }
 
     public static GlyphList getInstance() {
-        /* The following heuristic is that if the reusable instance is
-         * in use, it probably still will be in a micro-second, so avoid
-         * synchronising on the class and just allocate a new instance.
-         * The cost is one extra boolean test for the normal case, and some
-         * small number of cases where we allocate an extra object when
-         * in fact the reusable one would be freed very soon.
-         */
-        if (inUse) {
+        if (inUse.compareAndSet(false, true)) {
+            return reusableGL;
+        } else {
             return new GlyphList();
-        } else {
-            synchronized(GlyphList.class) {
-                if (inUse) {
-                    return new GlyphList();
-                } else {
-                    inUse = true;
-                    return reusableGL;
-                }
-            }
         }
     }
 
@@ -212,17 +199,10 @@
      * will be discarded so the re-allocation overhead is high.
      */
 //     public static GlyphList getInstance(int sz) {
-//      if (inUse) {
-//          return new GlyphList(sz);
+//      if (inUse.compareAndSet(false, true) {
+//          return reusableGL;
 //      } else {
-//          synchronized(GlyphList.class) {
-//              if (inUse) {
-//                  return new GlyphList();
-//              } else {
-//                  inUse = true;
-//                  return reusableGL;
-//              }
-//          }
+//          return new GlyphList(sz);
 //      }
 //     }
 
@@ -423,7 +403,7 @@
             }
             usePositions = false;
             strikelist = null; // remove reference to the strike list
-            inUse = false;
+            inUse.set(false);
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Wed Jul 05 22:01:14 2017 +0200
@@ -74,7 +74,7 @@
 import java.awt.event.KeyEvent;
 import java.net.URISyntaxException;
 import java.lang.reflect.Field;
-
+import java.net.MalformedURLException;
 
 /**
  * A class which implements a cross-platform print dialog.
@@ -932,12 +932,18 @@
                 allowedToPrintToFile() : false;
 
             // setup Destination (print-to-file) widgets
-            if (psCurrent.isAttributeCategorySupported(dstCategory)) {
-                dstSupported = true;
-            }
             Destination dst = (Destination)asCurrent.get(dstCategory);
             if (dst != null) {
-                dstSelected = true;
+                try {
+                     dst.getURI().toURL();
+                     if (psCurrent.isAttributeValueSupported(dst, docFlavor,
+                                                             asCurrent)) {
+                         dstSupported = true;
+                         dstSelected = true;
+                     }
+                 } catch (MalformedURLException ex) {
+                     dstSupported = true;
+                 }
             }
             cbPrintToFile.setEnabled(dstSupported && dstAllowed);
             cbPrintToFile.setSelected(dstSelected && dstAllowed
@@ -1294,8 +1300,16 @@
                 if (sc == null) {
                     sc = SheetCollate.UNCOLLATED;
                 }
+                if (sc != null &&
+                    !psCurrent.isAttributeValueSupported(sc, docFlavor, asCurrent)) {
+                    scSupported = false;
+                }
+            } else {
+                if (!psCurrent.isAttributeValueSupported(sc, docFlavor, asCurrent)) {
+                    scSupported = false;
+                }
             }
-            cbCollate.setSelected(sc == SheetCollate.COLLATED);
+            cbCollate.setSelected(sc == SheetCollate.COLLATED && scSupported);
             updateCollateCB();
         }
     }
--- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Wed Jul 05 22:01:14 2017 +0200
@@ -25,6 +25,7 @@
 package sun.swing;
 
 import java.awt.*;
+import java.awt.geom.AffineTransform;
 import java.awt.image.*;
 import java.util.*;
 
@@ -99,9 +100,7 @@
         }
     }
 
-    private void paint0(Component c, Graphics g, int x,
-                         int y, int w, int h, Object... args) {
-        Object key = getClass();
+    private Image getImage(Object key, Component c, int w, int h, Object... args) {
         GraphicsConfiguration config = getGraphicsConfiguration(c);
         ImageCache cache = getCache(key);
         Image image = cache.getImage(key, config, w, h, args);
@@ -133,14 +132,40 @@
                 g2.dispose();
             }
 
-            // Render to the passed in Graphics
-            paintImage(c, g, x, y, w, h, image, args);
-
             // If we did this 3 times and the contents are still lost
             // assume we're painting to a VolatileImage that is bogus and
             // give up.  Presumably we'll be called again to paint.
         } while ((image instanceof VolatileImage) &&
                  ((VolatileImage)image).contentsLost() && ++attempts < 3);
+
+        return image;
+    }
+
+    private void paint0(Component c, Graphics g, int x,
+                        int y, int w, int h, Object... args) {
+        Object key = getClass();
+        GraphicsConfiguration config = getGraphicsConfiguration(c);
+        ImageCache cache = getCache(key);
+        Image image = cache.getImage(key, config, w, h, args);
+
+        if (image == null) {
+            double sx = 1;
+            double sy = 1;
+            if (g instanceof Graphics2D) {
+                AffineTransform tx = ((Graphics2D) g).getTransform();
+                sx = tx.getScaleX();
+                sy = tx.getScaleY();
+            }
+            image = new PainterMultiResolutionCachedImage(sx, sy, w, h);
+            cache.setImage(key, config, w, h, args, image);
+        }
+
+        if (image instanceof PainterMultiResolutionCachedImage) {
+            ((PainterMultiResolutionCachedImage) image).setParams(c, args);
+        }
+
+        // Render to the passed in Graphics
+        paintImage(c, g, x, y, w, h, image, args);
     }
 
     /**
@@ -210,4 +235,62 @@
         }
         return c.getGraphicsConfiguration();
     }
-}
+
+    class PainterMultiResolutionCachedImage extends AbstractMultiResolutionImage {
+
+        private final double scaleX;
+        private final double scaleY;
+        private final int baseWidth;
+        private final int baseHeight;
+        private Component c;
+        private Object[] args;
+
+        public PainterMultiResolutionCachedImage(double scaleX, double scaleY,
+                                                 int baseWidth, int baseHeight) {
+            this.scaleX = scaleX;
+            this.scaleY = scaleY;
+            this.baseWidth = baseWidth;
+            this.baseHeight = baseHeight;
+        }
+
+        public void setParams(Component c, Object[] args) {
+            this.c = c;
+            this.args = args;
+        }
+
+        @Override
+        public int getWidth(ImageObserver observer) {
+            return baseWidth;
+        }
+
+        @Override
+        public int getHeight(ImageObserver observer) {
+            return baseHeight;
+        }
+
+        @Override
+        public Image getResolutionVariant(double destWidth, double destHeight) {
+            int w = (int) Math.ceil(destWidth);
+            int h = (int) Math.ceil(destHeight);
+            return getImage(this, c, w, h, args);
+        }
+
+        @Override
+        protected Image getBaseImage() {
+            return getResolutionVariant(baseWidth, baseHeight);
+        }
+
+        @Override
+        public java.util.List<Image> getResolutionVariants() {
+
+            if (scaleX == 1 && scaleY == 1) {
+                return Arrays.asList(getResolutionVariant(baseWidth, baseHeight));
+            }
+
+            return Arrays.asList(
+                    getResolutionVariant(baseWidth, baseHeight),
+                    getResolutionVariant(scaleX * baseWidth, scaleY * baseHeight)
+            );
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/src/java.desktop/share/classes/sun/swing/FilePane.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/swing/FilePane.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1748,8 +1748,8 @@
         if (listSelectionModel != null) {
             listSelectionModel.clearSelection();
             if (listSelectionModel instanceof DefaultListSelectionModel) {
-                ((DefaultListSelectionModel)listSelectionModel).moveLeadSelectionIndex(0);
-                listSelectionModel.setAnchorSelectionIndex(0);
+                ((DefaultListSelectionModel)listSelectionModel).moveLeadSelectionIndex(-1);
+                listSelectionModel.setAnchorSelectionIndex(-1);
             }
         }
     }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, 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
@@ -29,6 +29,9 @@
 import java.awt.event.ComponentEvent;
 import java.awt.event.InvocationEvent;
 import java.awt.event.WindowEvent;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 import sun.awt.IconInfo;
 import sun.util.logging.PlatformLogger;
@@ -52,6 +55,8 @@
     XContentWindow content;
     Insets currentInsets;
     XFocusProxyWindow focusProxy;
+    static final Map<Class<?>,Insets> lastKnownInsets =
+                                   Collections.synchronizedMap(new HashMap<>());
 
     XDecoratedPeer(Window target) {
         super(target);
@@ -74,6 +79,9 @@
         winAttr.initialFocus = true;
 
         currentInsets = new Insets(0,0,0,0);
+        if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
+            currentInsets = lastKnownInsets.get(getClass());
+        }
         applyGuessedInsets();
 
         Rectangle bounds = (Rectangle)params.get(BOUNDS);
@@ -297,7 +305,25 @@
         if (ev.get_atom() == XWM.XA_KDE_NET_WM_FRAME_STRUT.getAtom()
             || ev.get_atom() == XWM.XA_NET_FRAME_EXTENTS.getAtom())
         {
-            getWMSetInsets(XAtom.get(ev.get_atom()));
+            if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
+                getWMSetInsets(XAtom.get(ev.get_atom()));
+            } else {
+                if(!isReparented()) {
+                    return;
+                }
+                wm_set_insets = null;
+                Insets in = getWMSetInsets(XAtom.get(ev.get_atom()));
+                if (isNull(in)) {
+                    return;
+                }
+                if (!isEmbedded() && !isTargetUndecorated()) {
+                    lastKnownInsets.put(getClass(), in);
+                }
+                if (!in.equals(dimensions.getInsets())) {
+                    handleCorrectInsets(in);
+                }
+                insets_corrected = true;
+            }
         }
     }
 
@@ -370,7 +396,7 @@
                     }
                 }
 
-                if (correctWM != null) {
+                if (correctWM != null && XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
                     handleCorrectInsets(correctWM);
                 }
             }
@@ -664,6 +690,9 @@
 
     boolean no_reparent_artifacts = false;
     public void handleConfigureNotifyEvent(XEvent xev) {
+        if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM && !insets_corrected) {
+            return;
+        }
         assert (SunToolkit.isAWTLockHeldByCurrentThread());
         XConfigureEvent xe = xev.get_xconfigure();
         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
@@ -1010,7 +1039,22 @@
         if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
             focusLog.fine("WM_TAKE_FOCUS on {0}", this);
         }
-        requestWindowFocus(cl.get_data(1), true);
+
+        if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
+            // JDK-8159460
+            Window focusedWindow = XKeyboardFocusManagerPeer.getInstance()
+                    .getCurrentFocusedWindow();
+            Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
+            if (activeWindow != target) {
+                requestWindowFocus(cl.get_data(1), true);
+            } else {
+                WindowEvent we = new WindowEvent(focusedWindow,
+                        WindowEvent.WINDOW_GAINED_FOCUS);
+                sendEvent(we);
+            }
+        } else {
+            requestWindowFocus(cl.get_data(1), true);
+        }
     }
 
     /**
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java	Wed Jul 05 22:01:14 2017 +0200
@@ -35,8 +35,16 @@
 
 class XRobotPeer implements RobotPeer {
 
-    private static volatile boolean isGtkSupported;
+    static final boolean tryGtk;
+    static {
+        loadNativeLibraries();
+        tryGtk = Boolean.getBoolean("awt.robot.gtk");
+    }
+
+    private static boolean isGtkSupported =  false;
+    private static volatile boolean useGtk;
     private X11GraphicsConfig   xgc = null;
+
     /*
      * native implementation uses some static shared data (pipes, processes)
      * so use a class lock to synchronize native method calls
@@ -49,13 +57,14 @@
         setup(tk.getNumberOfButtons(),
                 AWTAccessor.getInputEventAccessor().getButtonDownMasks());
 
-        Toolkit toolkit = Toolkit.getDefaultToolkit();
-        if (!isGtkSupported) {
-            if (toolkit instanceof UNIXToolkit
-                    && ((UNIXToolkit) toolkit).loadGTK()) {
+        boolean isGtkSupported = false;
+        if (tryGtk) {
+            if (tk instanceof UNIXToolkit && ((UNIXToolkit) tk).loadGTK()) {
                 isGtkSupported = true;
             }
         }
+
+        useGtk = (tryGtk && isGtkSupported);
     }
 
     @Override
@@ -104,7 +113,7 @@
     public int getRGBPixel(int x, int y) {
         int pixelArray[] = new int[1];
         getRGBPixelsImpl(xgc, x, y, 1, 1, xgc.getScale(), pixelArray,
-                         isGtkSupported);
+                         useGtk);
         return pixelArray[0];
     }
 
@@ -112,11 +121,12 @@
     public int [] getRGBPixels(Rectangle bounds) {
         int pixelArray[] = new int[bounds.width*bounds.height];
         getRGBPixelsImpl(xgc, bounds.x, bounds.y, bounds.width, bounds.height,
-                         xgc.getScale(), pixelArray, isGtkSupported);
+                         xgc.getScale(), pixelArray, useGtk);
         return pixelArray;
     }
 
     private static synchronized native void setup(int numberOfButtons, int[] buttonDownMasks);
+    private static native void loadNativeLibraries();
 
     private static synchronized native void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
     private static synchronized native void mousePressImpl(int buttons);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java	Wed Jul 05 22:01:14 2017 +0200
@@ -32,6 +32,7 @@
 
 import sun.awt.UNIXToolkit;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import sun.security.action.GetPropertyAction;
 
 final class XTaskbarPeer implements TaskbarPeer {
@@ -40,6 +41,14 @@
     private static boolean initExecuted = false;
 
     private PopupMenu menu = null;
+    private static boolean isUnity;
+
+    static {
+        String de = AccessController.doPrivileged(
+                        (PrivilegedAction<String>) ()
+                                -> System.getenv("XDG_CURRENT_DESKTOP"));
+        isUnity = de != null && de.equals("Unity");
+    }
 
     private static void initWithLock() {
         XToolkit.awtLock();
@@ -68,6 +77,9 @@
     }
 
     static boolean isTaskbarSupported() {
+        if (!isUnity) {
+            return false;
+        }
         initWithLock();
         return nativeLibraryLoaded;
     }
@@ -107,6 +119,8 @@
                 val = Long.parseLong(badge);
                 visible = true;
             } catch (NumberFormatException e) {
+                throw new UnsupportedOperationException("The " + Feature.ICON_BADGE_TEXT
+                    + " feature is not supported on the current platform!");
             }
         }
         setBadge(val, visible);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWM.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWM.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, 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
@@ -104,7 +104,8 @@
         COMPIZ_WM = 12,
         LG3D_WM = 13,
         CWM_WM = 14,
-        MUTTER_WM = 15;
+        MUTTER_WM = 15,
+        UNITY_COMPIZ_WM = 16;
     public String toString() {
         switch  (WMID) {
           case NO_WM:
@@ -129,6 +130,8 @@
               return "Metacity";
           case COMPIZ_WM:
               return "Compiz";
+            case UNITY_COMPIZ_WM:
+              return "Unity Compiz";
           case LG3D_WM:
               return "LookingGlass";
           case CWM_WM:
@@ -572,6 +575,10 @@
         return isNetWMName("compiz");
     }
 
+    static boolean isUnityCompiz() {
+        return isNetWMName("Compiz");
+    }
+
     static boolean isLookingGlass() {
         return isNetWMName("LG3D");
     }
@@ -790,6 +797,8 @@
                 awt_wmgr = CWM_WM;
             } else if (doIsIceWM && isIceWM()) {
                 awt_wmgr = XWM.ICE_WM;
+            } else if (isUnityCompiz()) {
+                awt_wmgr = XWM.UNITY_COMPIZ_WM;
             }
             /*
              * We don't check for legacy WM when we already know that WM
@@ -1351,6 +1360,9 @@
               case LG3D_WM:
                   res = zeroInsets;
                   break;
+              case UNITY_COMPIZ_WM:
+                  res = new Insets(28, 1, 1, 1);
+                  break;
               case MOTIF_WM:
               case OPENLOOK_WM:
               default:
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Wed Jul 05 22:01:14 2017 +0200
@@ -777,6 +777,7 @@
                 case XWM.METACITY_WM:
                 case XWM.MUTTER_WM:
                 case XWM.SAWFISH_WM:
+                case XWM.UNITY_COMPIZ_WM:
                 {
                     Point xlocation = queryXLocation();
                     if (log.isLoggable(PlatformLogger.Level.FINE)) {
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -281,7 +281,7 @@
                                                  int width, int height,
                                                  int displayMode);
     private static native void resetNativeData(int screen);
-    private static native int getNativeScaleFactor(int screen);
+    private static native double getNativeScaleFactor(int screen);
 
     /**
      * Returns true only if:
@@ -516,6 +516,11 @@
         return scale;
     }
 
+    public int getNativeScale() {
+        isXrandrExtensionSupported();
+        return (int)Math.round(getNativeScaleFactor(screen));
+    }
+
     private int initScaleFactor() {
 
         if (SunGraphicsEnvironment.isUIScaleEnabled()) {
@@ -525,8 +530,7 @@
             if (debugScale >= 1) {
                 return (int) debugScale;
             }
-
-            int nativeScale = getNativeScaleFactor(screen);
+            int nativeScale = getNativeScale();
             return nativeScale >= 1 ? nativeScale : 1;
         }
 
--- a/jdk/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c	Wed Jul 05 22:01:14 2017 +0200
@@ -22,23 +22,171 @@
 */
 
 #include "systemScale.h"
+#include "jni.h"
+#include "jni_util.h"
+#include "jvm_md.h"
+#include <dlfcn.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
-int getNativeScaleFactor() {
+typedef void* g_settings_schema_source_get_default();
+typedef void* g_settings_schema_source_ref(void *);
+typedef void g_settings_schema_source_unref(void *);
+typedef void* g_settings_schema_source_lookup(void *, char *, int);
+typedef int g_settings_schema_has_key(void *, char *);
+typedef void* g_settings_new_full(void *, void *, char *);
+typedef void* g_settings_get_value(void *, char *);
+typedef int g_variant_is_of_type(void *, char *);
+typedef unsigned long g_variant_n_children(void *);
+typedef void* g_variant_get_child_value(void *, unsigned long);
+typedef void  g_variant_unref(void *);
+typedef char*  g_variant_get_string(void *, unsigned long *);
+typedef int  g_variant_get_int32(void *);
+typedef double  g_variant_get_double(void *);
+
+static g_settings_schema_has_key* fp_g_settings_schema_has_key;
+static g_settings_new_full* fp_g_settings_new_full;
+static g_settings_get_value* fp_g_settings_get_value;
+static g_variant_is_of_type* fp_g_variant_is_of_type;
+static g_variant_n_children* fp_g_variant_n_children;
+static g_variant_get_child_value* fp_g_variant_get_child_value;
+static g_variant_get_string* fp_g_variant_get_string;
+static g_variant_get_int32* fp_g_variant_get_int32;
+static g_variant_get_double* fp_g_variant_get_double;
+static g_variant_unref* fp_g_variant_unref;
 
-    static int scale = -2.0;
+static void* get_schema_value(char *name, char *key) {
+    static void *lib_handle;
+    static int initialized = 0;
+    static void * default_schema;
+    static g_settings_schema_source_lookup* schema_lookup;
+    void *schema = NULL, *fp = NULL;
+    if (!initialized) {
+        initialized = 1;
+        lib_handle = dlopen(JNI_LIB_NAME("gio-2.0"), RTLD_GLOBAL | RTLD_LAZY);
+        if (!lib_handle) {
+            CHECK_NULL_RETURN(lib_handle =
+                          dlopen(VERSIONED_JNI_LIB_NAME("gio-2.0", "0"),
+                                                RTLD_GLOBAL | RTLD_LAZY), NULL);
+        }
+        CHECK_NULL_RETURN(fp_g_settings_schema_has_key =
+                          (g_settings_schema_has_key*)
+                          dlsym(lib_handle, "g_settings_schema_has_key"), NULL);
+        CHECK_NULL_RETURN(fp_g_settings_new_full =
+                          (g_settings_new_full*)
+                          dlsym(lib_handle, "g_settings_new_full"), NULL);
+        CHECK_NULL_RETURN(fp_g_settings_get_value =
+                          (g_settings_get_value*)
+                          dlsym(lib_handle, "g_settings_get_value"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_is_of_type =
+                          (g_variant_is_of_type*)
+                          dlsym(lib_handle, "g_variant_is_of_type"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_n_children =
+                          (g_variant_n_children*)
+                          dlsym(lib_handle, "g_variant_n_children"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_get_child_value =
+                          (g_variant_get_child_value*)
+                          dlsym(lib_handle, "g_variant_get_child_value"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_get_string =
+                          (g_variant_get_string*)
+                          dlsym(lib_handle, "g_variant_get_string"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_get_int32 =
+                          (g_variant_get_int32*)
+                          dlsym(lib_handle, "g_variant_get_int32"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_get_double =
+                          (g_variant_get_double*)
+                          dlsym(lib_handle, "g_variant_get_double"), NULL);
+        CHECK_NULL_RETURN(fp_g_variant_unref =
+                          (g_variant_unref*)
+                          dlsym(lib_handle, "g_variant_unref"), NULL);
 
-    if (scale == -2) {
-        scale = getScale("J2D_UISCALE");
+        fp = dlsym(lib_handle, "g_settings_schema_source_get_default");
+        if (fp) {
+            default_schema = ((g_settings_schema_source_get_default*)fp)();
+        }
+        if (default_schema) {
+            fp = dlsym(lib_handle, "g_settings_schema_source_ref");
+            if (fp) {
+                ((g_settings_schema_source_ref*)fp)(default_schema);
+            }
+        }
+        schema_lookup = (g_settings_schema_source_lookup*)
+                           dlsym(lib_handle, "g_settings_schema_source_lookup");
     }
 
-    if (scale >= 1) {
-        return (int) scale;
+    if (!default_schema || !schema_lookup) {
+        return NULL;
     }
-    return getScale("GDK_SCALE");
+
+    schema = schema_lookup(default_schema, name, 1);
+    if (schema) {
+        if (fp_g_settings_schema_has_key(schema, key)) {
+            void *settings = fp_g_settings_new_full(schema, NULL, NULL);
+            if (settings) {
+                return fp_g_settings_get_value(settings, key);
+            }
+        }
+    }
+    return NULL;
 }
 
-int getScale(const char *name) {
+
+static double getDesktopScale(char *output_name) {
+    double result = -1;
+    if(output_name) {
+        void *value = get_schema_value("com.ubuntu.user-interface",
+                                                                "scale-factor");
+        if (value) {
+            if(fp_g_variant_is_of_type(value, "a{si}")) {
+                int num = fp_g_variant_n_children(value);
+                int i = 0;
+                while (i < num) {
+                    void *entry = fp_g_variant_get_child_value(value, i++);
+                    if (entry) {
+                        void *screen = fp_g_variant_get_child_value(entry, 0);
+                        void *scale = fp_g_variant_get_child_value(entry, 1);
+                        if (screen && scale) {
+                            char *name = fp_g_variant_get_string(screen, NULL);
+                            if (name && strcmp(name, output_name)) {
+                                result = fp_g_variant_get_int32(scale) / 8.;
+                            }
+                            fp_g_variant_unref(screen);
+                            fp_g_variant_unref(scale);
+                        }
+                        fp_g_variant_unref(entry);
+                    }
+                    if (result > 0) {
+                        break;
+                    }
+                }
+            }
+            fp_g_variant_unref(value);
+        }
+        if (result > 0) {
+            value = get_schema_value("com.canonical.Unity.Interface",
+                                                           "text-scale-factor");
+            if (value && fp_g_variant_is_of_type(value, "d")) {
+                result *= fp_g_variant_get_double(value);
+                fp_g_variant_unref(value);
+            }
+        }
+    }
+
+    if (result <= 0) {
+        void *value = get_schema_value("org.gnome.desktop.interface",
+                                                         "text-scaling-factor");
+        if (value && fp_g_variant_is_of_type(value, "d")) {
+            result = fp_g_variant_get_double(value);
+            fp_g_variant_unref(value);
+        }
+    }
+
+    return result;
+
+}
+
+static int getScale(const char *name) {
     char *uiScale = getenv(name);
     if (uiScale != NULL) {
         double scale = strtod(uiScale, NULL);
@@ -50,3 +198,26 @@
     return -1;
 }
 
+double getNativeScaleFactor(char *output_name) {
+    static int scale = -2.0;
+    double native_scale = 0;
+    int gdk_scale = 0;
+
+    if (scale == -2) {
+        scale = getScale("J2D_UISCALE");
+    }
+
+    if (scale > 0) {
+        return scale;
+    }
+
+    native_scale = getDesktopScale(output_name);
+
+    if (native_scale <= 0) {
+        native_scale = 1;
+    }
+
+    gdk_scale = getScale("GDK_SCALE");
+
+    return gdk_scale > 0 ? native_scale * gdk_scale : native_scale;
+}
--- a/jdk/src/java.desktop/unix/native/common/awt/systemscale/systemScale.h	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/common/awt/systemscale/systemScale.h	Wed Jul 05 22:01:14 2017 +0200
@@ -26,8 +26,7 @@
 #include <signal.h>
 #include <stdlib.h>
 
-int getNativeScaleFactor();
-int getScale(const char *uiScale);
+double getNativeScaleFactor();
 
 #endif
 
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Jul 05 22:01:14 2017 +0200
@@ -2141,15 +2141,50 @@
  * End DisplayMode/FullScreen support
  */
 
+static char *get_output_screen_name(JNIEnv *env, int screen) {
+    if (!awt_XRRGetScreenResources || !awt_XRRGetOutputInfo) {
+        return NULL;
+    }
+    char *name = NULL;
+    AWT_LOCK();
+    int scr = 0, out = 0;
+    if (usingXinerama && XScreenCount(awt_display) > 0) {
+        out = screen;
+    } else {
+        scr = screen;
+    }
+
+    XRRScreenResources *res = awt_XRRGetScreenResources(awt_display,
+                                                  RootWindow(awt_display, scr));
+    if (res) {
+       if (res->noutput > out) {
+            XRROutputInfo *output_info = awt_XRRGetOutputInfo(awt_display,
+                                                        res, res->outputs[out]);
+            if (output_info) {
+                if (output_info->name) {
+                    name = strdup(output_info->name);
+                }
+                awt_XRRFreeOutputInfo(output_info);
+            }
+        }
+        awt_XRRFreeScreenResources(res);
+    }
+    AWT_UNLOCK();
+    return name;
+}
 
 /*
  * Class:     sun_awt_X11GraphicsDevice
  * Method:    getNativeScaleFactor
- * Signature: (I)I
+ * Signature: (I)D
  */
-JNIEXPORT jint JNICALL
+JNIEXPORT jdouble JNICALL
 Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor
     (JNIEnv *env, jobject this, jint screen) {
-
-    return getNativeScaleFactor();
+    char *name = get_output_screen_name(env, screen);
+    double scale = getNativeScaleFactor(name);
+    if (name) {
+        free(name);
+    }
+    return scale;
 }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Wed Jul 05 22:01:14 2017 +0200
@@ -27,6 +27,9 @@
     #error This file should not be included in headless library
 #endif
 
+#include "jvm_md.h"
+#include <dlfcn.h>
+
 #include "awt_p.h"
 #include "awt_GraphicsEnv.h"
 #define XK_MISCELLANY
@@ -50,11 +53,46 @@
 #include <sys/socket.h>
 #endif
 
+static Bool   (*compositeQueryExtension)   (Display*, int*, int*);
+static Status (*compositeQueryVersion)     (Display*, int*, int*);
+static Window (*compositeGetOverlayWindow) (Display *, Window);
+
 extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
 
 static jint * masks;
 static jint num_buttons;
 
+static void *xCompositeHandle;
+
+static const char* XCOMPOSITE = JNI_LIB_NAME("Xcomposite");
+static const char* XCOMPOSITE_VERSIONED = VERSIONED_JNI_LIB_NAME("Xcomposite", "1");
+
+static Bool checkXCompositeFunctions(void) {
+    return (compositeQueryExtension   != NULL   &&
+            compositeQueryVersion     != NULL   &&
+            compositeGetOverlayWindow != NULL);
+}
+
+static void initXCompositeFunctions(void) {
+
+    if (xCompositeHandle == NULL) {
+        xCompositeHandle = dlopen(XCOMPOSITE, RTLD_LAZY | RTLD_GLOBAL);
+        if (xCompositeHandle == NULL) {
+            xCompositeHandle = dlopen(XCOMPOSITE_VERSIONED, RTLD_LAZY | RTLD_GLOBAL);
+        }
+    }
+    //*(void **)(&asyncGetCallTraceFunction)
+    if (xCompositeHandle != NULL) {
+        *(void **)(&compositeQueryExtension) = dlsym(xCompositeHandle, "XCompositeQueryExtension");
+        *(void **)(&compositeQueryVersion) = dlsym(xCompositeHandle, "XCompositeQueryVersion");
+        *(void **)(&compositeGetOverlayWindow) = dlsym(xCompositeHandle, "XCompositeGetOverlayWindow");
+    }
+
+    if (xCompositeHandle && !checkXCompositeFunctions()) {
+        dlclose(xCompositeHandle);
+    }
+}
+
 static int32_t isXTestAvailable() {
     int32_t major_opcode, first_event, first_error;
     int32_t  event_basep, error_basep, majorp, minorp;
@@ -89,6 +127,35 @@
     return isXTestAvailable;
 }
 
+static Bool hasXCompositeOverlayExtension(Display *display) {
+
+    int xoverlay = False;
+    int eventBase, errorBase;
+    if (checkXCompositeFunctions() &&
+        compositeQueryExtension(display, &eventBase, &errorBase))
+    {
+        int major = 0;
+        int minor = 0;
+
+        compositeQueryVersion(display, &major, &minor);
+        if (major > 0 || minor >= 3) {
+            xoverlay = True;
+        }
+    }
+
+    return xoverlay;
+}
+
+static jboolean isXCompositeDisplay(Display *display, int screenNumber) {
+
+    char NET_WM_CM_Sn[25];
+    snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d\0", screenNumber);
+
+    Atom managerSelection = XInternAtom(display, NET_WM_CM_Sn, 0);
+    Window owner = XGetSelectionOwner(display, managerSelection);
+
+    return owner != 0;
+}
 
 static XImage *getWindowImage(Display * display, Window window,
                               int32_t x, int32_t y,
@@ -211,7 +278,7 @@
                              jint jheight,
                              jint scale,
                              jintArray pixelArray,
-                             jboolean isGtkSupported) {
+                             jboolean useGtk) {
     XImage *image;
     jint *ary;               /* Array of jints for sending pixel values back
                               * to parent process.
@@ -238,6 +305,14 @@
 
     rootWindow = XRootWindow(awt_display, adata->awt_visInfo.screen);
 
+    if (!useGtk) {
+        if (hasXCompositeOverlayExtension(awt_display) &&
+            isXCompositeDisplay(awt_display, adata->awt_visInfo.screen))
+        {
+            rootWindow = compositeGetOverlayWindow(awt_display, rootWindow);
+        }
+    }
+
     if (!XGetWindowAttributes(awt_display, rootWindow, &attr)
             || sx + swidth <= attr.x
             || attr.x + attr.width <= sx
@@ -262,7 +337,7 @@
 
     int index;
 
-    if (isGtkSupported) {
+    if (useGtk) {
         gtk->gdk_threads_enter();
         gtk_failed = gtk->get_drawable_data(env, pixelArray, x, y, width,
                                             height, jwidth, dx, dy, scale);
@@ -454,3 +529,8 @@
 
     AWT_UNLOCK();
 }
+
+JNIEXPORT void JNICALL
+Java_sun_awt_X11_XRobotPeer_loadNativeLibraries (JNIEnv *env, jclass cls) {
+    initXCompositeFunctions();
+}
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Wed Jul 05 22:01:14 2017 +0200
@@ -1586,13 +1586,17 @@
     fp_gtk_style_context_save (context);
 
     GtkStateFlags flags = get_gtk_flags(state_type);
+    if (expander_style == GTK_EXPANDER_EXPANDED) {
+        flags |= GTK_STATE_FLAG_ACTIVE;
+    }
+
     fp_gtk_style_context_set_state(context, flags);
 
     if (detail != 0) {
         transform_detail_string(detail, context);
     }
 
-    fp_gtk_render_expander (context, cr, x, y, width, height);
+    fp_gtk_render_expander (context, cr, x + 2, y + 2, width - 4, height - 4);
 
     fp_gtk_style_context_restore (context);
 }
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Taskbar.h	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Taskbar.h	Wed Jul 05 22:01:14 2017 +0200
@@ -11,7 +11,7 @@
  * 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 thats
+ * 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
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Jul 05 22:01:14 2017 +0200
@@ -55,6 +55,7 @@
 
 import java.awt.dnd.DropTarget;
 import java.awt.dnd.peer.DropTargetPeer;
+import java.awt.geom.AffineTransform;
 import sun.awt.AWTAccessor;
 
 import sun.util.logging.PlatformLogger;
@@ -1128,6 +1129,12 @@
         }
 
         if (shape != null) {
+            AffineTransform tx = winGraphicsConfig.getDefaultTransform();
+            double scaleX = tx.getScaleX();
+            double scaleY = tx.getScaleY();
+            if (scaleX != 1 || scaleY != 1) {
+                shape = shape.getScaledRegion(scaleX, scaleY);
+            }
             setRectangularShape(shape.getLoX(), shape.getLoY(), shape.getHiX(), shape.getHiY(),
                     (shape.isRectangular() ? null : shape));
         } else {
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.cpp	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.cpp	Wed Jul 05 22:01:14 2017 +0200
@@ -473,8 +473,14 @@
 
     POINT p;
     ::GetCursorPos(&p);
-    env->SetIntField(point, AwtCursor::pointXID, (jint)p.x);
-    env->SetIntField(point, AwtCursor::pointYID, (jint)p.y);
+    HMONITOR monitor = MonitorFromPoint(p, MONITOR_DEFAULTTOPRIMARY);
+    int screen = AwtWin32GraphicsDevice::GetScreenFromHMONITOR(monitor);
+    Devices::InstanceAccess devices;
+    AwtWin32GraphicsDevice *device = devices->GetDevice(screen);
+    int x = (device == NULL) ? p.x : device->ScaleDownX(p.x);
+    int y = (device == NULL) ? p.y : device->ScaleDownY(p.y);
+    env->SetIntField(point, AwtCursor::pointXID, x);
+    env->SetIntField(point, AwtCursor::pointYID, y);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -32,6 +32,20 @@
 
 #define BSIZE (max(512, MAX_PATH+1))
 
+/* Typically all local references held by a JNI function are automatically
+ * released by JVM when the function returns. However, there is a limit to the
+ * number of local references that can remain active. If the local references
+ * continue to grow, it could result in out of memory error. Henceforth, we
+ * invoke DeleteLocalRef on objects that are no longer needed for execution in
+ * the JNI function.
+ */
+#define DeleteLocalReference(env, jniRef) \
+    do { \
+        if (jniRef != NULL) { \
+            (*env)->DeleteLocalRef(env, jniRef); \
+            jniRef = NULL; \
+        } \
+    } while (0)
 
 JNIEXPORT jstring JNICALL Java_sun_awt_Win32FontManager_getFontPath(JNIEnv *env, jobject thiz, jboolean noType1)
 {
@@ -88,81 +102,9 @@
     jobject locale;
 } GdiFontMapInfo;
 
-/* IS_NT means NT or later OSes which support Unicode.
- * We have to painfully deal with the ASCII and non-ASCII case we
- * we really want to get the font names as unicode wherever possible.
- * UNICODE_OS is 0 to mean uninitialised, 1 to mean not a unicode OS,
- * 2 to mean a unicode OS.
- */
-
-#define UC_UNKNOWN 0
-#define UC_NO     1
-#define UC_YES    2
-static int UNICODE_OS = UC_UNKNOWN;
-static int GetOSVersion () {
-    OSVERSIONINFO vinfo;
-    vinfo.dwOSVersionInfoSize = sizeof(vinfo);
-    GetVersionEx(&vinfo);
-    if ((int)vinfo.dwMajorVersion > 4) {
-        UNICODE_OS = UC_YES;
-    } else if ((int)vinfo.dwMajorVersion < 4) {
-        UNICODE_OS = UC_NO;
-    } else {
-        if ((int)vinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
-            UNICODE_OS = UC_NO;
-        } else {
-            UNICODE_OS = UC_YES;
-        }
-    }
-    return UNICODE_OS;
-}
-
-#define IS_NT ((UNICODE_OS == UC_UNKNOWN) \
-   ? (GetOSVersion() == UC_YES) : (UNICODE_OS == UC_YES))
-
-/* NT is W2K & XP. WIN is Win9x */
+/* Registry entry for fonts */
 static const char FONTKEY_NT[] =
     "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
-static const char FONTKEY_WIN[] =
-    "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
-
-/* Callback for call to EnumFontFamiliesEx in the EnumFamilyNames function.
- * Expects to be called once for each face name in the family specified
- * in the call. We extract the full name for the font which is expected
- * to be in the "system encoding" and create canonical and lower case
- * Java strings for the name which are added to the maps. The lower case
- * name is used as key to the family name value in the font to family map,
- * the canonical name is one of the"list" of members of the family.
- */
-static int CALLBACK EnumFontFacesInFamilyProcA(
-  ENUMLOGFONTEXA *lpelfe,
-  NEWTEXTMETRICEX *lpntme,
-  int FontType,
-  LPARAM lParam )
-{
-    GdiFontMapInfo *fmi = (GdiFontMapInfo*)lParam;
-    JNIEnv *env = fmi->env;
-    jstring fullname, fullnameLC;
-
-    /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
-    if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
-        return 1;
-    }
-
-    /* printf("FULL=%s\n",lpelfe->elfFullName);fflush(stdout);  */
-
-    fullname = JNU_NewStringPlatform(env, lpelfe->elfFullName);
-    if (fullname == NULL) {
-        (*env)->ExceptionClear(env);
-        return 1;
-    }
-    fullnameLC = (*env)->CallObjectMethod(env, fullname,
-                                          fmi->toLowerCaseMID, fmi->locale);
-    (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
-    (*env)->CallObjectMethod(env, fmi->fontToFamilyMap,
-                             fmi->putMID, fullnameLC, fmi->family);
-    return 1;
-}
 
 typedef struct CheckFamilyInfo {
   wchar_t *family;
@@ -219,6 +161,14 @@
     return info.isDifferent;
 }
 
+/* Callback for call to EnumFontFamiliesEx in the EnumFamilyNames function.
+ * Expects to be called once for each face name in the family specified
+ * in the call. We extract the full name for the font which is expected
+ * to be in the "system encoding" and create canonical and lower case
+ * Java strings for the name which are added to the maps. The lower case
+ * name is used as key to the family name value in the font to family map,
+ * the canonical name is one of the"list" of members of the family.
+ */
 static int CALLBACK EnumFontFacesInFamilyProcW(
   ENUMLOGFONTEXW *lpelfe,
   NEWTEXTMETRICEX *lpntme,
@@ -229,6 +179,19 @@
     JNIEnv *env = fmi->env;
     jstring fullname, fullnameLC;
 
+    /* Exceptions indicate critical errors such that program cannot continue
+     * with further execution. Henceforth, the function returns immediately
+     * on pending exceptions. In these situations, the function also returns
+     * 0 indicating windows API to stop further enumeration and callbacks.
+     *
+     * The JNI functions do not clear the pending exceptions. This allows the
+     * caller (Java code) to check and handle exceptions in the best possible
+     * way.
+     */
+    if ((*env)->ExceptionCheck(env)) {
+        return 0;
+    }
+
     /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
     if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
         return 1;
@@ -250,11 +213,30 @@
         (*env)->ExceptionClear(env);
         return 1;
     }
+
+    (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
+    if ((*env)->ExceptionCheck(env)) {
+        /* Delete the created reference before return */
+        DeleteLocalReference(env, fullname);
+        return 0;
+    }
+
     fullnameLC = (*env)->CallObjectMethod(env, fullname,
                                           fmi->toLowerCaseMID, fmi->locale);
-    (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
+    /* Delete the created reference after its usage */
+    DeleteLocalReference(env, fullname);
+    if ((*env)->ExceptionCheck(env)) {
+        return 0;
+    }
+
     (*env)->CallObjectMethod(env, fmi->fontToFamilyMap,
                              fmi->putMID, fullnameLC, fmi->family);
+    /* Delete the created reference after its usage */
+    DeleteLocalReference(env, fullnameLC);
+    if ((*env)->ExceptionCheck(env)) {
+        return 0;
+    }
+
     return 1;
 }
 
@@ -270,62 +252,6 @@
  * Because we set fmi->list to be the newly created list the call back
  * can safely add to that list without a search.
  */
-static int CALLBACK EnumFamilyNamesA(
-  ENUMLOGFONTEXA *lpelfe,    /* pointer to logical-font data */
-  NEWTEXTMETRICEX *lpntme,   /* pointer to physical-font data */
-  int FontType,              /* type of font */
-  LPARAM lParam)             /* application-defined data */
-{
-    GdiFontMapInfo *fmi = (GdiFontMapInfo*)lParam;
-    JNIEnv *env = fmi->env;
-    jstring familyLC;
-    LOGFONTA lfa;
-
-    /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
-    if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
-        return 1;
-    }
-
-    /* Windows lists fonts which have a vmtx (vertical metrics) table twice.
-     * Once using their normal name, and again preceded by '@'. These appear
-     * in font lists in some windows apps, such as wordpad. We don't want
-     * these so we skip any font where the first character is '@'
-     */
-    if (lpelfe->elfLogFont.lfFaceName[0] == '@') {
-        return 1;
-    }
-    fmi->family = JNU_NewStringPlatform(env,lpelfe->elfLogFont.lfFaceName);
-    if (fmi->family == NULL) {
-        (*env)->ExceptionClear(env);
-        return 1;
-    }
-    familyLC = (*env)->CallObjectMethod(env, fmi->family,
-                                        fmi->toLowerCaseMID, fmi->locale);
-    /* check if already seen this family with a different charset */
-    if ((*env)->CallBooleanMethod(env,fmi->familyToFontListMap,
-                                  fmi->containsKeyMID, familyLC)) {
-        return 1;
-    }
-    fmi->list = (*env)->NewObject(env,
-                                  fmi->arrayListClass, fmi->arrayListCtr, 4);
-    if (fmi->list == NULL) {
-        (*env)->ExceptionClear(env);
-        return 1;
-    }
-    (*env)->CallObjectMethod(env, fmi->familyToFontListMap,
-                             fmi->putMID, familyLC, fmi->list);
-
-/*  printf("FAMILY=%s\n", lpelfe->elfLogFont.lfFaceName);fflush(stdout); */
-
-    memset(&lfa, 0, sizeof(lfa));
-    strcpy(lfa.lfFaceName, lpelfe->elfLogFont.lfFaceName);
-    lfa.lfCharSet = lpelfe->elfLogFont.lfCharSet;
-    EnumFontFamiliesExA(screenDC, &lfa,
-                        (FONTENUMPROCA)EnumFontFacesInFamilyProcA,
-                        lParam, 0L);
-    return 1;
-}
-
 static int CALLBACK EnumFamilyNamesW(
   ENUMLOGFONTEXW *lpelfe,    /* pointer to logical-font data */
   NEWTEXTMETRICEX *lpntme,  /* pointer to physical-font data */
@@ -338,6 +264,19 @@
     size_t slen;
     LOGFONTW lfw;
 
+    /* Exceptions indicate critical errors such that program cannot continue
+     * with further execution. Henceforth, the function returns immediately
+     * on pending exceptions. In these situations, the function also returns
+     * 0 indicating windows API to stop further enumeration and callbacks.
+     *
+     * The JNI functions do not clear the pending exceptions. This allows the
+     * caller (Java code) to check and handle exceptions in the best possible
+     * way.
+     */
+    if ((*env)->ExceptionCheck(env)) {
+        return 0;
+    }
+
     /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
     if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
         return 1;
@@ -362,21 +301,51 @@
         (*env)->ExceptionClear(env);
         return 1;
     }
+
     familyLC = (*env)->CallObjectMethod(env, fmi->family,
                                         fmi->toLowerCaseMID, fmi->locale);
+    /* Delete the created reference after its usage */
+    if ((*env)->ExceptionCheck(env)) {
+        DeleteLocalReference(env, fmi->family);
+        return 0;
+    }
+
     /* check if already seen this family with a different charset */
-    if ((*env)->CallBooleanMethod(env,fmi->familyToFontListMap,
-                                  fmi->containsKeyMID, familyLC)) {
+    jboolean mapHasKey = (*env)->CallBooleanMethod(env,
+                                                   fmi->familyToFontListMap,
+                                                   fmi->containsKeyMID,
+                                                   familyLC);
+    if ((*env)->ExceptionCheck(env)) {
+        /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
+        DeleteLocalReference(env, familyLC);
+        return 0;
+    } else if (mapHasKey) {
+        /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
+        DeleteLocalReference(env, familyLC);
         return 1;
     }
+
     fmi->list = (*env)->NewObject(env,
                                   fmi->arrayListClass, fmi->arrayListCtr, 4);
     if (fmi->list == NULL) {
-        (*env)->ExceptionClear(env);
-        return 1;
+        /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
+        DeleteLocalReference(env, familyLC);
+        return 0;
     }
+
     (*env)->CallObjectMethod(env, fmi->familyToFontListMap,
                              fmi->putMID, familyLC, fmi->list);
+    /* Delete the created reference after its usage */
+    DeleteLocalReference(env, familyLC);
+    if ((*env)->ExceptionCheck(env)) {
+        /* Delete the created reference before return */
+        DeleteLocalReference(env, fmi->family);
+        DeleteLocalReference(env, fmi->list);
+        return 0;
+    }
 
     memset(&lfw, 0, sizeof(lfw));
     wcscpy(lfw.lfFaceName, lpelfe->elfLogFont.lfFaceName);
@@ -384,10 +353,13 @@
     EnumFontFamiliesExW(screenDC, &lfw,
                         (FONTENUMPROCW)EnumFontFacesInFamilyProcW,
                         lParam, 0L);
+
+    /* Delete the created reference after its usage in the enum function */
+    DeleteLocalReference(env, fmi->family);
+    DeleteLocalReference(env, fmi->list);
     return 1;
 }
 
-
 /* It looks like TrueType fonts have " (TrueType)" tacked on the end of their
  * name, so we can try to use that to distinguish TT from other fonts.
  * However if a program "installed" a font in the registry the key may
@@ -410,33 +382,6 @@
  * Note: OpenType fonts seems to have " (TrueType)" suffix on Vista
  *   but " (OpenType)" on XP.
  */
-
-static BOOL RegistryToBaseTTNameA(LPSTR name) {
-    static const char TTSUFFIX[] = " (TrueType)";
-    static const char OTSUFFIX[] = " (OpenType)";
-    size_t TTSLEN = strlen(TTSUFFIX);
-    char *suffix;
-
-    size_t len = strlen(name);
-    if (len == 0) {
-        return FALSE;
-    }
-    if (name[len-1] != ')') {
-        return FALSE;
-    }
-    if (len <= TTSLEN) {
-        return FALSE;
-    }
-
-    /* suffix length is the same for truetype and opentype fonts */
-    suffix = name + len - TTSLEN;
-    if (strcmp(suffix, TTSUFFIX) == 0 || strcmp(suffix, OTSUFFIX) == 0) {
-        suffix[0] = '\0'; /* truncate name */
-        return TRUE;
-    }
-    return FALSE;
-}
-
 static BOOL RegistryToBaseTTNameW(LPWSTR name) {
     static const wchar_t TTSUFFIX[] = L" (TrueType)";
     static const wchar_t OTSUFFIX[] = L" (OpenType)";
@@ -462,71 +407,12 @@
     return FALSE;
 }
 
-static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap,
-                          LPCSTR name, LPCSTR data) {
-    LPSTR ptr1, ptr2;
-    jstring fontStr;
-    JNIEnv *env = fmi->env;
-    size_t dslen = strlen(data);
-    jstring fileStr = JNU_NewStringPlatform(env, data);
-    if (fileStr == NULL) {
-        (*env)->ExceptionClear(env);
-        return;
-    }
-
-    /* TTC or ttc means it may be a collection. Need to parse out
-     * multiple font face names separated by " & "
-     * By only doing this for fonts which look like collections based on
-     * file name we are adhering to MS recommendations for font file names
-     * so it seems that we can be sure that this identifies precisely
-     * the MS-supplied truetype collections.
-     * This avoids any potential issues if a TTF file happens to have
-     * a & in the font name (I can't find anything which prohibits this)
-     * and also means we only parse the key in cases we know to be
-     * worthwhile.
-     */
-    if ((data[dslen-1] == 'C' || data[dslen-1] == 'c') &&
-        (ptr1 = strstr(name, " & ")) != NULL) {
-        ptr1+=3;
-        while (ptr1 >= name) { /* marginally safer than while (true) */
-            while ((ptr2 = strstr(ptr1, " & ")) != NULL) {
-                    ptr1 = ptr2+3;
-            }
-            fontStr = JNU_NewStringPlatform(env, ptr1);
-            if (fontStr == NULL) {
-                (*env)->ExceptionClear(env);
-                return;
-            }
-            fontStr = (*env)->CallObjectMethod(env, fontStr,
-                                               fmi->toLowerCaseMID,
-                                               fmi->locale);
-            (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
-                                     fontStr, fileStr);
-            if (ptr1 == name) {
-                break;
-            } else {
-                *(ptr1-3) ='\0';
-                ptr1 = (LPSTR)name;
-            }
-        }
-    } else {
-        fontStr = JNU_NewStringPlatform(env, name);
-        if (fontStr == NULL) {
-            (*env)->ExceptionClear(env);
-            return;
-        }
-        fontStr = (*env)->CallObjectMethod(env, fontStr,
-                                           fmi->toLowerCaseMID, fmi->locale);
-        (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
-                                 fontStr, fileStr);
-    }
-}
-
 static void registerFontW(GdiFontMapInfo *fmi, jobject fontToFileMap,
                           LPWSTR name, LPWSTR data) {
 
     wchar_t *ptr1, *ptr2;
     jstring fontStr;
+    jstring fontStrLC;
     JNIEnv *env = fmi->env;
     size_t dslen = wcslen(data);
     jstring fileStr = (*env)->NewString(env, data, (jsize)dslen);
@@ -557,13 +443,32 @@
             fontStr = (*env)->NewString(env, ptr1, (jsize)wcslen(ptr1));
             if (fontStr == NULL) {
                 (*env)->ExceptionClear(env);
+                /* Delete the created reference before return */
+                DeleteLocalReference(env, fileStr);
                 return;
             }
-            fontStr = (*env)->CallObjectMethod(env, fontStr,
-                                               fmi->toLowerCaseMID,
-                                               fmi->locale);
+
+            fontStrLC = (*env)->CallObjectMethod(env, fontStr,
+                                                 fmi->toLowerCaseMID,
+                                                 fmi->locale);
+            /* Delete the created reference after its usage */
+            DeleteLocalReference(env, fontStr);
+            if ((*env)->ExceptionCheck(env)) {
+                /* Delete the created reference before return */
+                DeleteLocalReference(env, fileStr);
+                return;
+            }
+
             (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
-                                     fontStr, fileStr);
+                                     fontStrLC, fileStr);
+            /* Delete the reference after its usage */
+            DeleteLocalReference(env, fontStrLC);
+            if ((*env)->ExceptionCheck(env)) {
+                /* Delete the created reference before return */
+                DeleteLocalReference(env, fileStr);
+                return;
+            }
+
             if (ptr1 == name) {
                 break;
             } else {
@@ -575,13 +480,34 @@
         fontStr = (*env)->NewString(env, name, (jsize)wcslen(name));
         if (fontStr == NULL) {
             (*env)->ExceptionClear(env);
+            /* Delete the created reference before return */
+            DeleteLocalReference(env, fileStr);
+            return;
+        }
+
+        fontStrLC = (*env)->CallObjectMethod(env, fontStr,
+                                           fmi->toLowerCaseMID, fmi->locale);
+        /* Delete the created reference after its usage */
+        DeleteLocalReference(env, fontStr);
+        if ((*env)->ExceptionCheck(env)) {
+            /* Delete the created reference before return */
+            DeleteLocalReference(env, fileStr);
             return;
         }
-        fontStr = (*env)->CallObjectMethod(env, fontStr,
-                                           fmi->toLowerCaseMID, fmi->locale);
+
         (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
-                                 fontStr, fileStr);
+                                 fontStrLC, fileStr);
+        /* Delete the created reference after its usage */
+        DeleteLocalReference(env, fontStrLC);
+        if ((*env)->ExceptionCheck(env)) {
+            /* Delete the created reference before return */
+            DeleteLocalReference(env, fileStr);
+            return;
+        }
     }
+
+    /* Delete the created reference after its usage */
+    DeleteLocalReference(env, fileStr);
 }
 
 /* Obtain all the fontname -> filename mappings.
@@ -595,7 +521,6 @@
 {
 #define MAX_BUFFER (FILENAME_MAX+1)
     const wchar_t wname[MAX_BUFFER];
-    const char cname[MAX_BUFFER];
     const char data[MAX_BUFFER];
 
     DWORD type;
@@ -604,10 +529,10 @@
     DWORD dwNameSize;
     DWORD dwDataValueSize;
     DWORD nval;
-    LPCSTR fontKeyName;
     DWORD dwNumValues, dwMaxValueNameLen, dwMaxValueDataLen;
     DWORD numValues = 0;
-    jclass classID;
+    jclass classIDHashMap;
+    jclass classIDString;
     jmethodID putMID;
     GdiFontMapInfo fmi;
 
@@ -619,11 +544,11 @@
         familyToFontListMap == NULL) {
         return;
     }
-    classID = (*env)->FindClass(env, "java/util/HashMap");
-    if (classID == NULL) {
+    classIDHashMap = (*env)->FindClass(env, "java/util/HashMap");
+    if (classIDHashMap == NULL) {
         return;
     }
-    putMID = (*env)->GetMethodID(env, classID, "put",
+    putMID = (*env)->GetMethodID(env, classIDHashMap, "put",
                  "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
     if (putMID == NULL) {
         return;
@@ -634,7 +559,8 @@
     fmi.familyToFontListMap = familyToFontListMap;
     fmi.putMID = putMID;
     fmi.locale = locale;
-    fmi.containsKeyMID = (*env)->GetMethodID(env, classID, "containsKey",
+    fmi.containsKeyMID = (*env)->GetMethodID(env, classIDHashMap,
+                                             "containsKey",
                                              "(Ljava/lang/Object;)Z");
     if (fmi.containsKeyMID == NULL) {
         return;
@@ -654,12 +580,13 @@
     if (fmi.addMID == NULL) {
         return;
     }
-    classID = (*env)->FindClass(env, "java/lang/String");
-    if (classID == NULL) {
+
+    classIDString = (*env)->FindClass(env, "java/lang/String");
+    if (classIDString == NULL) {
         return;
     }
     fmi.toLowerCaseMID =
-        (*env)->GetMethodID(env, classID, "toLowerCase",
+        (*env)->GetMethodID(env, classIDString, "toLowerCase",
                             "(Ljava/util/Locale;)Ljava/lang/String;");
     if (fmi.toLowerCaseMID == NULL) {
         return;
@@ -669,44 +596,29 @@
     if (screenDC == NULL) {
         return;
     }
+
     /* Enumerate fonts via GDI to build maps of fonts and families */
-    if (IS_NT) {
-        LOGFONTW lfw;
-        memset(&lfw, 0, sizeof(lfw));
-        lfw.lfCharSet = DEFAULT_CHARSET;  /* all charsets */
-        wcscpy(lfw.lfFaceName, L"");      /* one face per family (CHECK) */
-        EnumFontFamiliesExW(screenDC, &lfw,
-                            (FONTENUMPROCW)EnumFamilyNamesW,
-                            (LPARAM)(&fmi), 0L);
-    } else {
-        LOGFONT lfa;
-        memset(&lfa, 0, sizeof(lfa));
-        lfa.lfCharSet = DEFAULT_CHARSET; /* all charsets */
-        strcpy(lfa.lfFaceName, "");      /* one face per family */
-        ret = EnumFontFamiliesExA(screenDC, &lfa,
-                            (FONTENUMPROCA)EnumFamilyNamesA,
-                            (LPARAM)(&fmi), 0L);
-    }
+    LOGFONTW lfw;
+    memset(&lfw, 0, sizeof(lfw));
+    lfw.lfCharSet = DEFAULT_CHARSET;  /* all charsets */
+    wcscpy(lfw.lfFaceName, L"");      /* one face per family (CHECK) */
+    EnumFontFamiliesExW(screenDC, &lfw,
+                        (FONTENUMPROCW)EnumFamilyNamesW,
+                        (LPARAM)(&fmi), 0L);
 
     /* Use the windows registry to map font names to files */
-    fontKeyName = (IS_NT) ? FONTKEY_NT : FONTKEY_WIN;
     ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                       fontKeyName, 0L, KEY_READ, &hkeyFonts);
+                       FONTKEY_NT, 0L, KEY_READ, &hkeyFonts);
     if (ret != ERROR_SUCCESS) {
         ReleaseDC(NULL, screenDC);
         screenDC = NULL;
         return;
     }
 
-    if (IS_NT) {
-        ret = RegQueryInfoKeyW(hkeyFonts, NULL, NULL, NULL, NULL, NULL, NULL,
-                               &dwNumValues, &dwMaxValueNameLen,
-                               &dwMaxValueDataLen, NULL, NULL);
-    } else {
-        ret = RegQueryInfoKeyA(hkeyFonts, NULL, NULL, NULL, NULL, NULL, NULL,
-                               &dwNumValues, &dwMaxValueNameLen,
-                               &dwMaxValueDataLen, NULL, NULL);
-    }
+    ret = RegQueryInfoKeyW(hkeyFonts, NULL, NULL, NULL, NULL, NULL, NULL,
+                           &dwNumValues, &dwMaxValueNameLen,
+                           &dwMaxValueDataLen, NULL, NULL);
+
     if (ret != ERROR_SUCCESS ||
         dwMaxValueNameLen >= MAX_BUFFER ||
         dwMaxValueDataLen >= MAX_BUFFER) {
@@ -718,39 +630,30 @@
     for (nval = 0; nval < dwNumValues; nval++ ) {
         dwNameSize = MAX_BUFFER;
         dwDataValueSize = MAX_BUFFER;
-        if (IS_NT) {
-            ret = RegEnumValueW(hkeyFonts, nval, (LPWSTR)wname, &dwNameSize,
-                                NULL, &type, (LPBYTE)data, &dwDataValueSize);
-        } else {
-            ret = RegEnumValueA(hkeyFonts, nval, (LPSTR)cname, &dwNameSize,
-                                NULL, &type, (LPBYTE)data, &dwDataValueSize);
-        }
+        ret = RegEnumValueW(hkeyFonts, nval, (LPWSTR)wname, &dwNameSize,
+                            NULL, &type, (LPBYTE)data, &dwDataValueSize);
+
         if (ret != ERROR_SUCCESS) {
             break;
         }
         if (type != REG_SZ) { /* REG_SZ means a null-terminated string */
             continue;
         }
-        if (IS_NT) {
-            if (!RegistryToBaseTTNameW((LPWSTR)wname) ) {
-                /* If the filename ends with ".ttf" or ".otf" also accept it.
-                 * Not expecting to need to do this for .ttc files.
-                 * Also note this code is not mirrored in the "A" (win9x) path.
-                 */
-                LPWSTR dot = wcsrchr((LPWSTR)data, L'.');
-                if (dot == NULL || ((wcsicmp(dot, L".ttf") != 0)
-                                      && (wcsicmp(dot, L".otf") != 0))) {
-                    continue;  /* not a TT font... */
-                }
+
+        if (!RegistryToBaseTTNameW((LPWSTR)wname) ) {
+            /* If the filename ends with ".ttf" or ".otf" also accept it.
+             * Not expecting to need to do this for .ttc files.
+             * Also note this code is not mirrored in the "A" (win9x) path.
+             */
+            LPWSTR dot = wcsrchr((LPWSTR)data, L'.');
+            if (dot == NULL || ((wcsicmp(dot, L".ttf") != 0)
+                                  && (wcsicmp(dot, L".otf") != 0))) {
+                continue;  /* not a TT font... */
             }
-            registerFontW(&fmi, fontToFileMap, (LPWSTR)wname, (LPWSTR)data);
-        } else {
-            if (!RegistryToBaseTTNameA((LPSTR)cname)) {
-                continue; /* not a TT font... */
-            }
-            registerFontA(&fmi, fontToFileMap, cname, (LPCSTR)data);
         }
+        registerFontW(&fmi, fontToFileMap, (LPWSTR)wname, (LPWSTR)data);
     }
+
     RegCloseKey(hkeyFonts);
     ReleaseDC(NULL, screenDC);
     screenDC = NULL;
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -39,6 +39,7 @@
 
 import com.sun.jndi.ldap.pool.PoolCleaner;
 import com.sun.jndi.ldap.pool.Pool;
+import jdk.internal.misc.InnocuousThread;
 
 /**
  * Contains utilities for managing connection pools of LdapClient.
@@ -163,7 +164,17 @@
 
         if (idleTimeout > 0) {
             // Create cleaner to expire idle connections
-            new PoolCleaner(idleTimeout, pools).start();
+            PrivilegedAction<Void> pa = new PrivilegedAction<Void>() {
+                public Void run() {
+                    Thread t = InnocuousThread.newSystemThread(
+                            "LDAP PoolCleaner",
+                            new PoolCleaner(idleTimeout, pools));
+                    assert t.getContextClassLoader() == null;
+                    t.setDaemon(true);
+                    t.start();
+                    return null;
+                }};
+            AccessController.doPrivileged(pa);
         }
 
         if (debug) {
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/pool/PoolCleaner.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/pool/PoolCleaner.java	Wed Jul 05 22:01:14 2017 +0200
@@ -30,7 +30,7 @@
  *
  * @author Rosanna Lee
  */
-final public class PoolCleaner extends Thread {
+final public class PoolCleaner implements Runnable {
     final private Pool[] pools;
     final private long period;
 
@@ -42,9 +42,9 @@
         super();
         this.period = period;
         this.pools = pools.clone();
-        setDaemon(true);
     }
 
+    @Override
     public void run() {
         long threshold;
         while (true) {
--- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/GC.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/GC.java	Wed Jul 05 22:01:14 2017 +0200
@@ -29,6 +29,7 @@
 import java.security.PrivilegedAction;
 import java.util.SortedSet;
 import java.util.TreeSet;
+import jdk.internal.misc.InnocuousThread;
 
 
 /**
@@ -90,8 +91,9 @@
             }});
     }
 
-    private static class Daemon extends Thread {
+    private static class Daemon implements Runnable {
 
+        @Override
         public void run() {
             for (;;) {
                 long l;
@@ -129,23 +131,17 @@
             }
         }
 
-        private Daemon(ThreadGroup tg) {
-            super(tg, null, "GC Daemon", 0L, false);
-        }
-
-        /* Create a new daemon thread in the root thread group */
+        /* Create a new daemon thread */
         public static void create() {
             PrivilegedAction<Void> pa = new PrivilegedAction<Void>() {
                 public Void run() {
-                    ThreadGroup tg = Thread.currentThread().getThreadGroup();
-                    for (ThreadGroup tgn = tg;
-                         tgn != null;
-                         tg = tgn, tgn = tg.getParent());
-                    Daemon d = new Daemon(tg);
-                    d.setDaemon(true);
-                    d.setPriority(Thread.MIN_PRIORITY + 1);
-                    d.start();
-                    GC.daemon = d;
+                    Thread t = InnocuousThread.newSystemThread("RMI GC Daemon",
+                                                               new Daemon());
+                    assert t.getContextClassLoader() == null;
+                    t.setDaemon(true);
+                    t.setPriority(Thread.MIN_PRIORITY + 1);
+                    t.start();
+                    GC.daemon = t;
                     return null;
                 }};
             AccessController.doPrivileged(pa);
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java	Wed Jul 05 22:01:14 2017 +0200
@@ -39,8 +39,6 @@
 import javax.xml.crypto.XMLCryptoContext;
 import javax.xml.crypto.dsig.spec.TransformParameterSpec;
 
-import sun.security.jca.*;
-import sun.security.jca.GetInstance.Instance;
 
 /**
  * A Service Provider Interface for transform and canonicalization algorithms.
@@ -165,18 +163,23 @@
         if (mechanismType.equals("DOM")) {
             dom = true;
         }
-        List<Service> services = GetInstance.getServices("TransformService", algorithm);
-        for (Iterator<Service> t = services.iterator(); t.hasNext(); ) {
-            Service s = t.next();
-            String value = s.getAttribute("MechanismType");
-            if ((value == null && dom) ||
-                (value != null && value.equals(mechanismType))) {
-                Instance instance = GetInstance.getInstance(s, null);
-                TransformService ts = (TransformService) instance.impl;
-                ts.algorithm = algorithm;
-                ts.mechanism = mechanismType;
-                ts.provider = instance.provider;
-                return ts;
+
+        Provider[] provs = Security.getProviders();
+        for (Provider p : provs) {
+            Service s = p.getService("TransformService", algorithm);
+            if (s != null) {
+                String value = s.getAttribute("MechanismType");
+                if ((value == null && dom) ||
+                    (value != null && value.equals(mechanismType))) {
+                    Object obj = s.newInstance(null);
+                    if (obj instanceof TransformService) {
+                        TransformService ts = (TransformService) obj;
+                        ts.algorithm = algorithm;
+                        ts.mechanism = mechanismType;
+                        ts.provider = p;
+                        return ts;
+                    }
+                }
             }
         }
         throw new NoSuchAlgorithmException
@@ -215,21 +218,24 @@
         if (mechanismType.equals("DOM")) {
             dom = true;
         }
-        Service s = GetInstance.getService
-            ("TransformService", algorithm, provider);
-        String value = s.getAttribute("MechanismType");
-        if ((value == null && dom) ||
-            (value != null && value.equals(mechanismType))) {
-            Instance instance = GetInstance.getInstance(s, null);
-            TransformService ts = (TransformService) instance.impl;
-            ts.algorithm = algorithm;
-            ts.mechanism = mechanismType;
-            ts.provider = instance.provider;
-            return ts;
+        Service s = provider.getService("TransformService", algorithm);
+        if (s != null) {
+            String value = s.getAttribute("MechanismType");
+            if ((value == null && dom) ||
+                (value != null && value.equals(mechanismType))) {
+                Object obj = s.newInstance(null);
+                if (obj instanceof TransformService) {
+                    TransformService ts = (TransformService) obj;
+                    ts.algorithm = algorithm;
+                    ts.mechanism = mechanismType;
+                    ts.provider = provider;
+                    return ts;
+                }
+            }
         }
         throw new NoSuchAlgorithmException
             (algorithm + " algorithm and " + mechanismType
-                 + " mechanism not available");
+                 + " mechanism not available from " + provider.getName());
     }
 
     /**
@@ -268,21 +274,25 @@
         if (mechanismType.equals("DOM")) {
             dom = true;
         }
-        Service s = GetInstance.getService
-            ("TransformService", algorithm, provider);
-        String value = s.getAttribute("MechanismType");
-        if ((value == null && dom) ||
-            (value != null && value.equals(mechanismType))) {
-            Instance instance = GetInstance.getInstance(s, null);
-            TransformService ts = (TransformService) instance.impl;
-            ts.algorithm = algorithm;
-            ts.mechanism = mechanismType;
-            ts.provider = instance.provider;
-            return ts;
+        Provider p = Security.getProvider(provider);
+        Service s = p.getService("TransformService", algorithm);
+        if (s != null) {
+            String value = s.getAttribute("MechanismType");
+            if ((value == null && dom) ||
+                (value != null && value.equals(mechanismType))) {
+                Object obj = s.newInstance(null);
+                if (obj instanceof TransformService) {
+                    TransformService ts = (TransformService) obj;
+                    ts.algorithm = algorithm;
+                    ts.mechanism = mechanismType;
+                    ts.provider = p;
+                    return ts;
+                }
+            }
         }
         throw new NoSuchAlgorithmException
             (algorithm + " algorithm and " + mechanismType
-                 + " mechanism not available");
+                 + " mechanism not available from " + provider);
     }
 
     private static class MechanismMapEntry implements Map.Entry<String,String> {
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java	Wed Jul 05 22:01:14 2017 +0200
@@ -43,11 +43,10 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.security.Provider;
+import java.security.Provider.Service;
 import java.security.Security;
 import java.util.List;
 
-import sun.security.jca.*;
-import sun.security.jca.GetInstance.Instance;
 
 /**
  * A factory for creating {@link XMLSignature} objects from scratch or
@@ -198,17 +197,26 @@
         if (mechanismType == null) {
             throw new NullPointerException("mechanismType cannot be null");
         }
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("XMLSignatureFactory", null, mechanismType);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
+        Provider[] provs = Security.getProviders();
+        for (Provider p : provs) {
+            Service s = p.getService("XMLSignatureFactory", mechanismType);
+            if (s != null) {
+                Object obj = null;
+                try {
+                    obj = s.newInstance(null);
+                } catch (NoSuchAlgorithmException nsae) {
+                    throw new NoSuchMechanismException(nsae);
+                }
+                if (obj instanceof XMLSignatureFactory) {
+                    XMLSignatureFactory factory = (XMLSignatureFactory) obj;
+                    factory.mechanismType = mechanismType;
+                    factory.provider = p;
+                    return factory;
+                }
+            }
         }
-        XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
+        throw new NoSuchMechanismException
+            ("Mechanism " + mechanismType + " not available");
     }
 
     /**
@@ -240,17 +248,25 @@
             throw new NullPointerException("provider cannot be null");
         }
 
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("XMLSignatureFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
+        Service s = provider.getService("XMLSignatureFactory", mechanismType);
+        if (s != null) {
+            Object obj = null;
+            try {
+                obj = s.newInstance(null);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new NoSuchMechanismException(nsae);
+            }
+
+            if (obj instanceof XMLSignatureFactory) {
+                XMLSignatureFactory factory = (XMLSignatureFactory) obj;
+                factory.mechanismType = mechanismType;
+                factory.provider = provider;
+                return factory;
+            }
         }
-        XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
+        throw new NoSuchMechanismException
+            ("Mechanism " + mechanismType + " not available from " +
+             provider.getName());
     }
 
     /**
@@ -288,17 +304,24 @@
             throw new NoSuchProviderException();
         }
 
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("XMLSignatureFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
+        Provider p = Security.getProvider(provider);
+        Service s = p.getService("XMLSignatureFactory", mechanismType);
+        if (s != null) {
+            Object obj = null;
+            try {
+                obj = s.newInstance(null);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new NoSuchMechanismException(nsae);
+            }
+            if (obj instanceof XMLSignatureFactory) {
+                XMLSignatureFactory factory = (XMLSignatureFactory) obj;
+                factory.mechanismType = mechanismType;
+                factory.provider = p;
+                return factory;
+            }
         }
-        XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
+        throw new NoSuchMechanismException
+            ("Mechanism " + mechanismType + " not available from " + provider);
     }
 
     /**
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java	Wed Jul 05 22:01:14 2017 +0200
@@ -32,6 +32,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.security.Provider;
+import java.security.Provider.Service;
 import java.security.PublicKey;
 import java.security.Security;
 import java.security.cert.X509CRL;
@@ -43,8 +44,6 @@
 import javax.xml.crypto.dom.DOMStructure;
 import javax.xml.crypto.dsig.*;
 
-import sun.security.jca.*;
-import sun.security.jca.GetInstance.Instance;
 
 /**
  * A factory for creating {@link KeyInfo} objects from scratch or for
@@ -153,17 +152,26 @@
         if (mechanismType == null) {
             throw new NullPointerException("mechanismType cannot be null");
         }
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("KeyInfoFactory", null, mechanismType);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
+        Provider[] provs = Security.getProviders();
+        for (Provider p : provs) {
+            Service s = p.getService("KeyInfoFactory", mechanismType);
+            if (s != null) {
+                Object obj = null;
+                try {
+                    obj = s.newInstance(null);
+                } catch (NoSuchAlgorithmException nsae) {
+                    throw new NoSuchMechanismException(nsae);
+                }
+                if (obj instanceof KeyInfoFactory) {
+                    KeyInfoFactory factory = (KeyInfoFactory) obj;
+                    factory.mechanismType = mechanismType;
+                    factory.provider = p;
+                    return factory;
+                }
+            }
         }
-        KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
+        throw new NoSuchMechanismException
+            ("Mechanism " + mechanismType + " not available");
     }
 
     /**
@@ -195,17 +203,24 @@
             throw new NullPointerException("provider cannot be null");
         }
 
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("KeyInfoFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
+        Service s = provider.getService("KeyInfoFactory", mechanismType);
+        if (s != null) {
+            Object obj = null;
+            try {
+                obj = s.newInstance(null);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new NoSuchMechanismException(nsae);
+            }
+
+            if (obj instanceof KeyInfoFactory) {
+                KeyInfoFactory factory = (KeyInfoFactory) obj;
+                factory.mechanismType = mechanismType;
+                factory.provider = provider;
+                return factory;
+            }
         }
-        KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
+        throw new NoSuchMechanismException
+            ("Mechanism " + mechanismType + " not available from " + provider.getName());
     }
 
     /**
@@ -242,18 +257,24 @@
         } else if (provider.length() == 0) {
             throw new NoSuchProviderException();
         }
-
-        Instance instance;
-        try {
-            instance = GetInstance.getInstance
-                ("KeyInfoFactory", null, mechanismType, provider);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new NoSuchMechanismException(nsae);
+        Provider p = Security.getProvider(provider);
+        Service s = p.getService("KeyInfoFactory", mechanismType);
+        if (s != null) {
+            Object obj = null;
+            try {
+                obj = s.newInstance(null);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new NoSuchMechanismException(nsae);
+            }
+            if (obj instanceof KeyInfoFactory) {
+                KeyInfoFactory factory = (KeyInfoFactory) obj;
+                factory.mechanismType = mechanismType;
+                factory.provider = p;
+                return factory;
+            }
         }
-        KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
-        factory.mechanismType = mechanismType;
-        factory.provider = instance.provider;
-        return factory;
+        throw new NoSuchMechanismException
+            ("Mechanism " + mechanismType + " not available from " + provider);
     }
 
     /**
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Wed Jul 05 22:01:14 2017 +0200
@@ -245,7 +245,7 @@
         {"no.timestamp.signing",
                 "-tsa\u307E\u305F\u306F-tsacert\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u3053\u306Ejar\u306B\u306F\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u52A0\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u306A\u3044\u3068\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306E\u6709\u52B9\u671F\u9650(%1$tY-%1$tm-%1$td)\u5F8C\u306B\u3001\u30E6\u30FC\u30B6\u30FC\u306F\u3053\u306Ejar\u3092\u691C\u8A3C\u3067\u304D\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"},
         {"no.timestamp.verifying",
-                "\u3053\u306Ejar\u306B\u306F\u3001\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u306A\u3044\u7F72\u540D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u306A\u3044\u3068\u3001\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306E\u6709\u52B9\u671F\u9650(%1$tY-%1$tm-%1$td)\u5F8C\u306B\u3001\u30E6\u30FC\u30B6\u30FC\u306F\u3053\u306Ejar\u3092\u691C\u8A3C\u3067\u304D\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"},
+                "\u3053\u306Ejar\u306B\u306F\u3001\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u306A\u3044\u7F72\u540D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u306A\u3044\u3068\u3001\u3044\u305A\u308C\u304B\u306E\u7F72\u540D\u8005\u8A3C\u660E\u66F8\u306E\u6709\u52B9\u671F\u9650\u5F8C\u306B(\u65E9\u3051\u308C\u3070%1$tY-%1$tm-%1$td)\u30E6\u30FC\u30B6\u30FC\u306F\u3053\u306Ejar\u3092\u691C\u8A3C\u3067\u304D\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"},
         {"Unknown.password.type.", "\u4E0D\u660E\u306A\u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30BF\u30A4\u30D7: "},
         {"Cannot.find.environment.variable.",
                 "\u74B0\u5883\u5909\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: "},
--- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Wed Jul 05 22:01:14 2017 +0200
@@ -245,7 +245,7 @@
         {"no.timestamp.signing",
                 "\u672A\u63D0\u4F9B -tsa \u6216 -tsacert, \u6B64 jar \u6CA1\u6709\u65F6\u95F4\u6233\u3002\u5982\u679C\u6CA1\u6709\u65F6\u95F4\u6233, \u5219\u5728\u7B7E\u540D\u8005\u8BC1\u4E66\u7684\u5230\u671F\u65E5\u671F (%1$tY-%1$tm-%1$td) \u4E4B\u540E, \u7528\u6237\u53EF\u80FD\u65E0\u6CD5\u9A8C\u8BC1\u6B64 jar\u3002"},
         {"no.timestamp.verifying",
-                "\u6B64 jar \u5305\u542B\u7684\u7B7E\u540D\u6CA1\u6709\u65F6\u95F4\u6233\u3002\u5982\u679C\u6CA1\u6709\u65F6\u95F4\u6233, \u5219\u5728\u7B7E\u540D\u8005\u8BC1\u4E66\u7684\u5230\u671F\u65E5\u671F (%1$tY-%1$tm-%1$td) \u4E4B\u540E, \u7528\u6237\u53EF\u80FD\u65E0\u6CD5\u9A8C\u8BC1\u6B64 jar\u3002"},
+                "\u6B64 jar \u5305\u542B\u7684\u7B7E\u540D\u6CA1\u6709\u65F6\u95F4\u6233\u3002\u5982\u679C\u6CA1\u6709\u65F6\u95F4\u6233, \u5219\u5728\u5176\u4E2D\u4EFB\u4E00\u7B7E\u540D\u8005\u8BC1\u4E66\u5230\u671F (\u6700\u65E9\u4E3A %1$tY-%1$tm-%1$td) \u4E4B\u540E, \u7528\u6237\u53EF\u80FD\u65E0\u6CD5\u9A8C\u8BC1\u6B64 jar\u3002"},
         {"Unknown.password.type.", "\u672A\u77E5\u53E3\u4EE4\u7C7B\u578B: "},
         {"Cannot.find.environment.variable.",
                 "\u627E\u4E0D\u5230\u73AF\u5883\u53D8\u91CF: "},
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=--module-version oder --hash-modules ohne module-info.class
 error.unexpected.module-info=Unerwarteter Moduldeskriptor {0}
 error.module.descriptor.not.found=Moduldeskriptor nicht gefunden
-error.versioned.info.without.root=module-info.class in Abschnitt mit Versionsangabe ohne module-info.class in Root ermittelt
-error.versioned.info.name.notequal=module-info.class in Abschnitt mit Versionsangabe enth\u00E4lt falschen Namen
-error.versioned.info.requires.public=module-info.class in Abschnitt mit Versionsangabe enth\u00E4lt zus\u00E4tzlichen "requires public"
-error.versioned.info.requires.added=module-info.class in Abschnitt mit Versionsangabe enth\u00E4lt zus\u00E4tzlichen "requires"
-error.versioned.info.requires.dropped=module-info.class in Abschnitt mit Versionsangabe enth\u00E4lt fehlenden "requires"
-error.versioned.info.exports.notequal=module-info.class in Abschnitt mit Versionsangabe enth\u00E4lt unterschiedliche "exports"
-error.versioned.info.provides.notequal=module-info.class in Abschnitt mit Versionsangabe enth\u00E4lt unterschiedliche "provides"
+error.versioned.info.without.root=module-info.class in einem versionierten Verzeichnis gefunden, in der Root ist module-info.class jedoch nicht vorhanden
+error.versioned.info.name.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt falschen Namen
+error.versioned.info.requires.public=module-info.class in einem versionierten Verzeichnis enth\u00E4lt zus\u00E4tzlichen "requires public"
+error.versioned.info.requires.added=module-info.class in einem versionierten Verzeichnis enth\u00E4lt zus\u00E4tzlichen "requires"
+error.versioned.info.requires.dropped=module-info.class in einem versionierten Verzeichnis enth\u00E4lt fehlenden "requires"
+error.versioned.info.exports.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt unterschiedliche "exports"
+error.versioned.info.provides.notequal=module-info.class in einem versionierten Verzeichnis enth\u00E4lt unterschiedliche "provides"
 error.invalid.versioned.module.attribute=Ung\u00FCltiges Moduldeskriptorattribut {0}
 error.missing.provider=Serviceprovider nicht gefunden: {0}
+error.release.value.notnumber=Release {0} nicht g\u00FCltig
+error.release.value.toosmall=Release {0} nicht g\u00FCltig, muss >= 9 sein
 out.added.manifest=Manifest wurde hinzugef\u00FCgt
 out.added.module-info=module-info hinzugef\u00FCgt: {0}
 out.update.manifest=Manifest wurde aktualisiert
@@ -64,12 +66,12 @@
 out.inflated=\ vergr\u00F6\u00DFert: {0}
 out.size=(ein = {0}) (aus = {1})
 
-usage.compat=Kompatibilit\u00E4tsschnittstelle:\nVerwendung: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien...\nOptionen:\n    -c  Neues Archiv erstellen\n    -t  Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n    -x  Benannte (oder alle) Dateien aus Archiv extrahieren\n    -u  Vorhandenes Archiv aktualisieren\n    -v  Ausgabe im Verbose-Modus aus Standardausgabe generieren\n    -f  Dateinamen f\u00FCr Archiv angeben\n    -m  Manifestinformationen aus angegebener Manifestdatei einschlie\u00DFen\n    -n  Pack200-Normalisierung nach Erstellung eines neuen Archivs ausf\u00FChren\n    -e  Anwendungseinstiegspunkt f\u00FCr Standalone-Anwendung angeben, \n        die in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelt ist\n    -0  Nur speichern; keine ZIP-Komprimierung verwenden\n    -P  Komponenten mit vorangestelltem "/" (absoluter Pfad) und ".." (\u00FCbergeordnetes Verzeichnis) aus Dateinamen beibehalten\n    -M  Keine Manifestdatei f\u00FCr die Eintr\u00E4ge erstellen\n    -i  Indexinformationen f\u00FCr die angegebenen JAR-Dateien erstellen\n    -C  Zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifestdatei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n       jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandene Manifestdatei "mymanifest", und archivieren Sie alle\n           Dateien im Verzeichnis foo/ in "classes.jar": \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=Kompatibilit\u00E4tsschnittstelle:\nVerwendung:  jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] Dateien] ...\nOptionen:\n    -c  Neues Archiv erstellen\n    -t  Inhaltsverzeichnis f\u00FCr Archiv anzeigen\n    -x  Benannte (oder alle) Dateien aus Archiv extrahieren\n    -u  Vorhandenes Archiv aktualisieren\n    -v  Ausgabe im Verbose-Modus aus Standardausgabe generieren\n    -f  Dateinamen f\u00FCr Archiv angeben\n    -m  Manifestinformationen aus angegebener Manifestdatei aufnehmen\n    -n  Pack200-Normalisierung nach Erstellung eines neuen Archivs ausf\u00FChren\n    -e  Anwendungseinstiegspunkt f\u00FCr in ausf\u00FChrbare JAR-Datei \n        geb\u00FCndelte Standalone-Anwendung angeben\n    -0  Nur speichern; keine ZIP-Komprimierung verwenden\n    -P  Komponenten mit vorangestelltem "/" (absoluter Pfad) und ".." (\u00FCbergeordnetes Verzeichnis) aus Dateinamen beibehalten\n        -M  Keine Manifestdatei f\u00FCr die Eintr\u00E4ge erstellen\n    -i  Indexinformationen f\u00FCr die angegebenen JAR-Dateien erstellen\n    -C  Zum angegebenen Verzeichnis wechseln und folgende Datei ber\u00FCcksichtigen\nDateien, die Verzeichnisse sind, werden rekursiv verarbeitet.\nDer Name der Manifestdatei, der Name der Archivdatei und der Name des Einstiegspunktes werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Zwei Klassendateien in ein Archiv "classes.jar" archivieren: \n       jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Mit der vorhandenen Manifestdatei "mymanifest" alle\n           Dateien im Verzeichnis foo/ in "classes.jar" archivieren: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: Sie m\u00FCssen eine -ctxui-Option angeben.
 main.usage.summary.try=Verwenden Sie "jar --help", um weitere Informationen anzuzeigen.
 
-main.help.preopt=Verwendung: jar [OPTION...] [-C dir] files ...\njar erstellt ein Archiv f\u00FCr Klassen und Ressourcen und kann individuelle\nKlassen oder Ressourcen aus einem Archiv bearbeiten oder wiederherstellen.\n\n Beispiele:\n # Ein Archiv namens classes.jar mit zwei Klassendateien erstellen:\n jar --create --file classes.jar Foo.class Bar.class\n # Ein Archiv mit einem vorhandenen Manifest mit allen Dateien in foo/ erstellen:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Ein modulares JAR-Archiv erstellen, dessen Moduldeskriptor sich in\n # classes/module-info.class befindet:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Ein vorhandenes nicht modulares JAR-Archiv in ein modulares JAR-Archiv aktualisieren:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=Verwendung: jar [OPTION...] [ [--release VERSION] [-C dir] Dateien] ...\njar erstellt ein Archiv f\u00FCr Klassen und Ressourcen und kann individuelle\nKlassen oder Ressourcen aus einem Archiv bearbeiten oder wiederherstellen.\n\n Beispiele:\n # Ein Archiv namens classes.jar mit zwei Klassendateien erstellen:\n jar --create --file classes.jar Foo.class Bar.class\n # Ein Archiv mit einem vorhandenen Manifest mit allen Dateien in foo/ erstellen:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Ein modulares JAR-Archiv erstellen, dessen Moduldeskriptor sich in\n # classes/module-info.class befindet:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Ein vorhandenes nicht modulares JAR-Archiv in ein modulares JAR-Archiv aktualisieren:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # Multi-Release-JAR-Datei erstellen, wobei einige Dateien in das Verzeichnis META-INF/versions/9 gespeichert werden:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ Hauptvorgangsmodus:\n
 main.help.opt.main.create=\  -c, --create               Archiv erstellen
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  Indexinformationen f\u00FCr die angegebenen JAR-\n                             Archive generieren
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              Benannte (oder alle) Dateien aus dem Archiv extrahieren
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  Moduldeskriptor drucken
 main.help.opt.any=\ In jedem Modus g\u00FCltige Vorgangsmodifikatoren:\n\n  -C DIR                     Zum angegebenen Verzeichnis wechseln und die folgende\n                             Datei aufnehmen
-main.help.opt.any.file=\  -f, --file=FILE            Der Archivdateiname
+main.help.opt.any.file=-f, --file=FILE            Der Name der Archivdatei\n      --release VERSION      Die folgenden Dateien werden in ein versioniertes Verzeichnis\n                             der JAR-Datei gespeichert (d.h. META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              Verbose-Ausgabe bei Standardausgabe generieren
 main.help.opt.create.update=\ Vorgangsmodifikatoren, die nur im Erstellungs- und Aktualisierungsmodus g\u00FCltig sind:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME Der Anwendungseinstiegspunkt f\u00FCr Standalone-\n                             Anwendungen, die in einem modularen oder ausf\u00FChrbaren\n                             JAR-Archiv geb\u00FCndelt sind
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=Uno de --module-version o -hash-modules sin module-info.class
 error.unexpected.module-info=Descriptor de m\u00F3dulo inesperado {0}
 error.module.descriptor.not.found=No se ha encontrado el descriptor de m\u00F3dulo
-error.versioned.info.without.root=Se ha encontrado module-info.class en la secci\u00F3n de versi\u00F3n sin module-info.class en la ra\u00EDz
-error.versioned.info.name.notequal=module-info.class en la secci\u00F3n de versi\u00F3n contiene un nombre incorrecto
-error.versioned.info.requires.public=module-info.class en la secci\u00F3n de versi\u00F3n contiene requisitos p\u00FAblicos adicionales
-error.versioned.info.requires.added=module-info.class en la secci\u00F3n de versi\u00F3n contiene requisitos adicionales
-error.versioned.info.requires.dropped=module-info.class en la secci\u00F3n de versi\u00F3n contiene requisitos que faltan
-error.versioned.info.exports.notequal=module-info.class en la secci\u00F3n de versi\u00F3n contiene exportaciones diferentes
-error.versioned.info.provides.notequal=module-info.class en la secci\u00F3n de versi\u00F3n contiene aportaciones diferentes
+error.versioned.info.without.root=Se ha encontrado module-info.class en un directorio con versi\u00F3n sin module-info.class en la ra\u00EDz
+error.versioned.info.name.notequal=module-info.class en un directorio con versi\u00F3n contiene un nombre incorrecto
+error.versioned.info.requires.public=module-info.class en un directorio con versi\u00F3n contiene requisitos p\u00FAblicos adicionales
+error.versioned.info.requires.added=module-info.class en un directorio con versi\u00F3n contiene requisitos adicionales
+error.versioned.info.requires.dropped=module-info.class en un directorio con versi\u00F3n contiene requisitos que faltan
+error.versioned.info.exports.notequal=module-info.class en un directorio con versi\u00F3n contiene exportaciones diferentes
+error.versioned.info.provides.notequal=module-info.class en un directorio con versi\u00F3n contiene aportaciones diferentes
 error.invalid.versioned.module.attribute=Atributo de descriptor de m\u00F3dulo no v\u00E1lido {0}
 error.missing.provider=No se ha encontrado el proveedor de servicios: {0}
+error.release.value.notnumber=versi\u00F3n {0} no v\u00E1lida
+error.release.value.toosmall=versi\u00F3n {0} no v\u00E1lida, debe ser >= 9
 out.added.manifest=manifiesto agregado
 out.added.module-info=module-info agregado: {0}
 out.update.manifest=manifiesto actualizado
@@ -64,12 +66,12 @@
 out.inflated=\ inflado: {0}
 out.size=(entrada = {0}) (salida = {1})
 
-usage.compat=Interfaz de compatibilidad:\nSintaxis: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\nOpciones:\n    -c  crear nuevo archivo\n    -t  crear la tabla de contenido del archivo\n    -x   extraer el archivo mencionado (o todos) del archivo\n    -u  actualizar archivo existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre de archivo de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archivo de manifiesto especificado\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archivo jar ejecutable\n    -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n    -P  conservar componentes iniciales '/' (ruta absoluta) y ".." (directorio principal) en los nombres de archivo\n    -M  no crear un archivo de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archivos jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=Interfaz de compatibilidad:\nSintaxis: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...Opciones: \n    -c  crear nuevo archivo\n    -t  mostrar la tabla de contenido del archivo\n    -x   extraer el archivo mencionado (o todos) del archivo\n    -u  actualizar archivo existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre del archivo de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archivo de manifiesto especificado n    -n  realizar la normalizaci\u00F3n Pack200 despu\u00E9s de crear un archivo nuevo\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archivo jar ejecutable\n    -0  solo almacenar; no utilizar compresi\u00F3n ZIP\n    -P  conservar componentes iniciales '/' (ruta absoluta) y ".." (directorio principal) en los nombres de archivo\n    -M  no crear un archivo de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archivos jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente. \nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\n especifican en el mismo orden que los indicadores 'm', 'f' y 'e'. \n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: Debe especificar una de las opciones -ctxui.
 main.usage.summary.try=Intente `jar --help' para obtener m\u00E1s informaci\u00F3n.
 
-main.help.preopt=Sintaxis: archivos jar [OPTION...] [-C dir] ...\njar crea un archivo para las clases y recursos y puede manipular o\nrestaurar clases individuales o recursos de un archivo.\n\n Ejemplos:\n # Crear un archivo denominado classes.jar con dos archivos de clase:\n jar --create --file classes.jar Foo.class Bar.class\n # Crear un archivo con un manifiesto existente, con todos los archivos en foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Crear un archivo jar modular, donde el descriptor de m\u00F3dulo est\u00E1 en\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # actualizar un jar no modular en un jar modular:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=Sintaxis: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar crea un archivo para las clases y recursos y puede manipular o\nrestaurar clases individuales o recursos de un archivo.\n\n Ejemplos:\n # Crear un archivo denominado classes.jar con dos archivos de clase:\n jar --create --file classes.jar Foo.class Bar.class\n # Crear un archivo con un manifiesto existente, con todos los archivos en foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Crear un archivo jar modular, donde el descriptor de m\u00F3dulo est\u00E1 en\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Actualizar un jar no modular en un jar modular:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # Crear un archivo jar de varias versiones y colocar algunos archivos en el directorio META-INF/versions/9:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ Modo de operaci\u00F3n principal:\n
 main.help.opt.main.create=\  -c, --create               Crear el archivo
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  Generar informaci\u00F3n de \u00EDndice para los archivos jar\n                             especificados
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              Extraer determinados (o todos) los archivos del archivo
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  Imprimir el descriptor de m\u00F3dulo
 main.help.opt.any=\ Modificadores de operaci\u00F3n v\u00E1lidos en cualquier modo:\n\n  -C DIR                     Cambiar al directorio especificado e incluir el\n                             siguiente archivo
-main.help.opt.any.file=\  -f, --file=FILE            Nombre del archivo
+main.help.opt.any.file=\  -f, --file=FILE            Nombre del archivo\n      --release VERSION      Se colocan todos los archivos siguientes en un directorio con versi\u00F3n\n                             del archivo jar (es decir, META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              Generar salida verbose en salida est\u00E1ndar
 main.help.opt.create.update=\ Modificadores de operaci\u00F3n v\u00E1lidos solo en el modo de creaci\u00F3n y de actualizaci\u00F3n:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME Punto de entrada de la aplicaci\u00F3n para aplicaciones\n                             aut\u00F3nomas agrupadas en un archivo jar modular o\n                             ejecutable
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=Une des options --module-version ou --hash-modules sans module-info.class
 error.unexpected.module-info=Descripteur de module {0} inattendu
 error.module.descriptor.not.found=Descripteur de module introuvable
-error.versioned.info.without.root=module-info.class a \u00E9t\u00E9 d\u00E9tect\u00E9 dans la section avec num\u00E9ro de version sans module-info.class dans la racine
-error.versioned.info.name.notequal=module-info.class dans la section avec num\u00E9ro de version contient un nom incorrect
-error.versioned.info.requires.public=module-info.class dans la section avec num\u00E9ro de version contient des exigences publiques suppl\u00E9mentaires
-error.versioned.info.requires.added=module-info.class dans la section avec num\u00E9ro de version contient des exigences suppl\u00E9mentaires
-error.versioned.info.requires.dropped=module-info.class dans la section avec num\u00E9ro de version contient des exigences manquantes
-error.versioned.info.exports.notequal=module-info.class dans la section avec num\u00E9ro de version contient des exports diff\u00E9rents
-error.versioned.info.provides.notequal=module-info.class dans la section avec num\u00E9ro de version contient des fournitures diff\u00E9rentes
+error.versioned.info.without.root=module-info.class a \u00E9t\u00E9 d\u00E9tect\u00E9 dans un r\u00E9pertoire avec num\u00E9ro de version sans module-info.class dans la racine
+error.versioned.info.name.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient un nom incorrect
+error.versioned.info.requires.public=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des exigences publiques suppl\u00E9mentaires
+error.versioned.info.requires.added=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des exigences suppl\u00E9mentaires
+error.versioned.info.requires.dropped=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des exigences manquantes
+error.versioned.info.exports.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des exports diff\u00E9rents
+error.versioned.info.provides.notequal=module-info.class dans un r\u00E9pertoire avec num\u00E9ro de version contient des fournitures diff\u00E9rentes
 error.invalid.versioned.module.attribute=Attribut de descripteur de module non valide {0}
 error.missing.provider=Fournisseur de services introuvable : {0}
+error.release.value.notnumber=version {0} non valide
+error.release.value.toosmall=version {0} non valide : elle doit \u00EAtre sup\u00E9rieure ou \u00E9gale \u00E0 9
 out.added.manifest=manifeste ajout\u00E9
 out.added.module-info=module-info ajout\u00E9 : {0}
 out.update.manifest=manifeste mis \u00E0 jour
@@ -69,7 +71,7 @@
 main.usage.summary=jar : vous devez sp\u00E9cifier l'une des options -ctxui.
 main.usage.summary.try=Pour plus d'informations, essayez 'jar --help'.
 
-main.help.preopt=Syntaxe : jar [OPTION...] [-C dir] files ...\njar cr\u00E9e une archive pour les classes et les ressources, et peut manipuler ou\nrestaurer les classes ou ressources individuelles \u00E0 partir d'une archive.\n\n Exemples :\n # Cr\u00E9ation d'une archive nomm\u00E9e classes.jar compos\u00E9e de deux fichiers de classe :\n jar --create --file classes.jar Foo.class Bar.class\n # Cr\u00E9ation d'une archive \u00E0 l'aide d'un manifeste existant, avec tous les fichiers dans foo/ :\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Cr\u00E9ation d'une archive JAR modulaire, o\u00F9 le descripteur de module est situ\u00E9 dans\n # classes/module-info.class :\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Mise \u00E0 jour d'un fichier JAR non modulaire existant vers un fichier JAR modulaire :\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=Syntaxe : jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar cr\u00E9e une archive pour les classes et les ressources, et peut manipuler ou\nrestaurer les classes ou ressources individuelles \u00E0 partir d'une archive.\n\n Exemples :\n # Cr\u00E9ation d'une archive nomm\u00E9e classes.jar compos\u00E9e de deux fichiers de classe :\n jar --create --file classes.jar Foo.class Bar.class\n # Cr\u00E9ation d'une archive \u00E0 l'aide d'un manifeste existant, avec tous les fichiers dans foo/ :\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Cr\u00E9ation d'une archive JAR modulaire, o\u00F9 le descripteur de module est situ\u00E9 dans\n # classes/module-info.class :\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Mise \u00E0 jour d'un fichier JAR non modulaire existant vers un fichier JAR modulaire :\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # Cr\u00E9e un fichier JAR multiversion en pla\u00E7ant certains fichiers dans le r\u00E9pertoire META-INF/versions/9 :\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ Mode d'exploitation principal :\n
 main.help.opt.main.create=\  -c, --create               Cr\u00E9e l'archive
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  G\u00E9n\u00E8re des informations d'index pour les archives JAR\n                             indiqu\u00E9es
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              Extrait des fichiers nomm\u00E9s (ou tous les fichiers) de l'archive
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  Imprime le descripteur de module
 main.help.opt.any=\ Modificateurs d'op\u00E9ration valides pour tous les modes :\n\n  -C DIR                     Passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le\n                             fichier suivant
-main.help.opt.any.file=\  -f, --file=FILE            Nom de fichier d'archive
+main.help.opt.any.file=\  -f, --file=FILE            Nom de fichier d'archive\n      --release VERSION      Place tous les fichiers suivants dans un r\u00E9pertoire avec num\u00E9ro de version\n                             du fichier JAR (par exemple, META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              G\u00E9n\u00E8re une sortie en mode verbose d'une sortie standard
 main.help.opt.create.update=\ Modificateurs d'op\u00E9ration valides uniquement en modes create et update :\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME Point d'entr\u00E9e d'une application en mode autonome\n                             int\u00E9gr\u00E9e \u00E0 une archive JAR modulaire\n                             ou ex\u00E9cutable
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=Una delle opzioni --module-version o --hash-modules non contiene module-info.class
 error.unexpected.module-info=Descrittore di modulo {0} imprevisto
 error.module.descriptor.not.found=Descrittore di modulo non trovato
-error.versioned.info.without.root=module-info.class trovato nella sezione con controllo delle versioni senza module-info.class nella radice
-error.versioned.info.name.notequal=module-info.class nella sezione con controllo delle versioni contiene un nome errato
-error.versioned.info.requires.public=module-info.class nella sezione con controllo delle versioni contiene requisiti aggiuntivi pubblici
-error.versioned.info.requires.added=module-info.class nella sezione con controllo delle versioni contiene requisiti aggiuntivi
-error.versioned.info.requires.dropped=Mancano requisiti in module-info.class nella sezione con controllo delle versioni
-error.versioned.info.exports.notequal=module-info.class nella sezione con controllo delle versioni contiene esportazioni differenti
-error.versioned.info.provides.notequal=module-info.class nella sezione con controllo delle versioni contiene elementi differenti
+error.versioned.info.without.root=module-info.class trovato in una directory con controllo delle versioni senza module-info.class nella radice
+error.versioned.info.name.notequal=module-info.class in una directory con controllo delle versioni contiene un nome errato
+error.versioned.info.requires.public=module-info.class in una directory con controllo delle versioni contiene requisiti aggiuntivi pubblici
+error.versioned.info.requires.added=module-info.class in una directory con controllo delle versioni contiene requisiti aggiuntivi
+error.versioned.info.requires.dropped=Requisiti mancanti in module-info.class in una directory con controllo delle versioni
+error.versioned.info.exports.notequal=module-info.class in una directory con controllo delle versioni contiene esportazioni differenti
+error.versioned.info.provides.notequal=module-info.class in una directory con controllo delle versioni contiene elementi differenti
 error.invalid.versioned.module.attribute=Attributo descrittore del modulo {0} non valido.
 error.missing.provider=Provider di servizi non trovato: {0}
+error.release.value.notnumber=release {0} non valida
+error.release.value.toosmall=la release {0} non \u00E8 valida: deve essere >= 9
 out.added.manifest=aggiunto manifest
 out.added.module-info=aggiunto module-info: {0}
 out.update.manifest=aggiornato manifest
@@ -64,12 +66,12 @@
 out.inflated=\ decompresso: {0}
 out.size=(in = {0}) (out = {1})
 
-usage.compat=Interfaccia di compatibilit\u00E0:\nUso: jar {ctxui}[vfmn0PMe] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -n  esegue la normalizzazione Pack200 dopo la creazione di un nuovo archivio\n    -e  specifica il punto di ingresso per l'applicazione stand-alone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -P  conserva i componenti iniziali '/' (percorso assoluto) e \\"..\\" (directory padre) dai nomi file\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=Interfaccia di compatibilit\u00E0:\nUso: jar {ctxui}[vfmn0PMe] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file] ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -n  esegue la normalizzazione Pack200 dopo la creazione di un nuovo archivio\n    -e  specifica il punto di ingresso per l'applicazione stand-alone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -P  conserva i componenti iniziali '/' (percorso assoluto) e \\"..\\" (directory padre) dai nomi file\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: \u00E8 necessario specificare una delle opzioni -ctxui.
 main.usage.summary.try=Utilizzare 'jar --help' per ulteriori informazioni.
 
-main.help.preopt=Uso: jar [OPTION...] [-C dir] file ...\nil file jar crea un archivio per le classi e le risorse e pu\u00F2 manipolare o\nripristinare le singole classi o risorse da un archivio.\n\n Esempi:\n # Crea un archivio denominato classes.jar con due file di classe:\n jar --create --file classes.jar Foo.class Bar.class\n # Crea un archivio mediante un file manifest esistente, con tutti i file in foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Crea un archivio jar modulare, in cui il descrittore di modulo si trova in\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Aggiorna un file jar non modulare esistente in un file jar modulare:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=Uso: jar [OPTION...] [ [--release VERSION] [-C dir] file] ...\nIl file jar crea un archivio per le classi e le risorse e pu\u00F2 manipolare o\nripristinare le singole classi o risorse da un archivio.\n\n Esempi:\n # Crea un archivio denominato classes.jar con due file di classe:\n jar --create --file classes.jar Foo.class Bar.class\n # Crea un archivio mediante un file manifest esistente, con tutti i file in foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Crea un archivio jar modulare, in cui il descrittore di modulo si trova in\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Aggiorna un file jar non modulare esistente in un file jar modulare:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # Crea un file jar per pi\u00F9 release, posizionando alcuni file nella directory META-INF/versions/9:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ Modalit\u00E0 di funzionamento principale:\n
 main.help.opt.main.create=\  -c, --create               Crea l'archivio
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  Genera le informazioni sull'indice per gli archivi\n                             jar specificati
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              Estrae i file con nome (o tutti i file) dall'archivio
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  Stampa il descrittore del modulo
 main.help.opt.any=\ Modificatori di funzionamento validi in qualsiasi modalit\u00E0:\n\n  -C DIR                     Passa alla directory specificata e include il\n                              file seguente
-main.help.opt.any.file=\  -f, --file=FILE            Nome del file di archivio
+main.help.opt.any.file=\  -f, --file=FILE            Il nome file dell'archivio.\n      --release VERSION      Inserisce tutti i file riportati di seguito in una directory con\n                             controllo delle versioni del file JAR (ovvero META-INF/versions/VERSION/).
 main.help.opt.any.verbose=\  -v, --verbose              Genera l'output descrittivo nell'output standard
 main.help.opt.create.update=\ Modificatori di funzionamento validi solo nella modalit\u00E0 di creazione e aggiornamento:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME Punto di ingresso per le applicazioni\n                             stand-alone incluse nell'archivio jar modulare o\n                             eseguibile
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=--module-version\u307E\u305F\u306F--hash-modules\u306E\u3044\u305A\u308C\u304B\u3067module-info.class\u304C\u3042\u308A\u307E\u305B\u3093
 error.unexpected.module-info=\u4E88\u671F\u3057\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF{0}
 error.module.descriptor.not.found=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-error.versioned.info.without.root=\u30EB\u30FC\u30C8\u306Bmodule-info.class\u306E\u306A\u3044module-info.class\u304C\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306B\u898B\u3064\u304B\u308A\u307E\u3057\u305F
-error.versioned.info.name.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306Emodule-info.class\u306B\u6B63\u3057\u304F\u306A\u3044\u540D\u524D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-error.versioned.info.requires.public=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306Emodule-info.class\u306B\u8FFD\u52A0\u306Erequires public\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-error.versioned.info.requires.added=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306Emodule-info.class\u306B\u8FFD\u52A0\u306Erequires\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-error.versioned.info.requires.dropped=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306Emodule-info.class\u306B\u6B20\u843D\u3057\u3066\u3044\u308Brequires\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-error.versioned.info.exports.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306Emodule-info.class\u306B\u7570\u306A\u308Bexports\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-error.versioned.info.provides.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30BB\u30AF\u30B7\u30E7\u30F3\u306Emodule-info.class\u306B\u7570\u306A\u308Bprovides\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+error.versioned.info.without.root=module-info.class\u304C\u3001\u30EB\u30FC\u30C8\u306Bmodule-info.class\u306E\u306A\u3044\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u898B\u3064\u304B\u308A\u307E\u3057\u305F
+error.versioned.info.name.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u6B63\u3057\u304F\u306A\u3044\u540D\u524D\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+error.versioned.info.requires.public=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u8FFD\u52A0\u306Erequires public\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+error.versioned.info.requires.added=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u8FFD\u52A0\u306Erequires\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+error.versioned.info.requires.dropped=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u6B20\u843D\u3057\u3066\u3044\u308Brequires\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+error.versioned.info.exports.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u7570\u306A\u308Bexports\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+error.versioned.info.provides.notequal=\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306Emodule-info.class\u306B\u7570\u306A\u308Bprovides\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
 error.invalid.versioned.module.attribute=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u5C5E\u6027{0}\u304C\u7121\u52B9\u3067\u3059
 error.missing.provider=\u30B5\u30FC\u30D3\u30B9\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
+error.release.value.notnumber=\u30EA\u30EA\u30FC\u30B9{0}\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
+error.release.value.toosmall=\u30EA\u30EA\u30FC\u30B9{0}\u306F\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u30029\u4EE5\u4E0A\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
 out.added.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F
 out.added.module-info=module-info\u304C\u8FFD\u52A0\u3055\u308C\u307E\u3057\u305F: {0}
 out.update.manifest=\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F
@@ -64,12 +66,12 @@
 out.inflated=\ {0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
 out.size=(\u5165={0})(\u51FA={1})
 
-usage.compat=\u4E92\u63DB\u6027\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9:\n\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n    -c  \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n    -t  \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n    -x  \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n    -u  \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n    -v  \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n    -f  \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n    -m  \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n    -n  \u65B0\u898F\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u4F5C\u6210\u5F8C\u306BPack200\u6B63\u898F\u5316\u3092\u5B9F\u884C\u3059\u308B\n    -e  \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\n        \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n    -0  \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n    -P  \u30D5\u30A1\u30A4\u30EB\u540D\u306E\u5148\u982D\u306E'/' (\u7D76\u5BFE\u30D1\u30B9)\u304A\u3088\u3073\\"..\\" (\u89AA\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA)\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u4FDD\u6301\u3059\u308B\n    -M  \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n    -i  \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n    -C  \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u6B21\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B: \n       jar cvf classes.jar Foo.class Bar.class \n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n           \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=\u4E92\u63DB\u6027\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9:\n\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n    -c  \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n    -t  \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n    -x  \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n    -u  \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n    -v  \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n    -f  \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n    -m  \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n    -n  \u65B0\u898F\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u4F5C\u6210\u5F8C\u306BPack200\u6B63\u898F\u5316\u3092\u5B9F\u884C\u3059\u308B\n    -e  \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\n        \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n    -0  \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n    -P  \u30D5\u30A1\u30A4\u30EB\u540D\u306E\u5148\u982D\u306E'/' (\u7D76\u5BFE\u30D1\u30B9)\u304A\u3088\u3073\\"..\\" (\u89AA\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA)\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u4FDD\u6301\u3059\u308B\n    -M  \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n    -i  \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n    -C  \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u6B21\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B: \n       jar cvf classes.jar Foo.class Bar.class \n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n           \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: \u3044\u305A\u308C\u304B\u306E-ctxui\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
 main.usage.summary.try=\u8A73\u7D30\u306F\u3001`jar --help'\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 
-main.help.preopt=\u4F7F\u7528\u65B9\u6CD5: jar [OPTION...] [-C dir] files ...\njar\u306F\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30EA\u30BD\u30FC\u30B9\u306E\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3057\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u500B\u3005\u306E\u30AF\u30E9\u30B9\u307E\u305F\u306F\n\u30EA\u30BD\u30FC\u30B9\u3092\u64CD\u4F5C\u307E\u305F\u306F\u5FA9\u5143\u3067\u304D\u307E\u3059\u3002\n\n \u4F8B:\n # 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3080classes.jar\u3068\u3044\u3046\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3059\u308B:\n jar --create --file classes.jar Foo.class Bar.class\n # foo/\u306E\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3080\u3001\u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u305F\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3059\u308B:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \u30E2\u30B8\u30E5\u30E9jar\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3059\u308B\u3002\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u306Fclasses/module-info.class\u306B\n # \u3042\u308B:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \u65E2\u5B58\u306E\u975E\u30E2\u30B8\u30E5\u30E9jar\u3092\u30E2\u30B8\u30E5\u30E9jar\u306B\u66F4\u65B0\u3059\u308B:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=\u4F7F\u7528\u65B9\u6CD5: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar\u306F\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30EA\u30BD\u30FC\u30B9\u306E\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3057\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u500B\u3005\u306E\u30AF\u30E9\u30B9\u307E\u305F\u306F\n\u30EA\u30BD\u30FC\u30B9\u3092\u64CD\u4F5C\u307E\u305F\u306F\u5FA9\u5143\u3067\u304D\u307E\u3059\u3002\n\n \u4F8B:\n # 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3080classes.jar\u3068\u3044\u3046\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3059\u308B:\n jar --create --file classes.jar Foo.class Bar.class\n # foo/\u306E\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3080\u3001\u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u305F\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3059\u308B:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \u30E2\u30B8\u30E5\u30E9jar\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3059\u308B\u3002\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u306Fclasses/module-info.class\u306B\n # \u3042\u308B:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \u65E2\u5B58\u306E\u975E\u30E2\u30B8\u30E5\u30E9jar\u3092\u30E2\u30B8\u30E5\u30E9jar\u306B\u66F4\u65B0\u3059\u308B:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # \u8907\u6570\u30EA\u30EA\u30FC\u30B9jar\u3092\u4F5C\u6210\u3057\u3001\u4E00\u90E8\u306E\u30D5\u30A1\u30A4\u30EB\u3092META-INF/versions/9\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u914D\u7F6E\u3059\u308B:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ \u30E1\u30A4\u30F3\u64CD\u4F5C\u30E2\u30FC\u30C9:\n
 main.help.opt.main.create=\  -c\u3001--create               \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3057\u307E\u3059
 main.help.opt.main.generate-index=\  -i,\u3001--generate-index=FILE  \u6307\u5B9A\u306Ejar\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u7D22\u5F15\u60C5\u5831\u3092\n                             \u751F\u6210\u3057\u307E\u3059
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x\u3001--extract              \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3057\u307E\u3059
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  \u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u3092\u51FA\u529B\u3057\u307E\u3059
 main.help.opt.any=\ \u3069\u306E\u30E2\u30FC\u30C9\u3067\u3082\u6709\u52B9\u306A\u64CD\u4F5C\u4FEE\u98FE\u5B50:\n\n  -C DIR                     \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u6B21\u306E\u30D5\u30A1\u30A4\u30EB\u3092\n                             \u53D6\u308A\u8FBC\u307F\u307E\u3059
-main.help.opt.any.file=\  -f\u3001--file=FILE            \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D
+main.help.opt.any.file=\  -f\u3001--file=FILE            \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\n      --release VERSION      \u6B21\u306E\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u3092jar\u306E\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n                             (\u3064\u307E\u308A\u3001META-INF/versions/VERSION/)\u306B\u914D\u7F6E\u3057\u307E\u3059
 main.help.opt.any.verbose=\  -v\u3001--verbose              \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3057\u307E\u3059
 main.help.opt.create.update=\ \u4F5C\u6210\u307E\u305F\u306F\u66F4\u65B0\u30E2\u30FC\u30C9\u3067\u306E\u307F\u6709\u52B9\u306A\u64CD\u4F5C\u4FEE\u98FE\u5B50:\n
 main.help.opt.create.update.main-class=\  -e\u3001--main-class=CLASSNAME \u30E2\u30B8\u30E5\u30E9\u307E\u305F\u306F\u5B9F\u884C\u53EF\u80FD\u306Ajar\u30A2\u30FC\u30AB\u30A4\u30D6\u306B\n                             \u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n                             \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=module-info.class \uC5C6\uC774 --module-version \uB610\uB294 --hash-modules \uC911 \uD558\uB098
 error.unexpected.module-info=\uC608\uC0C1\uCE58 \uC54A\uC740 \uBAA8\uB4C8 \uAE30\uC220\uC790 {0}
 error.module.descriptor.not.found=\uBAA8\uB4C8 \uAE30\uC220\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C
-error.versioned.info.without.root=\uB8E8\uD2B8\uC5D0\uC11C module-info.class \uC5C6\uC774 \uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC5D0\uC11C module-info.class\uAC00 \uBC1C\uACAC\uB428
-error.versioned.info.name.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC758 module-info.class\uC5D0 \uC798\uBABB\uB41C \uC774\uB984\uC774 \uD3EC\uD568\uB428
-error.versioned.info.requires.public=\uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC758 module-info.class\uC5D0 \uCD94\uAC00 \uD544\uC218 \uACF5\uC6A9 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
-error.versioned.info.requires.added=\uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC758 module-info.class\uC5D0 \uCD94\uAC00 \uD544\uC218 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
-error.versioned.info.requires.dropped=\uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC758 module-info.class\uC5D0 \uB204\uB77D\uB41C \uD544\uC218 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
-error.versioned.info.exports.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC758 module-info.class\uC5D0 \uB2E4\uB978 \uC775\uC2A4\uD3EC\uD2B8 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
-error.versioned.info.provides.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uC139\uC158\uC758 module-info.class\uC5D0 \uB2E4\uB978 \uC81C\uACF5 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
+error.versioned.info.without.root=\uB8E8\uD2B8\uC5D0\uC11C module-info.class \uC5C6\uC774 \uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC5D0\uC11C module-info.class\uAC00 \uBC1C\uACAC\uB428
+error.versioned.info.name.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uC798\uBABB\uB41C \uC774\uB984\uC774 \uD3EC\uD568\uB428
+error.versioned.info.requires.public=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uCD94\uAC00 \uD544\uC218 \uACF5\uC6A9 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
+error.versioned.info.requires.added=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uCD94\uAC00 \uD544\uC218 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
+error.versioned.info.requires.dropped=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB204\uB77D\uB41C \uD544\uC218 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
+error.versioned.info.exports.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB2E4\uB978 \uC775\uC2A4\uD3EC\uD2B8 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
+error.versioned.info.provides.notequal=\uBC84\uC804 \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uC758 module-info.class\uC5D0 \uB2E4\uB978 \uC81C\uACF5 \uD56D\uBAA9\uC774 \uD3EC\uD568\uB428
 error.invalid.versioned.module.attribute=\uBD80\uC801\uD569\uD55C \uBAA8\uB4C8 \uAE30\uC220\uC790 \uC18D\uC131 {0}
 error.missing.provider=\uC11C\uBE44\uC2A4 \uC81C\uACF5\uC790\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C: {0}
+error.release.value.notnumber=\uB9B4\uB9AC\uC2A4 {0}\uC774(\uAC00) \uBD80\uC801\uD569\uD568
+error.release.value.toosmall=\uB9B4\uB9AC\uC2A4 {0}\uC774(\uAC00) \uBD80\uC801\uD569\uD568. 9 \uC774\uC0C1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
 out.added.manifest=Manifest\uB97C \uCD94\uAC00\uD568
 out.added.module-info=\uCD94\uAC00\uB41C \uBAA8\uB4C8 \uC815\uBCF4: {0}
 out.update.manifest=Manifest\uB97C \uC5C5\uB370\uC774\uD2B8\uD568
@@ -64,12 +66,12 @@
 out.inflated=\ \uC99D\uAC00\uB428: {0}
 out.size=(\uC785\uB825 = {0}) (\uCD9C\uB825 = {1})
 
-usage.compat=\uD638\uD658\uC131 \uC778\uD130\uD398\uC774\uC2A4:\n\uC0AC\uC6A9\uBC95: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n    -c  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -t  \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n    -x  \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n    -u  \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4.\n    -v  \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -f  \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -m  \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n    -n  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD55C \uD6C4 Pack200 \uC815\uADDC\uD654\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n    -e  jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\uC758 \n        \uC560\uD50C\uB9AC\uCF00\uC774\uC158 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -0  \uC800\uC7A5 \uC804\uC6A9\uC774\uBA70 ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -P  \uD30C\uC77C \uC774\uB984\uC5D0\uC11C \uC120\uD589 '/'(\uC808\uB300 \uACBD\uB85C) \uBC0F ".."(\uC0C1\uC704 \uB514\uB809\uD1A0\uB9AC) \uAD6C\uC131 \uC694\uC18C\uB97C \uC720\uC9C0\uD569\uB2C8\uB2E4.\n    -M  \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -i  \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -C  \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n           foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=\uD638\uD658\uC131 \uC778\uD130\uD398\uC774\uC2A4:\n\uC0AC\uC6A9\uBC95: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n    -c  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -t  \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n    -x  \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n    -u  \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uC5C5\uB370\uC774\uD2B8\uD569\uB2C8\uB2E4.\n    -v  \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -f  \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -m  \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n    -n  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD55C \uD6C4 Pack200 \uC815\uADDC\uD654\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n    -e  jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\uC758 \n        \uC560\uD50C\uB9AC\uCF00\uC774\uC158 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -0  \uC800\uC7A5 \uC804\uC6A9\uC774\uBA70 ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -P  \uD30C\uC77C \uC774\uB984\uC5D0\uC11C \uC120\uD589 '/'(\uC808\uB300 \uACBD\uB85C) \uBC0F ".."(\uC0C1\uC704 \uB514\uB809\uD1A0\uB9AC) \uAD6C\uC131\uC694\uC18C\uB97C \uC720\uC9C0\uD569\uB2C8\uB2E4.\n    -M  \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -i  \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -C  \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n           foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: -ctxui \uC635\uC158 \uC911 \uD558\uB098\uB97C \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.
 main.usage.summary.try=\uC790\uC138\uD55C \uB0B4\uC6A9\uC744 \uBCF4\uB824\uBA74 'jar --help'\uB97C \uC2E4\uD589\uD558\uC2ED\uC2DC\uC624.
 
-main.help.preopt=\uC0AC\uC6A9\uBC95: jar [OPTION...] [-C dir] files ...\njar\uB294 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4. \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C\n\uAC1C\uBCC4 \uD074\uB798\uC2A4\uB098 \uB9AC\uC18C\uC2A4\uB97C \uC870\uC791\uD558\uAC70\uB098 \uBCF5\uC6D0\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n\n \uC608\uC81C:\n # \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC0AC\uC6A9\uD558\uC5EC classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C \uC0DD\uC131:\n jar --create --file classes.jar Foo.class Bar.class\n # \uAE30\uC874 Manifest\uB97C \uC0AC\uC6A9\uD558\uC5EC \uBAA8\uB4E0 \uD30C\uC77C\uC774 foo/\uC5D0 \uD3EC\uD568\uB41C \uC544\uCE74\uC774\uBE0C \uC0DD\uC131:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \uBAA8\uB4C8 \uAE30\uC220\uC790\uAC00 classes/module-info.class\uC5D0 \uC704\uCE58\uD55C\n # \uBAA8\uB4C8\uD615 jar \uC544\uCE74\uC774\uBE0C \uC0DD\uC131:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \uAE30\uC874 \uBE44\uBAA8\uB4C8 jar\uB97C \uBAA8\uB4C8\uD615 jar\uB85C \uC5C5\uB370\uC774\uD2B8:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=\uC0AC\uC6A9\uBC95: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar\uB294 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4. \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C\n\uAC1C\uBCC4 \uD074\uB798\uC2A4\uB098 \uB9AC\uC18C\uC2A4\uB97C \uC870\uC791\uD558\uAC70\uB098 \uBCF5\uC6D0\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n\n \uC608\uC81C:\n # \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC0AC\uC6A9\uD558\uC5EC classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C \uC0DD\uC131:\n jar --create --file classes.jar Foo.class Bar.class\n # \uAE30\uC874 Manifest\uB97C \uC0AC\uC6A9\uD558\uC5EC \uBAA8\uB4E0 \uD30C\uC77C\uC774 foo/\uC5D0 \uD3EC\uD568\uB41C \uC544\uCE74\uC774\uBE0C \uC0DD\uC131:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \uBAA8\uB4C8 \uAE30\uC220\uC790\uAC00 classes/module-info.class\uC5D0 \uC704\uCE58\uD55C\n # \uBAA8\uB4C8\uD615 jar \uC544\uCE74\uC774\uBE0C \uC0DD\uC131:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \uAE30\uC874 \uBE44\uBAA8\uB4C8 jar\uB97C \uBAA8\uB4C8\uD615 jar\uB85C \uC5C5\uB370\uC774\uD2B8:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # \uC77C\uBD80 \uD30C\uC77C\uC774 META-INF/versions/9 \uB514\uB809\uD1A0\uB9AC\uC5D0 \uC704\uCE58\uD55C \uB2E4\uC911 \uB9B4\uB9AC\uC2A4 jar \uC0DD\uC131:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ \uAE30\uBCF8 \uC791\uC5C5 \uBAA8\uB4DC:\n
 main.help.opt.main.create=\  -c, --create               \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  \uC9C0\uC815\uB41C jar \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C\n                             \uC0DD\uC131\uD569\uB2C8\uB2E4.
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  \uBAA8\uB4C8 \uAE30\uC220\uC790\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.
 main.help.opt.any=\ \uBAA8\uB4E0 \uBAA8\uB4DC\uC5D0\uC11C \uC801\uD569\uD55C \uC791\uC5C5 \uC218\uC815\uC790:\n\n  -C DIR                     \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744\n                             \uD3EC\uD568\uD569\uB2C8\uB2E4.
-main.help.opt.any.file=\  -f, --file=FILE            \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC785\uB2C8\uB2E4.
+main.help.opt.any.file=\  -f, --file=FILE            \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC785\uB2C8\uB2E4.\n      --release VERSION      \uB2E4\uC74C \uBAA8\uB4E0 \uD30C\uC77C\uC744 \uBC84\uC804 \uC9C0\uC815\uB41C jar \uB514\uB809\uD1A0\uB9AC\n                             (\uC608: META-INF/versions/VERSION/)\uC5D0 \uBC30\uCE58\uD569\uB2C8\uB2E4.
 main.help.opt.any.verbose=\  -v, --verbose              \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.
 main.help.opt.create.update=\ \uC0DD\uC131 \uBC0F \uC5C5\uB370\uC774\uD2B8 \uBAA8\uB4DC\uC5D0\uC11C\uB9CC \uC801\uD569\uD55C \uC791\uC5C5 \uC218\uC815\uC790:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME \uBAA8\uB4C8\uD615 \uB610\uB294 \uC2E4\uD589\uD615 jar \uC544\uCE74\uC774\uBE0C\uC5D0 \uBC88\uB4E4\uB85C\n                             \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\uC758 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\n                             \uC2DC\uC791 \uC9C0\uC810\uC785\uB2C8\uB2E4.
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=Um dentre --module-version ou --hash-modules est\u00E1 sem module-info.class
 error.unexpected.module-info=Descritor de m\u00F3dulo inesperado {0}
 error.module.descriptor.not.found=Descritor de m\u00F3dulo n\u00E3o encontrado
-error.versioned.info.without.root=module-info.class encontrado na se\u00E7\u00E3o com controle de vers\u00E3o sem module-info.class na raiz
-error.versioned.info.name.notequal=module-info.class na se\u00E7\u00E3o com controle de vers\u00E3o cont\u00E9m nome incorreto
-error.versioned.info.requires.public=module-info.class na se\u00E7\u00E3o com controle de vers\u00E3o cont\u00E9m uma depend\u00EAncia requires public adicional
-error.versioned.info.requires.added=module-info.class na se\u00E7\u00E3o com controle de vers\u00E3o cont\u00E9m depend\u00EAncias require adicionais
-error.versioned.info.requires.dropped=module-info.class na se\u00E7\u00E3o com controle de vers\u00E3o cont\u00E9m depend\u00EAncias require ausentes
-error.versioned.info.exports.notequal=module-info.class na se\u00E7\u00E3o com controle de vers\u00E3o cont\u00E9m cl\u00E1usulas exports diferentes
-error.versioned.info.provides.notequal=module-info.class na se\u00E7\u00E3o com controle de vers\u00E3o cont\u00E9m cl\u00E1usulas provides diferentes
+error.versioned.info.without.root=module-info.class encontrado em um diret\u00F3rio com controle de vers\u00E3o sem module-info.class na raiz
+error.versioned.info.name.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m nome incorreto
+error.versioned.info.requires.public=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m uma depend\u00EAncia requires public adicional
+error.versioned.info.requires.added=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m uma depend\u00EAncia requires adicional
+error.versioned.info.requires.dropped=em module-info.class em um diret\u00F3rio com controle de vers\u00E3o falta uma depend\u00EAncia requires
+error.versioned.info.exports.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m depend\u00EAncias exports diferentes
+error.versioned.info.provides.notequal=module-info.class em um diret\u00F3rio com controle de vers\u00E3o cont\u00E9m depend\u00EAncias provides diferentes
 error.invalid.versioned.module.attribute=Atributo {0} de descritor de m\u00F3dulo inv\u00E1lido
 error.missing.provider=Prestador de servi\u00E7os  n\u00E3o encontrado: {0}
+error.release.value.notnumber=release {0} n\u00E3o v\u00E1lida
+error.release.value.toosmall=release {0} n\u00E3o v\u00E1lida; deve ser >= 9
 out.added.manifest=manifesto adicionado
 out.added.module-info=module-info: {0} adicionado
 out.update.manifest=manifesto atualizado
@@ -64,12 +66,12 @@
 out.inflated=\ inflado: {0}
 out.size=(entrada = {0}) (sa\u00EDda= {1})
 
-usage.compat=Interface de Compatibilidade:\nUso: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos ...\nOp\u00E7\u00F5es:\n    -c  cria novo arquivo compactado\n    -t  lista o sum\u00E1rio do arquivo compactado\n    -x  extrai arquivos com o nome (ou todos) do arquivo compactado\n    -u  atualiza o arquivo compactado existente\n    -v  gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n    -f  especifica o nome do arquivo do arquivo compactado\n    -m  inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n    -n   executa a normaliza\u00E7\u00E3o Pack200 ap\u00F3s a cria\u00E7\u00E3o de um novo arquivo compactado\n    -e  especifica o ponto de entrada da aplicativo para aplicativo stand-alone \n        empacotada em um arquivo jar execut\u00E1vel\n    -0  armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n    -P  preserva os componentes '/' inicial (caminho absoluto) e ".." (diret\u00F3rio pai) nos nomes dos arquivos\n    -M  n\u00E3o cria um arquivo de manifesto para as entradas\n    -i  gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n    -C  passa para o diret\u00F3rio especificado e inclui o arquivo a seguir\nSe um arquivo tamb\u00E9m for um diret\u00F3rio, ele ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado denominado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n           arquivos no diret\u00F3rio foo/ na 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=Interface de Compatibilidade:\nUso: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] arquivos] ...\nOp\u00E7\u00F5es:\n    -c  cria novo arquivo compactado\n    -t  lista o sum\u00E1rio do arquivo compactado\n    -x  extrai arquivos com o nome (ou todos) do arquivo compactado\n    -u  atualiza o arquivo compactado existente\n    -v  gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n    -f  especifica o nome do arquivo compactado\n    -m  inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n    -n   executa a normaliza\u00E7\u00E3o Pack200 ap\u00F3s a cria\u00E7\u00E3o de um novo arquivo compactado\n    -e  especifica o ponto de entrada da aplicativo para aplicativo stand-alone \n        empacotada em um arquivo jar execut\u00E1vel\n    -0  armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n    -P  preserva os componentes '/' inicial (caminho absoluto) e ".." (diret\u00F3rio pai) nos nomes dos arquivos\n    -M  n\u00E3o cria um arquivo de manifesto para as entradas\n    -i  gera informa\u00E7\u00F5es de \u00EDndice para os arquivos jar especificados\n    -C  passa para o diret\u00F3rio especificado e inclui o arquivo a seguir\nSe um arquivo tamb\u00E9m for um diret\u00F3rio, ele ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags 'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado denominado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n           arquivos no diret\u00F3rio foo/ em 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: Voc\u00EA deve especificar uma das op\u00E7\u00F5es -ctxui.
 main.usage.summary.try=Tente `jar --ajuda' para obter mais informa\u00E7\u00F5es.
 
-main.help.preopt=Uso: jar [OPTION...] [-C dir] arquivos...\njar cria um arquivo compactado para classes e recursos, e pode manipular ou\nrestaurar classes ou recursos individuais de um arquivo compactado.\n\n Exemplos:\n # Cria um arquivo compactado chamado classes.jar com dois arquivos de classe:\n jar --create --file classes.jar Foo.class Bar.class\n # Cria um arquivo compactado usando um manifesto existente, com todos os arquivos em foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Cria um arquivo compactado jar modular, em que o descritor do m\u00F3dulo se localize em\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Atualiza um arquivo jar n\u00E3o modular existente para um jar modular:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=Uso: jar [OPTION...] [ [--release VERSION] [-C dir] arquivos]...\njar cria um arquivo compactado para classes e recursos, e pode manipular ou\nrestaurar classes ou recursos individuais de um arquivo compactado.\n\n Exemplos:\n # Cria um arquivo compactado chamado classes.jar com dois arquivos de classe:\n jar --create --file classes.jar Foo.class Bar.class\n # Cria um arquivo compactado usando um manifesto existente, com todos os arquivos em foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Cria um arquivo compactado jar modular, em que o descritor do m\u00F3dulo se localize em\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Atualiza um arquivo jar n\u00E3o modular existente para um jar modular:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # Cria um arquivo jar de v\u00E1rias releases, colocando alguns arquivos no diret\u00F3rio META-INF/versions/9:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ Modo de opera\u00E7\u00E3o principal:\n
 main.help.opt.main.create=\  -c, --create               Cria o arquivo compactado
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  Gera informa\u00E7\u00F5es de \u00EDndice para os arquivos compactados jar \n                             especificados
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              Extrai arquivos nomeados (ou todos) do arquivo compactado
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  Imprime o descritor do m\u00F3dulo
 main.help.opt.any=\ Modificadores de opera\u00E7\u00E3o v\u00E1lidos em qualquer modo:\n\n  -C DIR                     Altera para o diret\u00F3rio especificado e inclui o\n                             seguinte arquivo:
-main.help.opt.any.file=\  -f, --file=FILE            O nome do arquivo compactado
+main.help.opt.any.file=\  -f, --file=FILE            O nome do arquivo compactado\n      --release VERSION      Coloca todos os arquivos a seguir em um diret\u00F3rio com controle de vers\u00E3o\n                             do arquivo jar (i.e. META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              Gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o
 main.help.opt.create.update=\ Modificadores de opera\u00E7\u00E3o v\u00E1lidos somente no modo de cria\u00E7\u00E3o e atualiza\u00E7\u00E3o:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME O ponto de entrada do aplicativo para aplicativos\n                             stand-alone empacotados em um arquivo compactado jar modular\n                             ou execut\u00E1vel
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=--module-version eller --hash-modules utan module-info.class
 error.unexpected.module-info=Ov\u00E4ntad moduldeskriptor, {0}
 error.module.descriptor.not.found=Moduldeskriptorn hittades inte
-error.versioned.info.without.root=module-info.class hittades i versionshanterad sektion utan module-info.class i roten
-error.versioned.info.name.notequal=module-info.class i en versionshanterad sektion inneh\u00E5ller ett felaktigt namn
-error.versioned.info.requires.public=module-info.class i en versionshanterad sektion inneh\u00E5ller fler allm\u00E4nna obligatoriska
-error.versioned.info.requires.added=module-info.class i en versionshanterad sektion inneh\u00E5ller fler obligatoriska
-error.versioned.info.requires.dropped=module-info.class i en versionshanterad sektion inneh\u00E5ller saknade obligatoriska
-error.versioned.info.exports.notequal=module-info.class i en versionshanterad sektion inneh\u00E5ller olika exporter
-error.versioned.info.provides.notequal=module-info.class i en versionshanterad sektion inneh\u00E5ller olika tillhandah\u00E5llna
+error.versioned.info.without.root=module-info.class hittades i en versionshanterad katalog utan module-info.class i roten
+error.versioned.info.name.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller ett felaktigt namn
+error.versioned.info.requires.public=module-info.class i en versionshanterad katalog inneh\u00E5ller fler "requires public"
+error.versioned.info.requires.added=module-info.class i en versionshanterad katalog inneh\u00E5ller fler "requires"
+error.versioned.info.requires.dropped=module-info.class i en versionshanterad katalog inneh\u00E5ller saknade "requires"
+error.versioned.info.exports.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller olika "exports"
+error.versioned.info.provides.notequal=module-info.class i en versionshanterad katalog inneh\u00E5ller olika "provides"
 error.invalid.versioned.module.attribute=Ogiltigt attribut f\u00F6r moduldeskriptor, {0}
 error.missing.provider=Tj\u00E4nsteleverant\u00F6ren hittades inte: {0}
+error.release.value.notnumber=utg\u00E5va {0} \u00E4r inte giltig
+error.release.value.toosmall=utg\u00E5va {0} \u00E4r inte giltig, m\u00E5ste vara >= 9
 out.added.manifest=tillagt manifestfil
 out.added.module-info=lade till module-info: {0}
 out.update.manifest=uppdaterat manifest
@@ -69,7 +71,7 @@
 main.usage.summary=jar: du m\u00E5ste ange ett av -ctxui-alternativen.
 main.usage.summary.try=F\u00F6rs\u00F6k med 'jar --help' f\u00F6r mer information.
 
-main.help.preopt=Syntax: jar [OPTION...] [-C dir] files ...\njar skapar ett arkiv f\u00F6r klasser och resurser och kan \u00E4ndra eller \n\u00E5terst\u00E4lla enskilda klasser och resurser i/fr\u00E5n ett arkiv.\n\n Exempel:\n # Skapa ett arkiv med namnet classes.jar med tv\u00E5 klassfiler:\n jar --create --file classes.jar Foo.class Bar.class\n # Skapa ett arkiv med ett befintligt manifest med alla filerna i foo/:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Skapa ett modul\u00E4rt jar-arkiv d\u00E4r moduldeskriptorn finns i\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Uppdatera ett befintligt icke-modul\u00E4rt jar-arkiv till ett modul\u00E4rt jar-arkiv:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=Syntax: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar skapar ett arkiv f\u00F6r klasser och resurser, och kan \u00E4ndra och \u00E5terst\u00E4lla\nenskilda klasser och resurser fr\u00E5n ett arkiv.\n\n Exempel:\n # Skapa ett arkiv med namnet classes.jar med tv\u00E5 klassfiler:\n jar --create --file classes.jar Foo.class Bar.class\n # Skapa ett arkiv med ett befintligt manifest med alla filerna i 'foo/':\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # Skapa ett modul\u00E4rt jar-arkiv, d\u00E4r moduldeskriptorn finns i\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # Uppdatera ett befintligt icke-modul\u00E4rt jar-arkiv till ett modul\u00E4rt jar-arkiv:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # Skapa ett jar-arkiv f\u00F6r flera utg\u00E5vor och placera vissa av filerna i katalogen 'META-INF/versions/9':\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ Huvudfunktionsl\u00E4ge:\n
 main.help.opt.main.create=\  -c, --create               Skapa arkivet
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  Generera indexinformation f\u00F6r de angivna jar-\n                             arkiven
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              Extrahera namngivna (eller alla) filer fr\u00E5n arkivet
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  Skriv ut moduldeskriptorn
 main.help.opt.any=\ \u00C5tg\u00E4rdsmodifierare som \u00E4r giltiga i alla l\u00E4gen:\n\n  -C DIR                     \u00C4ndra till den angivna katalogen och inkludera\n                             f\u00F6ljande fil
-main.help.opt.any.file=\  -f, --file=FILE            Arkivfilnamnet
+main.help.opt.any.file=\  -f, --file=FILE            Namnet p\u00E5 arkivfilen\n      --release VERSION      Placerar alla f\u00F6ljande filer i en versionshanterad katalog\n                             i jar-arkivet (exempel: META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              Generera utf\u00F6rliga utdata till standardutdata
 main.help.opt.create.update=\ \u00C5tg\u00E4rdsmodifierare som endast \u00E4r giltiga i l\u00E4gena create och update:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME Applikationsing\u00E5ngspunkten f\u00F6r frist\u00E5ende\n                             applikationer paketerad i ett modul\u00E4rt, eller k\u00F6rbart,\n                             jar-arkiv
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=--module-version \u6216 --hash-modules \u4E4B\u4E00\u6CA1\u6709 module-info.class
 error.unexpected.module-info=\u610F\u5916\u7684\u6A21\u5757\u63CF\u8FF0\u7B26 {0}
 error.module.descriptor.not.found=\u627E\u4E0D\u5230\u6A21\u5757\u63CF\u8FF0\u7B26
-error.versioned.info.without.root=\u5728\u7248\u672C\u5316\u8282\u4E2D\u627E\u5230\u4E86 module-info.class, \u4F46\u6839\u4E2D\u6CA1\u6709 module-info.class
-error.versioned.info.name.notequal=\u7248\u672C\u5316\u8282\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u786E\u7684\u540D\u79F0
-error.versioned.info.requires.public=\u7248\u672C\u5316\u8282\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 requires public
-error.versioned.info.requires.added=\u7248\u672C\u5316\u8282\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 requires
-error.versioned.info.requires.dropped=\u7248\u672C\u5316\u8282\u4E2D\u7684 module-info.class \u5305\u542B\u7F3A\u5C11\u7684 requires
-error.versioned.info.exports.notequal=\u7248\u672C\u5316\u8282\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 exports
-error.versioned.info.provides.notequal=\u7248\u672C\u5316\u8282\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 provides
+error.versioned.info.without.root=\u5728\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u627E\u5230\u4E86 module-info.class, \u4F46\u6839\u4E2D\u6CA1\u6709 module-info.class
+error.versioned.info.name.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u786E\u7684\u540D\u79F0
+error.versioned.info.requires.public=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 requires public
+error.versioned.info.requires.added=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u989D\u5916\u7684 requires
+error.versioned.info.requires.dropped=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u7F3A\u5C11\u7684 requires
+error.versioned.info.exports.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 exports
+error.versioned.info.provides.notequal=\u7248\u672C\u5316\u76EE\u5F55\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684 provides
 error.invalid.versioned.module.attribute=\u65E0\u6548\u7684\u6A21\u5757\u63CF\u8FF0\u7B26\u5C5E\u6027 {0}
 error.missing.provider=\u672A\u627E\u5230\u670D\u52A1\u63D0\u4F9B\u65B9: {0}
+error.release.value.notnumber=\u53D1\u884C\u7248 {0} \u65E0\u6548
+error.release.value.toosmall=\u53D1\u884C\u7248 {0} \u65E0\u6548, \u5FC5\u987B >= 9
 out.added.manifest=\u5DF2\u6DFB\u52A0\u6E05\u5355
 out.added.module-info=\u5DF2\u6DFB\u52A0 module-info: {0}
 out.update.manifest=\u5DF2\u66F4\u65B0\u6E05\u5355
@@ -64,12 +66,12 @@
 out.inflated=\  \u5DF2\u89E3\u538B: {0}
 out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
 
-usage.compat=\u517C\u5BB9\u6027\u63A5\u53E3:\n\u7528\u6CD5: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879:\n    -c  \u521B\u5EFA\u65B0\u6863\u6848\n    -t  \u5217\u51FA\u6863\u6848\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u6863\u6848\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u6863\u6848\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -n  \u521B\u5EFA\u65B0\u6863\u6848\u540E\u6267\u884C Pack200 \u89C4\u8303\u5316\n    -e  \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528 ZIP \u538B\u7F29\n    -P  \u4FDD\u7559\u6587\u4EF6\u540D\u4E2D\u7684\u524D\u5BFC '/' (\u7EDD\u5BF9\u8DEF\u5F84) \u548C ".." (\u7236\u76EE\u5F55) \u7EC4\u4EF6\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u4EE5\u4E0B\u6587\u4EF6\n\u5982\u679C\u4EFB\u4F55\u6587\u4EF6\u4E3A\u76EE\u5F55, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u6863\u6848\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u6863\u6848\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage.compat=\u517C\u5BB9\u6027\u63A5\u53E3:\n\u7528\u6CD5: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\n\u9009\u9879:\n    -c  \u521B\u5EFA\u65B0\u6863\u6848\n    -t  \u5217\u51FA\u6863\u6848\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u6863\u6848\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u6863\u6848\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -n  \u521B\u5EFA\u65B0\u6863\u6848\u540E\u6267\u884C Pack200 \u89C4\u8303\u5316\n    -e  \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528 ZIP \u538B\u7F29\n    -P  \u4FDD\u7559\u6587\u4EF6\u540D\u4E2D\u7684\u524D\u5BFC '/' (\u7EDD\u5BF9\u8DEF\u5F84) \u548C ".." (\u7236\u76EE\u5F55) \u7EC4\u4EF6\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u4EE5\u4E0B\u6587\u4EF6\n\u5982\u679C\u4EFB\u4F55\u6587\u4EF6\u4E3A\u76EE\u5F55, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u6863\u6848\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u6863\u6848\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
 
 main.usage.summary=jar: \u5FC5\u987B\u6307\u5B9A\u5176\u4E2D\u4E00\u4E2A -ctxui \u9009\u9879\u3002
 main.usage.summary.try=\u5C1D\u8BD5\u4F7F\u7528 `jar --help' \u83B7\u53D6\u8BE6\u7EC6\u4FE1\u606F\u3002
 
-main.help.preopt=\u7528\u6CD5: jar [OPTION...] [-C dir] files ...\njar \u521B\u5EFA\u7C7B\u548C\u8D44\u6E90\u7684\u6863\u6848, \u5E76\u4E14\u53EF\u4EE5\u5904\u7406\u6863\u6848\u4E2D\u7684\n\u5355\u4E2A\u7C7B\u6216\u8D44\u6E90\u6216\u8005\u4ECE\u6863\u6848\u4E2D\u8FD8\u539F\u5355\u4E2A\u7C7B\u6216\u8D44\u6E90\u3002\n\n \u793A\u4F8B:\n # \u521B\u5EFA\u5305\u542B\u4E24\u4E2A\u7C7B\u6587\u4EF6\u7684\u540D\u4E3A classes.jar \u7684\u6863\u6848:\n jar --create --file classes.jar Foo.class Bar.class\n # \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u521B\u5EFA\u6863\u6848, \u5176\u4E2D\u5305\u542B foo/ \u4E2D\u7684\u6240\u6709\u6587\u4EF6:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \u521B\u5EFA\u6A21\u5757\u5316 jar \u6863\u6848, \u5176\u4E2D\u6A21\u5757\u63CF\u8FF0\u7B26\u4F4D\u4E8E\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \u5C06\u73B0\u6709\u7684\u975E\u6A21\u5757\u5316 jar \u66F4\u65B0\u4E3A\u6A21\u5757\u5316 jar:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=\u7528\u6CD5: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar \u521B\u5EFA\u7C7B\u548C\u8D44\u6E90\u7684\u6863\u6848, \u5E76\u4E14\u53EF\u4EE5\u5904\u7406\u6863\u6848\u4E2D\u7684\n\u5355\u4E2A\u7C7B\u6216\u8D44\u6E90\u6216\u8005\u4ECE\u6863\u6848\u4E2D\u8FD8\u539F\u5355\u4E2A\u7C7B\u6216\u8D44\u6E90\u3002\n\n \u793A\u4F8B:\n # \u521B\u5EFA\u5305\u542B\u4E24\u4E2A\u7C7B\u6587\u4EF6\u7684\u540D\u4E3A classes.jar \u7684\u6863\u6848:\n jar --create --file classes.jar Foo.class Bar.class\n # \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u521B\u5EFA\u6863\u6848, \u5176\u4E2D\u5305\u542B foo/ \u4E2D\u7684\u6240\u6709\u6587\u4EF6:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \u521B\u5EFA\u6A21\u5757\u5316 jar \u6863\u6848, \u5176\u4E2D\u6A21\u5757\u63CF\u8FF0\u7B26\u4F4D\u4E8E\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \u5C06\u73B0\u6709\u7684\u975E\u6A21\u5757\u5316 jar \u66F4\u65B0\u4E3A\u6A21\u5757\u5316 jar:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # \u521B\u5EFA\u5305\u542B\u591A\u4E2A\u53D1\u884C\u7248\u7684 jar, \u5E76\u5C06\u4E00\u4E9B\u6587\u4EF6\u653E\u5728 META-INF/versions/9 \u76EE\u5F55\u4E2D:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ \u4E3B\u64CD\u4F5C\u6A21\u5F0F:\n
 main.help.opt.main.create=\  -c, --create               \u521B\u5EFA\u6863\u6848
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  \u4E3A\u6307\u5B9A\u7684 jar \u6863\u6848\u751F\u6210\n                             \u7D22\u5F15\u4FE1\u606F
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u5168\u90E8) \u6587\u4EF6
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  \u8F93\u51FA\u6A21\u5757\u63CF\u8FF0\u7B26
 main.help.opt.any=\ \u5728\u4EFB\u610F\u6A21\u5F0F\u4E0B\u6709\u6548\u7684\u64CD\u4F5C\u4FEE\u9970\u7B26:\n\n  -C DIR                     \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\n                             \u4EE5\u4E0B\u6587\u4EF6
-main.help.opt.any.file=\  -f, --file=FILE            \u6863\u6848\u6587\u4EF6\u540D
+main.help.opt.any.file=\  -f, --file=FILE            \u6863\u6848\u6587\u4EF6\u540D\n      --release VERSION      \u5C06\u4E0B\u9762\u7684\u6240\u6709\u6587\u4EF6\u90FD\u653E\u5728\n                             jar \u7684\u7248\u672C\u5316\u76EE\u5F55\u4E2D (\u5373 META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA
 main.help.opt.create.update=\ \u5728\u521B\u5EFA\u548C\u66F4\u65B0\u6A21\u5F0F\u4E0B\u6709\u6548\u7684\u64CD\u4F5C\u4FEE\u9970\u7B26:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME \u6346\u7ED1\u5230\u6A21\u5757\u5316\u6216\u53EF\u6267\u884C \n                             jar \u6863\u6848\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n                             \u7684\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9
--- a/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -42,15 +42,17 @@
 error.module.options.without.info=--module-version \u6216 --hash-modules \u5176\u4E2D\u4E00\u500B\u6C92\u6709 module-info.class
 error.unexpected.module-info=\u672A\u9810\u671F\u7684\u6A21\u7D44\u63CF\u8FF0\u5340 {0}
 error.module.descriptor.not.found=\u627E\u4E0D\u5230\u6A21\u7D44\u63CF\u8FF0\u5340
-error.versioned.info.without.root=versioned \u6BB5\u843D\u4E2D\u767C\u73FE module-info.class\uFF0C\u4F46\u662F\u6839\u4E2D\u6C92\u6709 module-info.class
-error.versioned.info.name.notequal=versioned \u6BB5\u843D\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u78BA\u7684\u540D\u7A31
-error.versioned.info.requires.public=versioned \u6BB5\u843D\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684\u516C\u958B\u9700\u6C42\u9805\u76EE
-error.versioned.info.requires.added=versioned \u6BB5\u843D\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684\u9700\u6C42\u9805\u76EE
-error.versioned.info.requires.dropped=versioned \u6BB5\u843D\u4E2D\u7684 module-info.class \u5305\u542B\u907A\u6F0F\u7684\u9700\u6C42\u9805\u76EE
-error.versioned.info.exports.notequal=versioned \u6BB5\u843D\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684\u532F\u51FA\u9805\u76EE
-error.versioned.info.provides.notequal=versioned \u6BB5\u843D\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684\u63D0\u4F9B\u9805\u76EE
+error.versioned.info.without.root=\u5728\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u767C\u73FE module-info.class\uFF0C\u4F46\u662F\u6839\u4E2D\u6C92\u6709 module-info.class
+error.versioned.info.name.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u6B63\u78BA\u7684\u540D\u7A31
+error.versioned.info.requires.public=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684\u516C\u958B\u9700\u6C42\u9805\u76EE
+error.versioned.info.requires.added=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u984D\u5916\u7684\u9700\u6C42\u9805\u76EE
+error.versioned.info.requires.dropped=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u907A\u6F0F\u7684\u9700\u6C42\u9805\u76EE
+error.versioned.info.exports.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684\u532F\u51FA\u9805\u76EE
+error.versioned.info.provides.notequal=\u5DF2\u555F\u52D5\u591A\u7248\u672C\u529F\u80FD\u76EE\u9304\u4E2D\u7684 module-info.class \u5305\u542B\u4E0D\u540C\u7684\u63D0\u4F9B\u9805\u76EE
 error.invalid.versioned.module.attribute=\u6A21\u7D44\u63CF\u8FF0\u5340\u5C6C\u6027 {0} \u7121\u6548
 error.missing.provider=\u627E\u4E0D\u5230\u670D\u52D9\u63D0\u4F9B\u8005: {0}
+error.release.value.notnumber=\u7248\u672C {0} \u7121\u6548
+error.release.value.toosmall=\u7248\u672C {0} \u7121\u6548\uFF0C\u5FC5\u9808\u5927\u65BC\u7B49\u65BC 9
 out.added.manifest=\u5DF2\u65B0\u589E\u8CC7\u8A0A\u6E05\u55AE
 out.added.module-info=\u5DF2\u65B0\u589E module-info: {0}
 out.update.manifest=\u5DF2\u66F4\u65B0\u8CC7\u8A0A\u6E05\u55AE
@@ -64,12 +66,12 @@
 out.inflated=\ \u64F4\u5C55: {0}
 out.size=\ (\u8B80={0})(\u5BEB={1})
 
-usage.compat=\u76F8\u5BB9\u6027\u4ECB\u9762:\n\u7528\u6CD5: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n    -c  \u5EFA\u7ACB\u65B0\u5B58\u6A94\n    -t  \u5217\u51FA\u5B58\u6A94\u7684\u76EE\u9304\n    -x  \u5F9E\u5B58\u6A94\u4E2D\u64F7\u53D6\u6307\u5B9A (\u6216\u6240\u6709) \u6A94\u6848\n    -u  \u66F4\u65B0\u73FE\u6709\u5B58\u6A94\n    -v  \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n    -f  \u6307\u5B9A\u5B58\u6A94\u6A94\u6848\u540D\u7A31\n    -m  \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n    -n  \u5728\u5EFA\u7ACB\u65B0\u5B58\u6A94\u4E4B\u5F8C\u57F7\u884C Pack200 \u6B63\u898F\u5316\n    -e  \u70BA\u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\u7684\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F \n        \u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n    -0  \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n    -P  \u4FDD\u7559\u6A94\u6848\u540D\u7A31\u524D\u9762\u7684 '/' (\u7D55\u5C0D\u8DEF\u5F91) \u548C ".." (\u4E0A\u5C64\u76EE\u9304) \u5143\u4EF6\n    -M  \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n    -i  \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n    -C  \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u5B58\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1:  \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u5B58\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u5B58\u6A94\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n           foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u5B58\u6A94\u81F3 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/\u3002\n
+usage.compat=\u76F8\u5BB9\u6027\u4ECB\u9762:\n\u7528\u6CD5: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\n\u9078\u9805:\n    -c  \u5EFA\u7ACB\u65B0\u5B58\u6A94\n    -t  \u5217\u51FA\u5B58\u6A94\u7684\u76EE\u9304\n    -x  \u5F9E\u5B58\u6A94\u4E2D\u64F7\u53D6\u6307\u5B9A (\u6216\u5168\u90E8) \u7684\u6A94\u6848\n    -u  \u66F4\u65B0\u73FE\u6709\u5B58\u6A94\n    -v  \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n    -f  \u6307\u5B9A\u5B58\u6A94\u6A94\u6848\u540D\u7A31\n    -m  \u5305\u542B\u6307\u5B9A\u4E4B\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n    -n  \u5728\u5EFA\u7ACB\u65B0\u5B58\u6A94\u4E4B\u5F8C\u57F7\u884C Pack200 \u6B63\u898F\u5316\n    -e  \u70BA\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\u7684\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F \n        \u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n    -0  \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n    -P  \u4FDD\u7559\u6A94\u6848\u540D\u7A31\u524D\u9762\u7684 '/' (\u7D55\u5C0D\u8DEF\u5F91) \u548C ".." (\u4E0A\u5C64\u76EE\u9304) \u5143\u4EF6\n    -M  \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n    -i  \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n    -C  \u8B8A\u66F4\u81F3\u6307\u5B9A\u7684\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u5B58\u6A94\u6A94\u6848\u540D\u7A31\u4EE5\u53CA\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm'\u3001'f' \u4EE5\u53CA 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u5B58\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u5B58\u6A94\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u7684\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n           foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u5B58\u6A94\u81F3 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/\u3002\n
 
 main.usage.summary=jar: \u60A8\u5FC5\u9808\u6307\u5B9A\u5176\u4E2D\u4E00\u500B -ctxui \u9078\u9805\u3002
 main.usage.summary.try=\u8ACB\u4F7F\u7528 'jar --help' \u4EE5\u53D6\u5F97\u66F4\u591A\u7684\u8CC7\u8A0A\u3002
 
-main.help.preopt=\u7528\u6CD5: jar [OPTION...] [-C dir] \u6A94\u6848 ...\njar \u6703\u5EFA\u7ACB\u985E\u5225\u548C\u8CC7\u6E90\u7684\u5B58\u6A94\uFF0C\u4E26\u53EF\u64CD\u63A7\u6216\n\u56DE\u5FA9\u5B58\u6A94\u4E2D\u7684\u500B\u5225\u985E\u5225\u6216\u8CC7\u6E90\u3002\n\n \u7BC4\u4F8B:\n # \u4F7F\u7528\u5169\u500B\u985E\u5225\u6A94\u6848\u5EFA\u7ACB\u540D\u70BA classes.jar \u7684\u5B58\u6A94:\n jar --create --file classes.jar Foo.class Bar.class\n # \u4F7F\u7528\u73FE\u6709\u7684\u8CC7\u8A0A\u6E05\u55AE\u548C foo/ \u4E2D\u7684\u6240\u6709\u6A94\u6848\u5EFA\u7ACB\u5B58\u6A94:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \u5EFA\u7ACB\u6A21\u7D44\u5316 jar \u5B58\u6A94\uFF0C\u5176\u4E2D\u7684\u6A21\u7D44\u6558\u8FF0\u5340\u4F4D\u65BC\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \u5C07\u73FE\u6709\u7684\u975E\u6A21\u7D44\u5316 jar \u66F4\u65B0\u70BA\u6A21\u7D44\u5316 jar:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class
+main.help.preopt=\u7528\u6CD5: jar [OPTION...] [ [--release VERSION] [-C dir] files] ...\njar \u6703\u5EFA\u7ACB\u985E\u5225\u548C\u8CC7\u6E90\u7684\u5B58\u6A94\uFF0C\u800C\u4E14\u53EF\u64CD\u63A7\u6216\n\u5F9E\u5B58\u6A94\u56DE\u5FA9\u500B\u5225\u985E\u5225\u6216\u8CC7\u6E90\u3002\n\n \u7BC4\u4F8B:\n # \u5EFA\u7ACB\u4E00\u500B\u540D\u70BA classes.jar \u4E14\u542B\u6709\u5169\u500B\u985E\u5225\u6A94\u6848\u7684\u5B58\u6A94:\n jar --create --file classes.jar Foo.class Bar.class\n # \u4F7F\u7528\u73FE\u6709\u7684\u8CC7\u8A0A\u6E05\u55AE\u548C foo/ \u4E2D\u7684\u6240\u6709\u6A94\u6848\u5EFA\u7ACB\u4E00\u500B\u5B58\u6A94:\n jar --create --file classes.jar --manifest mymanifest -C foo/ .\n # \u5EFA\u7ACB\u4E00\u500B\u6A21\u7D44\u5316 jar \u5B58\u6A94\uFF0C\u5176\u4E2D\u7684\u6A21\u7D44\u63CF\u8FF0\u5340\u4F4D\u65BC\n # classes/module-info.class:\n jar --create --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ classes resources\n # \u5C07\u73FE\u6709\u7684\u975E\u6A21\u7D44\u5316 jar \u66F4\u65B0\u70BA\u6A21\u7D44\u5316 jar:\n jar --update --file foo.jar --main-class com.foo.Main --module-version 1.0\n     -C foo/ module-info.class\n # \u5EFA\u7ACB\u591A\u91CD\u7248\u672C\u7684 jar\uFF0C\u5C07\u90E8\u5206\u6A94\u6848\u653E\u7F6E\u5728 META-INF/versions/9 \u76EE\u9304\u4E2D:\n jar --create --file mr.jar -C foo classes --release 9 -C foo9 classes
 main.help.opt.main=\ \u4E3B\u8981\u4F5C\u696D\u6A21\u5F0F:\n
 main.help.opt.main.create=\  -c, --create               \u5EFA\u7ACB\u5B58\u6A94
 main.help.opt.main.generate-index=\  -i, --generate-index=FILE  \u70BA\u6307\u5B9A\u7684 jar \u5B58\u6A94\u7522\u751F\u7D22\u5F15\n                             \u8CC7\u8A0A
@@ -78,7 +80,7 @@
 main.help.opt.main.extract=\  -x, --extract              \u5F9E\u5B58\u6A94\u4E2D\u64F7\u53D6\u6307\u5B9A (\u6216\u6240\u6709) \u6A94\u6848
 main.help.opt.main.print-module-descriptor=\  -p, --print-module-descriptor  \u5217\u5370\u6A21\u7D44\u63CF\u8FF0\u5340
 main.help.opt.any=\ \u53EF\u5728\u4EFB\u4F55\u6A21\u5F0F\u4E0B\u4F7F\u7528\u7684\u4F5C\u696D\u4FEE\u98FE\u689D\u4EF6:\n\n  -C DIR                     \u8B8A\u66F4\u70BA\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\n                             \u4E0B\u5217\u6A94\u6848
-main.help.opt.any.file=\  -f, --file=FILE            \u5B58\u6A94\u6A94\u6848\u540D\u7A31
+main.help.opt.any.file=\  -f, --file=FILE            \u5B58\u6A94\u6A94\u6848\u540D\u7A31\n      --release VERSION      \u5C07\u6240\u6709\u4E0B\u5217\u6A94\u6848\u653E\u7F6E\u5728 jar \u7684\u5DF2\u555F\u52D5\u591A\u7248\u672C\n                             \u529F\u80FD\u76EE\u9304\u4E2D (\u4F8B\u5982 META-INF/versions/VERSION/)
 main.help.opt.any.verbose=\  -v, --verbose              \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA
 main.help.opt.create.update=\ \u53EA\u80FD\u5728\u5EFA\u7ACB\u548C\u66F4\u65B0\u6A21\u5F0F\u4E0B\u4F7F\u7528\u7684\u4F5C\u696D\u4FEE\u98FE\u689D\u4EF6:\n
 main.help.opt.create.update.main-class=\  -e, --main-class=CLASSNAME \u96A8\u9644\u65BC\u6A21\u7D44\u5316\u6216\u53EF\u57F7\u884C\n                             jar \u5B58\u6A94\u4E2D\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u7684\n                             \u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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;
@@ -58,8 +59,9 @@
 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.ModulePool;
-import jdk.tools.jlink.plugin.ModuleEntry;
+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 +146,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);
             }
         }
     }
@@ -170,10 +170,10 @@
     }
 
     @Override
-    public void storeFiles(ModulePool files) {
+    public void storeFiles(ResourcePool files) {
         try {
             files.entries().forEach(f -> {
-                if (!f.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
+                if (!f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
                     try {
                         accept(f);
                     } catch (IOException ioExp) {
@@ -181,17 +181,17 @@
                     }
                 }
             });
-            files.modules().forEach(m -> {
+            files.moduleView().modules().forEach(m -> {
                 // Only add modules that contain packages
-                if (!m.getAllPackages().isEmpty()) {
+                if (!m.packages().isEmpty()) {
                     // Skip the fake module used by FileCopierPlugin when copying files.
-                    if (m.getName().equals(FileCopierPlugin.FAKE_MODULE)) {
+                    if (m.name().equals(FileCopierPlugin.FAKE_MODULE)) {
                         return;
                     }
-                    modules.add(m.getName());
+                    modules.add(m.name());
                 }
             });
-            storeFiles(modules, files.getReleaseProperties());
+            storeFiles(modules, releaseProperties(files));
 
             if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
                 // launchers in the bin directory need execute permission
@@ -219,6 +219,27 @@
         }
     }
 
+    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));
+        });
+
+        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.
      *
@@ -226,16 +247,16 @@
      * @param modules The set of modules that the runtime image contains.
      * @throws IOException
      */
-    protected void prepareApplicationFiles(ModulePool imageContent, Set<String> modules) throws IOException {
+    protected void prepareApplicationFiles(ResourcePool imageContent, Set<String> modules) throws IOException {
         // generate launch scripts for the modules with a main class
         for (String module : modules) {
             String path = "/" + module + "/module-info.class";
-            Optional<ModuleEntry> res = imageContent.findEntry(path);
+            Optional<ResourcePoolEntry> res = imageContent.findEntry(path);
             if (!res.isPresent()) {
                 throw new IOException("module-info.class not found for " + module + " module");
             }
             Optional<String> mainClass;
-            ByteArrayInputStream stream = new ByteArrayInputStream(res.get().getBytes());
+            ByteArrayInputStream stream = new ByteArrayInputStream(res.get().contentBytes());
             mainClass = ModuleDescriptor.read(stream).mainClass();
             if (mainClass.isPresent()) {
                 Path cmd = root.resolve("bin").resolve(module);
@@ -298,14 +319,14 @@
         }
     }
 
-    private void accept(ModuleEntry file) throws IOException {
-        String fullPath = file.getPath();
-        String module = "/" + file.getModule() + "/";
+    private void accept(ResourcePoolEntry file) throws IOException {
+        String fullPath = file.path();
+        String module = "/" + file.moduleName() + "/";
         String filename = fullPath.substring(module.length());
         // Remove radical native|config|...
         filename = filename.substring(filename.indexOf('/') + 1);
-        try (InputStream in = file.stream()) {
-            switch (file.getType()) {
+        try (InputStream in = file.content()) {
+            switch (file.type()) {
                 case NATIVE_LIB:
                     writeEntry(in, destFile(nativeDir(filename), filename));
                     break;
@@ -317,6 +338,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/builder/ImageBuilder.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -29,7 +29,7 @@
 
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
 
 /**
  * Implement this interface to develop your own image layout. First the jimage
@@ -45,7 +45,7 @@
      * @param release the release properties
      * @throws PluginException
      */
-    public default void storeFiles(ModulePool content, Properties release) {
+    public default void storeFiles(ResourcePool content, Properties release) {
         storeFiles(content);
     }
 
@@ -55,7 +55,7 @@
      * @param content Pool of module content.
      * @throws PluginException
      */
-    public default void storeFiles(ModulePool content) {
+    public default void storeFiles(ResourcePool content) {
         throw new UnsupportedOperationException("storeFiles");
     }
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractModuleEntry.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * 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.tools.jlink.internal;
-
-import java.util.Objects;
-import jdk.tools.jlink.plugin.ModuleEntry;
-
-/**
- * A LinkModuleEntry is the elementary unit of data inside an image. It is
- * generally a file. e.g.: a java class file, a resource file, a shared library,
- * ...
- * <br>
- * A LinkModuleEntry is identified by a path of the form:
- * <ul>
- * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
- * name}</li>
- * <li>For other files (shared lib, launchers, config, ...):/{module name}/
- * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
- * </ul>
- */
-abstract class AbstractModuleEntry implements ModuleEntry {
-    private final String path;
-    private final String module;
-    private final Type type;
-
-    /**
-     * Create a new AbstractModuleEntry.
-     *
-     * @param module The module name.
-     * @param path The data path identifier.
-     * @param type The data type.
-     */
-    AbstractModuleEntry(String module, String path, Type type) {
-        this.module = Objects.requireNonNull(module);
-        this.path = Objects.requireNonNull(path);
-        this.type = Objects.requireNonNull(type);
-    }
-
-    @Override
-    public final String getModule() {
-        return module;
-    }
-
-    @Override
-    public final String getPath() {
-        return path;
-    }
-
-    @Override
-    public final Type getType() {
-        return type;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(this.path);
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof AbstractModuleEntry)) {
-            return false;
-        }
-        AbstractModuleEntry f = (AbstractModuleEntry) other;
-        return f.path.equals(path);
-    }
-
-    @Override
-    public String toString() {
-        return getPath();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractResourcePoolEntry.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,95 @@
+/*
+ * 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.tools.jlink.internal;
+
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+
+/**
+ * A LinkResourcePoolEntry is the elementary unit of data inside an image. It is
+ * generally a file. e.g.: a java class file, a resource file, a shared library,
+ * ...
+ * <br>
+ * A LinkResourcePoolEntry is identified by a path of the form:
+ * <ul>
+ * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
+ * name}</li>
+ * <li>For other files (shared lib, launchers, config, ...):/{module name}/
+ * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
+ * </ul>
+ */
+abstract class AbstractResourcePoolEntry implements ResourcePoolEntry {
+    private final String path;
+    private final String module;
+    private final Type type;
+
+    /**
+     * Create a new AbstractResourcePoolEntry.
+     *
+     * @param module The module name.
+     * @param path The data path identifier.
+     * @param type The data type.
+     */
+    AbstractResourcePoolEntry(String module, String path, Type type) {
+        this.module = Objects.requireNonNull(module);
+        this.path = Objects.requireNonNull(path);
+        this.type = Objects.requireNonNull(type);
+    }
+
+    @Override
+    public final String moduleName() {
+        return module;
+    }
+
+    @Override
+    public final String path() {
+        return path;
+    }
+
+    @Override
+    public final Type type() {
+        return type;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(this.path);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof AbstractResourcePoolEntry)) {
+            return false;
+        }
+        AbstractResourcePoolEntry f = (AbstractResourcePoolEntry) other;
+        return f.path.equals(path);
+    }
+
+    @Override
+    public String toString() {
+        return path();
+    }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ArchiveEntryModuleEntry.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * 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.tools.jlink.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UncheckedIOException;
-import java.util.Objects;
-import jdk.tools.jlink.plugin.ModuleEntry;
-
-/**
- * A ModuleEntry backed by a given Archive Entry.
- */
-final class ArchiveEntryModuleEntry extends AbstractModuleEntry {
-    private final Archive.Entry entry;
-
-    /**
-     * Create a new ArchiveModuleEntry.
-     *
-     * @param module The module name.
-     * @param path The data path identifier.
-     * @param entry The archive Entry.
-     */
-    ArchiveEntryModuleEntry(String module, String path, Archive.Entry entry) {
-        super(module, path, getImageFileType(Objects.requireNonNull(entry)));
-        this.entry = entry;
-    }
-
-    @Override
-    public InputStream stream() {
-        try {
-            return entry.stream();
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
-        }
-    }
-
-    @Override
-    public long getLength() {
-        return entry.size();
-    }
-
-    private static ModuleEntry.Type getImageFileType(Archive.Entry entry) {
-        switch(entry.type()) {
-            case CLASS_OR_RESOURCE:
-                return ModuleEntry.Type.CLASS_OR_RESOURCE;
-            case CONFIG:
-                return ModuleEntry.Type.CONFIG;
-            case NATIVE_CMD:
-                return ModuleEntry.Type.NATIVE_CMD;
-            case NATIVE_LIB:
-                return ModuleEntry.Type.NATIVE_LIB;
-            default:
-                return ModuleEntry.Type.OTHER;
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ArchiveEntryResourcePoolEntry.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,80 @@
+/*
+ * 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.tools.jlink.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+
+/**
+ * A ResourcePoolEntry backed by a given Archive Entry.
+ */
+final class ArchiveEntryResourcePoolEntry extends AbstractResourcePoolEntry {
+    private final Archive.Entry entry;
+
+    /**
+     * Create a new ArchiveResourcePoolEntry.
+     *
+     * @param module The module name.
+     * @param path The data path identifier.
+     * @param entry The archive Entry.
+     */
+    ArchiveEntryResourcePoolEntry(String module, String path, Archive.Entry entry) {
+        super(module, path, getImageFileType(Objects.requireNonNull(entry)));
+        this.entry = entry;
+    }
+
+    @Override
+    public InputStream content() {
+        try {
+            return entry.stream();
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
+    }
+
+    @Override
+    public long contentLength() {
+        return entry.size();
+    }
+
+    private static ResourcePoolEntry.Type getImageFileType(Archive.Entry entry) {
+        switch(entry.type()) {
+            case CLASS_OR_RESOURCE:
+                return ResourcePoolEntry.Type.CLASS_OR_RESOURCE;
+            case CONFIG:
+                return ResourcePoolEntry.Type.CONFIG;
+            case NATIVE_CMD:
+                return ResourcePoolEntry.Type.NATIVE_CMD;
+            case NATIVE_LIB:
+                return ResourcePoolEntry.Type.NATIVE_LIB;
+            default:
+                return ResourcePoolEntry.Type.OTHER;
+        }
+    }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ByteArrayModuleEntry.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * 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.tools.jlink.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UncheckedIOException;
-import java.util.Objects;
-
-/**
- * A ModuleEntry backed by a given byte[].
- */
-class ByteArrayModuleEntry extends AbstractModuleEntry {
-    private final byte[] buffer;
-
-    /**
-     * Create a new ByteArrayModuleEntry.
-     *
-     * @param module The module name.
-     * @param path The data path identifier.
-     * @param type The data type.
-     * @param buf  The byte buffer.
-     */
-    ByteArrayModuleEntry(String module, String path, Type type, byte[] buffer) {
-        super(module, path, type);
-        this.buffer = Objects.requireNonNull(buffer);
-    }
-
-    @Override
-    public byte[] getBytes() {
-        return buffer.clone();
-    }
-
-    @Override
-    public InputStream stream() {
-        return new ByteArrayInputStream(buffer);
-    }
-
-    @Override
-    public void write(OutputStream out) {
-        try {
-            out.write(buffer);
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
-        }
-    }
-
-    @Override
-    public long getLength() {
-        return buffer.length;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ByteArrayResourcePoolEntry.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,77 @@
+/*
+ * 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.tools.jlink.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.util.Objects;
+
+/**
+ * A ResourcePoolEntry backed by a given byte[].
+ */
+class ByteArrayResourcePoolEntry extends AbstractResourcePoolEntry {
+    private final byte[] buffer;
+
+    /**
+     * Create a new ByteArrayResourcePoolEntry.
+     *
+     * @param module The module name.
+     * @param path The data path identifier.
+     * @param type The data type.
+     * @param buf  The byte buffer.
+     */
+    ByteArrayResourcePoolEntry(String module, String path, Type type, byte[] buffer) {
+        super(module, path, type);
+        this.buffer = Objects.requireNonNull(buffer);
+    }
+
+    @Override
+    public byte[] contentBytes() {
+        return buffer.clone();
+    }
+
+    @Override
+    public InputStream content() {
+        return new ByteArrayInputStream(buffer);
+    }
+
+    @Override
+    public void write(OutputStream out) {
+        try {
+            out.write(buffer);
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
+    }
+
+    @Override
+    public long contentLength() {
+        return buffer.length;
+    }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java	Wed Jul 05 22:01:14 2017 +0200
@@ -42,9 +42,10 @@
 import java.util.stream.Stream;
 import jdk.tools.jlink.internal.Archive.Entry;
 import jdk.tools.jlink.internal.Archive.Entry.EntryType;
-import jdk.tools.jlink.internal.ModulePoolImpl.CompressedModuleData;
+import jdk.tools.jlink.internal.ResourcePoolManager.CompressedModuleData;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 /**
  * An image (native endian.)
@@ -140,7 +141,7 @@
                                     }));
             ByteOrder order = ByteOrder.nativeOrder();
             BasicImageWriter writer = new BasicImageWriter(order);
-            ModulePoolImpl pool = createPools(archives, entriesForModule, order, writer);
+            ResourcePoolManager pool = createPoolManager(archives, entriesForModule, order, writer);
             try (OutputStream fos = Files.newOutputStream(jimageFile);
                     BufferedOutputStream bos = new BufferedOutputStream(fos);
                     DataOutputStream out = new DataOutputStream(bos)) {
@@ -158,52 +159,61 @@
             ByteOrder byteOrder)
             throws IOException {
         BasicImageWriter writer = new BasicImageWriter(byteOrder);
-        ModulePoolImpl allContent = createPools(archives,
+        ResourcePoolManager allContent = createPoolManager(archives,
                 entriesForModule, byteOrder, writer);
-        ModulePoolImpl result = generateJImage(allContent,
+        ResourcePool result = generateJImage(allContent,
              writer, plugins, plugins.getJImageFileOutputStream());
 
         //Handle files.
         try {
-            plugins.storeFiles(allContent, result, writer);
+            plugins.storeFiles(allContent.resourcePool(), result, writer);
         } catch (Exception ex) {
+            if (JlinkTask.DEBUG) {
+                ex.printStackTrace();
+            }
             throw new IOException(ex);
         }
     }
 
-    private static ModulePoolImpl generateJImage(ModulePoolImpl allContent,
+    private static ResourcePool generateJImage(ResourcePoolManager allContent,
             BasicImageWriter writer,
             ImagePluginStack pluginSupport,
             DataOutputStream out
     ) throws IOException {
-        ModulePoolImpl resultResources;
+        ResourcePool resultResources;
         try {
             resultResources = pluginSupport.visitResources(allContent);
         } catch (PluginException pe) {
+            if (JlinkTask.DEBUG) {
+                pe.printStackTrace();
+            }
             throw pe;
         } catch (Exception ex) {
+            if (JlinkTask.DEBUG) {
+                ex.printStackTrace();
+            }
             throw new IOException(ex);
         }
         Set<String> duplicates = new HashSet<>();
         long[] offset = new long[1];
 
-        List<ModuleEntry> content = new ArrayList<>();
+        List<ResourcePoolEntry> content = new ArrayList<>();
         List<String> paths = new ArrayList<>();
                  // the order of traversing the resources and the order of
         // the module content being written must be the same
         resultResources.entries().forEach(res -> {
-            if (res.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
-                String path = res.getPath();
+            if (res.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+                String path = res.path();
                 content.add(res);
-                long uncompressedSize = res.getLength();
+                long uncompressedSize = res.contentLength();
                 long compressedSize = 0;
                 if (res instanceof CompressedModuleData) {
                     CompressedModuleData comp
                             = (CompressedModuleData) res;
-                    compressedSize = res.getLength();
+                    compressedSize = res.contentLength();
                     uncompressedSize = comp.getUncompressedSize();
                 }
-                long onFileSize = res.getLength();
+                long onFileSize = res.contentLength();
 
                 if (duplicates.contains(path)) {
                     System.err.format("duplicate resource \"%s\", skipping%n",
@@ -239,11 +249,11 @@
         return resultResources;
     }
 
-    private static ModulePoolImpl createPools(Set<Archive> archives,
+    private static ResourcePoolManager createPoolManager(Set<Archive> archives,
             Map<String, List<Entry>> entriesForModule,
             ByteOrder byteOrder,
             BasicImageWriter writer) throws IOException {
-        ModulePoolImpl resources = new ModulePoolImpl(byteOrder, new StringTable() {
+        ResourcePoolManager resources = new ResourcePoolManager(byteOrder, new StringTable() {
 
             @Override
             public int addString(String str) {
@@ -273,7 +283,7 @@
                     path = "/" + mn + "/" + entry.path();
                 }
 
-                resources.add(new ArchiveEntryModuleEntry(mn, path, entry));
+                resources.add(new ArchiveEntryResourcePoolEntry(mn, path, entry));
             }
         }
         return resources;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java	Wed Jul 05 22:01:14 2017 +0200
@@ -37,7 +37,7 @@
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.Plugin.Category;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
 
 /**
  * Plugins configuration.
@@ -122,7 +122,7 @@
                 }
 
                 @Override
-                public void storeFiles(ModulePool files) {
+                public void storeFiles(ResourcePool files) {
                     throw new PluginException("No directory setup to store files");
                 }
             };
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java	Wed Jul 05 22:01:14 2017 +0200
@@ -46,9 +46,10 @@
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.builder.ImageBuilder;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.LinkModule;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
 
 /**
  * Plugins Stack. Plugins entry point to apply transformations onto resources
@@ -61,36 +62,47 @@
         ExecutableImage retrieve(ImagePluginStack stack) throws IOException;
     }
 
-    public static final class OrderedResourcePool extends ModulePoolImpl {
+    public static final class OrderedResourcePoolManager extends ResourcePoolManager {
+        class OrderedResourcePool extends ResourcePoolImpl {
+            List<ResourcePoolEntry> getOrderedList() {
+                return OrderedResourcePoolManager.this.getOrderedList();
+            }
+        }
 
-        private final List<ModuleEntry> orderedList = new ArrayList<>();
+        private final List<ResourcePoolEntry> orderedList = new ArrayList<>();
+        private final ResourcePoolImpl poolImpl = new OrderedResourcePool();
 
-        public OrderedResourcePool(ByteOrder order, StringTable table) {
+        public OrderedResourcePoolManager(ByteOrder order, StringTable table) {
             super(order, table);
         }
 
+        @Override
+        public ResourcePool resourcePool() {
+            return poolImpl;
+        }
+
         /**
          * Add a resource.
          *
          * @param resource The Resource to add.
          */
         @Override
-        public void add(ModuleEntry resource) {
+        public void add(ResourcePoolEntry resource) {
             super.add(resource);
             orderedList.add(resource);
         }
 
-        List<ModuleEntry> getOrderedList() {
+        List<ResourcePoolEntry> getOrderedList() {
             return Collections.unmodifiableList(orderedList);
         }
     }
 
-    private final static class CheckOrderResourcePool extends ModulePoolImpl {
+    private final static class CheckOrderResourcePoolManager extends ResourcePoolManager {
 
-        private final List<ModuleEntry> orderedList;
+        private final List<ResourcePoolEntry> orderedList;
         private int currentIndex;
 
-        public CheckOrderResourcePool(ByteOrder order, List<ModuleEntry> orderedList, StringTable table) {
+        public CheckOrderResourcePoolManager(ByteOrder order, List<ResourcePoolEntry> orderedList, StringTable table) {
             super(order, table);
             this.orderedList = Objects.requireNonNull(orderedList);
         }
@@ -101,10 +113,10 @@
          * @param resource The Resource to add.
          */
         @Override
-        public void add(ModuleEntry resource) {
-            ModuleEntry ordered = orderedList.get(currentIndex);
+        public void add(ResourcePoolEntry resource) {
+            ResourcePoolEntry ordered = orderedList.get(currentIndex);
             if (!resource.equals(ordered)) {
-                throw new PluginException("Resource " + resource.getPath() + " not in the right order");
+                throw new PluginException("Resource " + resource.path() + " not in the right order");
             }
             super.add(resource);
             currentIndex += 1;
@@ -209,17 +221,16 @@
      * @return The result of the visit.
      * @throws IOException
      */
-    public ModulePoolImpl visitResources(ModulePoolImpl resources)
+    public ResourcePool visitResources(ResourcePoolManager resources)
             throws Exception {
         Objects.requireNonNull(resources);
-        resources.setReadOnly();
         if (resources.isEmpty()) {
-            return new ModulePoolImpl(resources.getByteOrder(),
-                    resources.getStringTable());
+            return new ResourcePoolManager(resources.byteOrder(),
+                    resources.getStringTable()).resourcePool();
         }
         PreVisitStrings previsit = new PreVisitStrings();
         resourcePrevisitors.stream().forEach((p) -> {
-            p.previsit(resources, previsit);
+            p.previsit(resources.resourcePool(), previsit);
         });
 
         // Store the strings resulting from the previsit.
@@ -228,89 +239,85 @@
             resources.getStringTable().addString(s);
         });
 
-        ModulePoolImpl current = resources;
-        List<ModuleEntry> frozenOrder = null;
+        ResourcePool resPool = resources.resourcePool();
+        List<ResourcePoolEntry> frozenOrder = null;
         for (Plugin p : plugins) {
-            current.setReadOnly();
-            ModulePoolImpl output = null;
+            ResourcePoolManager resMgr = null;
             if (p == lastSorter) {
                 if (frozenOrder != null) {
                     throw new Exception("Order of resources is already frozen. Plugin "
                             + p.getName() + " is badly located");
                 }
                 // Create a special Resource pool to compute the indexes.
-                output = new OrderedResourcePool(current.getByteOrder(),
+                resMgr = new OrderedResourcePoolManager(resPool.byteOrder(),
                         resources.getStringTable());
             } else {// If we have an order, inject it
                 if (frozenOrder != null) {
-                    output = new CheckOrderResourcePool(current.getByteOrder(),
+                    resMgr = new CheckOrderResourcePoolManager(resPool.byteOrder(),
                             frozenOrder, resources.getStringTable());
                 } else {
-                    output = new ModulePoolImpl(current.getByteOrder(),
+                    resMgr = new ResourcePoolManager(resPool.byteOrder(),
                             resources.getStringTable());
                 }
             }
-            p.visit(current, output);
-            if (output.isEmpty()) {
+            resPool = p.transform(resPool, resMgr.resourcePoolBuilder());
+            if (resPool.isEmpty()) {
                 throw new Exception("Invalid resource pool for plugin " + p);
             }
-            if (output instanceof OrderedResourcePool) {
-                frozenOrder = ((OrderedResourcePool) output).getOrderedList();
+            if (resPool instanceof OrderedResourcePoolManager.OrderedResourcePool) {
+                frozenOrder = ((OrderedResourcePoolManager.OrderedResourcePool)resPool).getOrderedList();
             }
-
-            current = output;
         }
-        current.setReadOnly();
-        return current;
+        return resPool;
     }
 
     /**
-     * This pool wrap the original pool and automatically uncompress ModuleEntry
+     * This pool wrap the original pool and automatically uncompress ResourcePoolEntry
      * if needed.
      */
-    private class LastPool implements ModulePool {
-        private class LastModule implements LinkModule {
+    private class LastPoolManager extends ResourcePoolManager {
+        private class LastModule implements ResourcePoolModule {
 
-            final LinkModule module;
+            final ResourcePoolModule module;
+            // lazily initialized
+            ModuleDescriptor descriptor;
 
-            LastModule(LinkModule module) {
+            LastModule(ResourcePoolModule module) {
                 this.module = module;
             }
 
             @Override
-            public String getName() {
-                return module.getName();
+            public String name() {
+                return module.name();
             }
 
             @Override
-            public Optional<ModuleEntry> findEntry(String path) {
-                Optional<ModuleEntry> d = module.findEntry(path);
+            public Optional<ResourcePoolEntry> findEntry(String path) {
+                Optional<ResourcePoolEntry> d = module.findEntry(path);
                 return d.isPresent()? Optional.of(getUncompressed(d.get())) : Optional.empty();
             }
 
             @Override
-            public ModuleDescriptor getDescriptor() {
-                return module.getDescriptor();
+            public ModuleDescriptor descriptor() {
+                if (descriptor == null) {
+                    descriptor = ResourcePoolManager.readModuleDescriptor(this);
+                }
+                return descriptor;
             }
 
             @Override
-            public void add(ModuleEntry data) {
-                throw new PluginException("pool is readonly");
-            }
-
-            @Override
-            public Set<String> getAllPackages() {
-                return module.getAllPackages();
+            public Set<String> packages() {
+                return module.packages();
             }
 
             @Override
             public String toString() {
-                return getName();
+                return name();
             }
 
             @Override
-            public Stream<ModuleEntry> entries() {
-                List<ModuleEntry> lst = new ArrayList<>();
+            public Stream<ResourcePoolEntry> entries() {
+                List<ResourcePoolEntry> lst = new ArrayList<>();
                 module.entries().forEach(md -> {
                     lst.add(getUncompressed(md));
                 });
@@ -318,31 +325,27 @@
             }
 
             @Override
-            public int getEntryCount() {
-                return module.getEntryCount();
+            public int entryCount() {
+                return module.entryCount();
             }
         }
-        private final ModulePoolImpl pool;
+
+        private final ResourcePool pool;
         Decompressor decompressor = new Decompressor();
-        Collection<ModuleEntry> content;
+        Collection<ResourcePoolEntry> content;
 
-        LastPool(ModulePoolImpl pool) {
+        LastPoolManager(ResourcePool pool) {
             this.pool = pool;
         }
 
         @Override
-        public boolean isReadOnly() {
-            return true;
-        }
-
-        @Override
-        public void add(ModuleEntry resource) {
+        public void add(ResourcePoolEntry resource) {
             throw new PluginException("pool is readonly");
         }
 
         @Override
-        public Optional<LinkModule> findModule(String name) {
-            Optional<LinkModule> module = pool.findModule(name);
+        public Optional<ResourcePoolModule> findModule(String name) {
+            Optional<ResourcePoolModule> module = pool.moduleView().findModule(name);
             return module.isPresent()? Optional.of(new LastModule(module.get())) : Optional.empty();
         }
 
@@ -352,17 +355,17 @@
          * @return The collection of modules.
          */
         @Override
-        public Stream<? extends LinkModule> modules() {
-            List<LinkModule> modules = new ArrayList<>();
-            pool.modules().forEach(m -> {
+        public Stream<ResourcePoolModule> modules() {
+            List<ResourcePoolModule> modules = new ArrayList<>();
+            pool.moduleView().modules().forEach(m -> {
                 modules.add(new LastModule(m));
             });
             return modules.stream();
         }
 
         @Override
-        public int getModuleCount() {
-            return pool.getModuleCount();
+        public int moduleCount() {
+            return pool.moduleView().moduleCount();
         }
 
         /**
@@ -371,7 +374,7 @@
          * @return The stream of resources;
          */
         @Override
-        public Stream<? extends ModuleEntry> entries() {
+        public Stream<ResourcePoolEntry> entries() {
             if (content == null) {
                 content = new ArrayList<>();
                 pool.entries().forEach(md -> {
@@ -382,8 +385,8 @@
         }
 
         @Override
-        public int getEntryCount() {
-            return pool.getEntryCount();
+        public int entryCount() {
+            return pool.entryCount();
         }
 
         /**
@@ -393,22 +396,22 @@
          * @return A Resource instance if the resource is found
          */
         @Override
-        public Optional<ModuleEntry> findEntry(String path) {
+        public Optional<ResourcePoolEntry> findEntry(String path) {
             Objects.requireNonNull(path);
-            Optional<ModuleEntry> res = pool.findEntry(path);
+            Optional<ResourcePoolEntry> res = pool.findEntry(path);
             return res.isPresent()? Optional.of(getUncompressed(res.get())) : Optional.empty();
         }
 
         @Override
-        public Optional<ModuleEntry> findEntryInContext(String path, ModuleEntry context) {
+        public Optional<ResourcePoolEntry> findEntryInContext(String path, ResourcePoolEntry context) {
             Objects.requireNonNull(path);
             Objects.requireNonNull(context);
-            Optional<ModuleEntry> res = pool.findEntryInContext(path, context);
+            Optional<ResourcePoolEntry> res = pool.findEntryInContext(path, context);
             return res.map(this::getUncompressed);
         }
 
         @Override
-        public boolean contains(ModuleEntry res) {
+        public boolean contains(ResourcePoolEntry res) {
             return pool.contains(res);
         }
 
@@ -418,29 +421,22 @@
         }
 
         @Override
-        public void transformAndCopy(Function<ModuleEntry, ModuleEntry> visitor, ModulePool output) {
-            pool.transformAndCopy(visitor, output);
-        }
-
-        @Override
-        public ByteOrder getByteOrder() {
-            return pool.getByteOrder();
+        public ByteOrder byteOrder() {
+            return pool.byteOrder();
         }
 
-        @Override
-        public Map<String, String> getReleaseProperties() {
-            return Collections.unmodifiableMap(pool.getReleaseProperties());
-        }
-
-        private ModuleEntry getUncompressed(ModuleEntry res) {
+        private ResourcePoolEntry getUncompressed(ResourcePoolEntry res) {
             if (res != null) {
-                if (res instanceof ModulePoolImpl.CompressedModuleData) {
+                if (res instanceof ResourcePoolManager.CompressedModuleData) {
                     try {
-                        byte[] bytes = decompressor.decompressResource(getByteOrder(),
-                                (int offset) -> pool.getStringTable().getString(offset),
-                                res.getBytes());
-                        res = res.create(bytes);
+                        byte[] bytes = decompressor.decompressResource(byteOrder(),
+                                (int offset) -> ((ResourcePoolImpl)pool).getStringTable().getString(offset),
+                                res.contentBytes());
+                        res = res.copyWithContent(bytes);
                     } catch (IOException ex) {
+                        if (JlinkTask.DEBUG) {
+                            ex.printStackTrace();
+                        }
                         throw new PluginException(ex);
                     }
                 }
@@ -457,24 +453,12 @@
      * @param writer
      * @throws java.lang.Exception
      */
-    public void storeFiles(ModulePoolImpl original, ModulePoolImpl transformed,
+    public void storeFiles(ResourcePool original, ResourcePool transformed,
             BasicImageWriter writer)
             throws Exception {
         Objects.requireNonNull(original);
         Objects.requireNonNull(transformed);
-        Optional<LinkModule> javaBase = transformed.findModule("java.base");
-        javaBase.ifPresent(mod -> {
-            try {
-                Map<String, String> release = transformed.getReleaseProperties();
-                // fill release information available from transformed "java.base" module!
-                ModuleDescriptor desc = mod.getDescriptor();
-                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 LastPool(transformed));
+        imageBuilder.storeFiles(new LastPoolManager(transformed).resourcePool());
     }
 
     public ExecutableImage getExecutableImage() throws IOException {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Wed Jul 05 22:01:14 2017 +0200
@@ -61,7 +61,7 @@
  * ## Should use jdk.joptsimple some day.
  */
 public class JlinkTask {
-    private static final boolean DEBUG = Boolean.getBoolean("jlink.debug");
+    static final boolean DEBUG = Boolean.getBoolean("jlink.debug");
 
     private static <T extends Throwable> void fail(Class<T> type,
             String format,
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModuleEntryFactory.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * 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.tools.jlink.internal;
-
-import java.nio.file.Path;
-import java.util.Objects;
-import jdk.tools.jlink.plugin.ModuleEntry;
-
-public final class ModuleEntryFactory {
-    private ModuleEntryFactory() {}
-
-    public static ModuleEntry create(String path,
-            ModuleEntry.Type type, byte[] content) {
-        return new ByteArrayModuleEntry(moduleFrom(path), path, type, content);
-    }
-
-    public static ModuleEntry create(String path,
-            ModuleEntry.Type type, Path file) {
-        return new PathModuleEntry(moduleFrom(path), path, type, file);
-    }
-
-    public static ModuleEntry create(ModuleEntry original, byte[] content) {
-        return new ByteArrayModuleEntry(original.getModule(),
-                original.getPath(), original.getType(), content);
-    }
-
-    public static ModuleEntry create(ModuleEntry original, Path file) {
-        return new PathModuleEntry(original.getModule(),
-                original.getPath(), original.getType(), file);
-    }
-
-    static String moduleFrom(String path) {
-        Objects.requireNonNull(path);
-        if (path.isEmpty() || path.charAt(0) != '/') {
-            throw new IllegalArgumentException(path + " must start with /");
-        }
-        int idx = path.indexOf('/', 1);
-        if (idx == -1) {
-            throw new IllegalArgumentException("/ missing after module: " + path);
-        }
-        return path.substring(1, idx);
-    }
-
-    static String packageFrom(String path) {
-        Objects.requireNonNull(path);
-        int idx = path.lastIndexOf('/');
-        if (idx == -1) {
-            throw new IllegalArgumentException("/ missing from path: " + path);
-        }
-        if (path.startsWith("/")) {
-            int jdx = path.indexOf('/', 1);
-            if (jdx == -1) {
-                throw new IllegalArgumentException("/ missing after module: " + path);
-            }
-            return path.substring(jdx + 1, idx);
-        } else {
-            return path.substring(0, idx);
-        }
-    }
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModulePoolImpl.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,436 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.tools.jlink.internal;
-
-import java.lang.module.ModuleDescriptor;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Stream;
-import jdk.internal.jimage.decompressor.CompressedResourceHeader;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.LinkModule;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
-
-/**
- * Pool of module data.
- */
-public class ModulePoolImpl implements ModulePool {
-
-    private class ModuleImpl implements LinkModule {
-
-        final Map<String, ModuleEntry> moduleContent = new LinkedHashMap<>();
-        private ModuleDescriptor descriptor;
-        final String name;
-
-        private ModuleImpl(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
-        public Optional<ModuleEntry> findEntry(String path) {
-            if (!path.startsWith("/")) {
-                path = "/" + path;
-            }
-            if (!path.startsWith("/" + name)) {
-                path = "/" + name + path;
-            }
-            return Optional.ofNullable(moduleContent.get(path));
-        }
-
-        @Override
-        public ModuleDescriptor getDescriptor() {
-            if (descriptor == null) {
-                String p = "/" + name + "/module-info.class";
-                Optional<ModuleEntry> content = findEntry(p);
-                if (!content.isPresent()) {
-                    throw new PluginException("No module-info for " + name
-                            + " module");
-                }
-                ByteBuffer bb = ByteBuffer.wrap(content.get().getBytes());
-                descriptor = ModuleDescriptor.read(bb);
-            }
-            return descriptor;
-        }
-
-        @Override
-        public void add(ModuleEntry data) {
-            if (isReadOnly()) {
-                throw new PluginException("ModulePool is readonly");
-            }
-            Objects.requireNonNull(data);
-            if (!data.getModule().equals(name)) {
-                throw new PluginException("Can't add resource " + data.getPath()
-                        + " to module " + name);
-            }
-            ModulePoolImpl.this.add(data);
-        }
-
-        @Override
-        public Set<String> getAllPackages() {
-            Set<String> pkgs = new HashSet<>();
-            moduleContent.values().stream().filter(m -> m.getType().
-                    equals(ModuleEntry.Type.CLASS_OR_RESOURCE)).forEach(res -> {
-                // Module metadata only contains packages with .class files
-                if (ImageFileCreator.isClassPackage(res.getPath())) {
-                    String[] split = ImageFileCreator.splitPath(res.getPath());
-                    String pkg = split[1];
-                    if (pkg != null && !pkg.isEmpty()) {
-                        pkgs.add(pkg);
-                    }
-                }
-            });
-            return pkgs;
-        }
-
-        @Override
-        public String toString() {
-            return getName();
-        }
-
-        @Override
-        public Stream<? extends ModuleEntry> entries() {
-            return moduleContent.values().stream();
-        }
-
-        @Override
-        public int getEntryCount() {
-            return moduleContent.values().size();
-        }
-    }
-
-    private final Map<String, ModuleEntry> resources = new LinkedHashMap<>();
-    private final Map<String, ModuleImpl> modules = new LinkedHashMap<>();
-    private final ModuleImpl fileCopierModule = new ModuleImpl(FileCopierPlugin.FAKE_MODULE);
-    private Map<String, String> releaseProps = new HashMap<>();
-
-    private final ByteOrder order;
-
-    private boolean isReadOnly;
-    private final StringTable table;
-
-    public ModulePoolImpl() {
-        this(ByteOrder.nativeOrder());
-    }
-
-    public ModulePoolImpl(ByteOrder order) {
-        this(order, new StringTable() {
-
-            @Override
-            public int addString(String str) {
-                return -1;
-            }
-
-            @Override
-            public String getString(int id) {
-                return null;
-            }
-        });
-    }
-
-    public ModulePoolImpl(ByteOrder order, StringTable table) {
-        this.order = Objects.requireNonNull(order);
-        this.table = Objects.requireNonNull(table);
-    }
-
-    /**
-     * Add a ModuleEntry.
-     *
-     * @param data The ModuleEntry to add.
-     */
-    @Override
-    public void add(ModuleEntry data) {
-        if (isReadOnly()) {
-            throw new PluginException("ModulePool is readonly");
-        }
-        Objects.requireNonNull(data);
-        if (resources.get(data.getPath()) != null) {
-            throw new PluginException("Resource " + data.getPath()
-                    + " already present");
-        }
-        String modulename = data.getModule();
-        ModuleImpl m = 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 ModuleImpl(modulename);
-            modules.put(modulename, m);
-        }
-        resources.put(data.getPath(), data);
-        m.moduleContent.put(data.getPath(), data);
-    }
-
-    /**
-     * Retrieves the module for the provided name.
-     *
-     * @param name The module name
-     * @return the module of matching name, if found
-     */
-    @Override
-    public Optional<LinkModule> findModule(String name) {
-        Objects.requireNonNull(name);
-        return Optional.ofNullable(modules.get(name));
-    }
-
-    /**
-     * The stream of modules contained in this ModulePool.
-     *
-     * @return The stream of modules.
-     */
-    @Override
-    public Stream<? extends LinkModule> modules() {
-        return modules.values().stream();
-    }
-
-    /**
-     * Return the number of LinkModule count in this ModulePool.
-     *
-     * @return the module count.
-     */
-    @Override
-    public int getModuleCount() {
-        return modules.size();
-    }
-
-    /**
-     * Get all ModuleEntry contained in this ModulePool instance.
-     *
-     * @return The stream of LinkModuleEntries.
-     */
-    @Override
-    public Stream<? extends ModuleEntry> entries() {
-        return resources.values().stream();
-    }
-
-    /**
-     * Return the number of ModuleEntry count in this ModulePool.
-     *
-     * @return the entry count.
-     */
-    @Override
-    public int getEntryCount() {
-        return resources.values().size();
-    }
-
-    /**
-     * Get the ModuleEntry for the passed path.
-     *
-     * @param path A data path
-     * @return A ModuleEntry instance or null if the data is not found
-     */
-    @Override
-    public Optional<ModuleEntry> findEntry(String path) {
-        Objects.requireNonNull(path);
-        return Optional.ofNullable(resources.get(path));
-    }
-
-    /**
-     * Get the ModuleEntry for the passed path restricted to supplied context.
-     *
-     * @param path A data path
-     * @param context A context of the search
-     * @return A ModuleEntry instance or null if the data is not found
-     */
-    @Override
-    public Optional<ModuleEntry> findEntryInContext(String path, ModuleEntry context) {
-        Objects.requireNonNull(path);
-        Objects.requireNonNull(context);
-        LinkModule module = modules.get(context.getModule());
-        Objects.requireNonNull(module);
-        Optional<ModuleEntry> entry = module.findEntry(path);
-        // Navigating other modules via requires and exports is problematic
-        // since we cannot construct the runtime model of loaders and layers.
-        return entry;
-     }
-
-    /**
-     * Check if the ModulePool contains the given ModuleEntry.
-     *
-     * @param data The module data to check existence for.
-     * @return The module data or null if not found.
-     */
-    @Override
-    public boolean contains(ModuleEntry data) {
-        Objects.requireNonNull(data);
-        return findEntry(data.getPath()).isPresent();
-    }
-
-    /**
-     * Check if the ModulePool contains some content at all.
-     *
-     * @return True, no content, false otherwise.
-     */
-    @Override
-    public boolean isEmpty() {
-        return resources.isEmpty();
-    }
-
-    /**
-     * Visit each ModuleEntry in this ModulePool to transform it and
-     * copy the transformed ModuleEntry to the output ModulePool.
-     *
-     * @param transform The function called for each ModuleEntry found in
-     * the ModulePool. The transform function should return a
-     * ModuleEntry instance which will be added to the output or it should
-     * return null if the passed ModuleEntry is to be ignored for the
-     * output.
-     *
-     * @param output The ModulePool to be filled with Visitor returned
-     * ModuleEntry.
-     */
-    @Override
-    public void transformAndCopy(Function<ModuleEntry, ModuleEntry> transform,
-            ModulePool output) {
-        entries().forEach(resource -> {
-            ModuleEntry res = transform.apply(resource);
-            if (res != null) {
-                output.add(res);
-            }
-        });
-    }
-
-    /**
-     * The ByteOrder currently in use when generating the jimage file.
-     *
-     * @return The ByteOrder.
-     */
-    @Override
-    public ByteOrder getByteOrder() {
-        return order;
-    }
-
-    @Override
-    public Map<String, String> getReleaseProperties() {
-        return isReadOnly()? Collections.unmodifiableMap(releaseProps) : releaseProps;
-    }
-
-    public StringTable getStringTable() {
-        return table;
-    }
-
-    /**
-     * Make this Resources instance read-only. No resource can be added.
-     */
-    public void setReadOnly() {
-        isReadOnly = true;
-    }
-
-    /**
-     * Read only state.
-     *
-     * @return true if readonly false otherwise.
-     */
-    @Override
-    public boolean isReadOnly() {
-        return isReadOnly;
-    }
-
-    /**
-     * A resource that has been compressed.
-     */
-    public static final class CompressedModuleData extends ByteArrayModuleEntry {
-
-        final long uncompressed_size;
-
-        private CompressedModuleData(String module, String path,
-                byte[] content, long uncompressed_size) {
-            super(module, path, ModuleEntry.Type.CLASS_OR_RESOURCE, content);
-            this.uncompressed_size = uncompressed_size;
-        }
-
-        public long getUncompressedSize() {
-            return uncompressed_size;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (!(other instanceof CompressedModuleData)) {
-                return false;
-            }
-            CompressedModuleData f = (CompressedModuleData) other;
-            return f.getPath().equals(getPath());
-        }
-
-        @Override
-        public int hashCode() {
-            return super.hashCode();
-        }
-    }
-
-    public static CompressedModuleData newCompressedResource(ModuleEntry original,
-            ByteBuffer compressed,
-            String plugin, String pluginConfig, StringTable strings,
-            ByteOrder order) {
-        Objects.requireNonNull(original);
-        Objects.requireNonNull(compressed);
-        Objects.requireNonNull(plugin);
-
-        boolean isTerminal = !(original instanceof CompressedModuleData);
-        long uncompressed_size = original.getLength();
-        if (original instanceof CompressedModuleData) {
-            CompressedModuleData comp = (CompressedModuleData) original;
-            uncompressed_size = comp.getUncompressedSize();
-        }
-        int nameOffset = strings.addString(plugin);
-        int configOffset = -1;
-        if (pluginConfig != null) {
-            configOffset = strings.addString(plugin);
-        }
-        CompressedResourceHeader rh
-                = new CompressedResourceHeader(compressed.limit(), original.getLength(),
-                        nameOffset, configOffset, isTerminal);
-        // Merge header with content;
-        byte[] h = rh.getBytes(order);
-        ByteBuffer bb = ByteBuffer.allocate(compressed.limit() + h.length);
-        bb.order(order);
-        bb.put(h);
-        bb.put(compressed);
-        byte[] contentWithHeader = bb.array();
-
-        CompressedModuleData compressedResource
-                = new CompressedModuleData(original.getModule(), original.getPath(),
-                        contentWithHeader, uncompressed_size);
-        return compressedResource;
-    }
-
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PathModuleEntry.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * 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 "Classfile" 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.tools.jlink.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UncheckedIOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Objects;
-
-/**
- * A ModuleEntry backed by a given nio Path.
- */
-public class PathModuleEntry extends AbstractModuleEntry {
-    private final Path file;
-
-    /**
-     * Create a new PathModuleEntry.
-     *
-     * @param module The module name.
-     * @param path The path for the resource content.
-     * @param type The data type.
-     * @param file The data file identifier.
-     */
-    public PathModuleEntry(String module, String path, Type type, Path file) {
-        super(module, path, type);
-        this.file = Objects.requireNonNull(file);
-        if (!Files.isRegularFile(file)) {
-            throw new IllegalArgumentException(file + " not a file");
-        }
-    }
-
-    @Override
-    public final InputStream stream() {
-        try {
-            return Files.newInputStream(file);
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
-        }
-    }
-
-    @Override
-    public final long getLength() {
-        try {
-            return Files.size(file);
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PathResourcePoolEntry.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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 "Classfile" 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.tools.jlink.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Objects;
+
+/**
+ * A ResourcePoolEntry backed by a given nio Path.
+ */
+public class PathResourcePoolEntry extends AbstractResourcePoolEntry {
+    private final Path file;
+
+    /**
+     * Create a new PathResourcePoolEntry.
+     *
+     * @param module The module name.
+     * @param path The path for the resource content.
+     * @param type The data type.
+     * @param file The data file identifier.
+     */
+    public PathResourcePoolEntry(String module, String path, Type type, Path file) {
+        super(module, path, type);
+        this.file = Objects.requireNonNull(file);
+        if (!Files.isRegularFile(file)) {
+            throw new IllegalArgumentException(file + " not a file");
+        }
+    }
+
+    @Override
+    public final InputStream content() {
+        try {
+            return Files.newInputStream(file);
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
+    }
+
+    @Override
+    public final long contentLength() {
+        try {
+            return Files.size(file);
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolEntryFactory.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * 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.tools.jlink.internal;
+
+import java.nio.file.Path;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+
+public final class ResourcePoolEntryFactory {
+    private ResourcePoolEntryFactory() {}
+
+    public static ResourcePoolEntry create(String path,
+            ResourcePoolEntry.Type type, byte[] content) {
+        return new ByteArrayResourcePoolEntry(moduleFrom(path), path, type, content);
+    }
+
+    public static ResourcePoolEntry create(String path,
+            ResourcePoolEntry.Type type, Path file) {
+        return new PathResourcePoolEntry(moduleFrom(path), path, type, file);
+    }
+
+    public static ResourcePoolEntry create(ResourcePoolEntry original, byte[] content) {
+        return new ByteArrayResourcePoolEntry(original.moduleName(),
+                original.path(), original.type(), content);
+    }
+
+    public static ResourcePoolEntry create(ResourcePoolEntry original, Path file) {
+        return new PathResourcePoolEntry(original.moduleName(),
+                original.path(), original.type(), file);
+    }
+
+    private static String moduleFrom(String path) {
+        Objects.requireNonNull(path);
+        if (path.isEmpty() || path.charAt(0) != '/') {
+            throw new IllegalArgumentException(path + " must start with /");
+        }
+        String noRoot = path.substring(1);
+        int idx = noRoot.indexOf('/');
+        if (idx == -1) {
+            throw new IllegalArgumentException("/ missing after module: " + path);
+        }
+        return noRoot.substring(0, idx);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.tools.jlink.internal;
+
+import java.lang.module.ModuleDescriptor;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import jdk.internal.jimage.decompressor.CompressedResourceHeader;
+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.ResourcePoolModuleView;
+import jdk.tools.jlink.plugin.PluginException;
+import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+
+/**
+ * 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;
+
+        private ResourcePoolModuleImpl(String name) {
+            this.name = name;
+        }
+
+        @Override
+        public String name() {
+            return name;
+        }
+
+        @Override
+        public Optional<ResourcePoolEntry> findEntry(String path) {
+            if (!path.startsWith("/")) {
+                path = "/" + path;
+            }
+            if (!path.startsWith("/" + name)) {
+                path = "/" + name + path;
+            }
+            return Optional.ofNullable(moduleContent.get(path));
+        }
+
+        @Override
+        public ModuleDescriptor descriptor() {
+            if (descriptor == null) {
+                descriptor = readModuleDescriptor(this);
+            }
+            return descriptor;
+        }
+
+        @Override
+        public Set<String> packages() {
+            Set<String> pkgs = new HashSet<>();
+            moduleContent.values().stream().filter(m -> m.type().
+                    equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)).forEach(res -> {
+                // Module metadata only contains packages with .class files
+                if (ImageFileCreator.isClassPackage(res.path())) {
+                    String[] split = ImageFileCreator.splitPath(res.path());
+                    String pkg = split[1];
+                    if (pkg != null && !pkg.isEmpty()) {
+                        pkgs.add(pkg);
+                    }
+                }
+            });
+            return pkgs;
+        }
+
+        @Override
+        public String toString() {
+            return name();
+        }
+
+        @Override
+        public Stream<ResourcePoolEntry> entries() {
+            return moduleContent.values().stream();
+        }
+
+        @Override
+        public int entryCount() {
+            return moduleContent.values().size();
+        }
+    }
+
+    public class ResourcePoolImpl implements ResourcePool {
+        @Override
+        public ResourcePoolModuleView moduleView() {
+            return ResourcePoolManager.this.moduleView();
+        }
+
+        @Override
+        public Stream<ResourcePoolEntry> entries() {
+            return ResourcePoolManager.this.entries();
+        }
+
+        @Override
+        public int entryCount() {
+            return ResourcePoolManager.this.entryCount();
+        }
+
+        @Override
+        public Optional<ResourcePoolEntry> findEntry(String path) {
+            return ResourcePoolManager.this.findEntry(path);
+        }
+
+        @Override
+        public Optional<ResourcePoolEntry> findEntryInContext(String path, ResourcePoolEntry context) {
+            return ResourcePoolManager.this.findEntryInContext(path, context);
+        }
+
+        @Override
+        public boolean contains(ResourcePoolEntry data) {
+            return ResourcePoolManager.this.contains(data);
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return ResourcePoolManager.this.isEmpty();
+        }
+
+        @Override
+        public ByteOrder byteOrder() {
+            return ResourcePoolManager.this.byteOrder();
+        }
+
+        public StringTable getStringTable() {
+            return ResourcePoolManager.this.getStringTable();
+        }
+    }
+
+    class ResourcePoolBuilderImpl implements ResourcePoolBuilder {
+        private boolean built;
+
+        @Override
+        public void add(ResourcePoolEntry data) {
+            if (built) {
+                throw new IllegalStateException("resource pool already built!");
+            }
+            ResourcePoolManager.this.add(data);
+        }
+
+        @Override
+        public ResourcePool build() {
+            built = true;
+            return ResourcePoolManager.this.resourcePool();
+        }
+    }
+
+    class ResourcePoolModuleViewImpl implements ResourcePoolModuleView {
+        @Override
+        public Optional<ResourcePoolModule> findModule(String name) {
+            return ResourcePoolManager.this.findModule(name);
+        }
+
+        @Override
+        public Stream<ResourcePoolModule> modules() {
+            return ResourcePoolManager.this.modules();
+        }
+
+        @Override
+        public int moduleCount() {
+            return ResourcePoolManager.this.moduleCount();
+        }
+    }
+
+    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 final ByteOrder order;
+    private final StringTable table;
+    private final ResourcePool poolImpl;
+    private final ResourcePoolBuilder poolBuilderImpl;
+    private final ResourcePoolModuleView moduleViewImpl;
+
+    public ResourcePoolManager() {
+        this(ByteOrder.nativeOrder());
+    }
+
+    public ResourcePoolManager(ByteOrder order) {
+        this(order, new StringTable() {
+
+            @Override
+            public int addString(String str) {
+                return -1;
+            }
+
+            @Override
+            public String getString(int id) {
+                return null;
+            }
+        });
+    }
+
+    public ResourcePoolManager(ByteOrder order, StringTable table) {
+        this.order = Objects.requireNonNull(order);
+        this.table = Objects.requireNonNull(table);
+        this.poolImpl = new ResourcePoolImpl();
+        this.poolBuilderImpl = new ResourcePoolBuilderImpl();
+        this.moduleViewImpl = new ResourcePoolModuleViewImpl();
+    }
+
+    public ResourcePool resourcePool() {
+        return poolImpl;
+    }
+
+    public ResourcePoolBuilder resourcePoolBuilder() {
+        return poolBuilderImpl;
+    }
+
+    public ResourcePoolModuleView moduleView() {
+        return moduleViewImpl;
+    }
+
+    /**
+     * Add a ResourcePoolEntry.
+     *
+     * @param data The ResourcePoolEntry to add.
+     */
+    public void add(ResourcePoolEntry data) {
+        Objects.requireNonNull(data);
+        if (resources.get(data.path()) != null) {
+            throw new PluginException("Resource " + data.path()
+                    + " already present");
+        }
+        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);
+        }
+        resources.put(data.path(), data);
+        m.moduleContent.put(data.path(), data);
+    }
+
+    /**
+     * Retrieves the module for the provided name.
+     *
+     * @param name The module name
+     * @return the module of matching name, if found
+     */
+    public Optional<ResourcePoolModule> findModule(String name) {
+        Objects.requireNonNull(name);
+        return Optional.ofNullable(modules.get(name));
+    }
+
+    /**
+     * The stream of modules contained in this ResourcePool.
+     *
+     * @return The stream of modules.
+     */
+    public Stream<ResourcePoolModule> modules() {
+        return modules.values().stream();
+    }
+
+    /**
+     * Return the number of ResourcePoolModule count in this ResourcePool.
+     *
+     * @return the module count.
+     */
+    public int moduleCount() {
+        return modules.size();
+    }
+
+    /**
+     * Get all ResourcePoolEntry contained in this ResourcePool instance.
+     *
+     * @return The stream of ResourcePoolModuleEntries.
+     */
+    public Stream<ResourcePoolEntry> entries() {
+        return resources.values().stream();
+    }
+
+    /**
+     * Return the number of ResourcePoolEntry count in this ResourcePool.
+     *
+     * @return the entry count.
+     */
+    public int entryCount() {
+        return resources.values().size();
+    }
+
+    /**
+     * Get the ResourcePoolEntry for the passed path.
+     *
+     * @param path A data path
+     * @return A ResourcePoolEntry instance or null if the data is not found
+     */
+    public Optional<ResourcePoolEntry> findEntry(String path) {
+        Objects.requireNonNull(path);
+        return Optional.ofNullable(resources.get(path));
+    }
+
+    /**
+     * Get the ResourcePoolEntry for the passed path restricted to supplied context.
+     *
+     * @param path A data path
+     * @param context A context of the search
+     * @return A ResourcePoolEntry instance or null if the data is not found
+     */
+    public Optional<ResourcePoolEntry> findEntryInContext(String path, ResourcePoolEntry context) {
+        Objects.requireNonNull(path);
+        Objects.requireNonNull(context);
+        ResourcePoolModule module = modules.get(context.moduleName());
+        Objects.requireNonNull(module);
+        Optional<ResourcePoolEntry> entry = module.findEntry(path);
+        // Navigating other modules via requires and exports is problematic
+        // since we cannot construct the runtime model of loaders and layers.
+        return entry;
+     }
+
+    /**
+     * Check if the ResourcePool contains the given ResourcePoolEntry.
+     *
+     * @param data The module data to check existence for.
+     * @return The module data or null if not found.
+     */
+    public boolean contains(ResourcePoolEntry data) {
+        Objects.requireNonNull(data);
+        return findEntry(data.path()).isPresent();
+    }
+
+    /**
+     * Check if the ResourcePool contains some content at all.
+     *
+     * @return True, no content, false otherwise.
+     */
+    public boolean isEmpty() {
+        return resources.isEmpty();
+    }
+
+    /**
+     * The ByteOrder currently in use when generating the jimage file.
+     *
+     * @return The ByteOrder.
+     */
+    public ByteOrder byteOrder() {
+        return order;
+    }
+
+    public StringTable getStringTable() {
+        return table;
+    }
+
+    /**
+     * A resource that has been compressed.
+     */
+    public static final class CompressedModuleData extends ByteArrayResourcePoolEntry {
+
+        final long uncompressed_size;
+
+        private CompressedModuleData(String module, String path,
+                byte[] content, long uncompressed_size) {
+            super(module, path, ResourcePoolEntry.Type.CLASS_OR_RESOURCE, content);
+            this.uncompressed_size = uncompressed_size;
+        }
+
+        public long getUncompressedSize() {
+            return uncompressed_size;
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (!(other instanceof CompressedModuleData)) {
+                return false;
+            }
+            CompressedModuleData f = (CompressedModuleData) other;
+            return f.path().equals(path());
+        }
+
+        @Override
+        public int hashCode() {
+            return super.hashCode();
+        }
+    }
+
+    public static CompressedModuleData newCompressedResource(ResourcePoolEntry original,
+            ByteBuffer compressed,
+            String plugin, String pluginConfig, StringTable strings,
+            ByteOrder order) {
+        Objects.requireNonNull(original);
+        Objects.requireNonNull(compressed);
+        Objects.requireNonNull(plugin);
+
+        boolean isTerminal = !(original instanceof CompressedModuleData);
+        long uncompressed_size = original.contentLength();
+        if (original instanceof CompressedModuleData) {
+            CompressedModuleData comp = (CompressedModuleData) original;
+            uncompressed_size = comp.getUncompressedSize();
+        }
+        int nameOffset = strings.addString(plugin);
+        int configOffset = -1;
+        if (pluginConfig != null) {
+            configOffset = strings.addString(plugin);
+        }
+        CompressedResourceHeader rh
+                = new CompressedResourceHeader(compressed.limit(), original.contentLength(),
+                        nameOffset, configOffset, isTerminal);
+        // Merge header with content;
+        byte[] h = rh.getBytes(order);
+        ByteBuffer bb = ByteBuffer.allocate(compressed.limit() + h.length);
+        bb.order(order);
+        bb.put(h);
+        bb.put(compressed);
+        byte[] contentWithHeader = bb.array();
+
+        CompressedModuleData compressedResource
+                = new CompressedModuleData(original.moduleName(), original.path(),
+                        contentWithHeader, uncompressed_size);
+        return compressedResource;
+    }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePrevisitor.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePrevisitor.java	Wed Jul 05 22:01:14 2017 +0200
@@ -24,7 +24,7 @@
  */
 package jdk.tools.jlink.internal;
 
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
 
 /**
  * Plugin wishing to pre-visit the resources must implement this interface.
@@ -43,5 +43,5 @@
      * @param strings StringTable instance. Add string to the StringTable to track string
      * usage.
      */
-    public void previsit(ModulePool resources, StringTable strings);
+    public void previsit(ResourcePool resources, StringTable strings);
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ClassForNamePlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ClassForNamePlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -29,7 +29,8 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.Plugin.Category;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import static jdk.internal.org.objectweb.asm.ClassReader.*;
@@ -44,7 +45,7 @@
 import jdk.internal.org.objectweb.asm.tree.LineNumberNode;
 import jdk.internal.org.objectweb.asm.tree.MethodInsnNode;
 import jdk.internal.org.objectweb.asm.tree.MethodNode;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 
 public final class ClassForNamePlugin implements Plugin {
@@ -55,8 +56,8 @@
                               path.length() - ".class".length());
     }
 
-    private static int getAccess(ModuleEntry resource) {
-        ClassReader cr = new ClassReader(resource.getBytes());
+    private static int getAccess(ResourcePoolEntry resource) {
+        ClassReader cr = new ClassReader(resource.contentBytes());
 
         return cr.getAccess();
     }
@@ -67,8 +68,8 @@
         return index == -1 ? "" : binaryName.substring(0, index);
     }
 
-    private ModuleEntry transform(ModuleEntry resource, ModulePool pool) {
-        byte[] inBytes = resource.getBytes();
+    private ResourcePoolEntry transform(ResourcePoolEntry resource, ResourcePool pool) {
+        byte[] inBytes = resource.contentBytes();
         ClassReader cr = new ClassReader(inBytes);
         ClassNode cn = new ClassNode();
         cr.accept(cn, EXPAND_FRAMES);
@@ -76,7 +77,7 @@
         boolean modified = false;
         LdcInsnNode ldc = null;
 
-        String thisPackage = getPackage(binaryClassName(resource.getPath()));
+        String thisPackage = getPackage(binaryClassName(resource.path()));
 
         for (MethodNode mn : ms) {
             InsnList il = mn.instructions;
@@ -96,7 +97,7 @@
                         min.desc.equals("(Ljava/lang/String;)Ljava/lang/Class;")) {
                         String ldcClassName = ldc.cst.toString();
                         String thatClassName = ldcClassName.replaceAll("\\.", "/");
-                        Optional<ModuleEntry> thatClass =
+                        Optional<ResourcePoolEntry> thatClass =
                             pool.findEntryInContext(thatClassName + ".class", resource);
 
                         if (thatClass.isPresent()) {
@@ -128,7 +129,7 @@
             cn.accept(cw);
             byte[] outBytes = cw.toByteArray();
 
-            return resource.create(outBytes);
+            return resource.copyWithContent(outBytes);
         }
 
         return resource;
@@ -140,13 +141,13 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         Objects.requireNonNull(in);
         Objects.requireNonNull(out);
 
         in.entries()
             .forEach(resource -> {
-                String path = resource.getPath();
+                String path = resource.path();
 
                 if (path.endsWith(".class") && !path.endsWith("/module-info.class")) {
                     out.add(transform(resource, in));
@@ -154,6 +155,7 @@
                     out.add(resource);
                 }
             });
+        return out.build();
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -26,10 +26,12 @@
 
 import java.util.Map;
 
-import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.internal.ImagePluginStack;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
 
@@ -53,21 +55,22 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         if (ss != null && zip != null) {
-            ModulePool output = new ImagePluginStack.OrderedResourcePool(in.getByteOrder(),
-                    ((ModulePoolImpl) in).getStringTable());
-            ss.visit(in, output);
-            zip.visit(output, out);
+            ResourcePoolManager resMgr = new ImagePluginStack.OrderedResourcePoolManager(
+                    in.byteOrder(), ((ResourcePoolImpl)in).getStringTable());
+            return zip.transform(ss.transform(in, resMgr.resourcePoolBuilder()), out);
         } else if (ss != null) {
-            ss.visit(in, out);
+            return ss.transform(in, out);
         } else if (zip != null) {
-            zip.visit(in, out);
+            return zip.transform(in, out);
         }
+
+        return out.build();
     }
 
     @Override
-    public void previsit(ModulePool resources, StringTable strings) {
+    public void previsit(ResourcePool resources, StringTable strings) {
         if (ss != null) {
             ss.previsit(resources, strings);
         }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -27,8 +27,9 @@
 import java.util.Map;
 import java.util.function.Predicate;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 /**
  *
@@ -45,13 +46,14 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy((file) -> {
-            if (!file.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
-                file = predicate.test(file.getPath()) ? file : null;
+            if (!file.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+                file = predicate.test(file.path()) ? file : null;
             }
             return file;
         }, out);
+        return out.build();
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -27,8 +27,9 @@
 import java.util.Map;
 import java.util.function.Predicate;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 /**
  *
@@ -45,13 +46,14 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy((resource) -> {
-            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
-                resource = predicate.test(resource.getPath()) ? resource : null;
+            if (resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+                resource = predicate.test(resource.path()) ? resource : null;
             }
             return resource;
         }, out);
+        return out.build();
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -36,8 +36,9 @@
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.PluginException;
 
 /**
@@ -97,25 +98,25 @@
      * e.g.: /java.base/native/amd64/server/libjvm.so
      * /java.base/native/server/libjvm.dylib
      */
-    private List<ModuleEntry> getVMs(ModulePool in) {
+    private List<ResourcePoolEntry> getVMs(ResourcePool in) {
         String jvmlib = jvmlib();
-        List<ModuleEntry> ret = in.findModule("java.base").get().entries().filter((t) -> {
-            return t.getPath().endsWith("/" + jvmlib);
+        List<ResourcePoolEntry> ret = in.moduleView().findModule("java.base").get().entries().filter((t) -> {
+            return t.path().endsWith("/" + jvmlib);
         }).collect(Collectors.toList());
         return ret;
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         String jvmlib = jvmlib();
         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<ModuleEntry> jvms = getVMs(in);
+            List<ResourcePoolEntry> jvms = getVMs(in);
             for (Jvm jvm : Jvm.values()) {
-                for (ModuleEntry md : jvms) {
-                    if (md.getPath().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
+                for (ResourcePoolEntry md : jvms) {
+                    if (md.path().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
                         existing.add(jvm);
                         if (isRemoved(md)) {
                             removed.add(jvm);
@@ -134,8 +135,8 @@
         // Rewrite the jvm.cfg file.
         in.transformAndCopy((file) -> {
             if (!keepAll) {
-                if (file.getType().equals(ModuleEntry.Type.NATIVE_LIB)) {
-                    if (file.getPath().endsWith(JVM_CFG)) {
+                if (file.type().equals(ResourcePoolEntry.Type.NATIVE_LIB)) {
+                    if (file.path().endsWith(JVM_CFG)) {
                         try {
                             file = handleJvmCfgFile(file, existing, removed);
                         } catch (IOException ex) {
@@ -148,10 +149,11 @@
             return file;
         }, out);
 
+        return out.build();
     }
 
-    private boolean isRemoved(ModuleEntry file) {
-        return !predicate.test(file.getPath());
+    private boolean isRemoved(ResourcePoolEntry file) {
+        return !predicate.test(file.path());
     }
 
     @Override
@@ -206,7 +208,7 @@
         predicate = ResourceFilter.excludeFilter(exclude);
     }
 
-    private ModuleEntry handleJvmCfgFile(ModuleEntry orig,
+    private ResourcePoolEntry handleJvmCfgFile(ResourcePoolEntry orig,
             TreeSet<Jvm> existing,
             TreeSet<Jvm> removed) throws IOException {
         if (keepAll) {
@@ -215,7 +217,7 @@
         StringBuilder builder = new StringBuilder();
         // Keep comments
         try (BufferedReader reader
-                = new BufferedReader(new InputStreamReader(orig.stream(),
+                = new BufferedReader(new InputStreamReader(orig.content(),
                         StandardCharsets.UTF_8))) {
             reader.lines().forEach((s) -> {
                 if (s.startsWith("#")) {
@@ -242,7 +244,7 @@
 
         byte[] content = builder.toString().getBytes(StandardCharsets.UTF_8);
 
-        return orig.create(content);
+        return orig.copyWithContent(content);
     }
 
     private static String jvmlib() {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -37,10 +37,11 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import jdk.tools.jlink.internal.PathModuleEntry;
+import jdk.tools.jlink.internal.PathResourcePoolEntry;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.internal.Utils;
 
@@ -64,12 +65,12 @@
     /**
      * Symbolic link to another path.
      */
-    public static abstract class SymImageFile extends PathModuleEntry {
+    public static abstract class SymImageFile extends PathResourcePoolEntry {
 
         private final String targetPath;
 
         public SymImageFile(String targetPath, String module, String path,
-                ModuleEntry.Type type, Path file) {
+                ResourcePoolEntry.Type type, Path file) {
             super(module, path, type, file);
             this.targetPath = targetPath;
         }
@@ -82,7 +83,7 @@
     private static final class SymImageFileImpl extends SymImageFile {
 
         public SymImageFileImpl(String targetPath, Path file, String module,
-                String path, ModuleEntry.Type type) {
+                String path, ResourcePoolEntry.Type type) {
             super(targetPath, module, path, type, file);
         }
     }
@@ -90,11 +91,11 @@
     private static final class DirectoryCopy implements FileVisitor<Path> {
 
         private final Path source;
-        private final ModulePool pool;
+        private final ResourcePoolBuilder pool;
         private final String targetDir;
         private final List<SymImageFile> symlinks = new ArrayList<>();
 
-        DirectoryCopy(Path source, ModulePool pool, String targetDir) {
+        DirectoryCopy(Path source, ResourcePoolBuilder pool, String targetDir) {
             this.source = source;
             this.pool = pool;
             this.targetDir = targetDir;
@@ -128,7 +129,7 @@
                 }
                 SymImageFileImpl impl = new SymImageFileImpl(symTarget.toString(),
                         file, path, Objects.requireNonNull(file.getFileName()).toString(),
-                        ModuleEntry.Type.OTHER);
+                        ResourcePoolEntry.Type.OTHER);
                 symlinks.add(impl);
             } else {
                 addFile(pool, file, path);
@@ -152,14 +153,14 @@
         }
     }
 
-    private static void addFile(ModulePool pool, Path file, String path)
+    private static void addFile(ResourcePoolBuilder pool, Path file, String path)
             throws IOException {
         Objects.requireNonNull(pool);
         Objects.requireNonNull(file);
         Objects.requireNonNull(path);
-        ModuleEntry impl = ModuleEntry.create(
+        ResourcePoolEntry impl = ResourcePoolEntry.create(
                 "/" + FAKE_MODULE + "/other/" + path,
-                ModuleEntry.Type.OTHER, file);
+                ResourcePoolEntry.Type.OTHER, file);
         try {
             pool.add(impl);
         } catch (Exception ex) {
@@ -211,7 +212,7 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy((file) -> {
             return file;
         }, out);
@@ -238,6 +239,8 @@
         } catch (IOException ex) {
             throw new UncheckedIOException(ex);
         }
+
+        return out.build();
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -31,9 +31,10 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 
 /**
@@ -145,22 +146,22 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.entries().forEach(data -> {
-            if (("/java.base/" + BMH + ".class").equals(data.getPath())) {
+            if (("/java.base/" + BMH + ".class").equals(data.path())) {
                 // Add BoundMethodHandle unchanged
                 out.add(data);
                 speciesTypes.forEach(types -> generateConcreteClass(types, data, out));
             } else {
-                if (!out.contains(data)) {
-                    out.add(data);
-                }
+                out.add(data);
             }
         });
+
+        return out.build();
     }
 
     @SuppressWarnings("unchecked")
-    private void generateConcreteClass(String types, ModuleEntry data, ModulePool out) {
+    private void generateConcreteClass(String types, ResourcePoolEntry data, ResourcePoolBuilder out) {
         try {
             // Generate class
             Map.Entry<String, byte[]> result = (Map.Entry<String, byte[]>)
@@ -169,12 +170,10 @@
             byte[] bytes = result.getValue();
 
             // Add class to pool
-            ModuleEntry ndata = ModuleEntry.create(
+            ResourcePoolEntry ndata = ResourcePoolEntry.create(
                     "/java.base/" + className + ".class",
                     bytes);
-            if (!out.contains(ndata)) {
-                out.add(ndata);
-            }
+            out.add(ndata);
         } catch (Exception ex) {
             throw new PluginException(ex);
         }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -42,10 +42,11 @@
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
-import jdk.tools.jlink.plugin.LinkModule;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 import sun.util.cldr.CLDRBaseLocaleDataMetaInfo;
 import sun.util.locale.provider.LocaleProviderAdapter;
@@ -151,24 +152,26 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy((resource) -> {
-            if (resource.getModule().equals(MODULENAME)) {
-                String path = resource.getPath();
+            if (resource.moduleName().equals(MODULENAME)) {
+                String path = resource.path();
                 resource = predicate.test(path) ? resource: null;
                 if (resource != null &&
-                    resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
-                    byte[] bytes = resource.getBytes();
+                    resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+                    byte[] bytes = resource.contentBytes();
                     ClassReader cr = new ClassReader(bytes);
                     if (Arrays.stream(cr.getInterfaces())
                         .anyMatch(i -> i.contains(METAINFONAME)) &&
                         stripUnsupportedLocales(bytes, cr)) {
-                        resource = resource.create(bytes);
+                        resource = resource.copyWithContent(bytes);
                     }
                 }
             }
             return resource;
         }, out);
+
+        return out.build();
     }
 
     @Override
@@ -205,14 +208,14 @@
     }
 
     @Override
-    public void previsit(ModulePool resources, StringTable strings) {
+    public void previsit(ResourcePool resources, StringTable strings) {
         final Pattern p = Pattern.compile(".*((Data_)|(Names_))(?<tag>.*)\\.class");
-        Optional<LinkModule> optMod = resources.findModule(MODULENAME);
+        Optional<ResourcePoolModule> optMod = resources.moduleView().findModule(MODULENAME);
 
         // jdk.localedata module validation
         if (optMod.isPresent()) {
-            LinkModule module = optMod.get();
-            Set<String> packages = module.getAllPackages();
+            ResourcePoolModule module = optMod.get();
+            Set<String> packages = module.packages();
             if (!packages.containsAll(LOCALEDATA_PACKAGES)) {
                 throw new PluginException(PluginsResourceBundle.getMessage(NAME + ".missingpackages") +
                     LOCALEDATA_PACKAGES.stream()
@@ -221,7 +224,7 @@
             }
 
             available = Stream.concat(module.entries()
-                                        .map(md -> p.matcher(md.getPath()))
+                                        .map(md -> p.matcher(md.path()))
                                         .filter(m -> m.matches())
                                         .map(m -> m.group("tag").replaceAll("_", "-")),
                                     Stream.concat(Stream.of(jaJPJPTag), Stream.of(thTHTHTag)))
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -35,8 +35,9 @@
 import java.util.Map;
 import java.util.function.ToIntFunction;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.internal.Utils;
 
@@ -62,20 +63,20 @@
     }
 
     static class SortWrapper {
-        private final ModuleEntry resource;
+        private final ResourcePoolEntry resource;
         private final int ordinal;
 
-        SortWrapper(ModuleEntry resource, int ordinal) {
+        SortWrapper(ResourcePoolEntry resource, int ordinal) {
             this.resource = resource;
             this.ordinal = ordinal;
         }
 
-        ModuleEntry getResource() {
+        ResourcePoolEntry getResource() {
             return resource;
         }
 
         String getPath() {
-            return resource.getPath();
+            return resource.path();
         }
 
         int getOrdinal() {
@@ -95,8 +96,8 @@
         return path;
     }
 
-    private int getOrdinal(ModuleEntry resource) {
-        String path = resource.getPath();
+    private int getOrdinal(ResourcePoolEntry resource) {
+        String path = resource.path();
 
         Integer value = orderedPaths.get(stripModule(path));
 
@@ -126,17 +127,19 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.entries()
-                .filter(resource -> resource.getType()
-                        .equals(ModuleEntry.Type.CLASS_OR_RESOURCE))
+                .filter(resource -> resource.type()
+                        .equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE))
                 .map((resource) -> new SortWrapper(resource, getOrdinal(resource)))
                 .sorted(OrderResourcesPlugin::compare)
                 .forEach((wrapper) -> out.add(wrapper.getResource()));
         in.entries()
-                .filter(other -> !other.getType()
-                        .equals(ModuleEntry.Type.CLASS_OR_RESOURCE))
+                .filter(other -> !other.type()
+                        .equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE))
                 .forEach((other) -> out.add(other));
+
+        return out.build();
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -24,16 +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.ModulePool;
+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;
@@ -117,9 +124,24 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy(Function.identity(), out);
-        out.getReleaseProperties().putAll(in.getReleaseProperties());
-        out.getReleaseProperties().putAll(release);
+
+        // 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/internal/plugins/StringSharingPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -55,11 +55,13 @@
 import jdk.internal.jimage.decompressor.CompressIndexes;
 import jdk.internal.jimage.decompressor.SignatureParser;
 import jdk.internal.jimage.decompressor.StringSharingDecompressor;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
 
@@ -226,22 +228,22 @@
             }
         }
 
-        public byte[] transform(ModuleEntry resource, ModulePool out,
+        public byte[] transform(ResourcePoolEntry resource, ResourcePoolBuilder out,
                 StringTable strings) throws IOException, Exception {
-            byte[] content = resource.getBytes();
+            byte[] content = resource.contentBytes();
             ClassFile cf;
             try (InputStream stream = new ByteArrayInputStream(content)) {
                 cf = ClassFile.read(stream);
             } catch (ConstantPoolException ex) {
                 throw new IOException("Compressor EX " + ex + " for "
-                        + resource.getPath() + " content.length " + content.length, ex);
+                        + resource.path() + " content.length " + content.length, ex);
             }
             DescriptorsScanner scanner = new DescriptorsScanner(cf);
             return optimize(resource, out, strings, scanner.scan(), content);
         }
 
         @SuppressWarnings("fallthrough")
-        private byte[] optimize(ModuleEntry resource, ModulePool resources,
+        private byte[] optimize(ResourcePoolEntry resource, ResourcePoolBuilder resources,
                 StringTable strings,
                 Set<Integer> descriptorIndexes, byte[] content) throws Exception {
             DataInputStream stream = new DataInputStream(new ByteArrayInputStream(content));
@@ -347,23 +349,25 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool result) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder result) {
         CompactCPHelper visit = new CompactCPHelper();
         in.transformAndCopy((resource) -> {
-            ModuleEntry res = resource;
-            if (predicate.test(resource.getPath()) && resource.getPath().endsWith(".class")) {
+            ResourcePoolEntry res = resource;
+            if (predicate.test(resource.path()) && resource.path().endsWith(".class")) {
                 byte[] compressed = null;
                 try {
-                    compressed = visit.transform(resource, result, ((ModulePoolImpl) in).getStringTable());
+                    compressed = visit.transform(resource, result, ((ResourcePoolImpl)in).getStringTable());
                 } catch (Exception ex) {
                     throw new PluginException(ex);
                 }
-                res = ModulePoolImpl.newCompressedResource(resource,
+                res = ResourcePoolManager.newCompressedResource(resource,
                         ByteBuffer.wrap(compressed), getName(), null,
-                        ((ModulePoolImpl) in).getStringTable(), in.getByteOrder());
+                        ((ResourcePoolImpl)in).getStringTable(), in.byteOrder());
             }
             return res;
         }, result);
+
+        return result.build();
     }
 
     @Override
@@ -392,11 +396,11 @@
     }
 
     @Override
-    public void previsit(ModulePool resources, StringTable strings) {
+    public void previsit(ResourcePool resources, StringTable strings) {
         CompactCPHelper preVisit = new CompactCPHelper();
         resources.entries().forEach(resource -> {
-            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)
-                    && resource.getPath().endsWith(".class") && predicate.test(resource.getPath())) {
+            if (resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)
+                    && resource.path().endsWith(".class") && predicate.test(resource.path())) {
                 try {
                     preVisit.transform(resource, null, strings);
                 } catch (Exception ex) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -27,8 +27,9 @@
 import java.util.function.Predicate;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 
 /**
@@ -58,27 +59,29 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         //remove *.diz files as well as debug attributes.
         in.transformAndCopy((resource) -> {
-            ModuleEntry res = resource;
-            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)) {
-                String path = resource.getPath();
+            ResourcePoolEntry res = resource;
+            if (resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+                String path = resource.path();
                 if (path.endsWith(".class")) {
                     if (path.endsWith("module-info.class")) {
                         // XXX. Do we have debug info? Is Asm ready for module-info?
                     } else {
-                        ClassReader reader = new ClassReader(resource.getBytes());
+                        ClassReader reader = new ClassReader(resource.contentBytes());
                         ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
                         reader.accept(writer, ClassReader.SKIP_DEBUG);
                         byte[] content = writer.toByteArray();
-                        res = resource.create(content);
+                        res = resource.copyWithContent(content);
                     }
                 }
-            } else if (predicate.test(res.getPath())) {
+            } else if (predicate.test(res.path())) {
                 res = null;
             }
             return res;
         }, out);
+
+        return out.build();
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -24,8 +24,9 @@
  */
 package jdk.tools.jlink.internal.plugins;
 
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 
 /**
@@ -47,10 +48,12 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy((file) -> {
-            return file.getType() == ModuleEntry.Type.NATIVE_CMD ? null : file;
+            return file.type() == ResourcePoolEntry.Type.NATIVE_CMD ? null : file;
         }, out);
+
+        return out.build();
     }
 
     @Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -51,10 +51,11 @@
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin.Builder.*;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 /**
  * Jlink plugin to reconstitute module descriptors for installed modules.
@@ -107,7 +108,7 @@
 
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         if (!enabled) {
             throw new PluginException(NAME + " was set");
         }
@@ -116,30 +117,30 @@
 
         // generate the byte code to create ModuleDescriptors
         // skip parsing module-info.class and skip name check
-        in.modules().forEach(module -> {
-            Optional<ModuleEntry> optData = module.findEntry("module-info.class");
+        in.moduleView().modules().forEach(module -> {
+            Optional<ResourcePoolEntry> optData = module.findEntry("module-info.class");
             if (! optData.isPresent()) {
                 // automatic module not supported yet
                 throw new PluginException("module-info.class not found for " +
-                                          module.getName() + " module");
+                                          module.name() + " module");
             }
-            ModuleEntry data = optData.get();
-            assert module.getName().equals(data.getModule());
+            ResourcePoolEntry data = optData.get();
+            assert module.name().equals(data.moduleName());
             try {
-                ByteArrayInputStream bain = new ByteArrayInputStream(data.getBytes());
+                ByteArrayInputStream bain = new ByteArrayInputStream(data.contentBytes());
                 ModuleDescriptor md = ModuleDescriptor.read(bain);
                 validateNames(md);
 
-                ModuleDescriptorBuilder mbuilder = builder.module(md, module.getAllPackages());
+                ModuleDescriptorBuilder mbuilder = builder.module(md, module.packages());
                 int packages = md.exports().size() + md.conceals().size();
                 if (md.conceals().isEmpty() &&
-                        packages != module.getAllPackages().size()) {
+                        packages != module.packages().size()) {
                     // add ConcealedPackages attribute if not exist
                     bain.reset();
                     ModuleInfoRewriter minfoWriter =
                         new ModuleInfoRewriter(bain, mbuilder.conceals());
                     // replace with the overridden version
-                    data = data.create(minfoWriter.getBytes());
+                    data = data.copyWithContent(minfoWriter.getBytes());
                 }
                 out.add(data);
             } catch (IOException e) {
@@ -150,16 +151,18 @@
         // Generate the new class
         ClassWriter cwriter = builder.build();
         in.entries().forEach(data -> {
-            if (data.getPath().endsWith("module-info.class"))
+            if (data.path().endsWith("module-info.class"))
                 return;
-            if (builder.isOverriddenClass(data.getPath())) {
+            if (builder.isOverriddenClass(data.path())) {
                 byte[] bytes = cwriter.toByteArray();
-                ModuleEntry ndata = data.create(bytes);
+                ResourcePoolEntry ndata = data.copyWithContent(bytes);
                 out.add(ndata);
             } else {
                 out.add(data);
             }
         });
+
+        return out.build();
     }
 
     /*
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -31,9 +31,11 @@
 import java.util.Map;
 import java.util.function.Predicate;
 import java.util.zip.Deflater;
-import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.internal.ResourcePoolManager;
+import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.Plugin;
 
 /**
@@ -112,18 +114,20 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy((resource) -> {
-            ModuleEntry res = resource;
-            if (resource.getType().equals(ModuleEntry.Type.CLASS_OR_RESOURCE)
-                    && predicate.test(resource.getPath())) {
+            ResourcePoolEntry res = resource;
+            if (resource.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)
+                    && predicate.test(resource.path())) {
                 byte[] compressed;
-                compressed = compress(resource.getBytes());
-                res = ModulePoolImpl.newCompressedResource(resource,
+                compressed = compress(resource.contentBytes());
+                res = ResourcePoolManager.newCompressedResource(resource,
                         ByteBuffer.wrap(compressed), getName(), null,
-                        ((ModulePoolImpl) in).getStringTable(), in.getByteOrder());
+                        ((ResourcePoolImpl)in).getStringTable(), in.byteOrder());
             }
             return res;
         }, out);
+
+        return out.build();
     }
 }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/LinkModule.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * 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.tools.jlink.plugin;
-
-import java.lang.module.ModuleDescriptor;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Stream;
-
-/**
-  * Link-time representation of a Java module.
-  */
-public interface LinkModule {
-
-    /**
-     * The module name.
-     *
-     * @return The name.
-     */
-    public String getName();
-
-    /**
-     * Retrieves a LinkModuleEntry from the given path (e.g:
-     * /mymodule/com.foo.bar/MyClass.class)
-     *
-     * @param path The piece of data path.
-     * @return A LinkModuleEntry of the given path, if found.
-     */
-    public Optional<ModuleEntry> findEntry(String path);
-
-    /**
-     * The module descriptor of this module.
-     *
-     * @return The module descriptor.
-     */
-    public ModuleDescriptor getDescriptor();
-
-    /**
-     * Add a LinkModuleEntry to this module.
-     *
-     * @param data The LinkModuleEntry to add.
-     */
-    public void add(ModuleEntry data);
-
-    /**
-     * Retrieves all the packages located in this module.
-     *
-     * @return The set of packages.
-     */
-    public Set<String> getAllPackages();
-
-    /**
-     * Retrieves the stream of LinkModuleEntry.
-     *
-     * @return The LinkModuleEntry stream.
-     */
-    public Stream<? extends ModuleEntry> entries();
-
-    /**
-     * Return the number of LinkModuleEntry count in this LinkModule.
-     *
-     * @return the entry count.
-     */
-    public int getEntryCount();
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
- * 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.tools.jlink.plugin;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UncheckedIOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import jdk.tools.jlink.internal.ModuleEntryFactory;
-
-/**
- * A ModuleEntry is the elementary unit of data inside an image. It is
- * generally a file. e.g.: a java class file, a resource file, a shared library.
- * <br>
- * A ModuleEntry is identified by a path of the form:
- * <ul>
- * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
- * name}</li>
- * <li>For other files (shared lib, launchers, config, ...):/{module name}/
- * {@literal bin|conf|native}/{dir1}/.../{dirN}/{file name}</li>
- * </ul>
- */
-public interface ModuleEntry {
-
-    /**
-     * Type of module data.
-     * <li>
-     * <ul>CLASS_OR_RESOURCE: A java class or resource file.</ul>
-     * <ul>CONFIG: A configuration file.</ul>
-     * <ul>NATIVE_CMD: A native process launcher.</ul>
-     * <ul>NATIVE_LIB: A native library.</ul>
-     * <ul>OTHER: Other kind of file.</ul>
-     * </li>
-     */
-    public enum Type {
-        CLASS_OR_RESOURCE,
-        CONFIG,
-        NATIVE_CMD,
-        NATIVE_LIB,
-        OTHER
-    }
-    /**
-     * The ModuleEntry module name.
-     *
-     * @return The module name.
-     */
-    public String getModule();
-
-    /**
-     * The ModuleEntry path.
-     *
-     * @return The module path.
-     */
-    public String getPath();
-
-    /**
-     * The ModuleEntry's type.
-     *
-     * @return The data type.
-     */
-    public Type getType();
-
-    /**
-     * The ModuleEntry content as an array of bytes.
-     *
-     * @return An Array of bytes.
-     */
-    public default byte[] getBytes() {
-        try (InputStream is = stream()) {
-            return is.readAllBytes();
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
-        }
-    }
-
-    /**
-     * The ModuleEntry content length.
-     *
-     * @return The length.
-     */
-    public long getLength();
-
-    /**
-     * The ModuleEntry stream.
-     *
-     * @return The module data stream.
-     */
-    public InputStream stream();
-
-    /**
-     * Write the content of this ModuleEntry to stream.
-     *
-     * @param out the output stream
-     */
-    public default void write(OutputStream out) {
-        try {
-            out.write(getBytes());
-        } catch (IOException ex) {
-            throw new UncheckedIOException(ex);
-        }
-    }
-
-    /**
-     * Create a ModuleEntry with new content but other information
-     * copied from this ModuleEntry.
-     *
-     * @param content The new resource content.
-     * @return A new ModuleEntry.
-     */
-    public default ModuleEntry create(byte[] content) {
-        return ModuleEntryFactory.create(this, content);
-    }
-
-    /**
-     * Create a ModuleEntry with new content but other information
-     * copied from this ModuleEntry.
-     *
-     * @param file The new resource content.
-     * @return A new ModuleEntry.
-     */
-    public default ModuleEntry create(Path file) {
-        return ModuleEntryFactory.create(this, file);
-    }
-
-    /**
-     * Create a ModuleEntry for a resource of the given type.
-     *
-     * @param path The resource path.
-     * @param type The ModuleEntry type.
-     * @param content The resource content.
-     * @return A new ModuleEntry.
-     */
-    public static ModuleEntry create(String path,
-            ModuleEntry.Type type, byte[] content) {
-        return ModuleEntryFactory.create(path, type, content);
-    }
-
-    /**
-     * Create a ModuleEntry for a resource of type {@link Type#CLASS_OR_RESOURCE}.
-     *
-     * @param path The resource path.
-     * @param content The resource content.
-     * @return A new ModuleEntry.
-     */
-    public static ModuleEntry create(String path, byte[] content) {
-        return create(path, Type.CLASS_OR_RESOURCE, content);
-    }
-
-    /**
-     * Create a ModuleEntry for a resource of the given type.
-     *
-     * @param path The resource path.
-     * @param type The ModuleEntry type.
-     * @param file The resource file.
-     * @return A new ModuleEntry.
-     */
-    public static ModuleEntry create(String path,
-            ModuleEntry.Type type, Path file) {
-        return ModuleEntryFactory.create(path, type, file);
-    }
-
-    /**
-     * Create a ModuleEntry for a resource of type {@link Type#CLASS_OR_RESOURCE}.
-     *
-     * @param path The resource path.
-     * @param file The resource file.
-     * @return A new ModuleEntry.
-     */
-    public static ModuleEntry create(String path, Path file) {
-        return create(path, Type.CLASS_OR_RESOURCE, file);
-    }
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModulePool.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.tools.jlink.plugin;
-
-import java.nio.ByteOrder;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Function;
-import java.util.stream.Stream;
-
-/**
- * Pool of module data.
- */
-public interface ModulePool {
-/**
-     * Is this a read-only ModulePool?
-     *
-     * @return true if this is a read-only configuration.
-     */
-    public boolean isReadOnly();
-
-    /**
-     * Add a ModuleEntry.
-     *
-     * @param data The ModuleEntry to add.
-     */
-    public void add(ModuleEntry data);
-    /**
-     * Retrieves the module for the provided name.
-     *
-     * @param name The module name
-     * @return the module of matching name, if found
-     */
-    public Optional<LinkModule> findModule(String name);
-
-    /**
-     * The stream of modules contained in this ModulePool.
-     *
-     * @return The stream of modules.
-     */
-    public Stream<? extends LinkModule> modules();
-
-    /**
-     * Return the number of LinkModule count in this ModulePool.
-     *
-     * @return the module count.
-     */
-    public int getModuleCount();
-
-    /**
-     * Get all ModuleEntry contained in this ModulePool instance.
-     *
-     * @return The stream of LinkModuleEntries.
-     */
-    public Stream<? extends ModuleEntry> entries();
-
-    /**
-     * Return the number of ModuleEntry count in this ModulePool.
-     *
-     * @return the entry count.
-     */
-    public int getEntryCount();
-
-    /**
-     * Get the ModuleEntry for the passed path.
-     *
-     * @param path A data path
-     * @return A ModuleEntry instance or null if the data is not found
-     */
-    public Optional<ModuleEntry> findEntry(String path);
-
-    /**
-     * Get the ModuleEntry for the passed path restricted to supplied context.
-     *
-     * @param path A data path
-     * @param context A context of the search
-     * @return A ModuleEntry instance or null if the data is not found
-     */
-    public Optional<ModuleEntry> findEntryInContext(String path, ModuleEntry context);
-
-    /**
-     * Check if the ModulePool contains the given ModuleEntry.
-     *
-     * @param data The module data to check existence for.
-     * @return The module data or null if not found.
-     */
-    public boolean contains(ModuleEntry data);
-
-    /**
-     * Check if the ModulePool contains some content at all.
-     *
-     * @return True, no content, false otherwise.
-     */
-    public boolean isEmpty();
-
-    /**
-     * Visit each ModuleEntry in this ModulePool to transform it and copy
-     * the transformed ModuleEntry to the output ModulePool.
-     *
-     * @param transform The function called for each ModuleEntry found in the
-     * ModulePool. The transform function should return a ModuleEntry
-     * instance which will be added to the output or it should return null if
-     * the passed ModuleEntry is to be ignored for the output.
-     *
-     * @param output The ModulePool to be filled with Visitor returned
-     * ModuleEntry.
-     */
-    public void transformAndCopy(Function<ModuleEntry, ModuleEntry> transform, ModulePool output);
-
-    /**
-     * The ByteOrder currently in use when generating the jimage file.
-     *
-     * @return The ByteOrder.
-     */
-    public ByteOrder getByteOrder();
-
-    /**
-     * Release properties such as OS, CPU name, version etc.
-     *
-     * @return the release properties
-     */
-    public Map<String, String> getReleaseProperties();
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -191,5 +191,5 @@
      *
      * @throws PluginException
      */
-    public void visit(ModulePool in, ModulePool out);
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePool.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.tools.jlink.plugin;
+
+import java.nio.ByteOrder;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+/**
+ * A Pool of Java resources.
+ */
+public interface ResourcePool {
+    /**
+     * Return the module view of this resource pool.
+     *
+     * @return a module based view of this resource pool.
+     */
+    public ResourcePoolModuleView moduleView();
+
+    /**
+     * Get all ResourcePoolEntry contained in this ResourcePool instance.
+     *
+     * @return The stream of ResourcePoolEntries.
+     */
+    public Stream<ResourcePoolEntry> entries();
+
+    /**
+     * Return the number of ResourcePoolEntry count in this ResourcePool.
+     *
+     * @return the entry count.
+     */
+    public int entryCount();
+
+    /**
+     * Get the ResourcePoolEntry for the passed path.
+     *
+     * @param path A data path
+     * @return A ResourcePoolEntry instance or null if the data is not found
+     */
+    public Optional<ResourcePoolEntry> findEntry(String path);
+
+    /**
+     * Get the ModuleEntry for the passed path restricted to supplied context.
+     *
+     * @param path A data path
+     * @param context A context of the search
+     * @return A ModuleEntry instance or null if the data is not found
+     */
+    public Optional<ResourcePoolEntry> findEntryInContext(String path, ResourcePoolEntry context);
+
+    /**
+     * Check if the ResourcePool contains the given ResourcePoolEntry.
+     *
+     * @param data The module data to check existence for.
+     * @return The module data or null if not found.
+     */
+    public boolean contains(ResourcePoolEntry data);
+
+    /**
+     * Check if the ResourcePool contains some content at all.
+     *
+     * @return True, no content, false otherwise.
+     */
+    public boolean isEmpty();
+
+    /**
+     * The ByteOrder currently in use when generating the jimage file.
+     *
+     * @return The ByteOrder.
+     */
+    public ByteOrder byteOrder();
+
+    /**
+     * Visit each ResourcePoolEntry in this ResourcePool to transform it and copy
+     * the transformed ResourcePoolEntry to the output ResourcePoolBuilder.
+     *
+     * @param transform The function called for each ResourcePoolEntry found in the
+     * ResourcePool. The transform function should return a ResourcePoolEntry
+     * instance which will be added to the output or it should return null if
+     * the passed ResourcePoolEntry is to be ignored for the output.
+     *
+     * @param outBuilder The ResourcePoolBuilder to be filled with Visitor returned
+     * ResourcePoolEntries.
+     */
+    public default void transformAndCopy(
+            Function<ResourcePoolEntry, ResourcePoolEntry> transform,
+            ResourcePoolBuilder outBuilder) {
+        entries().forEach(resource -> {
+            ResourcePoolEntry res = transform.apply(resource);
+            if (res != null) {
+                outBuilder.add(res);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolBuilder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.tools.jlink.plugin;
+
+import java.nio.ByteOrder;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+/**
+ * Resource pool builder to build a resource pool by incrementally
+ * adding a set of resources one at a time.
+ */
+public interface ResourcePoolBuilder {
+    /**
+     * Add a ResourcePoolEntry.
+     *
+     * @param data The ResourcePoolEntry to add.
+     */
+    public void add(ResourcePoolEntry data);
+
+    /**
+     * Done with adding resource entries. Construct
+     * a ResourcePool with the added resource entries.
+     *
+     * @return a new ResourcePool filled with entries added.
+     */
+    public ResourcePool build();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolEntry.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,201 @@
+/*
+ * 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.tools.jlink.plugin;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import jdk.tools.jlink.internal.ResourcePoolEntryFactory;
+
+/**
+ * A ResourcePoolEntry is the elementary unit of data inside an image. It is
+ * generally a file. e.g.: a java class file, a resource file, a shared library.
+ * <br>
+ * A ResourcePoolEntry is identified by a path of the form:
+ * <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>
+ */
+public interface ResourcePoolEntry {
+
+    /**
+     * Type of module data.
+     * <li>
+     * <ul>CLASS_OR_RESOURCE: A java class or resource file.</ul>
+     * <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>
+     */
+    public enum Type {
+        CLASS_OR_RESOURCE,
+        CONFIG,
+        NATIVE_CMD,
+        NATIVE_LIB,
+        TOP,
+        OTHER
+    }
+
+    /**
+     * The module name of this ResourcePoolEntry.
+     *
+     * @return The module name.
+     */
+    public String moduleName();
+
+    /**
+     * The path of this ResourcePoolEntry.
+     *
+     * @return The module path.
+     */
+    public String path();
+
+    /**
+     * The ResourcePoolEntry's type.
+     *
+     * @return The data type.
+     */
+    public Type type();
+
+    /**
+     * The ResourcePoolEntry content length.
+     *
+     * @return The content length.
+     */
+    public long contentLength();
+
+    /**
+     * The ResourcePoolEntry content as an InputStream.
+     *
+     * @return The resource content as an InputStream.
+     */
+    public InputStream content();
+
+    /**
+     * The ResourcePoolEntry content as an array of bytes.
+     *
+     * @return An Array of bytes.
+     */
+    public default byte[] contentBytes() {
+        try (InputStream is = content()) {
+            return is.readAllBytes();
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
+    }
+
+    /**
+     * Write the content of this ResourcePoolEntry to an OutputStream.
+     *
+     * @param out the output stream
+     */
+    public default void write(OutputStream out) {
+        try {
+            out.write(contentBytes());
+        } catch (IOException ex) {
+            throw new UncheckedIOException(ex);
+        }
+    }
+
+    /**
+     * Create a ResourcePoolEntry with new content but other information
+     * copied from this ResourcePoolEntry.
+     *
+     * @param content The new resource content.
+     * @return A new ResourcePoolEntry.
+     */
+    public default ResourcePoolEntry copyWithContent(byte[] content) {
+        return ResourcePoolEntryFactory.create(this, content);
+    }
+
+    /**
+     * Create a ResourcePoolEntry with new content but other information
+     * copied from this ResourcePoolEntry.
+     *
+     * @param file The new resource content.
+     * @return A new ResourcePoolEntry.
+     */
+    public default ResourcePoolEntry copyWithContent(Path file) {
+        return ResourcePoolEntryFactory.create(this, file);
+    }
+
+    /**
+     * Create a ResourcePoolEntry for a resource of the given type.
+     *
+     * @param path The resource path.
+     * @param type The ResourcePoolEntry type.
+     * @param content The resource content.
+     * @return A new ResourcePoolEntry.
+     */
+    public static ResourcePoolEntry create(String path,
+            ResourcePoolEntry.Type type, byte[] content) {
+        return ResourcePoolEntryFactory.create(path, type, content);
+    }
+
+    /**
+     * Create a ResourcePoolEntry for a resource of type {@link Type#CLASS_OR_RESOURCE}.
+     *
+     * @param path The resource path.
+     * @param content The resource content.
+     * @return A new ResourcePoolEntry.
+     */
+    public static ResourcePoolEntry create(String path, byte[] content) {
+        return create(path, Type.CLASS_OR_RESOURCE, content);
+    }
+
+    /**
+     * Create a ResourcePoolEntry for a resource of the given type.
+     *
+     * @param path The resource path.
+     * @param type The ResourcePoolEntry type.
+     * @param file The resource file.
+     * @return A new ResourcePoolEntry.
+     */
+    public static ResourcePoolEntry create(String path,
+            ResourcePoolEntry.Type type, Path file) {
+        return ResourcePoolEntryFactory.create(path, type, file);
+    }
+
+    /**
+     * Create a ResourcePoolEntry for a resource of type {@link Type#CLASS_OR_RESOURCE}.
+     *
+     * @param path The resource path.
+     * @param file The resource file.
+     * @return A new ResourcePoolEntry.
+     */
+    public static ResourcePoolEntry create(String path, Path file) {
+        return create(path, Type.CLASS_OR_RESOURCE, file);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModule.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,79 @@
+/*
+ * 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.tools.jlink.plugin;
+
+import java.lang.module.ModuleDescriptor;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Stream;
+
+/**
+  * Link-time representation of a module.
+  */
+public interface ResourcePoolModule {
+    /**
+     * The module name.
+     *
+     * @return The module name.
+     */
+    public String name();
+
+    /**
+     * Retrieves a ResourcePoolEntry from the given path (e.g:
+     * /mymodule/com.foo.bar/MyClass.class)
+     *
+     * @param path The piece of data path.
+     * @return A ResourcePoolEntry of the given path, if found.
+     */
+    public Optional<ResourcePoolEntry> findEntry(String path);
+
+    /**
+     * The module descriptor of this module.
+     *
+     * @return The module descriptor.
+     */
+    public ModuleDescriptor descriptor();
+
+    /**
+     * Retrieves all the packages located in this module.
+     *
+     * @return The set of packages.
+     */
+    public Set<String> packages();
+
+    /**
+     * Retrieves the stream of ResourcePoolEntry.
+     *
+     * @return The ResourcePoolEntry stream.
+     */
+    public Stream<ResourcePoolEntry> entries();
+
+    /**
+     * Return the number of ResourcePoolEntry count in this ResourcePoolModule.
+     *
+     * @return the entry count.
+     */
+    public int entryCount();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ResourcePoolModuleView.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * 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.tools.jlink.plugin;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Stream;
+
+/**
+ * The module view of a ResourcePool.
+ */
+public interface ResourcePoolModuleView {
+    /**
+     * Find the module, if any, of the given name.
+     *
+     * @param name name of the module
+     * @return Optional containing the module of the given name.
+     */
+    public Optional<ResourcePoolModule> findModule(String name);
+
+    /**
+     * Find the module, if any, of the given ResourcePoolEntry
+     *
+     * @param entry The ResourcePoolEntry whose module is looked up.
+     * @return Optional containing the module of the given ResourcePoolEntry
+     */
+    public default Optional<ResourcePoolModule> findModule(ResourcePoolEntry entry) {
+        String name = Objects.requireNonNull(entry).moduleName();
+        return name != null? findModule(name) : Optional.empty();
+    }
+
+    /**
+     * The stream of modules contained in this ResourcePool.
+     *
+     * @return The stream of modules.
+     */
+    public Stream<ResourcePoolModule> modules();
+
+    /**
+     * Return the number of ResourcePoolModule count in this ResourcePool.
+     *
+     * @return the module count.
+     */
+    public int moduleCount();
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -52,6 +52,8 @@
 
 main.extended.help=\u4F7F\u7528\u53EF\u80FD\u306A\u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u30EA\u30B9\u30C8:
 
+main.extended.help.footer=<pattern-list>\u3092\u5FC5\u8981\u3068\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5834\u5408\u3001\u5024\u306F\u3001\u6B21\u306E\u5F62\u5F0F\u306E\u3044\u305A\u308C\u304B\u3092\u4F7F\u7528\u3059\u308B\u3001\u8981\u7D20\u306E\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30EA\u30B9\u30C8\u306B\u306A\u308A\u307E\u3059:\n  <glob-pattern>\n  glob:<glob-pattern>\n  regex:<regex-pattern>\n  @<filename> filename\u306F\u3001\u4F7F\u7528\u3059\u308B\u30D1\u30BF\u30FC\u30F3\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB(1\u884C\u3054\u3068\u306B1\u30D1\u30BF\u30FC\u30F3)\u306E\u540D\u524D\u3067\u3059\n\n
+
 err.unknown.byte.order:\u4E0D\u660E\u306A\u30D0\u30A4\u30C8\u9806{0}
 err.output.must.be.specified:--output\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
 err.modulepath.must.be.specified:--modulepath\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -52,6 +52,8 @@
 
 main.extended.help=\u53EF\u7528\u63D2\u4EF6\u5217\u8868:
 
+main.extended.help.footer=\u5BF9\u4E8E\u9700\u8981 <\u6A21\u5F0F\u5217\u8868> \u7684\u9009\u9879, \u503C\u5C06\u4E3A\u9017\u53F7\u5206\u9694\u7684\u5143\u7D20\u5217\u8868, \u6BCF\u4E2A\u5143\u7D20\u4F7F\u7528\u4EE5\u4E0B\u683C\u5F0F\u4E4B\u4E00:\n  <glob \u6A21\u5F0F>\n  glob:<glob \u6A21\u5F0F>\n  regex:<\u6B63\u5219\u8868\u8FBE\u5F0F\u6A21\u5F0F>\n  @<\u6587\u4EF6\u540D>, \u5176\u4E2D\u201C\u6587\u4EF6\u540D\u201D\u662F\u5305\u542B\u8981\u4F7F\u7528\u7684\u6A21\u5F0F\u7684\u6587\u4EF6\u540D, \u6BCF\u884C\u4E00\u4E2A\u6A21\u5F0F\n\n
+
 err.unknown.byte.order:\u672A\u77E5\u7684\u5B57\u8282\u987A\u5E8F {0}
 err.output.must.be.specified:\u5FC5\u987B\u6307\u5B9A --output
 err.modulepath.must.be.specified:\u5FC5\u987B\u6307\u5B9A --modulepath
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Wed Jul 05 22:01:14 2017 +0200
@@ -666,6 +666,10 @@
                     throws IOException
                 {
                     Path relPath = top.relativize(file);
+                    if (relPath.toString().equals(MODULE_INFO)
+                            && !Section.CLASSES.equals(section))
+                        warning("warn.ignore.entry", MODULE_INFO, section);
+
                     if (!relPath.toString().equals(MODULE_INFO)
                             && !matches(relPath, excludes)) {
                         try (InputStream in = Files.newInputStream(file)) {
@@ -693,9 +697,17 @@
             String name = Paths.get(prefix, other).toString()
                                .replace(File.separatorChar, '/');
             ZipEntry ze = new ZipEntry(name);
-            zos.putNextEntry(ze);
-            in.transferTo(zos);
-            zos.closeEntry();
+            try {
+                zos.putNextEntry(ze);
+                in.transferTo(zos);
+                zos.closeEntry();
+            } catch (ZipException x) {
+                if (x.getMessage().contains("duplicate entry")) {
+                    warning("warn.ignore.duplicate.entry", name, prefix);
+                    return;
+                }
+                throw x;
+            }
         }
 
         class JarEntryConsumer implements Consumer<JarEntry>, Predicate<JarEntry> {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -97,4 +97,7 @@
 warn.invalid.arg=Invalid classname or pathname not exist: {0}
 warn.no.module.hashes=No hashes recorded: no module specified for hashing depends on {0}
 warn.module.resolution.fail=No hashes recorded: {0}
+warn.ignore.entry=ignoring entry {0}, in section {1}
+warn.ignore.duplicate.entry=ignoring duplicate entry {0}, in section{1}
 
+
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_ja.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_ja.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -25,11 +25,11 @@
 
 main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} (create|list|describe|hash) <OPTIONS> <jmod-file>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001--help\u3092\u4F7F\u7528\u3057\u307E\u3059
 
-main.usage=\u4F7F\u7528\u65B9\u6CD5: {0} (create|list|describe|hash) <OPTIONS> <jmod-file>
-
+main.usage=\u4F7F\u7528\u65B9\u6CD5: {0} (create|list|describe|hash) <OPTIONS> <jmod-file>\n
 error.prefix=\u30A8\u30E9\u30FC:
 warn.prefix=\u8B66\u544A:
 
+main.opt.mode=\u30E1\u30A4\u30F3\u64CD\u4F5C\u30E2\u30FC\u30C9:
 main.opt.mode.create=create    - \u65B0\u898F\u306Ejmod\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u4F5C\u6210\u3057\u307E\u3059
 main.opt.mode.list=list      - \u3059\u3079\u3066\u306E\u30A8\u30F3\u30C8\u30EA\u306E\u540D\u524D\u3092\u51FA\u529B\u3057\u307E\u3059
 main.opt.mode.describe=describe  - \u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u8A73\u7D30\u3092\u51FA\u529B\u3057\u307E\u3059
@@ -42,7 +42,7 @@
 main.opt.cmds=\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30B3\u30DE\u30F3\u30C9\u306E\u5834\u6240
 main.opt.config=\u30E6\u30FC\u30B6\u30FC\u304C\u7DE8\u96C6\u53EF\u80FD\u306A\u69CB\u6210\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240
 main.opt.dry-run=\u30CF\u30C3\u30B7\u30E5\u30FB\u30E2\u30FC\u30C9\u306E\u8A66\u9A13\u7684\u306A\u5B9F\u884C
-main.opt.exclude=PATTERN\u3068\u3057\u3066\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u9664\u5916\u3057\u307E\u3059
+main.opt.exclude=\u5404\u8981\u7D20\u304C\u6B21\u306E\u5F62\u5F0F\u306E\u3044\u305A\u308C\u304B\u3092\u4F7F\u7528\u3059\u308B\u3001\u6307\u5B9A\u3055\u308C\u305F\u30AB\u30F3\u30DE\u533A\u5207\u308A\u30D1\u30BF\u30FC\u30F3\u30FB\u30EA\u30B9\u30C8\u306B\u4E00\u81F4\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u9664\u5916\u3057\u307E\u3059: <glob-pattern>\u3001glob:<glob-pattern>\u307E\u305F\u306Fregex:<regex-pattern>
 main.opt.module-version= \u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3
 main.opt.main-class=\u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9
 main.opt.main-class.arg=class-name
@@ -53,7 +53,7 @@
 main.opt.os-version=\u30AA\u30DA\u30EC\u30FC\u30C6\u30A3\u30F3\u30B0\u30FB\u30B7\u30B9\u30C6\u30E0\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3
 main.opt.os-version.arg=os-version
 main.opt.modulepath=\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9
-main.opt.hash-modules=\u6307\u5B9A\u306E\u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3057\u3001\u76F4\u63A5\u307E\u305F\u306F\u9593\u63A5\u7684\u306B\u4F9D\u5B58\u3057\u3066\u3044\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u7D50\u5408\u3059\u308B\u30CF\u30C3\u30B7\u30E5\u3092\u8A08\u7B97\u304A\u3088\u3073\u8A18\u9332\u3057\u307E\u3059\u3002\u30CF\u30C3\u30B7\u30E5\u306F\u3001\u4F5C\u6210\u3055\u308C\u3066\u3044\u308BJMOD\u30D5\u30A1\u30A4\u30EB\u3001jmod hash\u30B3\u30DE\u30F3\u30C9\u3067\u6307\u5B9A\u3057\u305F\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9\u306EJMOD\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30E9JAR\u306B\u8A18\u9332\u3055\u308C\u307E\u3059\u3002
+main.opt.hash-modules=\u6307\u5B9A\u306E<regex-pattern>\u306B\u4E00\u81F4\u3057\u3001\u76F4\u63A5\u307E\u305F\u306F\u9593\u63A5\u7684\u306B\u4F9D\u5B58\u3057\u3066\u3044\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30E2\u30B8\u30E5\u30FC\u30EB\u3092\u7D50\u5408\u3059\u308B\u30CF\u30C3\u30B7\u30E5\u3092\u8A08\u7B97\u304A\u3088\u3073\u8A18\u9332\u3057\u307E\u3059\u3002\u30CF\u30C3\u30B7\u30E5\u306F\u3001\u4F5C\u6210\u3055\u308C\u3066\u3044\u308BJMOD\u30D5\u30A1\u30A4\u30EB\u3001jmod hash\u30B3\u30DE\u30F3\u30C9\u3067\u6307\u5B9A\u3057\u305F\u30E2\u30B8\u30E5\u30FC\u30EB\u30FB\u30D1\u30B9\u306EJMOD\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30E9JAR\u306B\u8A18\u9332\u3055\u308C\u307E\u3059\u3002
 
 main.opt.cmdfile=\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8AAD\u307F\u53D6\u308A\u307E\u3059
 
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_zh_CN.properties	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_zh_CN.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -25,11 +25,11 @@
 
 main.usage.summary=\u7528\u6CD5: {0} (create|list|describe|hash) <\u9009\u9879> <jmod \u6587\u4EF6>\n\u4F7F\u7528 --help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
 
-main.usage=\u7528\u6CD5: {0} (create|list|describe|hash) <\u9009\u9879> <jmod \u6587\u4EF6>
-
+main.usage=\u7528\u6CD5: {0} (create|list|describe|hash) <\u9009\u9879> <jmod \u6587\u4EF6>\n
 error.prefix=\u9519\u8BEF:
 warn.prefix=\u8B66\u544A:
 
+main.opt.mode=\u4E3B\u64CD\u4F5C\u6A21\u5F0F:
 main.opt.mode.create=create    - \u521B\u5EFA\u65B0\u7684 jmod \u6863\u6848
 main.opt.mode.list=list      - \u8F93\u51FA\u6240\u6709\u6761\u76EE\u7684\u540D\u79F0
 main.opt.mode.describe=describe  - \u8F93\u51FA\u6A21\u5757\u8BE6\u7EC6\u4FE1\u606F
@@ -42,7 +42,7 @@
 main.opt.cmds=\u672C\u673A\u547D\u4EE4\u7684\u4F4D\u7F6E
 main.opt.config=\u7528\u6237\u53EF\u7F16\u8F91\u914D\u7F6E\u6587\u4EF6\u7684\u4F4D\u7F6E
 main.opt.dry-run=\u6563\u5217\u6A21\u5F0F\u7684\u6A21\u62DF\u8FD0\u884C
-main.opt.exclude=\u6392\u9664\u4EE5\u6A21\u5F0F\u6307\u5B9A\u7684\u6587\u4EF6
+main.opt.exclude=\u6392\u9664\u4E0E\u6240\u63D0\u4F9B\u9017\u53F7\u5206\u9694\u7684\u6A21\u5F0F\u5217\u8868\u5339\u914D\u7684\u6587\u4EF6, \u6BCF\u4E2A\u5143\u7D20\u4F7F\u7528\u4EE5\u4E0B\u683C\u5F0F\u4E4B\u4E00: <glob \u6A21\u5F0F>, glob:<glob \u6A21\u5F0F> \u6216 regex:<\u6B63\u5219\u8868\u8FBE\u5F0F\u6A21\u5F0F>
 main.opt.module-version= \u6A21\u5757\u7248\u672C
 main.opt.main-class=\u4E3B\u7C7B
 main.opt.main-class.arg=class-name
@@ -53,7 +53,7 @@
 main.opt.os-version=\u64CD\u4F5C\u7CFB\u7EDF\u7248\u672C
 main.opt.os-version.arg=os-version
 main.opt.modulepath=\u6A21\u5757\u8DEF\u5F84
-main.opt.hash-modules=\u8BA1\u7B97\u548C\u8BB0\u5F55\u6563\u5217, \u4EE5\u5C06\u6253\u5305\u6A21\u5757\u7ED1\u5B9A\u5230\u4E0E\u6307\u5B9A\u6A21\u5F0F\u5339\u914D\u5E76\u76F4\u63A5\u6216\u95F4\u63A5\u4F9D\u8D56\u4E8E\u7684\u6A21\u5757\u3002\u6563\u5217\u8BB0\u5F55\u5728\u6240\u521B\u5EFA\u7684 JMOD \u6587\u4EF6\u4E2D, \u6216\u8005\u8BB0\u5F55\u5728 jmod hash \u547D\u4EE4\u6307\u5B9A\u7684\u6A21\u5757\u8DEF\u5F84\u7684 JMOD \u6587\u4EF6\u6216\u6A21\u5757\u5316 JAR \u4E2D\u3002
+main.opt.hash-modules=\u8BA1\u7B97\u548C\u8BB0\u5F55\u6563\u5217, \u4EE5\u5C06\u6253\u5305\u6A21\u5757\u7ED1\u5B9A\u5230\u4E0E\u6307\u5B9A <\u6B63\u5219\u8868\u8FBE\u5F0F\u6A21\u5F0F> \u5339\u914D\u5E76\u76F4\u63A5\u6216\u95F4\u63A5\u4F9D\u8D56\u4E8E\u7684\u6A21\u5757\u3002\u6563\u5217\u8BB0\u5F55\u5728\u6240\u521B\u5EFA\u7684 JMOD \u6587\u4EF6\u4E2D, \u6216\u8005\u8BB0\u5F55\u5728 jmod hash \u547D\u4EE4\u6307\u5B9A\u7684\u6A21\u5757\u8DEF\u5F84\u7684 JMOD \u6587\u4EF6\u6216\u6A21\u5757\u5316 JAR \u4E2D\u3002
 
 main.opt.cmdfile=\u4ECE\u6307\u5B9A\u6587\u4EF6\u8BFB\u53D6\u9009\u9879
 
--- a/jdk/src/sample/share/nio/server/README.txt	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/src/sample/share/nio/server/README.txt	Wed Jul 05 22:01:14 2017 +0200
@@ -67,7 +67,7 @@
 Invoking the following should be sufficient:
 
     % mkdir build
-    % javac -source 1.5 -target 1.5 -d build *.java
+    % javac -d build *.java
 
 The following creates the document root:
 
--- a/jdk/test/TEST.ROOT	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/TEST.ROOT	Wed Jul 05 22:01:14 2017 +0200
@@ -23,8 +23,8 @@
 # Group definitions
 groups=TEST.groups [closed/TEST.groups]
 
-# Allow querying of sun.arch.data.model in @requires clauses
-requires.properties=sun.arch.data.model 
+# Allow querying of various System properties in @requires clauses
+requires.properties=sun.arch.data.model java.runtime.name
 
 # Tests using jtreg 4.2 b02 features
 requiredVersion=4.2 b02
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,286 @@
+/*
+ * 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
+ * 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 8155740
+ @summary See <rdar://problem/3429130>: Events: actionPerformed() method not
+          called when it is button is clicked (system load related)
+ @summary com.apple.junit.java.awt.Frame
+ @library ../../../regtesthelpers
+ @build VisibilityValidator
+ @build Util
+ @build Waypoint
+ @run main NestedModalDialogTest
+ */
+//////////////////////////////////////////////////////////////////////////////
+//  NestedModalDialogTest.java
+// The test launches a parent frame. From this parent frame it launches a modal
+// dialog. From the modal dialog it launches a second modal dialog with a text
+// field in it and tries to write into the text field. The test succeeds if you
+// are successfully able to write into this second Nested Modal Dialog
+//////////////////////////////////////////////////////////////////////////////
+// classes necessary for this test
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Enumeration;
+
+import test.java.awt.regtesthelpers.Waypoint;
+import test.java.awt.regtesthelpers.VisibilityValidator;
+import test.java.awt.regtesthelpers.Util;
+
+public class NestedModalDialogTest {
+
+    Waypoint[] event_checkpoint = new Waypoint[3];
+    VisibilityValidator[] win_checkpoint = new VisibilityValidator[2];
+
+    IntermediateDialog interDiag;
+    TextDialog txtDiag;
+
+    // Global variables so the robot thread can locate things.
+    Button[] robot_button = new Button[2];
+    TextField robot_text = null;
+    static Robot _robot = null;
+
+    /*
+     * @throws InterruptedException
+     * @throws WaypointException
+     */
+    public void testModalDialogs() throws Exception {
+        Frame frame = null;
+        String result = "";
+        Robot robot = getRobot();
+
+        event_checkpoint[0] = new Waypoint(); // "-Launch 1-"
+        event_checkpoint[1] = new Waypoint(); // "-Launch 2-"
+
+        // Thread.currentThread().setName("NestedModalDialogTest Thread");
+        // launch first frame with firstButton
+        frame = new StartFrame();
+        VisibilityValidator.setVisibleAndConfirm(frame);
+        Util.clickOnComp(robot_button[0], robot);
+
+        // Dialog must be created and onscreen before we proceed.
+        //   The event_checkpoint waits for the Dialog to be created.
+        //   The win_checkpoint waits for the Dialog to be visible.
+        event_checkpoint[0].requireClear("TestFrame actionPerformed() never "
+                + "called, see <rdar://problem/3429130>");
+        win_checkpoint[0].requireVisible();
+        Util.clickOnComp(robot_button[1], robot);
+
+        // Again, the Dialog must be created and onscreen before we proceed.
+        //   The event_checkpoint waits for the Dialog to be created.
+        //   The win_checkpoint waits for the Dialog to be visible.
+        event_checkpoint[1].requireClear("IntermediateDialog actionPerformed() "
+                + "never called, see <rdar://problem/3429130>");
+        win_checkpoint[1].requireVisible();
+        Util.clickOnComp(robot_text, robot);
+
+        // I'm really not sure whether the click is needed for focus
+        // but since it's asynchronous, as is the actually gaining of focus
+        // we might as well do our best
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                }
+            });
+        } catch (Exception e) {
+        }
+
+        robot.keyPress(KeyEvent.VK_SHIFT);
+
+        robot.keyPress(KeyEvent.VK_H);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_H);
+
+        robot.keyRelease(KeyEvent.VK_SHIFT);
+
+        robot.keyPress(KeyEvent.VK_E);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_E);
+
+        robot.keyPress(KeyEvent.VK_L);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_L);
+
+        robot.keyPress(KeyEvent.VK_L);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_L);
+
+        robot.keyPress(KeyEvent.VK_O);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_O);
+
+        //
+        // NOTE THAT WE MAY HAVE MORE SYNCHRONIZATION WORK TO DO HERE.
+        // CURRENTLY THERE IS NO GUARANTEE THAT THE KEYEVENT THAT THAT
+        // TYPES THE 'O' HAS BEEN PROCESSED BEFORE WE GET THE RESULT
+        //
+        // This is a (lame) attempt at waiting for the last typeKey events to
+        // propagate. It's not quite right because robot uses
+        // CGRemoteOperations, which are asynchronous. But that's why I put in
+        // the pause
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                }
+            });
+        } catch (Exception e) {
+        }
+
+        // Need to call this before the dialog that robot_text is in is disposed
+        result = robot_text.getText();
+
+        Thread.sleep(50); // shouldn't need this, but pause adds stability
+        // Click Close box of modal dialog with textField
+        Util.clickOnComp(txtDiag, robot);
+
+        Thread.sleep(50); // shouldn't need this, but pause adds stability
+        // Click Close box of intermediate modal dialog
+        Util.clickOnComp(interDiag, robot);
+
+        Thread.sleep(50); // shouldn't need this, but pause adds stability
+        // Click Close box of intermediate modal dialog
+        Util.clickOnComp(frame, robot);
+
+        String expected = "Hello";
+    }
+
+    private static Robot getRobot() {
+        if (_robot == null) {
+            try {
+                _robot = new Robot();
+            } catch (AWTException e) {
+                throw new RuntimeException("Robot creation failed");
+            }
+        }
+        return _robot;
+    }
+
+    //////////////////// Start Frame ///////////////////
+    /**
+     * Launches the first frame with a button in it
+     */
+    class StartFrame extends Frame {
+
+        /**
+         * Constructs a new instance.
+         */
+        public StartFrame() {
+            super("First Frame");
+            setLayout(new GridBagLayout());
+            setLocation(375, 200);
+            setSize(271, 161);
+            Button but = new Button("Make Intermediate");
+            but.addActionListener(new java.awt.event.ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    interDiag = new IntermediateDialog(StartFrame.this);
+                    win_checkpoint[0] = new VisibilityValidator(interDiag);
+                    interDiag.setSize(300, 200);
+
+                    // may need listener to watch this move.
+                    interDiag.setLocation(getLocationOnScreen());
+                    interDiag.pack();
+                    event_checkpoint[0].clear();
+                    interDiag.setVisible(true);
+                }
+            });
+            Panel pan = new Panel();
+            pan.add(but);
+            add(pan);
+            robot_button[0] = but;
+            addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    setVisible(false);
+                    dispose();
+                }
+            });
+        }
+    }
+
+    ///////////////////////////// MODAL DIALOGS /////////////////////////////
+    /* A Dialog that launches a sub-dialog */
+    class IntermediateDialog extends Dialog {
+
+        Dialog m_parent;
+
+        public IntermediateDialog(Frame parent) {
+            super(parent, "Intermediate Modal", true /*Modal*/);
+            m_parent = this;
+            Button but = new Button("Make Text");
+            but.addActionListener(new java.awt.event.ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    txtDiag = new TextDialog(m_parent);
+                    win_checkpoint[1] = new VisibilityValidator(txtDiag);
+                    txtDiag.setSize(300, 100);
+                    event_checkpoint[1].clear();
+                    txtDiag.setVisible(true);
+                }
+            });
+            Panel pan = new Panel();
+            pan.add(but);
+            add(pan);
+            pack();
+            addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    setVisible(false);
+                    dispose();
+                }
+            });
+
+            // The robot needs to know about us, so set global
+            robot_button[1] = but;
+        }
+    }
+
+    /* A Dialog that just holds a text field */
+    class TextDialog extends Dialog {
+
+        public TextDialog(Dialog parent) {
+            super(parent, "Modal Dialog", true /*Modal*/);
+            TextField txt = new TextField("", 10);
+            Panel pan = new Panel();
+            pan.add(txt);
+            add(pan);
+            pack();
+            addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    setVisible(false);
+                    dispose();
+                }
+            });
+
+            // The robot needs to know about us, so set global
+            robot_text = txt;
+        }
+    }
+
+    public static void main(String[] args) throws RuntimeException, Exception {
+        try {
+            new NestedModalDialogTest().testModalDialogs();
+        } catch (Exception e) {
+            throw new RuntimeException("NestedModalDialogTest object creation "
+                    + "failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,283 @@
+/*
+ * 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
+ * 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 8155740
+ @summary See <rdar://problem/3429130>: Events: actionPerformed() method not
+              called when it is button is clicked (system load related)
+ @summary com.apple.junit.java.awt.Frame
+ @library ../../../regtesthelpers
+ @build VisibilityValidator
+ @build Util
+ @build Waypoint
+ @run main NestedModelessDialogTest
+ */
+/////////////////////////////////////////////////////////////////////////////
+//  NestedModelessDialogTest.java
+// The test launches a parent frame. From this parent frame it launches a modal
+// dialog. From the modal dialog it launches a modeless dialog with a text
+// field in it and tries to write into the text field. The test succeeds if you
+// are successfully able to write into this Nested Modeless Dialog
+/////////////////////////////////////////////////////////////////////////////
+// classes necessary for this test
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Enumeration;
+
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.VisibilityValidator;
+import test.java.awt.regtesthelpers.Waypoint;
+
+public class NestedModelessDialogTest {
+
+    Waypoint[] event_checkpoint = new Waypoint[3];
+    VisibilityValidator[] win_checkpoint = new VisibilityValidator[2];
+
+    IntermediateDialog interDiag;
+    TextDialog txtDiag;
+
+    // Global variables so the robot thread can locate things.
+    Button[] robot_button = new Button[2];
+    TextField robot_text = null;
+    static Robot _robot = null;
+
+    /**
+     * Get called by test harness
+     *
+     * @throws Exception
+     */
+    public void testModelessDialogs() throws Exception {
+        Frame frame = null;
+        String result = "";
+        Robot robot = getRobot();
+
+        event_checkpoint[0] = new Waypoint(); // "-Launch 1-"
+        event_checkpoint[1] = new Waypoint(); // "-Launch 2-"
+
+        // launch first frame with fistButton
+        frame = new StartFrame();
+        VisibilityValidator.setVisibleAndConfirm(frame);
+        Util.clickOnComp(robot_button[0], robot);
+
+        // Dialog must be created and onscreen before we proceed.
+        //   The event_checkpoint waits for the Dialog to be created.
+        //   The win_checkpoint waits for the Dialog to be visible.
+        event_checkpoint[0].requireClear();
+        win_checkpoint[0].requireVisible();
+        Util.clickOnComp(robot_button[1], robot);
+
+        // Again, the Dialog must be created and onscreen before we proceed.
+        //   The event_checkpoint waits for the Dialog to be created.
+        //   The win_checkpoint waits for the Dialog to be visible.
+        event_checkpoint[1].requireClear();
+        win_checkpoint[1].requireVisible();
+        Util.clickOnComp(robot_text, robot);
+
+        // I'm really not sure whether the click is needed for focus
+        // but since it's asynchronous, as is the actually gaining of focus
+        // we might as well do our best
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                }
+            });
+        } catch (Exception e) {
+        }
+
+        robot.keyPress(KeyEvent.VK_SHIFT);
+
+        robot.keyPress(KeyEvent.VK_H);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_H);
+
+        robot.keyRelease(KeyEvent.VK_SHIFT);
+
+        robot.keyPress(KeyEvent.VK_E);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_E);
+
+        robot.keyPress(KeyEvent.VK_L);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_L);
+
+        robot.keyPress(KeyEvent.VK_L);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_L);
+
+        robot.keyPress(KeyEvent.VK_O);
+        robot.waitForIdle();
+        robot.keyRelease(KeyEvent.VK_O);
+
+        //
+        // NOTE THAT WE MAY HAVE MORE SYNCHRONIZATION WORK TO DO HERE.
+        // CURRENTLY THERE IS NO GUARANTEE THAT THE KEYEVENT THAT THAT
+        // TYPES THE 'O' HAS BEEN PROCESSED BEFORE WE GET THE RESULT
+        //
+        // This is a (lame) attempt at waiting for the last typeKey events to
+        // propagate. It's not quite right because robot uses
+        // CGRemoteOperations, which are asynchronous. But that's why I put in
+        // the Thread.sleep
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                }
+            });
+        } catch (Exception e) {
+        }
+
+        // Need to call this before the dialog that robot_text is in is disposed
+        result = robot_text.getText();
+
+        Thread.sleep(50); // Thread.sleep adds stability
+        // Click Close box of modeless dialog with textField
+        Util.clickOnComp(txtDiag, robot);
+
+        Thread.sleep(50); // Thread.sleep adds stability
+        // Click Close box of intermediate modal dialog
+        Util.clickOnComp(interDiag, robot);
+
+        Thread.sleep(50); // Thread.sleep adds stability
+        // Click Close box of intermediate modal dialog
+        Util.clickOnComp(frame, robot);
+
+        String expected = "Hello";
+    }
+
+    private static Robot getRobot() {
+        if (_robot == null) {
+            try {
+                _robot = new Robot();
+            } catch (AWTException e) {
+                throw new RuntimeException("Robot creation failed");
+            }
+        }
+        return _robot;
+    }
+
+    //////////////////// Start Frame ///////////////////
+    /**
+     * Launches the first frame with a button in it
+     */
+    class StartFrame extends Frame {
+
+        /**
+         * Constructs a new instance.
+         */
+        public StartFrame() {
+            super("First Frame");
+            setLayout(new GridBagLayout());
+            setLocation(375, 200);
+            setSize(271, 161);
+            Button but = new Button("Make Intermediate");
+            but.addActionListener(new java.awt.event.ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    interDiag = new IntermediateDialog(StartFrame.this);
+                    win_checkpoint[0] = new VisibilityValidator(interDiag);
+                    interDiag.setSize(300, 200);
+
+                    // may need listener to watch this move.
+                    interDiag.setLocation(getLocationOnScreen());
+                    interDiag.pack();
+                    event_checkpoint[0].clear();
+                    interDiag.setVisible(true);
+                }
+            });
+            Panel pan = new Panel();
+            pan.add(but);
+            add(pan);
+            robot_button[0] = but;
+            addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    setVisible(false);
+                    dispose();
+                }
+            });
+        }
+    }
+
+    ///////////////////////////// VARIOUS DIALOGS //////////////////////////
+    /* A Dialog that launches a sub-dialog */
+    class IntermediateDialog extends Dialog {
+
+        Dialog m_parent;
+
+        public IntermediateDialog(Frame parent) {
+            super(parent, "Intermediate Modal", true /*Modal*/);
+            m_parent = this;
+            Button but = new Button("Make Text");
+            but.addActionListener(new java.awt.event.ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    txtDiag = new TextDialog(m_parent);
+                    win_checkpoint[1] = new VisibilityValidator(txtDiag);
+                    txtDiag.setSize(300, 100);
+                    event_checkpoint[1].clear();
+                    txtDiag.setVisible(true);
+                }
+            });
+            Panel pan = new Panel();
+            pan.add(but);
+            add(pan);
+            pack();
+            addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    setVisible(false);
+                    dispose();
+                }
+            });
+
+            // The robot needs to know about us, so set global
+            robot_button[1] = but;
+        }
+    }
+
+    /* A Dialog that just holds a text field */
+    class TextDialog extends Dialog {
+
+        public TextDialog(Dialog parent) {
+            super(parent, "Modeless Dialog", false /*Modeless*/);
+            TextField txt = new TextField("", 10);
+            Panel pan = new Panel();
+            pan.add(txt);
+            add(pan);
+            pack();
+            addWindowListener(new WindowAdapter() {
+                public void windowClosing(WindowEvent e) {
+                    setVisible(false);
+                    dispose();
+                }
+            });
+
+            // The robot needs to know about us, so set global
+            robot_text = txt;
+        }
+    }
+
+    public static void main(String[] args) throws RuntimeException {
+        try {
+            new NestedModelessDialogTest().testModelessDialogs();
+        } catch (Exception e) {
+            throw new RuntimeException("NestedModelessDialogTest object "
+                    + "creation failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/ThemeReaderCrashTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,62 @@
+/*
+ * 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 8159956
+ * @summary Test to check JVM crash is not observed in headless mode while
+ * trying to create a JScrollPane
+ * @run main/othervm -Djava.awt.headless=true ThemeReaderCrashTest
+ */
+
+import javax.swing.JScrollPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.ScrollPaneConstants;
+
+public class ThemeReaderCrashTest {
+
+    public static void main(String[] args) throws Exception {
+
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                ThemeReaderCrashTest obj = new ThemeReaderCrashTest();
+            }
+        });
+    }
+
+    ThemeReaderCrashTest() {
+        JPanel panel = new JPanel();
+        JScrollPane pane =
+            new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
+                            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+        panel.setSize(300, 200);
+
+        panel.add(pane);
+    }
+}
+
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -45,9 +45,10 @@
  * @bug 6637655 6985776
  * @summary Overlapping test for javax.swing.JScrollPane
  * @author sergey.grinev@oracle.com: area=awt.mixing
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/sun.awt
  *          java.desktop/java.awt.peer
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main JGlassPaneInternalFrameOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -46,9 +46,10 @@
  * @bug 6637655 6981919
  * @summary Overlapping test for javax.swing.JScrollPane
  * @author sergey.grinev@oracle.com: area=awt.mixing
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/sun.awt
  *          java.desktop/java.awt.peer
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main JGlassPaneMoveOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -42,9 +42,10 @@
  * @bug 6985399
  * @summary Overlapping test for javax.swing.JScrollPane
  * @author sergey.grinev@oracle.com: area=awt.mixing
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/sun.awt
  *          java.desktop/java.awt.peer
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main JInternalFrameMoveOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -41,9 +41,10 @@
  * @key headful
  * @summary Overlapping test for javax.swing.JScrollPane
  * @author sergey.grinev@oracle.com: area=awt.mixing
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/sun.awt
  *          java.desktop/java.awt.peer
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main JInternalFrameOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -43,9 +43,10 @@
  * @key headful
  * @summary Overlapping test for javax.swing.JScrollPane
  * @author sergey.grinev@oracle.com: area=awt.mixing
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/sun.awt
  *          java.desktop/java.awt.peer
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main JScrollPaneOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -50,9 +50,10 @@
  * @bug 6986109
  * @summary Overlapping test for javax.swing.JSplitPane
  * @author sergey.grinev@oracle.com: area=awt.mixing
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/sun.awt
  *          java.desktop/java.awt.peer
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main JSplitPaneOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java	Wed Jul 05 22:01:14 2017 +0200
@@ -46,10 +46,11 @@
  * @key headful
  * @bug 6776743
  * @summary Opaque overlapping test for each AWT component
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/com.sun.awt
  *          java.desktop/java.awt.peer
  *          java.desktop/sun.awt
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main OpaqueOverlapping
  */
--- a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java	Wed Jul 05 22:01:14 2017 +0200
@@ -32,10 +32,11 @@
  * @key headful
  * @bug 6994264
  * @summary Opaque overlapping test for Choice AWT component
- * @library ../../regtesthelpers
+ * @library /java/awt/patchlib  ../../regtesthelpers
  * @modules java.desktop/com.sun.awt
  *          java.desktop/java.awt.peer
  *          java.desktop/sun.awt
+ * @build java.desktop/java.awt.Helper
  * @build Util
  * @run main OpaqueOverlappingChoice
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/8158205/MouseHandCursorTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,130 @@
+/*
+* 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 8158205
+ * @summary HiDPI hand cursor broken on Windows
+ * @run main/manual/othervm -Dsun.java2d.uiScale=2 MouseHandCursorTest
+ */
+import java.awt.Cursor;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JFrame;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+public class MouseHandCursorTest {
+
+    private static GridBagLayout layout;
+    private static JPanel mainControlPanel;
+    private static JPanel resultButtonPanel;
+    private static JLabel instructionText;
+    private static JButton passButton;
+    private static JButton failButton;
+    private static JFrame mainFrame;
+    private static CountDownLatch latch;
+
+    public static void main(String[] args) throws Exception {
+        latch = new CountDownLatch(1);
+        createUI();
+        latch.await();
+    }
+
+    public static void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mainFrame = new JFrame("Hand Cursor Test");
+                layout = new GridBagLayout();
+                mainControlPanel = new JPanel(layout);
+                resultButtonPanel = new JPanel(layout);
+
+                GridBagConstraints gbc = new GridBagConstraints();
+                String instructions
+                        = "<html><center>INSTRUCTIONS:</center><br>"
+                        + "Check the mouse cursor type on frame.<br>"
+                        + "If mouse cursor is hand cursor test passed else failed"
+                        + "<br><br></html>";
+
+                instructionText = new JLabel();
+                instructionText.setText(instructions);
+
+                gbc.gridx = 0;
+                gbc.gridy = 0;
+                gbc.fill = GridBagConstraints.HORIZONTAL;
+                mainControlPanel.add(instructionText, gbc);
+
+                passButton = new JButton("Pass");
+                passButton.setActionCommand("Pass");
+                passButton.addActionListener((ActionEvent e) -> {
+                    latch.countDown();
+                    mainFrame.dispose();
+                });
+
+                failButton = new JButton("Fail");
+                failButton.setActionCommand("Fail");
+                failButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        latch.countDown();
+                        mainFrame.dispose();
+                        throw new RuntimeException("Test Failed");
+                    }
+                });
+                gbc.gridx = 2;
+                gbc.gridy = 0;
+                resultButtonPanel.add(passButton, gbc);
+                gbc.gridx = 3;
+                gbc.gridy = 0;
+                resultButtonPanel.add(failButton, gbc);
+
+                gbc.gridx = 0;
+                gbc.gridy = 2;
+                mainControlPanel.add(resultButtonPanel, gbc);
+
+                mainFrame.add(mainControlPanel);
+                mainFrame.setSize(400, 200);
+                mainFrame.setLocationRelativeTo(null);
+                mainFrame.setVisible(true);
+
+                mainFrame.addWindowListener(new WindowAdapter() {
+                    @Override
+                    public void windowClosing(WindowEvent e) {
+                        latch.countDown();
+                        mainFrame.dispose();
+                    }
+                });
+                mainFrame.getContentPane().setCursor(Cursor.
+                        getPredefinedCursor(Cursor.HAND_CURSOR));
+            }
+        });
+    }
+}
--- a/jdk/test/java/awt/TextArea/TextAreaScrolling/TextAreaScrolling.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/TextArea/TextAreaScrolling/TextAreaScrolling.java	Wed Jul 05 22:01:14 2017 +0200
@@ -24,7 +24,7 @@
 /*
  @test
  @key headful
- @bug 6180449
+ @bug 6180449 8160764
  @summary TextArea scrolls to its left when selecting the text from the end.
  @run main TextAreaScrolling
  */
@@ -42,6 +42,12 @@
     Robot robot;
 
     TextAreaScrolling() {
+        try {
+            robot = new Robot();
+        } catch (Exception ex) {
+            throw new RuntimeException("Robot Creation Failed");
+        }
+
         mainFrame = new Frame();
         mainFrame.setSize(200, 200);
         mainFrame.setLocation(200, 200);
@@ -49,19 +55,10 @@
         textArea = new TextArea();
         textArea.setText("1234 5678");
         textArea.setSelectionStart(3);
-        textArea.setSelectionStart(4);
+        textArea.setSelectionEnd(4);
         mainFrame.add(textArea);
         mainFrame.setVisible(true);
         textArea.requestFocusInWindow();
-
-        try {
-            robot = new Robot();
-            robot.setAutoWaitForIdle(true);
-        } catch (Exception ex) {
-            dispose();
-            System.exit(0);
-            throw new RuntimeException("Robot Creation Failed");
-        }
     }
 
     public void dispose() {
@@ -71,6 +68,8 @@
     }
 
     public void performTest() {
+        robot.waitForIdle();
+        robot.delay(200);
         Point loc = textArea.getLocationOnScreen();
         Rectangle textAreaBounds = new Rectangle();
         textArea.getBounds(textAreaBounds);
@@ -80,7 +79,7 @@
 
         // Perform selection by scrolling to left from end of char sequence.
         robot.mousePress(InputEvent.BUTTON1_MASK);
-        robot.mouseMove(textAreaBounds.x - 5, loc.y + 5);
+        robot.mouseMove(loc.x - 5, loc.y + 5);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
         // Perform double click on beginning word of TextArea
@@ -91,11 +90,12 @@
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseRelease(InputEvent.BUTTON1_MASK);
         robot.delay(100);
+        robot.waitForIdle();
 
         if (textArea.getSelectedText().contentEquals("5678")) {
             dispose();
-            throw new RuntimeException ("TextArea over scrolled towards left"
-                + "Expected selected text: '1234 ' and for mac '1234'"
+            throw new RuntimeException ("TextArea over scrolled towards left. "
+                + "Expected selected text: '1234 ' and for mac '1234' "
                 + "Actual selected text: 5678");
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/8159168/SetShapeTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,92 @@
+/*
+* 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 8159168
+ * @summary [hidpi] Window.setShape() works incorrectly on HiDPI
+ * @run main/othervm -Dsun.java2d.uiScale=2 SetShapeTest
+ */
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Window;
+import java.awt.geom.Area;
+import java.awt.geom.Rectangle2D;
+import java.awt.Robot;
+import javax.swing.SwingUtilities;
+
+public class SetShapeTest {
+
+    private static Window window;
+    private static Frame background;
+
+    public static void main(String[] args) throws Exception {
+        createUI();
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        Rectangle rect = window.getBounds();
+        rect.x += rect.width - 10;
+        rect.y += rect.height - 10;
+        Color c = robot.getPixelColor(rect.x, rect.y);
+        try {
+            if (!c.equals(Color.RED)) {
+                throw new RuntimeException("Test Failed");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    background.dispose();
+                    window.dispose();
+                }
+            });
+        }
+    }
+
+    private static void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                background = new Frame();
+                background.setUndecorated(true);
+                background.setBackground(Color.blue);
+                background.setSize(300, 300);
+                background.setLocation(100, 100);
+                background.setVisible(true);
+                window = new Window(background);
+                window.setBackground(Color.red);
+                window.add(new Panel(), BorderLayout.CENTER);
+                window.setLocation(200, 200);
+                window.setSize(100, 100);
+                Area a = new Area();
+                a.add(new Area(new Rectangle2D.Double(0, 0, 100, 100)));
+                window.setShape(a);
+                window.setVisible(true);
+                window.toFront();
+            }
+        });
+    }
+}
--- a/jdk/test/java/awt/Window/FindOwner/FindOwnerTest.html	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/Window/FindOwner/FindOwnerTest.html	Wed Jul 05 22:01:14 2017 +0200
@@ -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
@@ -23,7 +23,7 @@
 
   @test
   @key headful
-  @bug 8139227
+  @bug 8139227 8159460
   @summary Text fields in JPopupMenu structure do not receive focus in hosted
            Applets
   @author Semyon Sadetsky
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/GetScreenLocation/GetScreenLocationTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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 @summary setLocationRelativeTo stopped working in Ubuntu 13.10 (Unity)
+ * @bug 8036915
+ * @run main GetScreenLocationTest
+ */
+import java.awt.*;
+
+public class GetScreenLocationTest {
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        Window frame = null;
+        for(int i = 0; i < 50; i++) {
+            if(frame != null) frame.dispose();
+            frame = new Dialog((Frame)null);
+            frame.setBounds(0, 0, 200, 200);
+            frame.setVisible(true);
+            robot.waitForIdle();
+            robot.delay(200);
+            frame.setLocation(321, 321);
+            robot.waitForIdle();
+            robot.delay(200);
+            Dimension size = frame.getSize();
+            if(size.width != 200 || size.height != 200) {
+                frame.dispose();
+                throw new RuntimeException("getSize() is wrong " + size);
+            }
+            Rectangle r = frame.getBounds();
+            frame.dispose();
+            if(r.x != 321 || r.y != 321) {
+                throw new RuntimeException("getLocation() returns " +
+                        "wrong coordinates " + r.getLocation());
+            }
+            if(r.width != 200 || r.height != 200) {
+                throw new RuntimeException("getSize() is wrong " + r.getSize());
+            }
+        }
+        System.out.println("ok");
+    }
+
+}
--- a/jdk/test/java/awt/font/JNICheck/LoadFontsJNICheck.sh	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/font/JNICheck/LoadFontsJNICheck.sh	Wed Jul 05 22:01:14 2017 +0200
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# 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
@@ -23,7 +23,7 @@
 
 #
 #   @test
-#   @bug        8138817
+#   @bug        8138817 8152971
 #   @summary    Tests that there are no JNI warnings about local references.
 #   @compile LoadFontsJNICheck.java
 #   @run shell/timeout=300 LoadFontsJNICheck.sh
@@ -37,11 +37,6 @@
   CP="${TESTCLASSES}"
 fi
 
-if [ $OS != Darwin ]
-then
-    exit 0
-fi
-
 if [ -z "${TESTJAVA}" ] ; then
    JAVACMD=java
 else
--- a/jdk/test/java/awt/print/PrinterJob/PrintTestLexmarkIQ.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/PrintTestLexmarkIQ.java	Wed Jul 05 22:01:14 2017 +0200
@@ -20,9 +20,9 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+ /*
  * @test
- * @bug 6966350
+ * @bug 6966350 8160882
  * @summary Verifies if Empty pages are printed on Lexmark E352dn PS3
  *           with "1200 IQ" setting
  * @run main/manual PrintTestLexmarkIQ
@@ -33,6 +33,8 @@
 import java.awt.Font;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import java.awt.geom.Rectangle2D;
 import java.awt.print.PageFormat;
 import java.awt.print.Paper;
@@ -145,6 +147,13 @@
         dialog.add(mainPanel);
         dialog.pack();
         dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
     }
 
     public int print(Graphics g, PageFormat pf, int pi)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/regtesthelpers/VisibilityValidator.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+ /*
+ * @summary Utility routines that wait for a window to be displayed or for
+colors to be visible
+ * @summary com.apple.junit.utils
+ */
+package test.java.awt.regtesthelpers;
+
+import java.awt.*;
+import java.awt.event.*;
+
+//import junit.framework.Assert;
+public class VisibilityValidator {
+
+    // Wait up to five seconds for our window events
+    static final int SETUP_PERIOD = 5000;
+    static final boolean DEBUG = false;
+
+    volatile Window win = null;
+    boolean activated = false;
+    boolean opened = false;
+    boolean focused = false;
+    volatile boolean valid = false;
+
+    //
+    // Utility functions that encapsulates normal usage patterns
+    //
+    public static void setVisibleAndConfirm(Frame testframe) throws Exception {
+        setVisibleAndConfirm(testframe, "Could not confirm test frame was "
+                + "visible");
+    }
+
+    public static void setVisibleAndConfirm(Frame testframe, String msg)
+            throws Exception {
+        if (testframe.isVisible()) {
+            throw new RuntimeException("Frame is already visible");
+        }
+
+        VisibilityValidator checkpoint = new VisibilityValidator(testframe);
+        testframe.setVisible(true);
+        checkpoint.requireVisible();
+        if (!checkpoint.isValid()) {
+            //System.err.println(msg);
+            throw new Exception("Frame not visible after " + SETUP_PERIOD
+                    + " milliseconds");
+        }
+    }
+
+    //
+    // Add listeners to the window
+    //
+    public VisibilityValidator(Window win) {
+        this.win = win;
+        WindowAdapter watcher = new WindowAdapter() {
+            public void windowOpened(WindowEvent e) {
+                doOpen();
+            }
+
+            public void windowActivated(WindowEvent e) {
+                doActivate();
+            }
+
+            public void windowGainedFocus(WindowEvent e) {
+                doGainedFocus();
+            }
+        };
+
+        win.addWindowListener(watcher);
+        win.addWindowFocusListener(watcher);
+    }
+
+    // Make the window visible
+    //
+    // The only way to make it through this routine is for the window to
+    // generate BOTH a windowOpened, a windowActivated event and a
+    // windowGainedFocus, or to timeout.
+    //
+    synchronized public void requireVisible() {
+        int tries = 0;
+
+        // wait for windowOpened and windowActivated events
+        try {
+            while ((opened == false)
+                    || (activated == false)
+                    || (focused == false)) {
+                if (tries < 4) {
+                    tries += 1;
+                    wait(SETUP_PERIOD);
+                } else {
+                    break;
+                }
+            }
+
+            if (opened && activated) {
+                valid = true;
+            } else {
+                valid = false;
+            }
+        } catch (InterruptedException ix) {
+            valid = false;
+        }
+
+        // Extra-super paranoid checks
+        if (win.isVisible() == false) {
+            valid = false;
+        }
+
+        if (win.isShowing() == false) {
+            valid = false;
+        }
+
+        if (win.isFocused() == false) {
+            valid = false;
+        }
+
+        if (DEBUG) {
+            if (!isValid()) {
+                System.out.println("\tactivated:" + new Boolean(activated));
+                System.out.println("\topened:" + new Boolean(opened));
+                System.out.println("\tfocused:" + new Boolean(focused));
+                System.out.println("\tvalid:" + new Boolean(valid));
+                System.out.println("\tisVisible():"
+                        + new Boolean(win.isVisible()));
+                System.out.println("\tisShowing():"
+                        + new Boolean(win.isShowing()));
+                System.out.println("\tisFocused():"
+                        + new Boolean(win.isFocused()));
+            }
+        }
+
+    }
+
+    synchronized void doOpen() {
+        opened = true;
+        notify();
+    }
+
+    synchronized void doActivate() {
+        activated = true;
+        notify();
+    }
+
+    synchronized void doGainedFocus() {
+        focused = true;
+        notify();
+    }
+
+    public boolean isValid() {
+        return valid;
+    }
+
+    public boolean isClear() {
+        return valid;
+    }
+
+    volatile static Robot robot = null;
+
+    // utility function that waits until a Component is shown with the
+    // appropriate color
+    public static boolean waitForColor(Component c,
+            Color expected) throws AWTException,
+            InterruptedException {
+        Dimension dim = c.getSize();
+        int xOff = dim.width / 2;
+        int yOff = dim.height / 2;
+        return waitForColor(c, xOff, yOff, expected);
+    }
+
+    // utility function that waits for 5 seconds for Component to be shown with
+    // the appropriate color
+    public static boolean waitForColor(Component c,
+            int xOff,
+            int yOff,
+            Color expected) throws AWTException, InterruptedException {
+        return waitForColor(c, xOff, yOff, expected, 5000L);
+    }
+
+    // utility function that waits until a Component is up with the appropriate
+    // color
+    public static boolean waitForColor(Component c,
+            int xOff,
+            int yOff,
+            Color expected,
+            long timeout) throws AWTException, InterruptedException {
+        Point p = c.getLocationOnScreen();
+        int x = (int) p.getX() + xOff;
+        int y = (int) p.getY() + yOff;
+        return waitForColor(x, y, expected, timeout);
+    }
+
+    // utility function that waits until specific screen coords have the
+    // appropriate color
+    public static boolean waitForColor(int locX,
+            int locY,
+            Color expected,
+            long timeout) throws AWTException, InterruptedException {
+        if (robot == null) {
+            robot = new Robot();
+        }
+
+        long endtime = System.currentTimeMillis() + timeout;
+        while (endtime > System.currentTimeMillis()) {
+            if (colorMatch(robot.getPixelColor(locX, locY), expected)) {
+                return true;
+            }
+            Thread.sleep(50);
+        }
+
+        return false;
+    }
+
+    // utility function that asserts that two colors are similar to each other
+    public static void assertColorEquals(final String message,
+            final Color actual,
+            final Color expected) {
+        System.out.println("actual color: " + actual);
+        System.out.println("expect color: " + expected);
+        //Assert.assertTrue(message, colorMatch(actual, expected));
+    }
+
+    // determines if two colors are close in hue and brightness
+    public static boolean colorMatch(final Color actual, final Color expected) {
+        final float[] actualHSB = getHSB(actual);
+        final float[] expectedHSB = getHSB(expected);
+
+        final float actualHue = actualHSB[0];
+        final float expectedHue = expectedHSB[0];
+        final boolean hueMatched = closeMatchHue(actualHue, expectedHue, 0.17f);
+        //System.out.println("hueMatched? " + hueMatched);
+        final float actualBrightness = actualHSB[2];
+        final float expectedBrightness = expectedHSB[2];
+        final boolean brightnessMatched = closeMatch(actualBrightness,
+                expectedBrightness, 0.15f);
+        //System.out.println("brightnessMatched? " + brightnessMatched);
+
+        // check to see if the brightness was so low or so high that the hue
+        // got clamped to red
+        if (brightnessMatched && !hueMatched) {
+            return (expectedBrightness < 0.15f);
+        }
+
+        return brightnessMatched && hueMatched;
+    }
+
+    static float[] getHSB(final Color color) {
+        final float[] hsb = new float[3];
+        Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb);
+        return hsb;
+    }
+
+    // matches hues from 0.0 to 1.0, accounting for wrap-around at the 1.0/0.0
+    // boundry
+    static boolean closeMatchHue(final float actual,
+            final float expected,
+            final float tolerance) {
+        if (closeMatch(actual, expected, tolerance)) {
+            return true;
+        }
+
+        // all that remains is the overflow and underflow cases
+        final float expectedHigh = expected + tolerance;
+        final float expectedLow = expected - tolerance;
+
+        if (expectedHigh > 1.0f) {
+            // expected is too high, and actual was too low
+            //System.out.println("\thue expected too high, actual too low");
+            return closeMatch(actual + 0.5f, expected - 0.5f, tolerance);
+        }
+
+        if (expectedLow < 0.0f) {
+            // expected is too low, and actual was too high
+            //System.out.println("\thue expected too low, actual too high");
+            return closeMatch(actual - 0.5f, expected + 0.5f, tolerance);
+        }
+
+        //System.out.println("\tcloseMatchHue? " + false);
+        return false;
+    }
+
+    static boolean closeMatch(final float actual,
+            final float expected,
+            final float tolerance) {
+        return (expected + tolerance) > actual && (expected - tolerance) < actual;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/regtesthelpers/Waypoint.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+ /*
+ * @summary This is a utility for coordinating the flow of events on different
+            threads.
+ * @summary com.apple.junit.utils
+ */
+package test.java.awt.regtesthelpers;
+
+public class Waypoint {
+
+    static final String MSG = "Waypoint timed out";
+    // Wait up to five seconds for our clear() to be called
+    static final int TIMEOUT = 5000;
+    boolean clear = false;
+
+    public Waypoint() {
+
+    }
+
+    //
+    //    Pause for either TIMEOUT millis or until clear() is called
+    //
+    synchronized public void requireClear() throws RuntimeException {
+        requireClear(MSG, TIMEOUT);
+    }
+
+    synchronized public void requireClear(long timeout)
+            throws RuntimeException {
+        requireClear(MSG, timeout);
+    }
+
+    synchronized public void requireClear(String timeOutMsg)
+            throws RuntimeException {
+        requireClear(timeOutMsg, TIMEOUT);
+    }
+
+    synchronized public void requireClear(String timeOutMsg, long timeout)
+            throws RuntimeException {
+        long endtime = System.currentTimeMillis() + timeout;
+        try {
+            while (isClear() == false) {
+                if (System.currentTimeMillis() < endtime) {
+                    wait(200);
+                } else {
+                    break;
+                }
+            }
+
+            if (!isClear()) {
+                throw new RuntimeException(timeOutMsg);
+            }
+        } catch (InterruptedException ix) {
+        }
+    }
+
+    //
+    //    Called when it is valid to procede past the waypoint
+    //
+    synchronized public void clear() {
+        clear = true;
+        notify();
+    }
+
+    //
+    //    Should be checked after a call to requireClear() to make
+    //    sure that we did not time out.
+    //
+    synchronized public boolean isClear() {
+        return clear;
+    }
+
+    synchronized public boolean isValid() {
+        return clear;
+    }
+
+    //
+    //    For re-use of a waypoint.  Be careful.
+    //
+    synchronized public void reset() {
+        clear = false;
+    }
+
+}
--- a/jdk/test/java/lang/reflect/Constructor/GenericStringTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/lang/reflect/Constructor/GenericStringTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5033583 6316717 6470106 8161500
+ * @bug 5033583 6316717 6470106 8161500 8162539
  * @summary Check toGenericString() and toString() methods
  * @author Joseph D. Darcy
  */
@@ -41,20 +41,11 @@
                 ExpectedGenericString egs = ctor.getAnnotation(ExpectedGenericString.class);
                 String actual = ctor.toGenericString();
                 System.out.println(actual);
-                if (! egs.value().equals(actual)) {
-                    failures++;
-                    System.err.printf("ERROR: Expected generic string ''%s''; got ''%s''.\n",
-                                      egs.value(), actual);
-                }
+                failures += checkForFailure(egs.value(), actual);
 
                 if (ctor.isAnnotationPresent(ExpectedString.class)) {
-                    ExpectedString es = ctor.getAnnotation(ExpectedString.class);
-                    String result = ctor.toString();
-                    if (! es.value().equals(result)) {
-                        failures++;
-                        System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
-                                          es.value(), result);
-                    }
+                    failures += checkForFailure(ctor.getAnnotation(ExpectedString.class).value(),
+                                                ctor.toString());
                 }
             }
 
@@ -63,6 +54,15 @@
             throw new RuntimeException();
         }
     }
+
+    private static int checkForFailure(String expected, String actual) {
+        if (!expected.equals(actual)) {
+            System.err.printf("ERROR: Expected ''%s'';%ngot             ''%s''.\n",
+                              expected, actual);
+            return 1;
+        } else
+            return 0;
+    }
 }
 
 class TestClass1 {
@@ -76,13 +76,23 @@
 
     @ExpectedGenericString(
    "private TestClass1(java.lang.Object) throws java.lang.RuntimeException")
+    @ExpectedString(
+   "private TestClass1(java.lang.Object) throws java.lang.RuntimeException")
     private TestClass1(Object o) throws RuntimeException {}
 
     @ExpectedGenericString(
    "protected <S,T> TestClass1(S,T) throws java.lang.Exception")
+    @ExpectedString(
+   "protected TestClass1(java.lang.Object,java.lang.Object) throws java.lang.Exception")
     protected <S, T> TestClass1(S s, T t) throws Exception{}
 
     @ExpectedGenericString(
+   "<E> TestClass1() throws E")
+    @ExpectedString(
+   "TestClass1() throws java.lang.Exception")
+    <E extends Exception> TestClass1() throws E {}
+
+    @ExpectedGenericString(
    "TestClass1(java.lang.Object...)")
     @ExpectedString(
    "TestClass1(java.lang.Object[])")
--- a/jdk/test/java/lang/reflect/Method/GenericStringTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/lang/reflect/Method/GenericStringTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5033583 6316717 6470106 8004979 8161500
+ * @bug 5033583 6316717 6470106 8004979 8161500 8162539
  * @summary Check toGenericString() and toString() methods
  * @author Joseph D. Darcy
  */
@@ -44,28 +44,16 @@
                     String actual = method.toGenericString();
                     System.out.println(actual);
                     if (method.isBridge()) {
-                        if (! egs.bridgeValue().equals(actual)) {
-                            failures++;
-                            System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
-                                              egs.value(), actual);
-                        }
+                        failures += checkForFailure(egs.bridgeValue(), actual);
                     } else {
-                        if (! egs.value().equals(actual)) {
-                            failures++;
-                            System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
-                                              egs.value(), actual);
-                        }
+                        failures += checkForFailure(egs.value(), actual);
                     }
                 }
 
                 if (method.isAnnotationPresent(ExpectedString.class)) {
                     ExpectedString es = method.getAnnotation(ExpectedString.class);
                     String actual = method.toString();
-                    if (! es.value().equals(actual)) {
-                        failures++;
-                        System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
-                                          es.value(), actual);
-                    }
+                    failures += checkForFailure(es.value(), actual);
                 }
 
             }
@@ -88,6 +76,15 @@
             throw new RuntimeException();
         }
     }
+
+    private static int checkForFailure(String expected, String actual) {
+        if (!expected.equals(actual)) {
+            System.err.printf("ERROR: Expected ''%s'';%ngot             ''%s''.\n",
+                              expected, actual);
+            return 1;
+        } else
+            return 0;
+    }
 }
 
 class TestClass1 {
@@ -115,6 +112,8 @@
 
     @ExpectedGenericString(
    "public void TestClass2.method2() throws F")
+    @ExpectedString(
+   "public void TestClass2.method2() throws java.lang.Exception")
     public void method2() throws F {return;}
 
     @ExpectedGenericString(
--- a/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Wed Jul 05 22:01:14 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887 8129632 8129633
+ * @bug 4313887 8129632 8129633 8162624
  * @summary Unit test for probeContentType method
  * @library ../..
  * @build Basic SimpleFileTypeDetector
--- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -407,6 +407,127 @@
                 {"+HH:mm:ss", 2, 0, 45, "+02:00:45"},
                 {"+HH:mm:ss", 2, 30, 45, "+02:30:45"},
 
+                {"+H", 2, 0, 0, "+2"},
+                {"+H", -2, 0, 0, "-2"},
+                {"+H", 2, 30, 0, "+2"},
+                {"+H", 2, 0, 45, "+2"},
+                {"+H", 2, 30, 45, "+2"},
+                {"+H", 12, 0, 0, "+12"},
+                {"+H", -12, 0, 0, "-12"},
+                {"+H", 12, 30, 0, "+12"},
+                {"+H", 12, 0, 45, "+12"},
+                {"+H", 12, 30, 45, "+12"},
+
+                {"+Hmm", 2, 0, 0, "+2"},
+                {"+Hmm", -2, 0, 0, "-2"},
+                {"+Hmm", 2, 30, 0, "+230"},
+                {"+Hmm", 2, 0, 45, "+2"},
+                {"+Hmm", 2, 30, 45, "+230"},
+                {"+Hmm", 12, 0, 0, "+12"},
+                {"+Hmm", -12, 0, 0, "-12"},
+                {"+Hmm", 12, 30, 0, "+1230"},
+                {"+Hmm", 12, 0, 45, "+12"},
+                {"+Hmm", 12, 30, 45, "+1230"},
+
+                {"+H:mm", 2, 0, 0, "+2"},
+                {"+H:mm", -2, 0, 0, "-2"},
+                {"+H:mm", 2, 30, 0, "+2:30"},
+                {"+H:mm", 2, 0, 45, "+2"},
+                {"+H:mm", 2, 30, 45, "+2:30"},
+                {"+H:mm", 12, 0, 0, "+12"},
+                {"+H:mm", -12, 0, 0, "-12"},
+                {"+H:mm", 12, 30, 0, "+12:30"},
+                {"+H:mm", 12, 0, 45, "+12"},
+                {"+H:mm", 12, 30, 45, "+12:30"},
+
+                {"+HMM", 2, 0, 0, "+200"},
+                {"+HMM", -2, 0, 0, "-200"},
+                {"+HMM", 2, 30, 0, "+230"},
+                {"+HMM", 2, 0, 45, "+200"},
+                {"+HMM", 2, 30, 45, "+230"},
+                {"+HMM", 12, 0, 0, "+1200"},
+                {"+HMM", -12, 0, 0, "-1200"},
+                {"+HMM", 12, 30, 0, "+1230"},
+                {"+HMM", 12, 0, 45, "+1200"},
+                {"+HMM", 12, 30, 45, "+1230"},
+
+                {"+H:MM", 2, 0, 0, "+2:00"},
+                {"+H:MM", -2, 0, 0, "-2:00"},
+                {"+H:MM", 2, 30, 0, "+2:30"},
+                {"+H:MM", 2, 0, 45, "+2:00"},
+                {"+H:MM", 2, 30, 45, "+2:30"},
+                {"+H:MM", 12, 0, 0, "+12:00"},
+                {"+H:MM", -12, 0, 0, "-12:00"},
+                {"+H:MM", 12, 30, 0, "+12:30"},
+                {"+H:MM", 12, 0, 45, "+12:00"},
+                {"+H:MM", 12, 30, 45, "+12:30"},
+
+                {"+HMMss", 2, 0, 0, "+200"},
+                {"+HMMss", -2, 0, 0, "-200"},
+                {"+HMMss", 2, 30, 0, "+230"},
+                {"+HMMss", 2, 0, 45, "+20045"},
+                {"+HMMss", 2, 30, 45, "+23045"},
+                {"+HMMss", 12, 0, 0, "+1200"},
+                {"+HMMss", -12, 0, 0, "-1200"},
+                {"+HMMss", 12, 30, 0, "+1230"},
+                {"+HMMss", 12, 0, 45, "+120045"},
+                {"+HMMss", 12, 30, 45, "+123045"},
+
+                {"+H:MM:ss", 2, 0, 0, "+2:00"},
+                {"+H:MM:ss", -2, 0, 0, "-2:00"},
+                {"+H:MM:ss", 2, 30, 0, "+2:30"},
+                {"+H:MM:ss", 2, 0, 45, "+2:00:45"},
+                {"+H:MM:ss", 2, 30, 45, "+2:30:45"},
+                {"+H:MM:ss", 12, 0, 0, "+12:00"},
+                {"+H:MM:ss", -12, 0, 0, "-12:00"},
+                {"+H:MM:ss", 12, 30, 0, "+12:30"},
+                {"+H:MM:ss", 12, 0, 45, "+12:00:45"},
+                {"+H:MM:ss", 12, 30, 45, "+12:30:45"},
+
+                {"+HMMSS", 2, 0, 0, "+20000"},
+                {"+HMMSS", -2, 0, 0, "-20000"},
+                {"+HMMSS", 2, 30, 0, "+23000"},
+                {"+HMMSS", 2, 0, 45, "+20045"},
+                {"+HMMSS", 2, 30, 45, "+23045"},
+                {"+HMMSS", 12, 0, 0, "+120000"},
+                {"+HMMSS", -12, 0, 0, "-120000"},
+                {"+HMMSS", 12, 30, 0, "+123000"},
+                {"+HMMSS", 12, 0, 45, "+120045"},
+                {"+HMMSS", 12, 30, 45, "+123045"},
+
+                {"+H:MM:SS", 2, 0, 0, "+2:00:00"},
+                {"+H:MM:SS", -2, 0, 0, "-2:00:00"},
+                {"+H:MM:SS", 2, 30, 0, "+2:30:00"},
+                {"+H:MM:SS", 2, 0, 45, "+2:00:45"},
+                {"+H:MM:SS", 2, 30, 45, "+2:30:45"},
+                {"+H:MM:SS", 12, 0, 0, "+12:00:00"},
+                {"+H:MM:SS", -12, 0, 0, "-12:00:00"},
+                {"+H:MM:SS", 12, 30, 0, "+12:30:00"},
+                {"+H:MM:SS", 12, 0, 45, "+12:00:45"},
+                {"+H:MM:SS", 12, 30, 45, "+12:30:45"},
+
+                {"+Hmmss", 2, 0, 0, "+2"},
+                {"+Hmmss", -2, 0, 0, "-2"},
+                {"+Hmmss", 2, 30, 0, "+230"},
+                {"+Hmmss", 2, 0, 45, "+20045"},
+                {"+Hmmss", 2, 30, 45, "+23045"},
+                {"+Hmmss", 12, 0, 0, "+12"},
+                {"+Hmmss", -12, 0, 0, "-12"},
+                {"+Hmmss", 12, 30, 0, "+1230"},
+                {"+Hmmss", 12, 0, 45, "+120045"},
+                {"+Hmmss", 12, 30, 45, "+123045"},
+
+                {"+H:mm:ss", 2, 0, 0, "+2"},
+                {"+H:mm:ss", -2, 0, 0, "-2"},
+                {"+H:mm:ss", 2, 30, 0, "+2:30"},
+                {"+H:mm:ss", 2, 0, 45, "+2:00:45"},
+                {"+H:mm:ss", 2, 30, 45, "+2:30:45"},
+                {"+H:mm:ss", 12, 0, 0, "+12"},
+                {"+H:mm:ss", -12, 0, 0, "-12"},
+                {"+H:mm:ss", 12, 30, 0, "+12:30"},
+                {"+H:mm:ss", 12, 0, 45, "+12:00:45"},
+                {"+H:mm:ss", 12, 30, 45, "+12:30:45"},
+
 
         };
     }
@@ -437,8 +558,6 @@
             {"HH:MM:ss"},
             {"HHMMSS"},
             {"HH:MM:SS"},
-            {"+H"},
-            {"+HMM"},
             {"+HHM"},
             {"+A"},
         };
@@ -1188,6 +1307,146 @@
             {"+HH:mm:ss", "+01", 3600},
             {"+HH:mm:ss", "+01:01", 3660},
             {"+HH:mm:ss", "+01:01:01", 3661},
+
+            {"+H", "+1", 3600},
+            {"+H", "+101", 3660},
+            {"+H", "+10101", 3661},
+            {"+H", "+1:01", 3660},
+            {"+H", "+1:01:01", 3661},
+            {"+H", "+01", 3600},
+            {"+H", "+0101", 3660},
+            {"+H", "+010101", 3661},
+            {"+H", "+01:01", 3660},
+            {"+H", "+01:01:01", 3661},
+            {"+Hmm", "+1", 3600},
+            {"+Hmm", "+101", 3660},
+            {"+Hmm", "+10101", 3661},
+            {"+Hmm", "+01", 3600},
+            {"+Hmm", "+0101", 3660},
+            {"+Hmm", "+010101", 3661},
+            {"+H:mm", "+1", 3600},
+            {"+H:mm", "+1:01", 3660},
+            {"+H:mm", "+1:01:01", 3661},
+            {"+H:mm", "+01", 3600},
+            {"+H:mm", "+01:01", 3660},
+            {"+H:mm", "+01:01:01", 3661},
+            {"+HMM", "+1", 3600},
+            {"+HMM", "+101", 3660},
+            {"+HMM", "+10101", 3661},
+            {"+HMM", "+01", 3600},
+            {"+HMM", "+0101", 3660},
+            {"+HMM", "+010101", 3661},
+            {"+H:MM", "+1", 3600},
+            {"+H:MM", "+1:01", 3660},
+            {"+H:MM", "+1:01:01", 3661},
+            {"+H:MM", "+01", 3600},
+            {"+H:MM", "+01:01", 3660},
+            {"+H:MM", "+01:01:01", 3661},
+            {"+HMMss", "+1", 3600},
+            {"+HMMss", "+101", 3660},
+            {"+HMMss", "+10101", 3661},
+            {"+HMMss", "+01", 3600},
+            {"+HMMss", "+0101", 3660},
+            {"+HMMss", "+010101", 3661},
+            {"+H:MM:ss", "+1", 3600},
+            {"+H:MM:ss", "+1:01", 3660},
+            {"+H:MM:ss", "+1:01:01", 3661},
+            {"+H:MM:ss", "+01", 3600},
+            {"+H:MM:ss", "+01:01", 3660},
+            {"+H:MM:ss", "+01:01:01", 3661},
+            {"+HMMSS", "+1", 3600},
+            {"+HMMSS", "+101", 3660},
+            {"+HMMSS", "+10101", 3661},
+            {"+HMMSS", "+01", 3600},
+            {"+HMMSS", "+0101", 3660},
+            {"+HMMSS", "+010101", 3661},
+            {"+H:MM:SS", "+1", 3600},
+            {"+H:MM:SS", "+1:01", 3660},
+            {"+H:MM:SS", "+1:01:01", 3661},
+            {"+H:MM:SS", "+01", 3600},
+            {"+H:MM:SS", "+01:01", 3660},
+            {"+H:MM:SS", "+01:01:01", 3661},
+            {"+Hmmss", "+1", 3600},
+            {"+Hmmss", "+101", 3660},
+            {"+Hmmss", "+10101", 3661},
+            {"+Hmmss", "+01", 3600},
+            {"+Hmmss", "+0101", 3660},
+            {"+Hmmss", "+010101", 3661},
+            {"+H:mm:ss", "+1", 3600},
+            {"+H:mm:ss", "+1:01", 3660},
+            {"+H:mm:ss", "+1:01:01", 3661},
+            {"+H:mm:ss", "+01", 3600},
+            {"+H:mm:ss", "+01:01", 3660},
+            {"+H:mm:ss", "+01:01:01", 3661},
+        };
+    }
+
+    @DataProvider(name="strictDoubleDigitHourOffsetParseData")
+    Object[][] data_strictDoubleDigitHour_offset_parse() {
+        return new Object[][] {
+            {"+HH", "+01", 3600},
+            {"+HHmm", "+01", 3600},
+            {"+HHmm", "+0101", 3660},
+            {"+HH:mm", "+01", 3600},
+            {"+HH:mm", "+01:01", 3660},
+            {"+HHMM", "+0101", 3660},
+            {"+HH:MM", "+01:01", 3660},
+            {"+HHMMss", "+0101", 3660},
+            {"+HHMMss", "+010101", 3661},
+            {"+HH:MM:ss", "+01:01", 3660},
+            {"+HH:MM:ss", "+01:01:01", 3661},
+            {"+HHMMSS", "+010101", 3661},
+            {"+HH:MM:SS", "+01:01:01", 3661},
+            {"+HHmmss", "+01", 3600},
+            {"+HHmmss", "+0101", 3660},
+            {"+HHmmss", "+010101", 3661},
+            {"+HH:mm:ss", "+01", 3600},
+            {"+HH:mm:ss", "+01:01", 3660},
+            {"+HH:mm:ss", "+01:01:01", 3661},
+        };
+    }
+
+    @DataProvider(name="strictSingleDigitHourOffsetParseData")
+    Object[][] data_strictSingleDigitHour_offset_parse() {
+        return new Object[][] {
+            {"+H", "+01", 3600},
+            {"+H", "+1", 3600},
+            {"+Hmm", "+01", 3600},
+            {"+Hmm", "+0101", 3660},
+            {"+Hmm", "+1", 3600},
+            {"+Hmm", "+101", 3660},
+            {"+H:mm", "+01", 3600},
+            {"+H:mm", "+01:01", 3660},
+            {"+H:mm", "+1", 3600},
+            {"+H:mm", "+1:01", 3660},
+            {"+HMM", "+0101", 3660},
+            {"+HMM", "+101", 3660},
+            {"+H:MM", "+01:01", 3660},
+            {"+H:MM", "+1:01", 3660},
+            {"+HMMss", "+0101", 3660},
+            {"+HMMss", "+010101", 3661},
+            {"+HMMss", "+101", 3660},
+            {"+HMMss", "+10101", 3661},
+            {"+H:MM:ss", "+01:01", 3660},
+            {"+H:MM:ss", "+01:01:01", 3661},
+            {"+H:MM:ss", "+1:01", 3660},
+            {"+H:MM:ss", "+1:01:01", 3661},
+            {"+HMMSS", "+010101", 3661},
+            {"+HMMSS", "+10101", 3661},
+            {"+H:MM:SS", "+01:01:01", 3661},
+            {"+H:MM:SS", "+1:01:01", 3661},
+            {"+Hmmss", "+01", 3600},
+            {"+Hmmss", "+0101", 3660},
+            {"+Hmmss", "+010101", 3661},
+            {"+Hmmss", "+1", 3600},
+            {"+Hmmss", "+101", 3660},
+            {"+Hmmss", "+10101", 3661},
+            {"+H:mm:ss", "+01", 3600},
+            {"+H:mm:ss", "+01:01", 3660},
+            {"+H:mm:ss", "+01:01:01", 3661},
+            {"+H:mm:ss", "+1", 3600},
+            {"+H:mm:ss", "+1:01", 3660},
+            {"+H:mm:ss", "+1:01:01", 3661},
         };
     }
 
@@ -1203,22 +1462,226 @@
                      3600);
     }
 
+    @Test(dataProvider="strictDoubleDigitHourOffsetParseData")
+    public void test_strictDoubleDigitHour_offset_parse_1(String pattern, String offset, int offsetSeconds) {
+        assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z").toFormatter()
+                .parse(offset).get(OFFSET_SECONDS), offsetSeconds);
+    }
+
+    @Test(dataProvider="strictDoubleDigitHourOffsetParseData")
+    public void test_strictDoubleDigitHour_offset_parse_2(String pattern, String offset, int offsetSeconds) {
+        assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z")
+                .appendLiteral("text").toFormatter().parse(offset + "text").get(OFFSET_SECONDS), offsetSeconds);
+    }
+
+    @Test(dataProvider="strictSingleDigitHourOffsetParseData")
+    public void test_strictSingleDigitHour_offset_parse_1(String pattern, String offset, int offsetSeconds) {
+        assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z").toFormatter()
+                .parse(offset).get(OFFSET_SECONDS), offsetSeconds);
+    }
+
+    @Test(dataProvider="strictSingleDigitHourOffsetParseData")
+    public void test_strictSingleDigitHour_offset_parse_2(String pattern, String offset, int offsetSeconds) {
+        assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z")
+                .appendLiteral("text").toFormatter().parse(offset + "text").get(OFFSET_SECONDS), offsetSeconds);
+    }
+
+    @DataProvider(name="strictOffsetAdjacentParseValidPatternData")
+    Object[][] data_strict_offset_adjacentParse_validPattern() {
+        return new Object[][] {
+            {"+HH", "+01", 3600},
+            {"+HHmm", "+0101", 3660},
+            {"+HH:mm", "+01", 3600},
+            {"+HH:mm", "+01:01", 3660},
+            {"+HHMM", "+0101", 3660},
+            {"+HH:MM", "+01:01", 3660},
+            {"+HHMMss", "+010101", 3661},
+            {"+HH:MM:ss", "+01:01", 3660},
+            {"+HH:MM:ss", "+01:01:01", 3661},
+            {"+HHMMSS", "+010101", 3661},
+            {"+HH:MM:SS", "+01:01:01", 3661},
+            {"+HHmmss", "+010101", 3661},
+            {"+HH:mm:ss", "+01", 3600},
+            {"+HH:mm:ss", "+01:01", 3660},
+            {"+HH:mm:ss", "+01:01:01", 3661},
+
+            {"+H", "+01", 3600},
+            {"+Hmm", "+0101", 3660},
+            {"+H:mm", "+01", 3600},
+            {"+H:mm", "+01:01", 3660},
+            {"+H:mm", "+1:01", 3660},
+            {"+HMM", "+0101", 3660},
+            {"+H:MM", "+01:01", 3660},
+            {"+H:MM", "+1:01", 3660},
+            {"+HMMss", "+010101", 3661},
+            {"+H:MM:ss", "+01:01", 3660},
+            {"+H:MM:ss", "+01:01:01", 3661},
+            {"+H:MM:ss", "+1:01", 3660},
+            {"+H:MM:ss", "+1:01:01", 3661},
+            {"+HMMSS", "+010101", 3661},
+            {"+H:MM:SS", "+01:01:01", 3661},
+            {"+H:MM:SS", "+1:01:01", 3661},
+            {"+Hmmss", "+010101", 3661},
+            {"+H:mm:ss", "+01", 3600},
+            {"+H:mm:ss", "+01:01", 3660},
+            {"+H:mm:ss", "+01:01:01", 3661},
+            {"+H:mm:ss", "+1:01", 3660},
+            {"+H:mm:ss", "+1:01:01", 3661},
+        };
+    }
+
+    @Test(dataProvider="strictOffsetAdjacentParseValidPatternData")
+    public void test_strict_offset_adjacentValidPattern_parse(String pattern, String offset, int offsetSeconds) {
+        TemporalAccessor tmp = new DateTimeFormatterBuilder().appendOffset(pattern, "Z")
+                .appendValue(HOUR_OF_DAY, 2).toFormatter().parse(offset + "12");
+        assertEquals(tmp.get(OFFSET_SECONDS), offsetSeconds);
+        assertEquals(tmp.get(HOUR_OF_DAY), 12);
+    }
+
+    @DataProvider(name="strictOffsetAdjacentParseInvalidPatternData")
+    Object[][] data_strict_offset_adjacentParse_invalidPattern() {
+        return new Object[][] {
+            {"+HHmm", "+01", 3600},
+            {"+HHMMss", "+0101", 3660},
+            {"+HHmmss", "+01", 3600},
+            {"+HHmmss", "+0101", 3660},
+            {"+H", "+1", 3600},
+            {"+Hmm", "+01", 3600},
+            {"+H:mm", "+1", 3600},
+            {"+Hmm", "+1", 3600},
+            {"+Hmm", "+101", 3660},
+            {"+HMM", "+101", 3660},
+            {"+HMMss", "+0101", 3660},
+            {"+HMMss", "+101", 3660},
+            {"+HMMss", "+10101", 3661},
+            {"+HMMSS", "+10101", 3661},
+            {"+Hmmss", "+01", 3600},
+            {"+Hmmss", "+0101", 3660},
+            {"+Hmmss", "+1", 3600},
+            {"+Hmmss", "+101", 3660},
+            {"+Hmmss", "+10101", 3661},
+            {"+H:mm:ss", "+1", 3600},
+        };
+    }
+
+    @Test(dataProvider="strictOffsetAdjacentParseInvalidPatternData", expectedExceptions=DateTimeParseException.class)
+    public void test_strict_offset_adjacentInvalidPattern_parse(String pattern, String offset, int offsetSeconds) {
+       new DateTimeFormatterBuilder().appendOffset(pattern, "Z").appendValue(HOUR_OF_DAY, 2)
+               .toFormatter().parse(offset + "12");
+    }
+
+    @DataProvider(name="lenientOffsetAdjacentParseValidPatternData")
+    Object[][] data_lenient_offset_adjacentParse_validPattern() {
+        return new Object[][] {
+            {"+HH:mm", "+01", 3600},
+            {"+HH:mm", "+01:01", 3660},
+            {"+HH:MM", "+01:01", 3660},
+            {"+HH:MM:ss", "+01:01", 3660},
+            {"+HH:MM:ss", "+01:01:01", 3661},
+            {"+HHMMSS", "+010101", 3661},
+            {"+HH:MM:SS", "+01:01:01", 3661},
+            {"+HHmmss", "+010101", 3661},
+            {"+HH:mm:ss", "+01", 3600},
+            {"+HH:mm:ss", "+01:01", 3660},
+            {"+HH:mm:ss", "+01:01:01", 3661},
+            {"+H:mm", "+01", 3600},
+            {"+H:mm", "+01:01", 3660},
+            {"+H:mm", "+1:01", 3660},
+            {"+H:MM", "+01:01", 3660},
+            {"+H:MM", "+1:01", 3660},
+            {"+HMMss", "+010101", 3661},
+            {"+H:MM:ss", "+01:01", 3660},
+            {"+H:MM:ss", "+01:01:01", 3661},
+            {"+H:MM:ss", "+1:01", 3660},
+            {"+H:MM:ss", "+1:01:01", 3661},
+            {"+HMMSS", "+010101", 3661},
+            {"+H:MM:SS", "+01:01:01", 3661},
+            {"+H:MM:SS", "+1:01:01", 3661},
+            {"+Hmmss", "+010101", 3661},
+            {"+H:mm:ss", "+01", 3600},
+            {"+H:mm:ss", "+01:01", 3660},
+            {"+H:mm:ss", "+01:01:01", 3661},
+            {"+H:mm:ss", "+1:01", 3660},
+            {"+H:mm:ss", "+1:01:01", 3661},
+        };
+    }
+
+    @Test(dataProvider="lenientOffsetAdjacentParseValidPatternData")
+    public void test_lenient_offset_adjacentValidPattern_parse(String pattern, String offset, int offsetSeconds) {
+        TemporalAccessor tmp = new DateTimeFormatterBuilder().parseLenient()
+                .appendOffset(pattern, "Z").appendValue(HOUR_OF_DAY, 2).toFormatter().parse(offset + "12");
+        assertEquals(tmp.get(OFFSET_SECONDS), offsetSeconds);
+        assertEquals(tmp.get(HOUR_OF_DAY), 12);
+    }
+
+    @Test
+    public void test_lenient_offset_adjacentValidPattern_parse1() {
+        TemporalAccessor tmp = new DateTimeFormatterBuilder().parseLenient()
+                .appendOffset("+HMMSS", "Z").appendValue(HOUR_OF_DAY, 2).toFormatter().parse("+10101" + "12");
+        //Equivalent to +101011. In lenient mode, offset will parse upto 6 digit if possible.
+        //It will take 1 digit from HOUR_OF_DAY.
+        assertEquals(tmp.get(OFFSET_SECONDS), 36611);
+        assertEquals(tmp.get(HOUR_OF_DAY), 2);
+    }
+
+  @DataProvider(name="lenientOffsetAdjacentParseInvalidPatternData")
+    Object[][] data_lenient_offset_adjacentParse_invalidPattern() {
+        return new Object[][] {
+            {"+HH", "+01", 3600},
+            {"+HHmm", "+0101", 3660},
+            {"+HHMM", "+0101", 3660},
+            {"+H", "+01", 3600},
+            {"+Hmm", "+0101", 3660},
+            {"+HMM", "+0101", 3660},
+        };
+    }
+
+    @Test(dataProvider="lenientOffsetAdjacentParseInvalidPatternData", expectedExceptions=DateTimeParseException.class)
+    public void test_lenient_offset_adjacentInvalidPattern_parse(String pattern, String offset, int offsetSeconds) {
+       new DateTimeFormatterBuilder().parseLenient().appendOffset(pattern, "Z")
+               .appendValue(HOUR_OF_DAY, 2).toFormatter().parse(offset + "12");
+    }
+
+    @DataProvider(name="badValues")
+    Object[][] data_badOffsetValues() {
+        return new Object[][] {
+            {"+HH", "+24"},
+            {"+HHMM", "-1361"},
+            {"+HH:MM:ss", "+13:12:66"},
+            {"+HH:MM:SS", "+24:60:60"},
+            {"+HHMMSS", "369999"},
+            {"+H:MM", "+28:12"},
+        };
+    }
+
+    @Test(dataProvider="badValues", expectedExceptions=DateTimeParseException.class)
+    public void test_badOffset_parse(String pattern, String offset) {
+        new DateTimeFormatterBuilder().appendOffset(pattern, "Z").toFormatter().parse(offset);
+    }
+
     @Test(expectedExceptions=DateTimeParseException.class)
     public void test_strict_appendOffsetId() {
-        assertEquals(new DateTimeFormatterBuilder().appendOffsetId().toFormatter().parse("+01").get(OFFSET_SECONDS),
-                     3600);
+        new DateTimeFormatterBuilder().appendOffsetId().toFormatter().parse("+01");
     }
 
     @Test(expectedExceptions=DateTimeParseException.class)
     public void test_strict_appendOffset_1() {
-        assertEquals(new DateTimeFormatterBuilder().appendOffset("+HH:MM:ss", "Z").toFormatter().parse("+01").get(OFFSET_SECONDS),
-                     3600);
+        new DateTimeFormatterBuilder().appendOffset("+HH:MM:ss", "Z").toFormatter().parse("+01");
     }
 
     @Test(expectedExceptions=DateTimeParseException.class)
     public void test_strict_appendOffset_2() {
-        assertEquals(new DateTimeFormatterBuilder().appendOffset("+HHMMss", "Z").toFormatter().parse("+01").get(OFFSET_SECONDS),
-                     3600);
+        new DateTimeFormatterBuilder().appendOffset("+HHMMss", "Z").toFormatter().parse("+01");
+    }
+
+    @Test(expectedExceptions=DateTimeParseException.class)
+    public void test_strict_appendOffset_3() {
+        new DateTimeFormatterBuilder().appendOffset("+H:MM:ss", "Z").toFormatter().parse("+1");
+    }
+
+    @Test(expectedExceptions=DateTimeParseException.class)
+    public void test_strict_appendOffset_4() {
+        new DateTimeFormatterBuilder().appendOffset("+HMMss", "Z").toFormatter().parse("+1");
     }
 
     @Test
--- a/jdk/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -93,6 +93,14 @@
     private static final ZoneOffset OFFSET_M000045 = ZoneOffset.ofHoursMinutesSeconds(0, 0, -45);
     private static final LocalDateTime DT_2012_06_30_12_30_40 = LocalDateTime.of(2012, 6, 30, 12, 30, 40);
 
+    private static final ZoneOffset OFFSET_P1100 = ZoneOffset.ofHours(11);
+    private static final ZoneOffset OFFSET_P1123 = ZoneOffset.ofHoursMinutes(11, 23);
+    private static final ZoneOffset OFFSET_P1023 = ZoneOffset.ofHoursMinutes(10, 23);
+    private static final ZoneOffset OFFSET_P112345 = ZoneOffset.ofHoursMinutesSeconds(11, 23, 45);
+    private static final ZoneOffset OFFSET_P100045 = ZoneOffset.ofHoursMinutesSeconds(10, 0, 45);
+    private static final ZoneOffset OFFSET_M1100 = ZoneOffset.ofHours(-11);
+    private static final ZoneOffset OFFSET_M1123 = ZoneOffset.ofHoursMinutes(-11, -23);
+    private static final ZoneOffset OFFSET_M112345 = ZoneOffset.ofHoursMinutesSeconds(-11, -23, -45);
     private DateTimeFormatterBuilder builder;
 
     @BeforeMethod
@@ -223,6 +231,212 @@
                 {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0023"},
                 {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-012345"},
                 {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-000045"},
+
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "Z"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "Z"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+100"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-100"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1:00"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1:00"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+100"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+12345"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "+00045"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-100"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-12345"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1:00"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23:45"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1:00"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23:45"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+10000"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+12300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+02300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+12345"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-10000"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-12300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-02300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-12345"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1:00:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23:45"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1:00:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23:45"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23:45"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23:45"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+12345"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "+00045"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-12345"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+10"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11"},
+                {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11"},
+
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+1123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+10"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+                {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-1123"},
+
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+1100"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+1123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+1000"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-1100"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+                {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-1123"},
+
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11:00"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+10:00"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11:00"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23"},
+                {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23"},
+
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+1100"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+112345"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+100045"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-1100"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+                {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-112345"},
+
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11:00"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23:45"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11:00"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23"},
+                {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23:45"},
+
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+110000"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+112300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+102300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+112345"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-110000"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-112300"},
+                {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-112345"},
+
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11:00:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23:45"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11:00:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23:00"},
+                {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23:45"},
+
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23:45"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23"},
+                {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23:45"},
+
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+112345"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+100045"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+                {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-112345"},
         };
     }
 
--- a/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java	Wed Jul 05 22:01:14 2017 +0200
@@ -484,8 +484,6 @@
             {"HH:MM:ss"},
             {"HHMMSS"},
             {"HH:MM:SS"},
-            {"+H"},
-            {"+HMM"},
             {"+HHM"},
             {"+A"},
         };
--- a/jdk/test/java/time/test/java/time/format/TestZoneOffsetParser.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/time/test/java/time/format/TestZoneOffsetParser.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -296,7 +296,7 @@
     @DataProvider(name="bigOffsets")
     Object[][] provider_bigOffsets() {
         return new Object[][] {
-            {"+HH", "+59", 59 * 3600},
+            {"+HH", "+19", 19 * 3600},
             {"+HH", "-19", -(19 * 3600)},
 
             {"+HHMM", "+1801", 18 * 3600 + 1 * 60},
--- a/jdk/test/java/util/SplittableRandom/SplittableRandomTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,561 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 org.testng.Assert;
-import org.testng.annotations.Test;
-
-import java.util.SplittableRandom;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.LongAdder;
-import java.util.function.BiConsumer;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-/**
- * @test
- * @run testng SplittableRandomTest
- * @run testng/othervm -Djava.util.secureRandomSeed=true SplittableRandomTest
- * @summary test methods on SplittableRandom
- * @key randomness
- */
-@Test
-public class SplittableRandomTest {
-
-    // Note: this test was copied from the 166 TCK SplittableRandomTest test
-    // and modified to be a TestNG test
-
-    /*
-     * Testing coverage notes:
-     *
-     * 1. Many of the test methods are adapted from ThreadLocalRandomTest.
-     *
-     * 2. These tests do not check for random number generator quality.
-     * But we check for minimal API compliance by requiring that
-     * repeated calls to nextX methods, up to NCALLS tries, produce at
-     * least two distinct results. (In some possible universe, a
-     * "correct" implementation might fail, but the odds are vastly
-     * less than that of encountering a hardware failure while running
-     * the test.) For bounded nextX methods, we sample various
-     * intervals across multiples of primes. In other tests, we repeat
-     * under REPS different values.
-     */
-
-    // max numbers of calls to detect getting stuck on one value
-    static final int NCALLS = 10000;
-
-    // max sampled int bound
-    static final int MAX_INT_BOUND = (1 << 28);
-
-    // max sampled long bound
-    static final long MAX_LONG_BOUND = (1L << 42);
-
-    // Number of replications for other checks
-    static final int REPS = 20;
-
-    /**
-     * Repeated calls to nextInt produce at least two distinct results
-     */
-    public void testNextInt() {
-        SplittableRandom sr = new SplittableRandom();
-        int f = sr.nextInt();
-        int i = 0;
-        while (i < NCALLS && sr.nextInt() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextLong produce at least two distinct results
-     */
-    public void testNextLong() {
-        SplittableRandom sr = new SplittableRandom();
-        long f = sr.nextLong();
-        int i = 0;
-        while (i < NCALLS && sr.nextLong() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextDouble produce at least two distinct results
-     */
-    public void testNextDouble() {
-        SplittableRandom sr = new SplittableRandom();
-        double f = sr.nextDouble();
-        int i = 0;
-        while (i < NCALLS && sr.nextDouble() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Two SplittableRandoms created with the same seed produce the
-     * same values for nextLong.
-     */
-    public void testSeedConstructor() {
-        for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863)  {
-            SplittableRandom sr1 = new SplittableRandom(seed);
-            SplittableRandom sr2 = new SplittableRandom(seed);
-            for (int i = 0; i < REPS; ++i)
-                assertEquals(sr1.nextLong(), sr2.nextLong());
-        }
-    }
-
-    /**
-     * A SplittableRandom produced by split() of a default-constructed
-     * SplittableRandom generates a different sequence
-     */
-    public void testSplit1() {
-        SplittableRandom sr = new SplittableRandom();
-        for (int reps = 0; reps < REPS; ++reps) {
-            SplittableRandom sc = sr.split();
-            int i = 0;
-            while (i < NCALLS && sr.nextLong() == sc.nextLong())
-                ++i;
-            assertTrue(i < NCALLS);
-        }
-    }
-
-    /**
-     * A SplittableRandom produced by split() of a seeded-constructed
-     * SplittableRandom generates a different sequence
-     */
-    public void testSplit2() {
-        SplittableRandom sr = new SplittableRandom(12345);
-        for (int reps = 0; reps < REPS; ++reps) {
-            SplittableRandom sc = sr.split();
-            int i = 0;
-            while (i < NCALLS && sr.nextLong() == sc.nextLong())
-                ++i;
-            assertTrue(i < NCALLS);
-        }
-    }
-
-    /**
-     * nextInt(negative) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextIntBoundedNeg() {
-        SplittableRandom sr = new SplittableRandom();
-        int f = sr.nextInt(-17);
-    }
-
-    /**
-     * nextInt(least >= bound) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextIntBadBounds() {
-        SplittableRandom sr = new SplittableRandom();
-        int f = sr.nextInt(17, 2);
-    }
-
-    /**
-     * nextInt(bound) returns 0 <= value < bound;
-     * repeated calls produce at least two distinct results
-     */
-    public void testNextIntBounded() {
-        SplittableRandom sr = new SplittableRandom();
-        // sample bound space across prime number increments
-        for (int bound = 2; bound < MAX_INT_BOUND; bound += 524959) {
-            int f = sr.nextInt(bound);
-            assertTrue(0 <= f && f < bound);
-            int i = 0;
-            int j;
-            while (i < NCALLS &&
-                   (j = sr.nextInt(bound)) == f) {
-                assertTrue(0 <= j && j < bound);
-                ++i;
-            }
-            assertTrue(i < NCALLS);
-        }
-    }
-
-    /**
-     * nextInt(least, bound) returns least <= value < bound;
-     * repeated calls produce at least two distinct results
-     */
-    public void testNextIntBounded2() {
-        SplittableRandom sr = new SplittableRandom();
-        for (int least = -15485863; least < MAX_INT_BOUND; least += 524959) {
-            for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 49979687) {
-                int f = sr.nextInt(least, bound);
-                assertTrue(least <= f && f < bound);
-                int i = 0;
-                int j;
-                while (i < NCALLS &&
-                       (j = sr.nextInt(least, bound)) == f) {
-                    assertTrue(least <= j && j < bound);
-                    ++i;
-                }
-                assertTrue(i < NCALLS);
-            }
-        }
-    }
-
-    /**
-     * nextLong(negative) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextLongBoundedNeg() {
-        SplittableRandom sr = new SplittableRandom();
-        long f = sr.nextLong(-17);
-    }
-
-    /**
-     * nextLong(least >= bound) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextLongBadBounds() {
-        SplittableRandom sr = new SplittableRandom();
-        long f = sr.nextLong(17, 2);
-    }
-
-    /**
-     * nextLong(bound) returns 0 <= value < bound;
-     * repeated calls produce at least two distinct results
-     */
-    public void testNextLongBounded() {
-        SplittableRandom sr = new SplittableRandom();
-        for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) {
-            long f = sr.nextLong(bound);
-            assertTrue(0 <= f && f < bound);
-            int i = 0;
-            long j;
-            while (i < NCALLS &&
-                   (j = sr.nextLong(bound)) == f) {
-                assertTrue(0 <= j && j < bound);
-                ++i;
-            }
-            assertTrue(i < NCALLS);
-        }
-    }
-
-    /**
-     * nextLong(least, bound) returns least <= value < bound;
-     * repeated calls produce at least two distinct results
-     */
-    public void testNextLongBounded2() {
-        SplittableRandom sr = new SplittableRandom();
-        for (long least = -86028121; least < MAX_LONG_BOUND; least += 982451653L) {
-            for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) {
-                long f = sr.nextLong(least, bound);
-                assertTrue(least <= f && f < bound);
-                int i = 0;
-                long j;
-                while (i < NCALLS &&
-                       (j = sr.nextLong(least, bound)) == f) {
-                    assertTrue(least <= j && j < bound);
-                    ++i;
-                }
-                assertTrue(i < NCALLS);
-            }
-        }
-    }
-
-    /**
-     * nextDouble(bound) throws IllegalArgumentException
-     */
-    public void testNextDoubleBadBound() {
-        SplittableRandom sr = new SplittableRandom();
-        executeAndCatchIAE(() -> sr.nextDouble(0.0));
-        executeAndCatchIAE(() -> sr.nextDouble(-0.0));
-        executeAndCatchIAE(() -> sr.nextDouble(+0.0));
-        executeAndCatchIAE(() -> sr.nextDouble(-1.0));
-        executeAndCatchIAE(() -> sr.nextDouble(Double.NaN));
-        executeAndCatchIAE(() -> sr.nextDouble(Double.NEGATIVE_INFINITY));
-
-        // Returns Double.MAX_VALUE
-//        executeAndCatchIAE(() -> r.nextDouble(Double.POSITIVE_INFINITY));
-    }
-
-    /**
-     * nextDouble(origin, bound) throws IllegalArgumentException
-     */
-    public void testNextDoubleBadOriginBound() {
-        testDoubleBadOriginBound(new SplittableRandom()::nextDouble);
-    }
-
-    // An arbitrary finite double value
-    static final double FINITE = Math.PI;
-
-    void testDoubleBadOriginBound(BiConsumer<Double, Double> bi) {
-        executeAndCatchIAE(() -> bi.accept(17.0, 2.0));
-        executeAndCatchIAE(() -> bi.accept(0.0, 0.0));
-        executeAndCatchIAE(() -> bi.accept(Double.NaN, FINITE));
-        executeAndCatchIAE(() -> bi.accept(FINITE, Double.NaN));
-        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
-
-        // Returns NaN
-//        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, FINITE));
-//        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
-
-        executeAndCatchIAE(() -> bi.accept(FINITE, Double.NEGATIVE_INFINITY));
-
-        // Returns Double.MAX_VALUE
-//        executeAndCatchIAE(() -> bi.accept(FINITE, Double.POSITIVE_INFINITY));
-
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY));
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, FINITE));
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY));
-    }
-
-    /**
-     * nextDouble(least, bound) returns least <= value < bound;
-     * repeated calls produce at least two distinct results
-     */
-    public void testNextDoubleBounded2() {
-        SplittableRandom sr = new SplittableRandom();
-        for (double least = 0.0001; least < 1.0e20; least *= 8) {
-            for (double bound = least * 1.001; bound < 1.0e20; bound *= 16) {
-                double f = sr.nextDouble(least, bound);
-                assertTrue(least <= f && f < bound);
-                int i = 0;
-                double j;
-                while (i < NCALLS &&
-                       (j = sr.nextDouble(least, bound)) == f) {
-                    assertTrue(least <= j && j < bound);
-                    ++i;
-                }
-                assertTrue(i < NCALLS);
-            }
-        }
-    }
-
-    /**
-     * Invoking sized ints, long, doubles, with negative sizes throws
-     * IllegalArgumentException
-     */
-    public void testBadStreamSize() {
-        SplittableRandom r = new SplittableRandom();
-        executeAndCatchIAE(() -> r.ints(-1L));
-        executeAndCatchIAE(() -> r.ints(-1L, 2, 3));
-        executeAndCatchIAE(() -> r.longs(-1L));
-        executeAndCatchIAE(() -> r.longs(-1L, -1L, 1L));
-        executeAndCatchIAE(() -> r.doubles(-1L));
-        executeAndCatchIAE(() -> r.doubles(-1L, .5, .6));
-    }
-
-    /**
-     * Invoking bounded ints, long, doubles, with illegal bounds throws
-     * IllegalArgumentException
-     */
-    public void testBadStreamBounds() {
-        SplittableRandom r = new SplittableRandom();
-        executeAndCatchIAE(() -> r.ints(2, 1));
-        executeAndCatchIAE(() -> r.ints(10, 42, 42));
-        executeAndCatchIAE(() -> r.longs(-1L, -1L));
-        executeAndCatchIAE(() -> r.longs(10, 1L, -2L));
-
-        testDoubleBadOriginBound((o, b) -> r.doubles(10, o, b));
-    }
-
-    private void executeAndCatchIAE(Runnable r) {
-        executeAndCatch(IllegalArgumentException.class, r);
-    }
-
-    private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
-        Exception caught = null;
-        try {
-            r.run();
-        }
-        catch (Exception e) {
-            caught = e;
-        }
-
-        assertNotNull(caught,
-                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
-                                    expected.getName()));
-        Assert.assertTrue(expected.isInstance(caught),
-                          String.format("Exception thrown %s not an instance of %s",
-                                        caught.getClass().getName(), expected.getName()));
-    }
-
-    /**
-     * A parallel sized stream of ints generates the given number of values
-     */
-    public void testIntsCount() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 0;
-        for (int reps = 0; reps < REPS; ++reps) {
-            counter.reset();
-            r.ints(size).parallel().forEach(x -> {counter.increment();});
-            assertEquals(counter.sum(), size);
-            size += 524959;
-        }
-    }
-
-    /**
-     * A parallel sized stream of longs generates the given number of values
-     */
-    public void testLongsCount() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 0;
-        for (int reps = 0; reps < REPS; ++reps) {
-            counter.reset();
-            r.longs(size).parallel().forEach(x -> {counter.increment();});
-            assertEquals(counter.sum(), size);
-            size += 524959;
-        }
-    }
-
-    /**
-     * A parallel sized stream of doubles generates the given number of values
-     */
-    public void testDoublesCount() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 0;
-        for (int reps = 0; reps < REPS; ++reps) {
-            counter.reset();
-            r.doubles(size).parallel().forEach(x -> {counter.increment();});
-            assertEquals(counter.sum(), size);
-            size += 524959;
-        }
-    }
-
-    /**
-     * Each of a parallel sized stream of bounded ints is within bounds
-     */
-    public void testBoundedInts() {
-        AtomicInteger fails = new AtomicInteger(0);
-        SplittableRandom r = new SplittableRandom();
-        long size = 12345L;
-        for (int least = -15485867; least < MAX_INT_BOUND; least += 524959) {
-            for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 67867967) {
-                final int lo = least, hi = bound;
-                r.ints(size, lo, hi).parallel().
-                    forEach(x -> {if (x < lo || x >= hi)
-                                fails.getAndIncrement(); });
-            }
-        }
-        assertEquals(fails.get(), 0);
-    }
-
-    /**
-     * Each of a parallel sized stream of bounded longs is within bounds
-     */
-    public void testBoundedLongs() {
-        AtomicInteger fails = new AtomicInteger(0);
-        SplittableRandom r = new SplittableRandom();
-        long size = 123L;
-        for (long least = -86028121; least < MAX_LONG_BOUND; least += 1982451653L) {
-            for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) {
-                final long lo = least, hi = bound;
-                r.longs(size, lo, hi).parallel().
-                    forEach(x -> {if (x < lo || x >= hi)
-                                fails.getAndIncrement(); });
-            }
-        }
-        assertEquals(fails.get(), 0);
-    }
-
-    /**
-     * Each of a parallel sized stream of bounded doubles is within bounds
-     */
-    public void testBoundedDoubles() {
-        AtomicInteger fails = new AtomicInteger(0);
-        SplittableRandom r = new SplittableRandom();
-        long size = 456;
-        for (double least = 0.00011; least < 1.0e20; least *= 9) {
-            for (double bound = least * 1.0011; bound < 1.0e20; bound *= 17) {
-                final double lo = least, hi = bound;
-                r.doubles(size, lo, hi).parallel().
-                    forEach(x -> {if (x < lo || x >= hi)
-                                fails.getAndIncrement(); });
-            }
-        }
-        assertEquals(fails.get(), 0);
-    }
-
-    /**
-     * A parallel unsized stream of ints generates at least 100 values
-     */
-    public void testUnsizedIntsCount() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 100;
-        r.ints().limit(size).parallel().forEach(x -> {counter.increment();});
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A parallel unsized stream of longs generates at least 100 values
-     */
-    public void testUnsizedLongsCount() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 100;
-        r.longs().limit(size).parallel().forEach(x -> {counter.increment();});
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A parallel unsized stream of doubles generates at least 100 values
-     */
-    public void testUnsizedDoublesCount() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 100;
-        r.doubles().limit(size).parallel().forEach(x -> {counter.increment();});
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A sequential unsized stream of ints generates at least 100 values
-     */
-    public void testUnsizedIntsCountSeq() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 100;
-        r.ints().limit(size).forEach(x -> {counter.increment();});
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A sequential unsized stream of longs generates at least 100 values
-     */
-    public void testUnsizedLongsCountSeq() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 100;
-        r.longs().limit(size).forEach(x -> {counter.increment();});
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A sequential unsized stream of doubles generates at least 100 values
-     */
-    public void testUnsizedDoublesCountSeq() {
-        LongAdder counter = new LongAdder();
-        SplittableRandom r = new SplittableRandom();
-        long size = 100;
-        r.doubles().limit(size).forEach(x -> {counter.increment();});
-        assertEquals(counter.sum(), size);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/TimeZone/Bug8066652.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+import java.util.TimeZone;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+public class Bug8066652 {
+
+    public static void main(String args[]) {
+        ExecutorService executor = Executors.newFixedThreadPool(10);
+        Callable<TimeZone> calTimeZone = () -> TimeZone.getDefault();
+        List<Callable<TimeZone>> tasks = new ArrayList<>();
+        for (int j = 1; j < 10; j++) {
+            tasks.add(calTimeZone);
+        }
+        try {
+            List<Future<TimeZone>> results = executor.invokeAll(tasks);
+            for (Future<TimeZone> f : results) {
+                TimeZone tz = f.get();
+                if (! tz.getID().equals("GMT")) {
+                    throw new RuntimeException("wrong Time zone ID: " + tz.getID()
+                            + ", It should be GMT");
+                }
+            }
+        } catch (InterruptedException | ExecutionException e) {
+            throw new RuntimeException("Execution interrupted or Execution Exception occurred", e);
+        } finally {
+            executor.shutdown();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/TimeZone/Bug8066652.sh	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# 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 8066652
+# @requires os.family == "mac"
+# @summary tests thread safe native function localtime_r is accessed by multiple threads at same time and
+# zone id should not be  “GMT+00:00” if default timezone is “GMT” and user specifies a fake timezone.
+# @build Bug8066652
+# @run shell/timeout=600 Bug8066652.sh
+
+
+if [ "${TESTSRC}" = "" ]
+then
+  echo "TESTSRC not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTSRC=${TESTSRC}"
+if [ "${TESTJAVA}" = "" ]
+then
+  echo "TESTJAVA not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTJAVA=${TESTJAVA}"
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+echo "TESTCLASSES=${TESTCLASSES}"
+echo "CLASSPATH=${CLASSPATH}"
+
+
+# set system TimeZone to GMT using environment variable TZ
+export TZ="GMT"
+
+# Setting invalid TimeZone using VM option
+${TESTJAVA}/bin/java -Duser.timezone=Foo/Bar  ${TESTVMOPTS} -cp ${TESTCLASSES}  Bug8066652
+
+status=$?
+if [ $status -eq 0 ]
+then
+  echo "Success, Test Passed";
+else
+  echo "Test Failed";
+fi
+
+exit $status
--- a/jdk/test/java/util/TimeZone/TimeZoneTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/util/TimeZone/TimeZoneTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 4028006 4044013 4096694 4107276 4107570 4112869 4130885 7039469 7126465 7158483
- *      8008577 8077685 8098547 8133321 8138716 8148446 8151876
+ *      8008577 8077685 8098547 8133321 8138716 8148446 8151876 8159684
  * @modules java.base/sun.util.resources
  * @library /java/text/testlib
  * @summary test TimeZone
--- a/jdk/test/java/util/concurrent/ThreadLocalRandom/ThreadLocalRandomTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,561 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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 org.testng.Assert;
-import org.testng.annotations.Test;
-
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.LongAdder;
-import java.util.function.BiConsumer;
-
-import static org.testng.Assert.*;
-
-/**
- * @test
- * @bug 8024253
- * @run testng ThreadLocalRandomTest
- * @run testng/othervm -Djava.util.secureRandomSeed=true ThreadLocalRandomTest
- * @summary test methods on ThreadLocalRandom
- */
-@Test
-public class ThreadLocalRandomTest {
-
-    // Note: this test was copied from the 166 TCK ThreadLocalRandomTest test
-    // and modified to be a TestNG test
-
-    /*
-     * Testing coverage notes:
-     *
-     * We don't test randomness properties, but only that repeated
-     * calls, up to NCALLS tries, produce at least one different
-     * result.  For bounded versions, we sample various intervals
-     * across multiples of primes.
-     */
-
-    // max numbers of calls to detect getting stuck on one value
-    static final int NCALLS = 10000;
-
-    // max sampled int bound
-    static final int MAX_INT_BOUND = (1 << 28);
-
-    // max sampled long bound
-    static final long MAX_LONG_BOUND = (1L << 42);
-
-    // Number of replications for other checks
-    static final int REPS = 20;
-
-    /**
-     * setSeed throws UnsupportedOperationException
-     */
-    @Test(expectedExceptions = UnsupportedOperationException.class)
-    public void testSetSeed() {
-        ThreadLocalRandom.current().setSeed(17);
-    }
-
-    /**
-     * Repeated calls to nextInt produce at least two distinct results
-     */
-    public void testNextInt() {
-        int f = ThreadLocalRandom.current().nextInt();
-        int i = 0;
-        while (i < NCALLS && ThreadLocalRandom.current().nextInt() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextLong produce at least two distinct results
-     */
-    public void testNextLong() {
-        long f = ThreadLocalRandom.current().nextLong();
-        int i = 0;
-        while (i < NCALLS && ThreadLocalRandom.current().nextLong() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextBoolean produce at least two distinct results
-     */
-    public void testNextBoolean() {
-        boolean f = ThreadLocalRandom.current().nextBoolean();
-        int i = 0;
-        while (i < NCALLS && ThreadLocalRandom.current().nextBoolean() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextFloat produce at least two distinct results
-     */
-    public void testNextFloat() {
-        float f = ThreadLocalRandom.current().nextFloat();
-        int i = 0;
-        while (i < NCALLS && ThreadLocalRandom.current().nextFloat() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextDouble produce at least two distinct results
-     */
-    public void testNextDouble() {
-        double f = ThreadLocalRandom.current().nextDouble();
-        int i = 0;
-        while (i < NCALLS && ThreadLocalRandom.current().nextDouble() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * Repeated calls to nextGaussian produce at least two distinct results
-     */
-    public void testNextGaussian() {
-        double f = ThreadLocalRandom.current().nextGaussian();
-        int i = 0;
-        while (i < NCALLS && ThreadLocalRandom.current().nextGaussian() == f)
-            ++i;
-        assertTrue(i < NCALLS);
-    }
-
-    /**
-     * nextInt(negative) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextIntBoundedNeg() {
-        int f = ThreadLocalRandom.current().nextInt(-17);
-    }
-
-    /**
-     * nextInt(least >= bound) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextIntBadBounds() {
-        int f = ThreadLocalRandom.current().nextInt(17, 2);
-    }
-
-    /**
-     * nextInt(bound) returns 0 <= value < bound; repeated calls produce at
-     * least two distinct results
-     */
-    public void testNextIntBounded() {
-        // sample bound space across prime number increments
-        for (int bound = 2; bound < MAX_INT_BOUND; bound += 524959) {
-            int f = ThreadLocalRandom.current().nextInt(bound);
-            assertTrue(0 <= f && f < bound);
-            int i = 0;
-            int j;
-            while (i < NCALLS &&
-                   (j = ThreadLocalRandom.current().nextInt(bound)) == f) {
-                assertTrue(0 <= j && j < bound);
-                ++i;
-            }
-            assertTrue(i < NCALLS);
-        }
-    }
-
-    /**
-     * nextInt(least, bound) returns least <= value < bound; repeated calls
-     * produce at least two distinct results
-     */
-    public void testNextIntBounded2() {
-        for (int least = -15485863; least < MAX_INT_BOUND; least += 524959) {
-            for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 49979687) {
-                int f = ThreadLocalRandom.current().nextInt(least, bound);
-                assertTrue(least <= f && f < bound);
-                int i = 0;
-                int j;
-                while (i < NCALLS &&
-                       (j = ThreadLocalRandom.current().nextInt(least, bound)) == f) {
-                    assertTrue(least <= j && j < bound);
-                    ++i;
-                }
-                assertTrue(i < NCALLS);
-            }
-        }
-    }
-
-    /**
-     * nextLong(negative) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextLongBoundedNeg() {
-        long f = ThreadLocalRandom.current().nextLong(-17);
-    }
-
-    /**
-     * nextLong(least >= bound) throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testNextLongBadBounds() {
-        long f = ThreadLocalRandom.current().nextLong(17, 2);
-    }
-
-    /**
-     * nextLong(bound) returns 0 <= value < bound; repeated calls produce at
-     * least two distinct results
-     */
-    public void testNextLongBounded() {
-        for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) {
-            long f = ThreadLocalRandom.current().nextLong(bound);
-            assertTrue(0 <= f && f < bound);
-            int i = 0;
-            long j;
-            while (i < NCALLS &&
-                   (j = ThreadLocalRandom.current().nextLong(bound)) == f) {
-                assertTrue(0 <= j && j < bound);
-                ++i;
-            }
-            assertTrue(i < NCALLS);
-        }
-    }
-
-    /**
-     * nextLong(least, bound) returns least <= value < bound; repeated calls
-     * produce at least two distinct results
-     */
-    public void testNextLongBounded2() {
-        for (long least = -86028121; least < MAX_LONG_BOUND; least += 982451653L) {
-            for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) {
-                long f = ThreadLocalRandom.current().nextLong(least, bound);
-                assertTrue(least <= f && f < bound);
-                int i = 0;
-                long j;
-                while (i < NCALLS &&
-                       (j = ThreadLocalRandom.current().nextLong(least, bound)) == f) {
-                    assertTrue(least <= j && j < bound);
-                    ++i;
-                }
-                assertTrue(i < NCALLS);
-            }
-        }
-    }
-
-    /**
-     * nextDouble(bound) throws IllegalArgumentException
-     */
-    public void testNextDoubleBadBound() {
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        executeAndCatchIAE(() -> r.nextDouble(0.0));
-        executeAndCatchIAE(() -> r.nextDouble(-0.0));
-        executeAndCatchIAE(() -> r.nextDouble(+0.0));
-        executeAndCatchIAE(() -> r.nextDouble(-1.0));
-        executeAndCatchIAE(() -> r.nextDouble(Double.NaN));
-        executeAndCatchIAE(() -> r.nextDouble(Double.NEGATIVE_INFINITY));
-
-        // Returns Double.MAX_VALUE
-//        executeAndCatchIAE(() -> r.nextDouble(Double.POSITIVE_INFINITY));
-    }
-
-    /**
-     * nextDouble(origin, bound) throws IllegalArgumentException
-     */
-    public void testNextDoubleBadOriginBound() {
-        testDoubleBadOriginBound(ThreadLocalRandom.current()::nextDouble);
-    }
-
-    // An arbitrary finite double value
-    static final double FINITE = Math.PI;
-
-    void testDoubleBadOriginBound(BiConsumer<Double, Double> bi) {
-        executeAndCatchIAE(() -> bi.accept(17.0, 2.0));
-        executeAndCatchIAE(() -> bi.accept(0.0, 0.0));
-        executeAndCatchIAE(() -> bi.accept(Double.NaN, FINITE));
-        executeAndCatchIAE(() -> bi.accept(FINITE, Double.NaN));
-        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
-
-        // Returns NaN
-//        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, FINITE));
-//        executeAndCatchIAE(() -> bi.accept(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
-
-        executeAndCatchIAE(() -> bi.accept(FINITE, Double.NEGATIVE_INFINITY));
-
-        // Returns Double.MAX_VALUE
-//        executeAndCatchIAE(() -> bi.accept(FINITE, Double.POSITIVE_INFINITY));
-
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY));
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, FINITE));
-        executeAndCatchIAE(() -> bi.accept(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY));
-    }
-
-    /**
-     * nextDouble(least, bound) returns least <= value < bound; repeated calls
-     * produce at least two distinct results
-     */
-    public void testNextDoubleBounded2() {
-        for (double least = 0.0001; least < 1.0e20; least *= 8) {
-            for (double bound = least * 1.001; bound < 1.0e20; bound *= 16) {
-                double f = ThreadLocalRandom.current().nextDouble(least, bound);
-                assertTrue(least <= f && f < bound);
-                int i = 0;
-                double j;
-                while (i < NCALLS &&
-                       (j = ThreadLocalRandom.current().nextDouble(least, bound)) == f) {
-                    assertTrue(least <= j && j < bound);
-                    ++i;
-                }
-                assertTrue(i < NCALLS);
-            }
-        }
-    }
-
-    /**
-     * Invoking sized ints, long, doubles, with negative sizes throws
-     * IllegalArgumentException
-     */
-    public void testBadStreamSize() {
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        executeAndCatchIAE(() -> r.ints(-1L));
-        executeAndCatchIAE(() -> r.ints(-1L, 2, 3));
-        executeAndCatchIAE(() -> r.longs(-1L));
-        executeAndCatchIAE(() -> r.longs(-1L, -1L, 1L));
-        executeAndCatchIAE(() -> r.doubles(-1L));
-        executeAndCatchIAE(() -> r.doubles(-1L, .5, .6));
-    }
-
-    /**
-     * Invoking bounded ints, long, doubles, with illegal bounds throws
-     * IllegalArgumentException
-     */
-    public void testBadStreamBounds() {
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        executeAndCatchIAE(() -> r.ints(2, 1));
-        executeAndCatchIAE(() -> r.ints(10, 42, 42));
-        executeAndCatchIAE(() -> r.longs(-1L, -1L));
-        executeAndCatchIAE(() -> r.longs(10, 1L, -2L));
-
-        testDoubleBadOriginBound((o, b) -> r.doubles(10, o, b));
-    }
-
-    private void executeAndCatchIAE(Runnable r) {
-        executeAndCatch(IllegalArgumentException.class, r);
-    }
-
-    private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
-        Exception caught = null;
-        try {
-            r.run();
-        }
-        catch (Exception e) {
-            caught = e;
-        }
-
-        assertNotNull(caught,
-                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
-                                    expected.getName()));
-        Assert.assertTrue(expected.isInstance(caught),
-                          String.format("Exception thrown %s not an instance of %s",
-                                        caught.getClass().getName(), expected.getName()));
-    }
-
-    /**
-     * A parallel sized stream of ints generates the given number of values
-     */
-    public void testIntsCount() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 0;
-        for (int reps = 0; reps < REPS; ++reps) {
-            counter.reset();
-            r.ints(size).parallel().forEach(x -> {
-                counter.increment();
-            });
-            assertEquals(counter.sum(), size);
-            size += 524959;
-        }
-    }
-
-    /**
-     * A parallel sized stream of longs generates the given number of values
-     */
-    public void testLongsCount() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 0;
-        for (int reps = 0; reps < REPS; ++reps) {
-            counter.reset();
-            r.longs(size).parallel().forEach(x -> {
-                counter.increment();
-            });
-            assertEquals(counter.sum(), size);
-            size += 524959;
-        }
-    }
-
-    /**
-     * A parallel sized stream of doubles generates the given number of values
-     */
-    public void testDoublesCount() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 0;
-        for (int reps = 0; reps < REPS; ++reps) {
-            counter.reset();
-            r.doubles(size).parallel().forEach(x -> {
-                counter.increment();
-            });
-            assertEquals(counter.sum(), size);
-            size += 524959;
-        }
-    }
-
-    /**
-     * Each of a parallel sized stream of bounded ints is within bounds
-     */
-    public void testBoundedInts() {
-        AtomicInteger fails = new AtomicInteger(0);
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 12345L;
-        for (int least = -15485867; least < MAX_INT_BOUND; least += 524959) {
-            for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 67867967) {
-                final int lo = least, hi = bound;
-                r.ints(size, lo, hi).parallel().
-                        forEach(x -> {
-                            if (x < lo || x >= hi)
-                                fails.getAndIncrement();
-                        });
-            }
-        }
-        assertEquals(fails.get(), 0);
-    }
-
-    /**
-     * Each of a parallel sized stream of bounded longs is within bounds
-     */
-    public void testBoundedLongs() {
-        AtomicInteger fails = new AtomicInteger(0);
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 123L;
-        for (long least = -86028121; least < MAX_LONG_BOUND; least += 1982451653L) {
-            for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) {
-                final long lo = least, hi = bound;
-                r.longs(size, lo, hi).parallel().
-                        forEach(x -> {
-                            if (x < lo || x >= hi)
-                                fails.getAndIncrement();
-                        });
-            }
-        }
-        assertEquals(fails.get(), 0);
-    }
-
-    /**
-     * Each of a parallel sized stream of bounded doubles is within bounds
-     */
-    public void testBoundedDoubles() {
-        AtomicInteger fails = new AtomicInteger(0);
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 456;
-        for (double least = 0.00011; least < 1.0e20; least *= 9) {
-            for (double bound = least * 1.0011; bound < 1.0e20; bound *= 17) {
-                final double lo = least, hi = bound;
-                r.doubles(size, lo, hi).parallel().
-                        forEach(x -> {
-                            if (x < lo || x >= hi)
-                                fails.getAndIncrement();
-                        });
-            }
-        }
-        assertEquals(fails.get(), 0);
-    }
-
-    /**
-     * A parallel unsized stream of ints generates at least 100 values
-     */
-    public void testUnsizedIntsCount() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 100;
-        r.ints().limit(size).parallel().forEach(x -> {
-            counter.increment();
-        });
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A parallel unsized stream of longs generates at least 100 values
-     */
-    public void testUnsizedLongsCount() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 100;
-        r.longs().limit(size).parallel().forEach(x -> {
-            counter.increment();
-        });
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A parallel unsized stream of doubles generates at least 100 values
-     */
-    public void testUnsizedDoublesCount() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 100;
-        r.doubles().limit(size).parallel().forEach(x -> {
-            counter.increment();
-        });
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A sequential unsized stream of ints generates at least 100 values
-     */
-    public void testUnsizedIntsCountSeq() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 100;
-        r.ints().limit(size).forEach(x -> {
-            counter.increment();
-        });
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A sequential unsized stream of longs generates at least 100 values
-     */
-    public void testUnsizedLongsCountSeq() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 100;
-        r.longs().limit(size).forEach(x -> {
-            counter.increment();
-        });
-        assertEquals(counter.sum(), size);
-    }
-
-    /**
-     * A sequential unsized stream of doubles generates at least 100 values
-     */
-    public void testUnsizedDoublesCountSeq() {
-        LongAdder counter = new LongAdder();
-        ThreadLocalRandom r = ThreadLocalRandom.current();
-        long size = 100;
-        r.doubles().limit(size).forEach(x -> {
-            counter.increment();
-        });
-        assertEquals(counter.sum(), size);
-    }
-
-}
--- a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Wed Jul 05 22:01:14 2017 +0200
@@ -40,6 +40,7 @@
  * @build *
  * @run junit/othervm/timeout=1000 -Djsr166.testImplementationDetails=true JSR166TestCase
  * @run junit/othervm/timeout=1000 -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 -Djsr166.testImplementationDetails=true JSR166TestCase
+ * @run junit/othervm/timeout=1000 -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -Djava.util.secureRandomSeed=true JSR166TestCase
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/CryptoPermissions/README.txt	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,2 @@
+If TestExemption.java/cryptoPerms files ever change, please rebuild the
+corresponding signed jar file in the closed repo.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/CryptoPermissions/TestExemption.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+import javax.crypto.*;
+import java.security.*;
+
+public class TestExemption {
+
+    public static void main(String[] args) throws Exception {
+
+        KeyGenerator kg = KeyGenerator.getInstance("AES");
+        kg.init(128);
+        SecretKey key128 = kg.generateKey();
+
+        kg.init(192);
+        SecretKey key192 = kg.generateKey();
+
+        kg.init(256);
+        SecretKey key256 = kg.generateKey();
+
+        Cipher c = Cipher.getInstance("AES/CBC/NoPadding");
+
+        System.out.println("Testing 128-bit");
+        c.init(Cipher.ENCRYPT_MODE, key128);
+
+        System.out.println("Testing 192-bit");
+        c.init(Cipher.ENCRYPT_MODE, key192);
+
+        try {
+            System.out.println("Testing 256-bit");
+            c.init(Cipher.ENCRYPT_MODE, key256);
+        } catch (InvalidKeyException e) {
+            System.out.println("Caught the right exception");
+        }
+
+        System.out.println("DONE!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/CryptoPermissions/TestExemption.sh	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,79 @@
+#
+# 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 8161527
+# @summary NPE is thrown if exempt application is bundled with specific
+#     cryptoPerms
+# @requires java.runtime.name ~= "OpenJDK.*"
+
+# set a few environment variables so that the shell-script can run stand-alone
+# in the source directory
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux | Darwin | AIX | CYGWIN* )
+    FS="/"
+    ;;
+  Windows_* )
+    FS="\\"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+if [ "${TESTSRC}" = "" ] ; then
+  TESTSRC="."
+fi
+if [ "${TESTCLASSES}" = "" ] ; then
+  TESTCLASSES="."
+fi
+if [ "${TESTJAVA}" = "" ] ; then
+  JAVAC_CMD=`which javac`
+  TESTJAVA=`dirname $JAVAC_CMD`${FS}..
+  COMPILEJAVA="${TESTJAVA}"
+fi
+
+# Build
+${COMPILEJAVA}${FS}bin${FS}javac \
+    -d . \
+    ${TESTSRC}${FS}TestExemption.java \
+    || exit 10
+
+# Package
+${COMPILEJAVA}${FS}bin${FS}jar \
+    -cvf TestExemption.jar \
+    TestExemption.class \
+    -C ${TESTSRC} cryptoPerms \
+    || exit 10
+
+# Test
+${TESTJAVA}${FS}bin${FS}java \
+    -classpath TestExemption.jar TestExemption
+status=$?
+
+exit $status
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/CryptoPermissions/cryptoPerms	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,5 @@
+grant {
+     // The stock JDK allows for 128 bit AES.
+     // Grant up to 192 bits, but no further.
+     permission javax.crypto.CryptoPermission "AES", 192;
+};
--- a/jdk/test/javax/imageio/plugins/png/ITXtTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/imageio/plugins/png/ITXtTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 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
@@ -21,16 +21,15 @@
  * questions.
  */
 
-/**
+/*
  * @test
- * @bug     6541476
- * @summary Test verifies that ImageIO PNG plugin correcly handles the
+ * @bug     6541476 7059970
+ * @summary Test verifies that ImageIO PNG plug-in correctly handles the
  *          iTxt chunk (International textual data).
  *
  * @run     main ITXtTest
  */
 
-
 import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
@@ -157,21 +156,22 @@
 
         File file = new File("test.png");
 
-        writeTo(file, src);
-        ITXtTest dst = readFrom(file);
-
-        if (dst == null || !dst.equals(src)) {
-            throw new RuntimeException("Test failed.");
+        try {
+            writeTo(file, src);
+            ITXtTest dst = readFrom(file);
+            if (dst == null || !dst.equals(src)) {
+                throw new RuntimeException("Test failed.");
+            }
+        } finally {
+            file.delete();
         }
-
         System.out.println("Test passed.");
     }
 
     private static void writeTo(File f, ITXtTest t) {
         BufferedImage src = createBufferedImage();
-        try {
-            ImageOutputStream imageOutputStream =
-                ImageIO.createImageOutputStream(f);
+        try (ImageOutputStream imageOutputStream =
+                ImageIO.createImageOutputStream(f)) {
 
             ImageTypeSpecifier imageTypeSpecifier =
                 new ImageTypeSpecifier(src);
@@ -191,7 +191,6 @@
             m.setFromTree(format, root);
 
             imageWriter.write(new IIOImage(src, null, m));
-            imageOutputStream.close();
             System.out.println("Writing done.");
         } catch (Throwable e) {
             throw new RuntimeException("Writing test failed.", e);
@@ -199,10 +198,11 @@
     }
 
     private static ITXtTest readFrom(File f) {
-        try {
-            ImageInputStream iis = ImageIO.createImageInputStream(f);
-            ImageReader r = ImageIO.getImageReaders(iis).next();
-            r.setInput(iis);
+        try (ImageInputStream imageInputStream =
+                ImageIO.createImageInputStream(f)) {
+
+            ImageReader r = ImageIO.getImageReaders(imageInputStream).next();
+            r.setInput(imageInputStream);
 
             IIOImage dst = r.readAll(0, null);
 
@@ -234,3 +234,4 @@
         return image;
     }
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,154 @@
+/*
+ * 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 5049012
+ * @summary Verify if PrintToFile option is disabled for flavors that do not
+ *          support Destination
+ * @requires (os.family == "linux")
+ * @run main/manual ServiceDialogValidateTest
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.io.File;
+import javax.print.DocFlavor;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.ServiceUI;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.standard.Destination;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class ServiceDialogValidateTest {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+
+    private static void printTest() {
+        PrintService defService = null, service[] = null;
+        HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet();
+        DocFlavor flavor = DocFlavor.INPUT_STREAM.JPEG;
+
+        service = PrintServiceLookup.lookupPrintServices(flavor, null);
+        defService = PrintServiceLookup.lookupDefaultPrintService();
+
+        if ((service == null) || (service.length == 0)) {
+            throw new RuntimeException("No Printer services found");
+        }
+        File f = new File("output.ps");
+        Destination d = new Destination(f.toURI());
+        prSet.add(d);
+        if (defService != null) {
+            System.out.println("isAttrCategory Supported? " +
+                    defService.isAttributeCategorySupported(Destination.class));
+            System.out.println("isAttrValue Supported? " +
+                    defService.isAttributeValueSupported(d, flavor, null));
+        }
+
+        defService = ServiceUI.printDialog(null, 100, 100, service, defService,
+                flavor, prSet);
+
+    }
+
+    /**
+     * Starts the application.
+     */
+    public static void main(java.lang.String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(ServiceDialogValidateTest::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(60000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("PrintToFile option is not disabled "
+                        + "for flavors that do not support destination");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " Visual inspection of print dialog is required.\n"
+                + " A print dialog will be shown.\n "
+                + " Please verify Print-To-File option is disabled.\n"
+                + " Press Cancel to close the print dialog.\n"
+                + " If Print-To-File option is disabled, press PASS else press FAIL";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/attribute/ServiceDlgSheetCollateTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,161 @@
+/*
+ * 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 5080830
+ * @summary Verify if SheetCollate option is disabled for flavors that do not
+ *          support SheetCollate
+ * @run main/manual ServiceDlgSheetCollateTest
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import javax.print.DocFlavor;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.ServiceUI;
+import javax.print.attribute.Attribute;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.standard.SheetCollate;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class ServiceDlgSheetCollateTest {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+
+    /**
+     * Starts the application.
+     */
+    public static void main(java.lang.String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(ServiceDlgSheetCollateTest::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(600000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("SheetCollate option is not disabled "
+                        + "for flavors that do not support sheetCollate");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void printTest() {
+        ServiceDlgSheetCollateTest pd = new ServiceDlgSheetCollateTest();
+        DocFlavor flavor = DocFlavor.INPUT_STREAM.JPEG;
+        //DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
+        PrintService defService = null, service[] = null;
+        defService = PrintServiceLookup.lookupDefaultPrintService();
+        service = PrintServiceLookup.lookupPrintServices(flavor, null);
+
+        if ((service == null) || (service.length == 0)) {
+            throw new RuntimeException("No Printer services found");
+        }
+        if (defService != null) {
+            System.out.println("\nDefault print service: " + service );
+            System.out.println("is flavor: "+flavor+" supported? "+
+                            defService.isDocFlavorSupported(flavor));
+            System.out.println("is SheetCollate category supported? "+
+                  defService.isAttributeCategorySupported(SheetCollate.class));
+            System.out.println("is SheetCollate.COLLATED value supported ? "+
+                  defService.isAttributeValueSupported(SheetCollate.COLLATED,
+                                                            flavor, null));
+        }
+        HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet();
+        try {
+            PrintService selService = ServiceUI.printDialog(null, 200, 200, service, defService, flavor, prSet);
+        } catch (IllegalArgumentException ia) {
+            System.out.println("Exception thrown : " + ia);
+        }
+
+        System.out.println("\nSelected Values\n");
+        Attribute attr[] = prSet.toArray();
+        for (int x = 0; x < attr.length; x ++) {
+            System.out.println("Attribute: " + attr[x].getName() + " Value: " + attr[x]);
+        }
+
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " A print dialog would appear.\n"
+                + " Increase the no. of copies.\n"
+                + " If COLLATE checkbox gets enabled, press FAIL else press PASS.\n"
+                + " Press Cancel to close the dialog.";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+}
+
--- a/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/6567433/UpdateUIRecursionTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * 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 6567433
+ *
+ * @summary  JComboBox.updateUI() invokes updateUI() on its cellrenderer via
+ * SwingUtilities.updateComponentTreeUI().
+ * If the cellrenderer is a parent of this JComboBox the method recurses
+ * endless.
+ * This test tests that the fix is effective in avoiding recursion.
+ *
+ * @run main/othervm UpdateUIRecursionTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingUtilities;
+
+public class UpdateUIRecursionTest extends JFrame implements ListCellRenderer {
+    JComboBox combo;
+    DefaultListCellRenderer renderer;
+
+    public UpdateUIRecursionTest() {
+        super("UpdateUIRecursionTest");
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setSize(400, 400);
+
+        String[] listData = {
+            "First", "Second", "Third", "Fourth", "Fifth", "Sixth"
+        };
+
+        combo = new JComboBox(listData);
+        combo.setRenderer(this);
+        renderer = new DefaultListCellRenderer();
+        getContentPane().add(new JScrollPane(combo), BorderLayout.CENTER);
+
+        setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                UpdateUIRecursionTest obj = new UpdateUIRecursionTest();
+
+                obj.test();
+
+                obj.disposeUI();
+            }
+        });
+    }
+
+    public void test() {
+        combo.updateUI();
+    }
+
+    public void disposeUI() {
+        setVisible(false);
+        dispose();
+    }
+
+    public Component getListCellRendererComponent(JList list, Object value,
+            int index, boolean isSelected, boolean cellHasFocus)
+    {
+        return renderer.getListCellRendererComponent(list, value, index,
+                                                     isSelected, cellHasFocus);
+    }
+}
+
--- a/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -40,7 +40,7 @@
 
 /**
  * @test
- * @bug 7199708
+ * @bug 7199708 8159587
  * @author Alexander Scherbatiy
  * @summary FileChooser crashs when opening large folder
  * @run main bug7199708
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JList/6567433/UpdateUIRecursionTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,97 @@
+/*
+ * 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 6567433
+ *
+ * @summary  JList.updateUI() for invokes updateUI() on its cellrenderer via
+ * SwingUtilities.updateComponentTreeUI().
+ * If the cellrenderer is a parent of this JList the method recurses
+ * endless.
+ * This test tests that the fix is effective in avoiding recursion.
+ *
+ * @run main/othervm UpdateUIRecursionTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingUtilities;
+
+public class UpdateUIRecursionTest extends JFrame implements ListCellRenderer {
+    JList list;
+    DefaultListCellRenderer renderer;
+
+    public UpdateUIRecursionTest() {
+        super("UpdateUIRecursionTest");
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setSize(400, 400);
+
+        String[] listData = {
+            "First", "Second", "Third", "Fourth", "Fifth", "Sixth"
+        };
+
+        list = new JList(listData);
+        list.setCellRenderer(this);
+        renderer = new DefaultListCellRenderer();
+        getContentPane().add(new JScrollPane(list), BorderLayout.CENTER);
+
+        setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                UpdateUIRecursionTest obj = new UpdateUIRecursionTest();
+
+                obj.test();
+
+                obj.disposeUI();
+            }
+        });
+    }
+
+    public void test() {
+        list.updateUI();
+    }
+
+    public void disposeUI() {
+        setVisible(false);
+        dispose();
+    }
+
+    public Component getListCellRendererComponent(JList list, Object value,
+            int index, boolean isSelected, boolean cellHasFocus)
+    {
+        return renderer.getListCellRendererComponent(list, value, index,
+                                                     isSelected, cellHasFocus);
+    }
+}
+
--- a/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -26,9 +26,10 @@
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
 import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
 
 /* @test
- * @bug 8031573 8040279
+ * @bug 8031573 8040279 8143064
  * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
  *           in high resolution on Retina
  * @author Alexander Scherbatiy
@@ -39,6 +40,9 @@
     @Override
     public void init() {
         try {
+
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+
             SwingUtilities.invokeAndWait(new Runnable() {
 
                 @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/6567433/UpdateUIRecursionTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,117 @@
+/*
+ * 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 6567433
+ *
+ * @summary  JTable.updateUI() invokes updateUI() on its TableCellrenderer via
+ * SwingUtilities.updateRendererOrEditorUI().
+ * If the TableCellrenderer is a parent of this JTable the method recurses
+ * endless.
+ * This test tests that the fix is effective in avoiding recursion.
+ *
+ * @run main/othervm UpdateUIRecursionTest
+ */
+
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+
+public class UpdateUIRecursionTest extends JFrame implements TableCellRenderer {
+    JTable table;
+    DefaultTableCellRenderer renderer;
+
+    public UpdateUIRecursionTest() {
+        super("UpdateUIRecursionTest");
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setSize(400, 400);
+
+        String[] columnNames = {
+                "First Name",
+                "Last Name",
+                "Sport",
+                "# of Years",
+                "Vegetarian"};
+
+                Object[][] data = {
+                    {"Mary", "Campione",
+                    "Snowboarding", new Integer(5), new Boolean(false)},
+                    {"Alison", "Huml",
+                    "Rowing", new Integer(3), new Boolean(true)},
+                    {"Kathy", "Walrath",
+                    "Knitting", new Integer(2), new Boolean(false)},
+                    {"Sharon", "Zakhour",
+                    "Speed reading", new Integer(20), new Boolean(true)},
+                    {"Philip", "Milne",
+                    "Pool", new Integer(10), new Boolean(false)}
+                };
+
+
+        table = new JTable(data, columnNames);
+
+        renderer = new DefaultTableCellRenderer();
+        getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
+        table.setDefaultRenderer(table.getColumnClass(1), this);
+
+        setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                UpdateUIRecursionTest obj = new UpdateUIRecursionTest();
+
+                obj.test();
+
+                obj.disposeUI();
+            }
+        });
+    }
+
+    public void test() {
+        table.updateUI();
+    }
+
+    public void disposeUI() {
+        setVisible(false);
+        dispose();
+    }
+
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value,
+                                         boolean isSelected, boolean hasFocus,
+                                         int row, int column)
+    {
+         return renderer.getTableCellRendererComponent(table, value, isSelected,
+                                                       hasFocus, row, column);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/6567433/UpdateUIRecursionTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * 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 6567433
+ *
+ * @summary  JTableHeader.updateUI() invokes updateUI() on its TableCellrenderer via
+ * SwingUtilities.updateComponentTreeUI().
+ * If the Tablecellrenderer is a parent of this JTableHeader, the method recurses
+ * endless.
+ * This test tests that the fix is effective in avoiding recursion.
+ *
+ * @run main/othervm UpdateUIRecursionTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
+
+public class UpdateUIRecursionTest extends JFrame implements TableCellRenderer {
+    JTable table;
+
+    public UpdateUIRecursionTest() {
+        super("UpdateUIRecursionTest");
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setSize(400, 400);
+
+         String[] columnNames = {
+                "First Name",
+                "Last Name",
+                "Sport",
+                "# of Years",
+                "Vegetarian"};
+
+                Object[][] data = {
+                    {"Mary", "Campione",
+                    "Snowboarding", new Integer(5), new Boolean(false)},
+                    {"Alison", "Huml",
+                    "Rowing", new Integer(3), new Boolean(true)},
+                    {"Kathy", "Walrath",
+                    "Knitting", new Integer(2), new Boolean(false)},
+                    {"Sharon", "Zakhour",
+                    "Speed reading", new Integer(20), new Boolean(true)},
+                    {"Philip", "Milne",
+                    "Pool", new Integer(10), new Boolean(false)}
+                };
+
+        JTableHeader tableHeader =  new JTableHeader();
+        table = new JTable(data, columnNames);
+        table.setTableHeader(tableHeader);
+        tableHeader.setDefaultRenderer(this);
+
+        getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
+
+        setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                UpdateUIRecursionTest obj = new UpdateUIRecursionTest();
+
+                obj.test();
+
+                obj.disposeUI();
+            }
+        });
+    }
+
+    public void test() {
+        SwingUtilities.updateComponentTreeUI(this);
+    }
+
+    public void disposeUI() {
+        setVisible(false);
+        dispose();
+    }
+
+    public Component getTableCellRendererComponent(JTable table, Object value,
+        boolean isSelected, boolean hasFocus, int row, int col) {
+        return new JLabel(String.valueOf(value));
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/6567433/UpdateUIRecursionTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * 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 6567433
+ *
+ * @summary  JTree.updateUI() invokes updateUI() on its TreeCellrenderer via
+ * SwingUtilities.updateRendererOrEditorUI().
+ * If the TreeCellrenderer is a parent of this JTree, the method recurses
+ * endless.
+ * This test tests that the fix is effective in avoiding recursion.
+ *
+ * @run main/othervm UpdateUIRecursionTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+public class UpdateUIRecursionTest extends JFrame implements TreeCellRenderer {
+    JTree tree;
+    DefaultTreeCellRenderer renderer;
+
+    public UpdateUIRecursionTest() {
+        super("UpdateUIRecursionTest");
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setSize(400, 400);
+
+        String[] listData = {
+            "First", "Second", "Third", "Fourth", "Fifth", "Sixth"
+        };
+
+        tree = new JTree(listData);
+        renderer = new DefaultTreeCellRenderer();
+        getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
+        tree.setCellRenderer(this);
+
+        setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                UpdateUIRecursionTest obj = new UpdateUIRecursionTest();
+
+                obj.test();
+
+                obj.disposeUI();
+            }
+        });
+    }
+
+    public void test() {
+        tree.updateUI();
+    }
+
+    public void disposeUI() {
+        setVisible(false);
+        dispose();
+    }
+
+    @Override
+    public Component getTreeCellRendererComponent(JTree tree, Object value,
+                              boolean selected, boolean expanded, boolean leaf,
+                              int row, boolean hasFocus)
+    {
+        return renderer.getTreeCellRendererComponent(tree, value, leaf,
+                                                expanded, leaf, row, hasFocus);
+    }
+}
--- a/jdk/test/javax/transaction/testng/Driver.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/transaction/testng/Driver.java	Wed Jul 05 22:01:14 2017 +0200
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @modules java.sql java.transaction
  * @compile -addmods java.transaction
  *   test/transaction/InvalidTransactionExceptionTests.java
  *   test/transaction/TransactionRequiredExceptionTests.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/crypto/dsig/GetInstanceTests.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,97 @@
+/*
+ * 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 8159488
+ * @summary Basic tests for the various getInstance() methods of
+ * XMLSignatureFactory, TransformService, and KeyInfoFactory classes
+ * @run main GetInstanceTests
+ */
+import java.security.*;
+import javax.xml.crypto.dsig.*;
+import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
+
+
+public class GetInstanceTests {
+
+    public static void main(String[] argv) throws Exception {
+        TestTransformService(CanonicalizationMethod.INCLUSIVE, "DOM");
+        TestTransformService(CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS, "DOM");
+        TestTransformService(Transform.BASE64, "DOM");
+        TestTransformService(Transform.XPATH2, "DOM");
+        TestXMLSignatureFactory();
+        TestKeyInfoFactory();
+    }
+
+    private static void TestTransformService(String algo,
+        String mechType) throws Exception {
+        TransformService ts = TransformService.getInstance(algo, mechType);
+        Provider p = ts.getProvider();
+        try {
+            ts = TransformService.getInstance(algo, mechType, p);
+            ts = TransformService.getInstance(algo, mechType, p.getName());
+        } catch (Exception ex) {
+            throw new RuntimeException("Error: Unexpected exception", ex);
+        }
+    }
+
+    private static void TestXMLSignatureFactory() throws Exception {
+        XMLSignatureFactory fac = XMLSignatureFactory.getInstance();
+        Provider p = fac.getProvider();
+        String mechType = fac.getMechanismType();
+        Provider p2;
+        try {
+            fac = XMLSignatureFactory.getInstance(mechType);
+            p2 = fac.getProvider();
+            fac = XMLSignatureFactory.getInstance(mechType, p);
+            fac = XMLSignatureFactory.getInstance(mechType, p.getName());
+        } catch (Exception ex) {
+            throw new RuntimeException("Error: Unexpected exception", ex);
+        }
+        if (p2.getName() != p.getName()) {
+            throw new RuntimeException("Error: Provider equality check failed");
+        }
+        if (p2.getName() != p.getName()) {
+            throw new RuntimeException("Error: Provider equality check failed");
+        }
+    }
+
+    private static void TestKeyInfoFactory() throws Exception {
+        KeyInfoFactory fac = KeyInfoFactory.getInstance();
+        Provider p = fac.getProvider();
+        String mechType = fac.getMechanismType();
+        Provider p2;
+        try {
+            fac = KeyInfoFactory.getInstance(mechType);
+            p2 = fac.getProvider();
+            fac = KeyInfoFactory.getInstance(mechType, p);
+            fac = KeyInfoFactory.getInstance(mechType, p.getName());
+        } catch (Exception ex) {
+            throw new RuntimeException("Error: Unexpected exception", ex);
+        }
+        if (p2.getName() != p.getName()) {
+            throw new RuntimeException("Error: Provider equality check failed");
+        }
+    }
+}
--- a/jdk/test/javax/xml/soap/spi/SAAJFactoryTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/xml/soap/spi/SAAJFactoryTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/xml/ws/8043129/MailTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/xml/ws/publish/WSTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/javax/xml/ws/xsanymixed/Test.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/image/OffScreenImageSource/ImageConsumerUnregisterTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * 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 8160421
+ * @summary Test to check OffScreenImageSource handles case where
+ *          imageComplete(ImageConsumer.SINGLEFRAMEDONE) unregisters.
+ * @run main/othervm ImageConsumerUnregisterTest
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+public class ImageConsumerUnregisterTest extends javax.swing.JFrame {
+
+    public static void main(String[] args) throws Exception {
+
+        final java.awt.Component component = new TestBug8160421();
+
+        // Redirect the System.err stream and verify there is no
+        // stacktrace printed
+        ByteArrayOutputStream rs = new ByteArrayOutputStream();
+        PrintStream obj = System.err;
+        System.setErr(new PrintStream(rs));
+
+        String str = "";
+
+        try {
+            // Test call
+            component.getToolkit().createCustomCursor(
+                    component.getGraphicsConfiguration().createCompatibleImage(
+                            16, 16, java.awt.Transparency.BITMASK),
+                            new java.awt.Point(0, 0), "Hidden");
+
+            // Convert the redirected System.err contents to a string
+            str = rs.toString();
+        } finally {
+            // Reset System.err
+            System.setErr(obj);
+
+            if (!str.isEmpty()) {
+                throw new RuntimeException("Invalid imageComplete(STATICIMAGEDONE) call");
+            }
+        }
+    }
+}
+
--- a/jdk/test/sun/security/krb5/auto/SSL.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/security/krb5/auto/SSL.java	Wed Jul 05 22:01:14 2017 +0200
@@ -92,6 +92,10 @@
 
         boolean unbound = args.length > 1;
 
+        // Workaround for JDK-8161101, reference the class before
+        // SecurityManager is set.
+        System.out.println("Touching " + ServicePermission.class);
+
         System.setSecurityManager(new SSL());
 
         KDC kdc = KDC.create(OneKDC.REALM);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/PolicyFile/DefaultPolicy.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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 8159752
+ * @summary Test that default policy permissions are always granted
+ * @run main/othervm DefaultPolicy
+ */
+
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.Paths;
+import java.security.AllPermission;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.URIParameter;
+
+public class DefaultPolicy {
+
+    public static void main(String[] args) throws Exception {
+
+        // Check policy with no java.security.policy property set
+        Policy p = Policy.getPolicy();
+        checkPolicy(p);
+
+        // Check policy with java.security.policy '=' option
+        System.setProperty("java.security.policy", "Extra.policy");
+        p.refresh();
+        checkPolicy(p);
+
+        // Check policy with java.security.policy override '==' option
+        System.setProperty("java.security.policy", "=Extra.policy");
+        p.refresh();
+        checkPolicy(p);
+
+        // Check Policy.getInstance
+        URI policyURI = Paths.get(System.getProperty("test.src"),
+                                  "Extra.policy").toUri();
+        p = Policy.getInstance("JavaPolicy", new URIParameter(policyURI));
+        checkPolicy(p);
+    }
+
+    private static void checkPolicy(Policy p) throws Exception {
+        // check if jdk.crypto.ec module has been de-privileged
+        CodeSource cs =
+            new CodeSource(new URL("jrt:/jdk.crypto.ec"), (CodeSigner[])null);
+        ProtectionDomain pd = new ProtectionDomain(cs, null, null, null);
+        if (p.implies(pd, new AllPermission())) {
+            throw new Exception("module should not be granted AllPermission");
+        }
+        if (!p.implies(pd, new RuntimePermission("loadLibrary.sunec"))) {
+            throw new Exception("module should be granted RuntimePermission");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/PolicyFile/Extra.policy	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,3 @@
+grant {
+    permission java.net.SocketPermission "localhost:0", "listen";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/keytool/HasSrcStoretypeOption.java	Wed Jul 05 22:01:14 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * 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 8162752
+ * @summary keytool -importkeystore should probe srcstoretype if not specified
+ * @modules java.base/sun.security.tools.keytool
+ */
+
+import sun.security.tools.keytool.Main;
+
+public class HasSrcStoretypeOption {
+
+    public static void main(String[] args) throws Exception {
+        run("-genkeypair -alias a -dname CN=A -storetype jceks -keystore jce");
+        // When there is no -srcstoretype, it should be probed from the file
+        run("-importkeystore -srckeystore jce -destkeystore jks -deststoretype jks");
+    }
+
+    private static void run(String cmd) throws Exception {
+        cmd += " -debug -storepass changeit -keypass changeit -srcstorepass changeit";
+        Main.main(cmd.split(" "));
+    }
+}
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Wed Jul 05 22:01:14 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2016d
+tzdata2016f
--- a/jdk/test/sun/util/calendar/zi/tzdata/africa	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/africa	Wed Jul 05 22:01:14 2017 +0200
@@ -366,6 +366,12 @@
 # decision to abandon DST permanently.  See Ahram Online 2015-04-24.
 # http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx
 
+# From Steffen Thorsen (2016-04-29):
+# Egypt will have DST from July 7 until the end of October....
+# http://english.ahram.org.eg/NewsContentP/1/204655/Egypt/Daylight-savings-time-returning-to-Egypt-on--July.aspx
+# From Mina Samuel (2016-07-04):
+# Egyptian government took the decision to cancel the DST,
+
 Rule	Egypt	2008	only	-	Aug	lastThu	24:00	0	-
 Rule	Egypt	2009	only	-	Aug	20	24:00	0	-
 Rule	Egypt	2010	only	-	Aug	10	24:00	0	-
@@ -881,11 +887,11 @@
 Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
 Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 Rule	Morocco	2011	only	-	Apr	 3	 0:00	1:00	S
-Rule	Morocco	2011	only	-	Jul	31	 0	0	-
+Rule	Morocco	2011	only	-	Jul	31	 0:00	0	-
 Rule	Morocco	2012	2013	-	Apr	lastSun	 2:00	1:00	S
-Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
 Rule	Morocco	2012	only	-	Jul	20	 3:00	0	-
 Rule	Morocco	2012	only	-	Aug	20	 2:00	1:00	S
+Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
 Rule	Morocco	2013	only	-	Jul	 7	 3:00	0	-
 Rule	Morocco	2013	only	-	Aug	10	 2:00	1:00	S
 Rule	Morocco	2013	max	-	Oct	lastSun	 3:00	0	-
--- a/jdk/test/sun/util/calendar/zi/tzdata/antarctica	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/antarctica	Wed Jul 05 22:01:14 2017 +0200
@@ -36,7 +36,7 @@
 #
 # Except for the French entries,
 # I made up all time zone abbreviations mentioned here; corrections welcome!
-# FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited.
+# FORMAT is '-00' and GMTOFF is 0 for locations while uninhabited.
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
@@ -90,22 +90,22 @@
 # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Casey	0	-	zzz	1969
+Zone Antarctica/Casey	0	-	-00	1969
 			8:00	-	AWST	2009 Oct 18  2:00
 						# Australian Western Std Time
 			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
 			8:00	-	AWST	2011 Oct 28  2:00
 			11:00	-	CAST	2012 Feb 21 17:00u
 			8:00	-	AWST
-Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
+Zone Antarctica/Davis	0	-	-00	1957 Jan 13
 			7:00	-	DAVT	1964 Nov    # Davis Time
-			0	-	zzz	1969 Feb
+			0	-	-00	1969 Feb
 			7:00	-	DAVT	2009 Oct 18  2:00
 			5:00	-	DAVT	2010 Mar 10 20:00u
 			7:00	-	DAVT	2011 Oct 28  2:00
 			5:00	-	DAVT	2012 Feb 21 20:00u
 			7:00	-	DAVT
-Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
+Zone Antarctica/Mawson	0	-	-00	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
 			5:00	-	MAWT
 # References:
@@ -160,7 +160,7 @@
 #	fishing stations operated variously 1819/1931
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Kerguelen	0	-	zzz	1950 # Port-aux-Français
+Zone Indian/Kerguelen	0	-	-00	1950 # Port-aux-Français
 			5:00	-	TFT	# ISO code TF Time
 #
 # year-round base in the main continent
@@ -171,9 +171,9 @@
 # It was destroyed by fire on 1952-01-14.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/DumontDUrville 0 -	zzz	1947
+Zone Antarctica/DumontDUrville 0 -	-00	1947
 			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
-			0	-	zzz	1956 Nov
+			0	-	-00	1956 Nov
 			10:00	-	DDUT	# Dumont-d'Urville Time
 
 # France & Italy - year-round base
@@ -199,7 +199,7 @@
 # was established on 1957-01-29.  Since Syowa station is still the main
 # station of Japan, it's appropriate for the principal location.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Syowa	0	-	zzz	1957 Jan 29
+Zone Antarctica/Syowa	0	-	-00	1957 Jan 29
 			3:00	-	SYOT	# Syowa Time
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
@@ -249,7 +249,7 @@
 # Remove the following line when uncommenting the above '#Rule' lines.
 Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Troll	0	-	zzz	2005 Feb 12
+Zone Antarctica/Troll	0	-	-00	2005 Feb 12
 			0:00	Troll	%s
 
 # Poland - year-round base
@@ -290,7 +290,7 @@
 # happened to be during their visit.  So we still don't really know what time
 # it is at Vostok.  But we'll guess UTC+6.
 #
-Zone Antarctica/Vostok	0	-	zzz	1957 Dec 16
+Zone Antarctica/Vostok	0	-	-00	1957 Dec 16
 			6:00	-	VOST	# Vostok time
 
 # S Africa - year-round bases
@@ -323,7 +323,7 @@
 # <http://webexhibits.org/daylightsaving/g.html> says Rothera is -03 all year.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Rothera	0	-	zzz	1976 Dec  1
+Zone Antarctica/Rothera	0	-	-00	1976 Dec  1
 			-3:00	-	ROTT	# Rothera time
 
 # Uruguay - year round base
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia	Wed Jul 05 22:01:14 2017 +0200
@@ -169,7 +169,7 @@
 			3:00	-	BAKT	1957 Mar    # Baku Time
 			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
 			3:00	1:00	BAKST	1991 Aug 30 # independence
-			3:00 RussiaAsia	AZ%sT	1992 Sep lastSat 23:00
+			3:00 RussiaAsia	AZ%sT	1992 Sep lastSun  2:00s
 			4:00	-	AZT	1996     # Azerbaijan Time
 			4:00	EUAsia	AZ%sT	1997
 			4:00	Azer	AZ%sT
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia	Wed Jul 05 22:01:14 2017 +0200
@@ -266,11 +266,11 @@
 # will produce a binary file with an [A]EST-type as the first 32-bit type;
 # this is required for correct handling of times before 1916 by
 # pre-2013 versions of localtime.
-Zone Antarctica/Macquarie 0	-	zzz	1899 Nov
+Zone Antarctica/Macquarie 0	-	-00	1899 Nov
 			10:00	-	AEST	1916 Oct  1  2:00
 			10:00	1:00	AEDT	1917 Feb
 			10:00	Aus	AE%sT	1919 Apr  1  0:00s
-			0	-	zzz	1948 Mar 25
+			0	-	-00	1948 Mar 25
 			10:00	Aus	AE%sT	1967
 			10:00	AT	AE%sT	2010 Apr  4  3:00
 			11:00	-	MIST	# Macquarie I Standard Time
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe	Wed Jul 05 22:01:14 2017 +0200
@@ -778,6 +778,14 @@
 			1:00	EU	CE%sT
 
 # Belarus
+#
+# From Stepan Golosunov (2016-07-02):
+# http://www.lawbelarus.com/repub/sub30/texf9611.htm
+# (Act of the Cabinet of Ministers of the Republic of Belarus from
+# 1992-03-25 No. 157) ... says clocks were to be moved forward at 2:00
+# on last Sunday of March and backward at 3:00 on last Sunday of September
+# (the same as previous USSR and contemporary Russian regulations).
+#
 # From Yauhen Kharuzhy (2011-09-16):
 # By latest Belarus government act Europe/Minsk timezone was changed to
 # GMT+3 without DST (was GMT+2 with DST).
@@ -801,9 +809,6 @@
 			1:00	C-Eur	CE%sT	1944 Jul  3
 			3:00	Russia	MSK/MSD	1990
 			3:00	-	MSK	1991 Mar 31  2:00s
-			2:00	1:00	EEST	1991 Sep 29  2:00s
-			2:00	-	EET	1992 Mar 29  0:00s
-			2:00	1:00	EEST	1992 Sep 27  0:00s
 			2:00	Russia	EE%sT	2011 Mar 27  2:00s
 			3:00	-	FET	2014 Oct 26  1:00s
 			3:00	-	MSK
@@ -2746,14 +2751,22 @@
 # Asia/Novosibirsk covers:
 # 54	RU-NVS	Novosibirsk Oblast
 
+# From Stepan Golosunov (2016-05-30):
+# http://asozd2.duma.gov.ru/main.nsf/(Spravka)?OpenAgent&RN=1085784-6
+# moves Novosibirsk oblast from UTC+6 to UTC+7.
+# From Stepan Golosunov (2016-07-04):
+# The law was signed yesterday and published today on
+# http://publication.pravo.gov.ru/Document/View/0001201607040064
+
 Zone Asia/Novosibirsk	 5:31:40 -	LMT	1919 Dec 14  6:00
-			 6:00	-	NOVT	1930 Jun 21 # Novosibirsk Time
-			 7:00	Russia	NOV%sT	1991 Mar 31  2:00s
-			 6:00	Russia	NOV%sT	1992 Jan 19  2:00s
-			 7:00	Russia	NOV%sT	1993 May 23 # say Shanks & P.
-			 6:00	Russia	NOV%sT	2011 Mar 27  2:00s
-			 7:00	-	NOVT	2014 Oct 26  2:00s
-			 6:00	-	NOVT
+			 6:00	-	+06	1930 Jun 21
+			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
+			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
+			 7:00	Russia	+07/+08	1993 May 23 # say Shanks & P.
+			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
+			 7:00	-	+07	2014 Oct 26  2:00s
+			 6:00	-	+06	2016 Jul 24  2:00s
+			 7:00	-	+07
 
 # From Paul Eggert (2016-03-18):
 # Asia/Tomsk covers:
@@ -2794,6 +2807,9 @@
 # approved by the Federation Council on 2016-04-20, signed by the President and
 # published as a law around 2016-04-26.
 
+# From Matt Johnson (2016-04-26):
+# http://publication.pravo.gov.ru/Document/View/0001201604260048
+
 Zone	Asia/Tomsk	 5:39:51 -	LMT	1919 Dec 22
 			 6:00	-	+06	1930 Jun 21
 			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
@@ -2833,14 +2849,12 @@
 # realigning itself with KRAT.
 
 Zone Asia/Novokuznetsk	 5:48:48 -	LMT	1924 May  1
-			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
-			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
-			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
-			 7:00	Russia	KRA%sT	2010 Mar 28  2:00s
-			 6:00	Russia	NOV%sT	2011 Mar 27  2:00s # Novosibirsk
-			 7:00	-	NOVT	2014 Oct 26  2:00s
-			 7:00	-	KRAT	# Krasnoyarsk Time
-
+			 6:00	-	+06	1930 Jun 21
+			 7:00	Russia	+07/+08	1991 Mar 31  2:00s
+			 6:00	Russia	+06/+07	1992 Jan 19  2:00s
+			 7:00	Russia	+07/+08	2010 Mar 28  2:00s
+			 6:00	Russia	+06/+07	2011 Mar 27  2:00s
+			 7:00	-	+07
 
 # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
 # Asia/Krasnoyarsk covers...
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Wed Jul 05 22:01:14 2017 +0200
@@ -2214,39 +2214,39 @@
 Rule	NT_YK	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # aka Panniqtuuq
-Zone America/Pangnirtung 0	-	zzz	1921 # trading post est.
+Zone America/Pangnirtung 0	-	-00	1921 # trading post est.
 			-4:00	NT_YK	A%sT	1995 Apr Sun>=1  2:00
 			-5:00	Canada	E%sT	1999 Oct 31  2:00
 			-6:00	Canada	C%sT	2000 Oct 29  2:00
 			-5:00	Canada	E%sT
 # formerly Frobisher Bay
-Zone America/Iqaluit	0	-	zzz	1942 Aug # Frobisher Bay est.
+Zone America/Iqaluit	0	-	-00	1942 Aug # Frobisher Bay est.
 			-5:00	NT_YK	E%sT	1999 Oct 31  2:00
 			-6:00	Canada	C%sT	2000 Oct 29  2:00
 			-5:00	Canada	E%sT
 # aka Qausuittuq
-Zone America/Resolute	0	-	zzz	1947 Aug 31 # Resolute founded
+Zone America/Resolute	0	-	-00	1947 Aug 31 # Resolute founded
 			-6:00	NT_YK	C%sT	2000 Oct 29  2:00
 			-5:00	-	EST	2001 Apr  1  3:00
 			-6:00	Canada	C%sT	2006 Oct 29  2:00
 			-5:00	-	EST	2007 Mar 11  3:00
 			-6:00	Canada	C%sT
 # aka Kangiqiniq
-Zone America/Rankin_Inlet 0	-	zzz	1957 # Rankin Inlet founded
+Zone America/Rankin_Inlet 0	-	-00	1957 # Rankin Inlet founded
 			-6:00	NT_YK	C%sT	2000 Oct 29  2:00
 			-5:00	-	EST	2001 Apr  1  3:00
 			-6:00	Canada	C%sT
 # aka Iqaluktuuttiaq
-Zone America/Cambridge_Bay 0	-	zzz	1920 # trading post est.?
+Zone America/Cambridge_Bay 0	-	-00	1920 # trading post est.?
 			-7:00	NT_YK	M%sT	1999 Oct 31  2:00
 			-6:00	Canada	C%sT	2000 Oct 29  2:00
 			-5:00	-	EST	2000 Nov  5  0:00
 			-6:00	-	CST	2001 Apr  1  3:00
 			-7:00	Canada	M%sT
-Zone America/Yellowknife 0	-	zzz	1935 # Yellowknife founded?
+Zone America/Yellowknife 0	-	-00	1935 # Yellowknife founded?
 			-7:00	NT_YK	M%sT	1980
 			-7:00	Canada	M%sT
-Zone America/Inuvik	0	-	zzz	1953 # Inuvik founded
+Zone America/Inuvik	0	-	-00	1953 # Inuvik founded
 			-8:00	NT_YK	P%sT	1979 Apr lastSun  2:00
 			-7:00	NT_YK	M%sT	1980
 			-7:00	Canada	M%sT
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Wed Jul 05 22:01:14 2017 +0200
@@ -1332,7 +1332,7 @@
 # Palmer used to be supplied from Argentina.
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Antarctica/Palmer	0	-	zzz	1965
+Zone Antarctica/Palmer	0	-	-00	1965
 			-4:00	Arg	AR%sT	1969 Oct  5
 			-3:00	Arg	AR%sT	1982 May
 			-4:00	Chile	CL%sT
@@ -1782,16 +1782,16 @@
 # https://actualidad.rt.com/actualidad/204758-venezuela-modificar-huso-horario-sequia-elnino
 #
 # From Paul Eggert (2016-04-15):
-# Clocks advance 30 minutes on 2016-05-01 at 02:30. See:
-# Barboza AD. Huso horario en Venezuela volverá a 4 horas menos con
-# respecto al "Greenwich". Panorama 2016-04-15 12:20 -0430.
-# http://www.panorama.com.ve/ciudad/Huso-horario-en-Venezuela-volvera-a-4-horas-menos-con-respecto-al-Greenwich-20160415-0032.html
-#
+# Clocks advance 30 minutes on 2016-05-01 at 02:30....
 # "'Venezuela's new time-zone: hours without light, hours without water,
-# hours of presidential broadcasts, hours of lines," quipped comedian
-# Jean Mary Curro ...". See: Cawthorne A, Kai D. Venezuela scraps
+# hours of presidential broadcasts, hours of lines,' quipped comedian
+# Jean Mary Curró ...". See: Cawthorne A, Kai D. Venezuela scraps
 # half-hour time difference set by Chavez. Reuters 2016-04-15 14:50 -0400
 # http://www.reuters.com/article/us-venezuela-timezone-idUSKCN0XC2BE
+#
+# From Matt Johnson (2016-04-20):
+# ... published in the official Gazette [2016-04-18], here:
+# http://historico.tsj.gob.ve/gaceta_ext/abril/1842016/E-1842016-4551.pdf
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Caracas	-4:27:44 -	LMT	1890
--- a/jdk/test/tools/jlink/DefaultProviderTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/DefaultProviderTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -32,7 +32,8 @@
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import tests.Helper;
 
 /*
@@ -69,7 +70,7 @@
         }
 
         @Override
-        public void visit(ModulePool in, ModulePool out) {
+        public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
             if (!enabled) {
                 throw new PluginException(NAME + " was set");
             }
@@ -78,6 +79,8 @@
             in.transformAndCopy(content -> {
                 return content;
             }, out);
+
+            return out.build();
         }
 
         @Override
--- a/jdk/test/tools/jlink/ImageFileCreatorTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -39,7 +39,7 @@
 import jdk.tools.jlink.internal.ImagePluginStack;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.builder.ImageBuilder;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
 
 
 /*
@@ -215,7 +215,7 @@
             }
 
             @Override
-            public void storeFiles(ModulePool content) {
+            public void storeFiles(ResourcePool content) {
             }
         };
 
--- a/jdk/test/tools/jlink/ImageFilePoolTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/ImageFilePoolTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -33,10 +33,10 @@
 import java.io.ByteArrayInputStream;
 import java.util.Optional;
 import java.util.function.Function;
-import jdk.tools.jlink.internal.ModuleEntryFactory;
-import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.internal.ResourcePoolEntryFactory;
+import jdk.tools.jlink.internal.ResourcePoolManager;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
 
 public class ImageFilePoolTest {
     public static void main(String[] args) throws Exception {
@@ -51,55 +51,55 @@
     private static final String SUFFIX = "END";
 
     private void checkVisitor() throws Exception {
-        ModulePool input = new ModulePoolImpl();
+        ResourcePoolManager input = new ResourcePoolManager();
         for (int i = 0; i < 1000; ++i) {
             String module = "module" + (i / 100);
             input.add(newInMemoryImageFile("/" + module + "/java/class" + i,
-                    ModuleEntry.Type.CONFIG, "class" + i));
+                    ResourcePoolEntry.Type.CONFIG, "class" + i));
         }
-        if (input.getEntryCount() != 1000) {
+        if (input.entryCount() != 1000) {
             throw new AssertionError();
         }
-        ModulePool output = new ModulePoolImpl();
+        ResourcePoolManager output = new ResourcePoolManager();
         ResourceVisitor visitor = new ResourceVisitor();
-        input.transformAndCopy(visitor, output);
+        input.resourcePool().transformAndCopy(visitor, output.resourcePoolBuilder());
         if (visitor.getAmountBefore() == 0) {
             throw new AssertionError("Resources not found");
         }
-        if (visitor.getAmountBefore() != input.getEntryCount()) {
+        if (visitor.getAmountBefore() != input.entryCount()) {
             throw new AssertionError("Number of visited resources. Expected: " +
-                    visitor.getAmountBefore() + ", got: " + input.getEntryCount());
+                    visitor.getAmountBefore() + ", got: " + input.entryCount());
         }
-        if (visitor.getAmountAfter() != output.getEntryCount()) {
+        if (visitor.getAmountAfter() != output.entryCount()) {
             throw new AssertionError("Number of added resources. Expected: " +
-                    visitor.getAmountAfter() + ", got: " + output.getEntryCount());
+                    visitor.getAmountAfter() + ", got: " + output.entryCount());
         }
         output.entries().forEach(outFile -> {
-            String path = outFile.getPath().replaceAll(SUFFIX + "$", "");
-            Optional<ModuleEntry> inFile = input.findEntry(path);
+            String path = outFile.path().replaceAll(SUFFIX + "$", "");
+            Optional<ResourcePoolEntry> inFile = input.findEntry(path);
             if (!inFile.isPresent()) {
                 throw new AssertionError("Unknown resource: " + path);
             }
         });
     }
 
-    private static class ResourceVisitor implements Function<ModuleEntry, ModuleEntry> {
+    private static class ResourceVisitor implements Function<ResourcePoolEntry, ResourcePoolEntry> {
 
         private int amountBefore;
         private int amountAfter;
 
         @Override
-        public ModuleEntry apply(ModuleEntry file) {
+        public ResourcePoolEntry apply(ResourcePoolEntry file) {
             int index = ++amountBefore % 3;
             switch (index) {
                 case 0:
                     ++amountAfter;
-                    return newInMemoryImageFile(file.getPath() + SUFFIX,
-                            file.getType(), file.getPath());
+                    return newInMemoryImageFile(file.path() + SUFFIX,
+                            file.type(), file.path());
                 case 1:
                     ++amountAfter;
-                    return newInMemoryImageFile(file.getPath(),
-                            file.getType(), file.getPath());
+                    return newInMemoryImageFile(file.path(),
+                            file.type(), file.path());
             }
             return null;
         }
@@ -114,7 +114,7 @@
     }
 
     private void checkNegative() throws Exception {
-        ModulePoolImpl input = new ModulePoolImpl();
+        ResourcePoolManager input = new ResourcePoolManager();
         try {
             input.add(null);
             throw new AssertionError("NullPointerException is not thrown");
@@ -128,29 +128,22 @@
             // expected
         }
         if (input.findEntry("unknown").isPresent()) {
-            throw new AssertionError("ImageFileModulePool does not return null for unknown file");
+            throw new AssertionError("ImageFileResourcePool does not return null for unknown file");
         }
-        if (input.contains(newInMemoryImageFile("/unknown/foo", ModuleEntry.Type.CONFIG, "unknown"))) {
+        if (input.contains(newInMemoryImageFile("/unknown/foo", ResourcePoolEntry.Type.CONFIG, "unknown"))) {
             throw new AssertionError("'contain' returns true for /unknown/foo file");
         }
-        input.add(newInMemoryImageFile("/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
+        input.add(newInMemoryImageFile("/aaa/bbb", ResourcePoolEntry.Type.CONFIG, ""));
         try {
-            input.add(newInMemoryImageFile("/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
-            throw new AssertionError("Exception expected");
-        } catch (Exception e) {
-            // expected
-        }
-        input.setReadOnly();
-        try {
-            input.add(newInMemoryImageFile("/aaa/ccc", ModuleEntry.Type.CONFIG, ""));
+            input.add(newInMemoryImageFile("/aaa/bbb", ResourcePoolEntry.Type.CONFIG, ""));
             throw new AssertionError("Exception expected");
         } catch (Exception e) {
             // expected
         }
     }
 
-    private static ModuleEntry newInMemoryImageFile(String path,
-            ModuleEntry.Type type, String content) {
-        return ModuleEntryFactory.create(path, type, content.getBytes());
+    private static ResourcePoolEntry newInMemoryImageFile(String path,
+            ResourcePoolEntry.Type type, String content) {
+        return ResourcePoolEntryFactory.create(path, type, content.getBytes());
     }
 }
--- a/jdk/test/tools/jlink/IntegrationTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/IntegrationTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -39,7 +39,8 @@
 import jdk.tools.jlink.Jlink.JlinkConfiguration;
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.internal.PostProcessor;
@@ -100,8 +101,9 @@
         }
 
         @Override
-        public void visit(ModulePool in, ModulePool out) {
+        public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
             in.transformAndCopy(Function.identity(), out);
+            return out.build();
         }
     }
 
--- a/jdk/test/tools/jlink/JLinkOptionsTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/JLinkOptionsTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -24,7 +24,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.plugin.Plugin;
 
@@ -62,8 +63,8 @@
         }
 
         @Override
-        public void visit(ModulePool in, ModulePool out) {
-
+        public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
+            return out.build();
         }
 
         @Override
--- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -31,7 +31,8 @@
 import java.util.function.Function;
 
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.PostProcessor;
 import jdk.tools.jlink.internal.ExecutableImage;
@@ -71,8 +72,9 @@
         }
 
         @Override
-        public void visit(ModulePool in, ModulePool out) {
+        public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
             in.transformAndCopy(Function.identity(), out);
+            return out.build();
         }
 
         @Override
--- a/jdk/test/tools/jlink/ResourcePoolTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/ResourcePoolTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -40,11 +40,11 @@
 import java.util.Optional;
 import java.util.Set;
 import java.util.function.Function;
-import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.LinkModule;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.internal.ResourcePoolManager;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolModule;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class ResourcePoolTest {
 
@@ -61,51 +61,51 @@
     private static final String SUFFIX = "END";
 
     private void checkResourceVisitor() throws Exception {
-        ModulePool input = new ModulePoolImpl();
+        ResourcePoolManager input = new ResourcePoolManager();
         for (int i = 0; i < 1000; ++i) {
             String module = "/module" + (i / 10);
             String resourcePath = module + "/java/package" + i;
             byte[] bytes = resourcePath.getBytes();
-            input.add(ModuleEntry.create(resourcePath, bytes));
+            input.add(ResourcePoolEntry.create(resourcePath, bytes));
         }
-        ModulePool output = new ModulePoolImpl();
+        ResourcePoolManager output = new ResourcePoolManager();
         ResourceVisitor visitor = new ResourceVisitor();
-        input.transformAndCopy(visitor, output);
+        input.resourcePool().transformAndCopy(visitor, output.resourcePoolBuilder());
         if (visitor.getAmountBefore() == 0) {
             throw new AssertionError("Resources not found");
         }
-        if (visitor.getAmountBefore() != input.getEntryCount()) {
+        if (visitor.getAmountBefore() != input.entryCount()) {
             throw new AssertionError("Number of visited resources. Expected: " +
-                    visitor.getAmountBefore() + ", got: " + input.getEntryCount());
+                    visitor.getAmountBefore() + ", got: " + input.entryCount());
         }
-        if (visitor.getAmountAfter() != output.getEntryCount()) {
+        if (visitor.getAmountAfter() != output.entryCount()) {
             throw new AssertionError("Number of added resources. Expected: " +
-                    visitor.getAmountAfter() + ", got: " + output.getEntryCount());
+                    visitor.getAmountAfter() + ", got: " + output.entryCount());
         }
         output.entries().forEach(outResource -> {
-            String path = outResource.getPath().replaceAll(SUFFIX + "$", "");
+            String path = outResource.path().replaceAll(SUFFIX + "$", "");
             if (!input.findEntry(path).isPresent()) {
                 throw new AssertionError("Unknown resource: " + path);
             }
         });
     }
 
-    private static class ResourceVisitor implements Function<ModuleEntry, ModuleEntry> {
+    private static class ResourceVisitor implements Function<ResourcePoolEntry, ResourcePoolEntry> {
 
         private int amountBefore;
         private int amountAfter;
 
         @Override
-        public ModuleEntry apply(ModuleEntry resource) {
+        public ResourcePoolEntry apply(ResourcePoolEntry resource) {
             int index = ++amountBefore % 3;
             switch (index) {
                 case 0:
                     ++amountAfter;
-                    return ModuleEntry.create(resource.getPath() + SUFFIX,
-                            resource.getType(), resource.getBytes());
+                    return ResourcePoolEntry.create(resource.path() + SUFFIX,
+                            resource.type(), resource.contentBytes());
                 case 1:
                     ++amountAfter;
-                    return resource.create(resource.getBytes());
+                    return resource.copyWithContent(resource.contentBytes());
             }
             return null;
         }
@@ -129,17 +129,17 @@
         samples.add("javax/management/ObjectName");
         test(samples, (resources, module, path) -> {
             try {
-                resources.add(ModuleEntry.create(path, new byte[0]));
+                resources.add(ResourcePoolEntry.create(path, new byte[0]));
             } catch (Exception ex) {
                 throw new RuntimeException(ex);
             }
         });
         test(samples, (resources, module, path) -> {
             try {
-                resources.add(ModulePoolImpl.
-                        newCompressedResource(ModuleEntry.create(path, new byte[0]),
+                resources.add(ResourcePoolManager.
+                        newCompressedResource(ResourcePoolEntry.create(path, new byte[0]),
                                 ByteBuffer.allocate(99), "bitcruncher", null,
-                                ((ModulePoolImpl)resources).getStringTable(), ByteOrder.nativeOrder()));
+                                ((ResourcePoolManager)resources).getStringTable(), ByteOrder.nativeOrder()));
             } catch (Exception ex) {
                 throw new RuntimeException(ex);
             }
@@ -150,7 +150,7 @@
         if (samples.isEmpty()) {
             throw new AssertionError("No sample to test");
         }
-        ModulePool resources = new ModulePoolImpl();
+        ResourcePoolManager resources = new ResourcePoolManager();
         Set<String> modules = new HashSet<>();
         for (int i = 0; i < samples.size(); i++) {
             String module = samples.get(i);
@@ -165,68 +165,68 @@
             i++;
             String clazz = samples.get(i);
             String path = "/" + module + "/" + clazz + ".class";
-            Optional<ModuleEntry> res = resources.findEntry(path);
+            Optional<ResourcePoolEntry> res = resources.findEntry(path);
             if (!res.isPresent()) {
                 throw new AssertionError("Resource not found " + path);
             }
-            checkModule(resources, res.get());
+            checkModule(resources.resourcePool(), res.get());
             if (resources.findEntry(clazz).isPresent()) {
                 throw new AssertionError("Resource found " + clazz);
             }
         }
-        if (resources.getEntryCount() != samples.size() / 2) {
+        if (resources.entryCount() != samples.size() / 2) {
             throw new AssertionError("Invalid number of resources");
         }
     }
 
-    private void checkModule(ModulePool resources, ModuleEntry res) {
-        Optional<LinkModule> optMod = resources.findModule(res.getModule());
+    private void checkModule(ResourcePool resources, ResourcePoolEntry res) {
+        Optional<ResourcePoolModule> optMod = resources.moduleView().findModule(res.moduleName());
         if (!optMod.isPresent()) {
-            throw new AssertionError("No module " + res.getModule());
+            throw new AssertionError("No module " + res.moduleName());
         }
-        LinkModule m = optMod.get();
-        if (!m.getName().equals(res.getModule())) {
-            throw new AssertionError("Not right module name " + res.getModule());
+        ResourcePoolModule m = optMod.get();
+        if (!m.name().equals(res.moduleName())) {
+            throw new AssertionError("Not right module name " + res.moduleName());
         }
-        if (!m.findEntry(res.getPath()).isPresent()) {
-            throw new AssertionError("resource " + res.getPath()
-                    + " not in module " + m.getName());
+        if (!m.findEntry(res.path()).isPresent()) {
+            throw new AssertionError("resource " + res.path()
+                    + " not in module " + m.name());
         }
     }
 
     private void checkResourcesAfterCompression() throws Exception {
-        ModulePoolImpl resources1 = new ModulePoolImpl();
-        ModuleEntry res1 = ModuleEntry.create("/module1/toto1", new byte[0]);
-        ModuleEntry res2 = ModuleEntry.create("/module2/toto1", new byte[0]);
+        ResourcePoolManager resources1 = new ResourcePoolManager();
+        ResourcePoolEntry res1 = ResourcePoolEntry.create("/module1/toto1", new byte[0]);
+        ResourcePoolEntry res2 = ResourcePoolEntry.create("/module2/toto1", new byte[0]);
         resources1.add(res1);
         resources1.add(res2);
 
         checkResources(resources1, res1, res2);
-        ModulePool resources2 = new ModulePoolImpl();
-        ModuleEntry res3 = ModuleEntry.create("/module2/toto1", new byte[7]);
+        ResourcePoolManager resources2 = new ResourcePoolManager();
+        ResourcePoolEntry res3 = ResourcePoolEntry.create("/module2/toto1", new byte[7]);
         resources2.add(res3);
-        resources2.add(ModulePoolImpl.newCompressedResource(res1,
+        resources2.add(ResourcePoolManager.newCompressedResource(res1,
                 ByteBuffer.allocate(7), "zip", null, resources1.getStringTable(),
                 ByteOrder.nativeOrder()));
         checkResources(resources2, res1, res2);
     }
 
-    private void checkResources(ModulePool resources, ModuleEntry... expected) {
+    private void checkResources(ResourcePoolManager resources, ResourcePoolEntry... expected) {
         List<String> modules = new ArrayList();
         resources.modules().forEach(m -> {
-            modules.add(m.getName());
+            modules.add(m.name());
         });
-        for (ModuleEntry res : expected) {
+        for (ResourcePoolEntry res : expected) {
             if (!resources.contains(res)) {
                 throw new AssertionError("Resource not found: " + res);
             }
 
-            if (!resources.findEntry(res.getPath()).isPresent()) {
+            if (!resources.findEntry(res.path()).isPresent()) {
                 throw new AssertionError("Resource not found: " + res);
             }
 
-            if (!modules.contains(res.getModule())) {
-                throw new AssertionError("Module not found: " + res.getModule());
+            if (!modules.contains(res.moduleName())) {
+                throw new AssertionError("Module not found: " + res.moduleName());
             }
 
             if (!resources.contains(res)) {
@@ -241,20 +241,15 @@
             }
         }
 
-        if (resources.isReadOnly()) {
-            throw new AssertionError("ReadOnly resources");
-        }
-
-        ((ModulePoolImpl) resources).setReadOnly();
         try {
-            resources.add(ModuleEntry.create("/module2/toto1", new byte[0]));
-            throw new AssertionError("ModulePool is read-only, but an exception is not thrown");
+            resources.add(ResourcePoolEntry.create("/module2/toto1", new byte[0]));
+            throw new AssertionError("ResourcePool is read-only, but an exception is not thrown");
         } catch (Exception ex) {
             // Expected
         }
     }
 
     interface ResourceAdder {
-        void add(ModulePool resources, String module, String path);
+        void add(ResourcePoolManager resources, String module, String path);
     }
 }
--- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -25,8 +25,9 @@
 import java.util.Collections;
 import java.util.Map;
 import java.util.function.Function;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 
 public class CustomPlugin implements Plugin {
@@ -37,8 +38,9 @@
     }
 
     @Override
-    public void visit(ModulePool in, ModulePool out) {
+    public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         in.transformAndCopy(Function.identity(), out);
+        return out.build();
     }
 
     @Override
--- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java	Wed Jul 05 22:01:14 2017 +0200
@@ -27,8 +27,9 @@
 import java.io.UncheckedIOException;
 import java.util.Collections;
 import java.util.Map;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
 import jdk.tools.jlink.plugin.Plugin;
 
 /**
@@ -47,7 +48,7 @@
     }
 
     @Override
-    public void visit(ModulePool inResources, ModulePool outResources) {
+    public ResourcePool transform(ResourcePool inResources, ResourcePoolBuilder outResources) {
         try {
             System.out.println("Hello!!!!!!!!!!");
             File f = new File(OUTPUT_FILE);
@@ -58,6 +59,7 @@
         } catch (IOException ex) {
             throw new UncheckedIOException(ex);
         }
+        return outResources.build();
     }
 
     @Override
--- a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -53,14 +53,15 @@
 import jdk.internal.jimage.decompressor.ResourceDecompressorFactory;
 import jdk.internal.jimage.decompressor.StringSharingDecompressorFactory;
 import jdk.internal.jimage.decompressor.ZipDecompressorFactory;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
 import jdk.tools.jlink.internal.plugins.StringSharingPlugin;
 import jdk.tools.jlink.internal.plugins.ZipPlugin;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class CompressorPluginTest {
 
@@ -85,7 +86,7 @@
                     new ZipDecompressorFactory()
                 });
 
-        ModulePool classes = gatherClasses(javabase);
+        ResourcePool classes = gatherClasses(javabase);
         // compress = String sharing
         checkCompress(classes, new StringSharingPlugin(), null,
                 new ResourceDecompressorFactory[]{
@@ -168,8 +169,8 @@
                 }, Collections.singletonList(".*Exception.class"));
     }
 
-    private ModulePool gatherResources(Path module) throws Exception {
-        ModulePool pool = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+    private ResourcePool gatherResources(Path module) throws Exception {
+        ResourcePoolManager poolMgr = new ResourcePoolManager(ByteOrder.nativeOrder(), new StringTable() {
 
             @Override
             public int addString(String str) {
@@ -181,20 +182,22 @@
                 return null;
             }
         });
+
+        ResourcePoolBuilder poolBuilder = poolMgr.resourcePoolBuilder();
         try (Stream<Path> stream = Files.walk(module)) {
             for (Iterator<Path> iterator = stream.iterator(); iterator.hasNext();) {
                 Path p = iterator.next();
                 if (Files.isRegularFile(p)) {
                     byte[] content = Files.readAllBytes(p);
-                    pool.add(ModuleEntry.create(p.toString(), content));
+                    poolBuilder.add(ResourcePoolEntry.create(p.toString(), content));
                 }
             }
         }
-        return pool;
+        return poolBuilder.build();
     }
 
-    private ModulePool gatherClasses(Path module) throws Exception {
-        ModulePool pool = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+    private ResourcePool gatherClasses(Path module) throws Exception {
+        ResourcePoolManager poolMgr = new ResourcePoolManager(ByteOrder.nativeOrder(), new StringTable() {
 
             @Override
             public int addString(String str) {
@@ -206,25 +209,27 @@
                 return null;
             }
         });
+
+        ResourcePoolBuilder poolBuilder = poolMgr.resourcePoolBuilder();
         try (Stream<Path> stream = Files.walk(module)) {
             for (Iterator<Path> iterator = stream.iterator(); iterator.hasNext();) {
                 Path p = iterator.next();
                 if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
                     byte[] content = Files.readAllBytes(p);
-                    pool.add(ModuleEntry.create(p.toString(), content));
+                    poolBuilder.add(ResourcePoolEntry.create(p.toString(), content));
                 }
             }
         }
-        return pool;
+        return poolBuilder.build();
     }
 
-    private void checkCompress(ModulePool resources, Plugin prov,
+    private void checkCompress(ResourcePool resources, Plugin prov,
             Properties config,
             ResourceDecompressorFactory[] factories) throws Exception {
         checkCompress(resources, prov, config, factories, Collections.emptyList());
     }
 
-    private void checkCompress(ModulePool resources, Plugin prov,
+    private void checkCompress(ResourcePool resources, Plugin prov,
             Properties config,
             ResourceDecompressorFactory[] factories,
             List<String> includes) throws Exception {
@@ -243,7 +248,7 @@
             }
             prov.configure(props);
             final Map<Integer, String> strings = new HashMap<>();
-            ModulePoolImpl inputResources = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+            ResourcePoolManager inputResourcesMgr = new ResourcePoolManager(ByteOrder.nativeOrder(), new StringTable() {
                 @Override
                 public int addString(String str) {
                     int id = strID;
@@ -257,11 +262,11 @@
                     return strings.get(id);
                 }
             });
-            inputResources.add(resource);
-            ModulePool compressedResources = applyCompressor(prov, inputResources, resource, includesPatterns);
-            original[0] += resource.getLength();
-            compressed[0] += compressedResources.findEntry(resource.getPath()).get().getLength();
-            applyDecompressors(factories, inputResources, compressedResources, strings, includesPatterns);
+            inputResourcesMgr.add(resource);
+            ResourcePool compressedResources = applyCompressor(prov, inputResourcesMgr, resource, includesPatterns);
+            original[0] += resource.contentLength();
+            compressed[0] += compressedResources.findEntry(resource.path()).get().contentLength();
+            applyDecompressors(factories, inputResourcesMgr.resourcePool(), compressedResources, strings, includesPatterns);
         });
         String compressors = Stream.of(factories)
                 .map(Object::getClass)
@@ -274,16 +279,18 @@
         }
     }
 
-    private ModulePool applyCompressor(Plugin plugin,
-            ModulePoolImpl inputResources,
-            ModuleEntry res,
+    private ResourcePool applyCompressor(Plugin plugin,
+            ResourcePoolManager inputResources,
+            ResourcePoolEntry res,
             List<Pattern> includesPatterns) {
-        ModulePool compressedModulePool = new ModulePoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable());
-        plugin.visit(inputResources, compressedModulePool);
-        String path = res.getPath();
-        ModuleEntry compressed = compressedModulePool.findEntry(path).get();
+        ResourcePoolManager resMgr = new ResourcePoolManager(ByteOrder.nativeOrder(),
+                inputResources.getStringTable());
+        ResourcePool compressedResourcePool = plugin.transform(inputResources.resourcePool(),
+            resMgr.resourcePoolBuilder());
+        String path = res.path();
+        ResourcePoolEntry compressed = compressedResourcePool.findEntry(path).get();
         CompressedResourceHeader header
-                = CompressedResourceHeader.readFromResource(ByteOrder.nativeOrder(), compressed.getBytes());
+                = CompressedResourceHeader.readFromResource(ByteOrder.nativeOrder(), compressed.contentBytes());
         if (isIncluded(includesPatterns, path)) {
             if (header == null) {
                 throw new AssertionError("Path should be compressed: " + path);
@@ -299,23 +306,23 @@
         } else if (header != null) {
             throw new AssertionError("Path should not be compressed: " + path);
         }
-        return compressedModulePool;
+        return compressedResourcePool;
     }
 
     private void applyDecompressors(ResourceDecompressorFactory[] decompressors,
-            ModulePool inputResources,
-            ModulePool compressedResources,
+            ResourcePool inputResources,
+            ResourcePool compressedResources,
             Map<Integer, String> strings,
             List<Pattern> includesPatterns) {
         compressedResources.entries().forEach(compressed -> {
             CompressedResourceHeader header = CompressedResourceHeader.readFromResource(
-                    ByteOrder.nativeOrder(), compressed.getBytes());
-            String path = compressed.getPath();
-            ModuleEntry orig = inputResources.findEntry(path).get();
+                    ByteOrder.nativeOrder(), compressed.contentBytes());
+            String path = compressed.path();
+            ResourcePoolEntry orig = inputResources.findEntry(path).get();
             if (!isIncluded(includesPatterns, path)) {
                 return;
             }
-            byte[] decompressed = compressed.getBytes();
+            byte[] decompressed = compressed.contentBytes();
             for (ResourceDecompressorFactory factory : decompressors) {
                 try {
                     ResourceDecompressor decompressor = factory.newDecompressor(new Properties());
@@ -327,11 +334,11 @@
                 }
             }
 
-            if (decompressed.length != orig.getLength()) {
+            if (decompressed.length != orig.contentLength()) {
                 throw new AssertionError("Invalid uncompressed size "
                         + header.getUncompressedSize());
             }
-            byte[] origContent = orig.getBytes();
+            byte[] origContent = orig.contentBytes();
             for (int i = 0; i < decompressed.length; i++) {
                 if (decompressed[i] != origContent[i]) {
                     throw new AssertionError("Decompressed and original differ at index " + i);
--- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -35,11 +35,11 @@
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 
 import jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class ExcludeFilesPluginTest {
     public static void main(String[] args) throws Exception {
@@ -71,20 +71,20 @@
         prop.put(ExcludeFilesPlugin.NAME, s);
         ExcludeFilesPlugin fplug = new ExcludeFilesPlugin();
         fplug.configure(prop);
-        ModulePoolImpl files = new ModulePoolImpl();
-        ModulePoolImpl fresult = new ModulePoolImpl();
-        ModuleEntry f = ModuleEntry.create("/" + module + "/" + sample,
-                ModuleEntry.Type.CONFIG, new byte[0]);
+        ResourcePoolManager files = new ResourcePoolManager();
+        ResourcePoolManager fresult = new ResourcePoolManager();
+        ResourcePoolEntry f = ResourcePoolEntry.create("/" + module + "/" + sample,
+                ResourcePoolEntry.Type.CONFIG, new byte[0]);
         files.add(f);
 
-        fplug.visit(files, fresult);
+        ResourcePool resPool = fplug.transform(files.resourcePool(), fresult.resourcePoolBuilder());
 
         if (exclude) {
-            if (fresult.contains(f)) {
+            if (resPool.contains(f)) {
                 throw new Exception(sample + " should be excluded by " + s);
             }
         } else {
-            if (!fresult.contains(f)) {
+            if (!resPool.contains(f)) {
                 throw new Exception(sample + " shouldn't be excluded by " + s);
             }
         }
--- a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -34,11 +34,12 @@
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 
 import jdk.tools.jlink.internal.plugins.ExcludePlugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class ExcludePluginTest {
 
@@ -75,17 +76,18 @@
         prop.put(ExcludePlugin.NAME, s);
         ExcludePlugin excludePlugin = new ExcludePlugin();
         excludePlugin.configure(prop);
-        ModulePool resources = new ModulePoolImpl();
-        ModuleEntry resource = ModuleEntry.create(sample, new byte[0]);
-        resources.add(resource);
-        ModulePool result = new ModulePoolImpl();
-        excludePlugin.visit(resources, result);
+        ResourcePoolManager resourcesMgr = new ResourcePoolManager();
+        ResourcePoolEntry resource = ResourcePoolEntry.create(sample, new byte[0]);
+        resourcesMgr.add(resource);
+        ResourcePoolManager resultMgr = new ResourcePoolManager();
+        ResourcePool resPool = excludePlugin.transform(resourcesMgr.resourcePool(),
+                resultMgr.resourcePoolBuilder());
         if (exclude) {
-            if (result.contains(resource)) {
+            if (resPool.contains(resource)) {
                 throw new AssertionError(sample + " should be excluded by " + s);
             }
         } else {
-            if (!result.contains(resource)) {
+            if (!resPool.contains(resource)) {
                 throw new AssertionError(sample + " shouldn't be excluded by " + s);
             }
         }
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -32,12 +32,12 @@
 import java.io.ByteArrayInputStream;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 
 import jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.ModuleEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class ExcludeVMPluginTest {
 
@@ -163,14 +163,15 @@
     private void doCheckVM(String vm, String[] input, String jvmcfg, String[] expectedOutput, String expectdJvmCfg) throws Exception {
         // Create a pool with jvm.cfg and the input paths.
         byte[] jvmcfgContent = jvmcfg.getBytes();
-        ModulePool pool = new ModulePoolImpl();
-        pool.add(ModuleEntry.create("/java.base/native/jvm.cfg",
-                ModuleEntry.Type.NATIVE_LIB, jvmcfgContent));
+        ResourcePoolManager poolMgr = new ResourcePoolManager();
+        poolMgr.add(
+            ResourcePoolEntry.create("/java.base/native/jvm.cfg",
+                ResourcePoolEntry.Type.NATIVE_LIB, jvmcfgContent));
         for (String in : input) {
-            pool.add(ModuleEntry.create(in,
-                    ModuleEntry.Type.NATIVE_LIB, new byte[0]));
+            poolMgr.add(ResourcePoolEntry.create(in,
+                    ResourcePoolEntry.Type.NATIVE_LIB, new byte[0]));
         }
-        ModulePool out = new ModulePoolImpl();
+        ResourcePoolManager outMgr = new ResourcePoolManager();
 
         Plugin p = new ExcludeVMPlugin();
         Map<String, String> config = new HashMap<>();
@@ -178,34 +179,34 @@
             config.put(ExcludeVMPlugin.NAME, vm);
         }
         p.configure(config);
-        p.visit(pool, out);
+        ResourcePool out = p.transform(poolMgr.resourcePool(), outMgr.resourcePoolBuilder());
 
-        String newContent = new String(out.findEntry("/java.base/native/jvm.cfg").get().stream().readAllBytes());
+        String newContent = new String(out.findEntry("/java.base/native/jvm.cfg").get().contentBytes());
 
         if (!expectdJvmCfg.equals(newContent)) {
             throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg);
         }
 
-        if (out.getEntryCount() != (expectedOutput.length + 1)) {
+        if (out.entryCount() != (expectedOutput.length + 1)) {
             out.entries().forEach(m -> {
-                System.err.println(m.getPath());
+                System.err.println(m.path());
             });
-            throw new Exception("Invalid output size " + out.getEntryCount() + " expected " + (expectedOutput.length + 1));
+            throw new Exception("Invalid output size " + out.entryCount() + " expected " + (expectedOutput.length + 1));
         }
 
         out.entries().forEach(md -> {
-            if (md.getPath().equals("/java.base/native/jvm.cfg")) {
+            if (md.path().equals("/java.base/native/jvm.cfg")) {
                 return;
             }
             boolean contained = false;
             for (String o : expectedOutput) {
-                if (md.getPath().equals(o)) {
+                if (md.path().equals(o)) {
                     contained = true;
                     break;
                 }
             }
             if (!contained) {
-                throw new RuntimeException(md.getPath() + " not expected");
+                throw new RuntimeException(md.path() + " not expected");
             }
         });
 
--- a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -37,12 +37,12 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
 
 public class FileCopierPluginTest {
 
@@ -85,18 +85,20 @@
         Map<String, String> conf = new HashMap<>();
         conf.put(FileCopierPlugin.NAME, builder.toString());
         plug.configure(conf);
-        ModulePool pool = new ModulePoolImpl();
-        plug.visit(new ModulePoolImpl(), pool);
-        if (pool.getEntryCount() != expected) {
+        ResourcePoolManager poolMgr = new ResourcePoolManager();
+        ResourcePool pool = plug.transform(
+                new ResourcePoolManager().resourcePool(),
+                poolMgr.resourcePoolBuilder());
+        if (pool.entryCount() != expected) {
             throw new AssertionError("Wrong number of added files");
         }
         pool.entries().forEach(f -> {
-            if (!f.getType().equals(ModuleEntry.Type.OTHER)) {
-                throw new AssertionError("Invalid type " + f.getType()
-                        + " for file " + f.getPath());
+            if (!f.type().equals(ResourcePoolEntry.Type.OTHER)) {
+                throw new AssertionError("Invalid type " + f.type()
+                        + " for file " + f.path());
             }
-            if (f.stream() == null) {
-                throw new AssertionError("Null stream for file " + f.getPath());
+            if (f.content() == null) {
+                throw new AssertionError("Null stream for file " + f.path());
             }
         });
         Path root = new File(".").toPath();
--- a/jdk/test/tools/jlink/plugins/LastSorterTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -39,12 +39,13 @@
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class LastSorterTest {
 
@@ -78,7 +79,7 @@
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config);
 
         // check order
-        ModulePoolImpl res = fillOutResourceModulePool();
+        ResourcePoolManager res = fillOutResourceResourcePool();
 
         try {
             stack.visitResources(res);
@@ -89,18 +90,18 @@
         }
     }
 
-    private ModulePoolImpl fillOutResourceModulePool() throws Exception {
-        ModulePoolImpl res = new ModulePoolImpl();
-        res.add(ModuleEntry.create("/eee/bbb/res1.class", new byte[90]));
-        res.add(ModuleEntry.create("/aaaa/bbb/res2.class", new byte[90]));
-        res.add(ModuleEntry.create("/bbb/aa/res1.class", new byte[90]));
-        res.add(ModuleEntry.create("/aaaa/bbb/res3.class", new byte[90]));
-        res.add(ModuleEntry.create("/bbb/aa/res2.class", new byte[90]));
-        res.add(ModuleEntry.create("/fff/bbb/res1.class", new byte[90]));
-        res.add(ModuleEntry.create("/aaaa/bbb/res1.class", new byte[90]));
-        res.add(ModuleEntry.create("/bbb/aa/res3.class", new byte[90]));
-        res.add(ModuleEntry.create("/ccc/bbb/res1.class", new byte[90]));
-        res.add(ModuleEntry.create("/ddd/bbb/res1.class", new byte[90]));
+    private ResourcePoolManager fillOutResourceResourcePool() throws Exception {
+        ResourcePoolManager res = new ResourcePoolManager();
+        res.add(ResourcePoolEntry.create("/eee/bbb/res1.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/aaaa/bbb/res2.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/bbb/aa/res1.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/aaaa/bbb/res3.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/bbb/aa/res2.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/fff/bbb/res1.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/aaaa/bbb/res1.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/bbb/aa/res3.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/ccc/bbb/res1.class", new byte[90]));
+        res.add(ResourcePoolEntry.create("/ddd/bbb/res1.class", new byte[90]));
         return res;
     }
 
@@ -122,7 +123,7 @@
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config);
 
         // check order
-        ModulePoolImpl res = fillOutResourceModulePool();
+        ResourcePoolManager res = fillOutResourceResourcePool();
 
         stack.visitResources(res);
     }
@@ -157,7 +158,7 @@
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config);
 
         // check order
-        ModulePoolImpl res = fillOutResourceModulePool();
+        ResourcePoolManager res = fillOutResourceResourcePool();
         try {
             stack.visitResources(res);
             throw new AssertionError("Order was changed after the last sorter, but no exception occurred");
@@ -176,19 +177,21 @@
         }
 
         @Override
-        public void visit(ModulePool resources, ModulePool output) {
-            List<ModuleEntry> paths = new ArrayList<>();
+        public ResourcePool transform(ResourcePool resources, ResourcePoolBuilder output) {
+            List<ResourcePoolEntry> paths = new ArrayList<>();
             resources.entries().forEach(res -> {
-                if (res.getPath().startsWith(starts)) {
+                if (res.path().startsWith(starts)) {
                     paths.add(0, res);
                 } else {
                     paths.add(res);
                 }
             });
 
-            for (ModuleEntry r : paths) {
+            for (ResourcePoolEntry r : paths) {
                 output.add(r);
             }
+
+            return output.build();
         }
 
         @Override
--- a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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
- * @summary Test sorter plugin
- * @author Jean-Francois Denise
- * @modules jdk.jlink/jdk.tools.jlink.internal
- *          jdk.jlink/jdk.tools.jlink.internal.plugins
- * @run main OrderResourcesPluginTest
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.Plugin;
-
-public class OrderResourcesPluginTest {
-
-    public static void main(String[] args) throws Exception {
-        new OrderResourcesPluginTest().test();
-    }
-
-    public void test() throws Exception {
-        ModuleEntry[] array = {
-                ModuleEntry.create("/module1/toto1.class", new byte[0]),
-                ModuleEntry.create("/module2/toto2.class", new byte[0]),
-                ModuleEntry.create("/module3/toto3.class", new byte[0]),
-                ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]),
-                ModuleEntry.create("/zazou/toto.class", new byte[0]),
-                ModuleEntry.create("/module4/zazou.class", new byte[0]),
-                ModuleEntry.create("/module5/toto5.class", new byte[0]),
-                ModuleEntry.create("/module6/toto6/module-info.class", new byte[0])
-        };
-
-        ModuleEntry[] sorted = {
-                ModuleEntry.create("/zazou/toto.class", new byte[0]),
-                ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]),
-                ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]),
-                ModuleEntry.create("/module1/toto1.class", new byte[0]),
-                ModuleEntry.create("/module2/toto2.class", new byte[0]),
-                ModuleEntry.create("/module3/toto3.class", new byte[0]),
-                ModuleEntry.create("/module4/zazou.class", new byte[0]),
-                ModuleEntry.create("/module5/toto5.class", new byte[0])
-        };
-
-        ModuleEntry[] sorted2 = {
-            ModuleEntry.create("/module5/toto5.class", new byte[0]),
-            ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]),
-            ModuleEntry.create("/module4/zazou.class", new byte[0]),
-            ModuleEntry.create("/module3/toto3.class", new byte[0]),
-            ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]),
-            ModuleEntry.create("/module1/toto1.class", new byte[0]),
-            ModuleEntry.create("/module2/toto2.class", new byte[0]),
-            ModuleEntry.create("/zazou/toto.class", new byte[0])
-        };
-
-        ModulePool resources = new ModulePoolImpl();
-        for (ModuleEntry r : array) {
-            resources.add(r);
-        }
-
-        {
-            ModulePool out = new ModulePoolImpl();
-            Map<String, String> config = new HashMap<>();
-            config.put(OrderResourcesPlugin.NAME, "/zazou/**,**/module-info.class");
-            Plugin p = new OrderResourcesPlugin();
-            p.configure(config);
-            p.visit(resources, out);
-            check(out.entries().collect(Collectors.toList()), sorted);
-        }
-
-        {
-            // Order of resources in the file, then un-ordered resources.
-            File order = new File("resources.order");
-            order.createNewFile();
-            StringBuilder builder = new StringBuilder();
-            // 5 first resources come from file
-            for (int i = 0; i < 5; i++) {
-                String path = sorted2[i].getPath();
-                int index = path.indexOf('/', 1);
-                path = path.substring(index + 1, path.length() - ".class".length());
-                builder.append(path).append("\n");
-            }
-            Files.write(order.toPath(), builder.toString().getBytes());
-
-            ModulePool out = new ModulePoolImpl();
-            Map<String, String> config = new HashMap<>();
-            config.put(OrderResourcesPlugin.NAME, "@" + order.getAbsolutePath());
-            Plugin p = new OrderResourcesPlugin();
-            p.configure(config);
-            p.visit(resources, out);
-            check(out.entries().collect(Collectors.toList()), sorted2);
-
-        }
-    }
-
-    private void check(Collection<ModuleEntry> outResources,
-            ModuleEntry[] sorted) {
-        if (outResources.size() != sorted.length) {
-            throw new AssertionError("Wrong number of resources:\n"
-                    + "expected: " + Arrays.toString(sorted) + ",\n"
-                    + "     got: " + outResources);
-        }
-        int i = 0;
-        for (ModuleEntry r : outResources) {
-            System.err.println("Resource: " + r);
-            if (!sorted[i].getPath().equals(r.getPath())) {
-                throw new AssertionError("Resource not properly sorted, difference at: " + i + "\n"
-                        + "expected: " + Arrays.toString(sorted) + ",\n"
-                        + "     got: " + outResources);
-            }
-            i++;
-        }
-    }
-}
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -38,12 +38,13 @@
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.Jlink.PluginsConfiguration;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class PluginsNegativeTest {
 
@@ -95,8 +96,8 @@
         plugins.add(createPlugin("plugin"));
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new PluginsConfiguration(plugins,
                 null, null));
-        ModulePoolImpl inResources = new ModulePoolImpl();
-        inResources.add(ModuleEntry.create("/aaa/bbb/A", new byte[10]));
+        ResourcePoolManager inResources = new ResourcePoolManager();
+        inResources.add(ResourcePoolEntry.create("/aaa/bbb/A", new byte[10]));
         try {
             stack.visitResources(inResources);
             throw new AssertionError("Exception expected when output resource is empty");
@@ -109,8 +110,8 @@
         plugins.add(createPlugin("plugin"));
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new PluginsConfiguration(plugins,
                 null, null));
-        ModulePoolImpl inResources = new ModulePoolImpl();
-        ModulePoolImpl outResources = (ModulePoolImpl) stack.visitResources(inResources);
+        ResourcePoolManager inResources = new ResourcePoolManager();
+        ResourcePool outResources = stack.visitResources(inResources);
         if (!outResources.isEmpty()) {
             throw new AssertionError("Output resource is not empty");
         }
@@ -125,8 +126,9 @@
         }
 
         @Override
-        public void visit(ModulePool inResources, ModulePool outResources) {
-            // do nothing
+        public ResourcePool transform(ResourcePool inResources, ResourcePoolBuilder outResources) {
+            // don't add anything to the builder
+            return outResources.build();
         }
 
         @Override
--- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -42,13 +42,15 @@
 import jdk.tools.jlink.internal.ImagePluginConfiguration;
 import jdk.tools.jlink.internal.PluginRepository;
 import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
+import jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl;
 import jdk.tools.jlink.internal.ResourcePrevisitor;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.Jlink;
 import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePool;
+import jdk.tools.jlink.plugin.ResourcePoolBuilder;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
 
 public class PrevisitorTest {
 
@@ -67,13 +69,13 @@
         plugins.add(createPlugin(CustomPlugin.NAME));
         ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new Jlink.PluginsConfiguration(plugins,
                 null, null));
-        ModulePoolImpl inResources = new ModulePoolImpl(ByteOrder.nativeOrder(), new CustomStringTable());
-        inResources.add(ModuleEntry.create("/aaa/bbb/res1.class", new byte[90]));
-        inResources.add(ModuleEntry.create("/aaa/bbb/res2.class", new byte[90]));
-        inResources.add(ModuleEntry.create("/aaa/bbb/res3.class", new byte[90]));
-        inResources.add(ModuleEntry.create("/aaa/ddd/res1.class", new byte[90]));
-        inResources.add(ModuleEntry.create("/aaa/res1.class", new byte[90]));
-        ModulePool outResources = stack.visitResources(inResources);
+        ResourcePoolManager inResources = new ResourcePoolManager(ByteOrder.nativeOrder(), new CustomStringTable());
+        inResources.add(ResourcePoolEntry.create("/aaa/bbb/res1.class", new byte[90]));
+        inResources.add(ResourcePoolEntry.create("/aaa/bbb/res2.class", new byte[90]));
+        inResources.add(ResourcePoolEntry.create("/aaa/bbb/res3.class", new byte[90]));
+        inResources.add(ResourcePoolEntry.create("/aaa/ddd/res1.class", new byte[90]));
+        inResources.add(ResourcePoolEntry.create("/aaa/res1.class", new byte[90]));
+        ResourcePool outResources = stack.visitResources(inResources);
         Collection<String> input = inResources.entries()
                 .map(Object::toString)
                 .collect(Collectors.toList());
@@ -113,19 +115,18 @@
         private boolean isPrevisitCalled = false;
 
         @Override
-        public void visit(ModulePool inResources, ModulePool outResources) {
+        public ResourcePool transform(ResourcePool inResources, ResourcePoolBuilder outResources) {
             if (!isPrevisitCalled) {
                 throw new AssertionError("Previsit was not called");
             }
-            CustomStringTable table = (CustomStringTable)
-                    ((ModulePoolImpl) inResources).getStringTable();
+            CustomStringTable table = (CustomStringTable)((ResourcePoolImpl)inResources).getStringTable();
             if (table.size() == 0) {
                 throw new AssertionError("Table is empty");
             }
             Map<String, Integer> count = new HashMap<>();
             for (int i = 0; i < table.size(); ++i) {
                 String s = table.getString(i);
-                Optional<ModuleEntry> e = inResources.findEntry(s);
+                Optional<ResourcePoolEntry> e = inResources.findEntry(s);
                 if (e.isPresent()) {
                     throw new AssertionError();
                 }
@@ -139,6 +140,8 @@
             inResources.entries().forEach(r -> {
                 outResources.add(r);
             });
+
+            return outResources.build();
         }
 
         @Override
@@ -147,10 +150,10 @@
         }
 
         @Override
-        public void previsit(ModulePool resources, StringTable strings) {
+        public void previsit(ResourcePool resources, StringTable strings) {
             isPrevisitCalled = true;
             resources.entries().forEach(r -> {
-                String s = r.getPath();
+                String s = r.path();
                 int lastIndexOf = s.lastIndexOf('/');
                 if (lastIndexOf >= 0) {
                     strings.addString(s.substring(0, lastIndexOf));
--- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -52,11 +52,11 @@
 
 import jdk.internal.jimage.decompressor.CompressedResourceHeader;
 import jdk.internal.jimage.decompressor.StringSharingDecompressor;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.internal.StringTable;
 import jdk.tools.jlink.internal.plugins.StringSharingPlugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.Plugin;
 import tests.Helper;
 import tests.JImageValidator;
@@ -80,7 +80,7 @@
         Map<String, Integer> map = new HashMap<>();
         Map<Integer, String> reversedMap = new HashMap<>();
 
-        ModulePoolImpl resources = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() {
+        ResourcePoolManager resources = new ResourcePoolManager(ByteOrder.nativeOrder(), new StringTable() {
             @Override
             public int addString(String str) {
                 Integer id = map.get(str);
@@ -109,7 +109,7 @@
                     if (path.charAt(0) != '/') {
                         path = "/" + path;
                     }
-                    ModuleEntry res = ModuleEntry.create(path, content);
+                    ResourcePoolEntry res = ResourcePoolEntry.create(path, content);
                     resources.add(res);
                 } catch (Exception ex) {
                     throw new RuntimeException(ex);
@@ -120,17 +120,17 @@
             stream.forEach(c);
         }
         Plugin plugin = new StringSharingPlugin();
-        ModulePoolImpl result = new ModulePoolImpl(resources.getByteOrder(), resources.getStringTable());
-        plugin.visit(resources, result);
+        ResourcePoolManager resultMgr = new ResourcePoolManager(resources.byteOrder(), resources.getStringTable());
+        ResourcePool result = plugin.transform(resources.resourcePool(), resultMgr.resourcePoolBuilder());
 
         if (result.isEmpty()) {
             throw new AssertionError("No result");
         }
 
         result.entries().forEach(res -> {
-            if (res.getPath().endsWith(".class")) {
+            if (res.path().endsWith(".class")) {
                 try {
-                    byte[] uncompacted = StringSharingDecompressor.normalize(reversedMap::get, res.getBytes(),
+                    byte[] uncompacted = StringSharingDecompressor.normalize(reversedMap::get, res.contentBytes(),
                         CompressedResourceHeader.getSize());
                     JImageValidator.readClass(uncompacted);
                 } catch (IOException exp) {
--- a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -54,10 +54,10 @@
 import com.sun.tools.classfile.Method;
 import java.util.HashMap;
 import java.util.Map;
-import jdk.tools.jlink.internal.ModulePoolImpl;
+import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
-import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.ModulePool;
+import jdk.tools.jlink.plugin.ResourcePoolEntry;
+import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.Plugin;
 import tests.Helper;
 
@@ -106,36 +106,38 @@
         path = path.replace('\\', '/');
         StripDebugPlugin debug = new StripDebugPlugin();
         debug.configure(new HashMap<>());
-        ModuleEntry result1 = stripDebug(debug, ModuleEntry.create(path,content), path, infoPath, moduleInfo);
+        ResourcePoolEntry result1 = stripDebug(debug, ResourcePoolEntry.create(path,content), path, infoPath, moduleInfo);
 
         if (!path.endsWith("module-info.class")) {
-            if (result1.getLength() >= content.length) {
+            if (result1.contentLength() >= content.length) {
                 throw new AssertionError("Class size not reduced, debug info not "
                         + "removed for " + path);
             }
-            checkDebugAttributes(result1.getBytes());
+            checkDebugAttributes(result1.contentBytes());
         }
 
-        ModuleEntry result2 = stripDebug(debug, result1, path, infoPath, moduleInfo);
-        if (result1.getLength() != result2.getLength()) {
+        ResourcePoolEntry result2 = stripDebug(debug, result1, path, infoPath, moduleInfo);
+        if (result1.contentLength() != result2.contentLength()) {
             throw new AssertionError("removing debug info twice reduces class size of "
                     + path);
         }
-        checkDebugAttributes(result1.getBytes());
+        checkDebugAttributes(result1.contentBytes());
     }
 
-    private ModuleEntry stripDebug(Plugin debug, ModuleEntry classResource,
+    private ResourcePoolEntry stripDebug(Plugin debug, ResourcePoolEntry classResource,
             String path, String infoPath, byte[] moduleInfo) throws Exception {
-        ModulePool resources = new ModulePoolImpl();
+        ResourcePoolManager resources = new ResourcePoolManager();
         resources.add(classResource);
         if (!path.endsWith("module-info.class")) {
-            ModuleEntry res2 = ModuleEntry.create(infoPath, moduleInfo);
+            ResourcePoolEntry res2 = ResourcePoolEntry.create(infoPath, moduleInfo);
             resources.add(res2);
         }
-        ModulePool results = new ModulePoolImpl();
-        debug.visit(resources, results);
-        System.out.println(classResource.getPath());
-        return results.findEntry(classResource.getPath()).get();
+        ResourcePoolManager results = new ResourcePoolManager();
+        ResourcePool resPool = debug.transform(resources.resourcePool(),
+                results.resourcePoolBuilder());
+        System.out.println(classResource.path());
+
+        return resPool.findEntry(classResource.path()).get();
     }
 
     private void checkDebugAttributes(byte[] strippedClassFile) throws IOException, ConstantPoolException {
--- a/jdk/test/tools/jmod/JmodNegativeTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jmod/JmodNegativeTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -229,21 +229,6 @@
         }
     }
 
-    @Test(enabled = false)  // TODO: jmod should check for duplicates before creating.
-    public void testDuplicates() throws IOException {
-        Path jmod = MODS_DIR.resolve("testDuplicates.jmod");
-        FileUtils.deleteFileIfExistsWithRetry(jmod);
-        String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString();
-
-        jmod("create",
-             "--class-path", cp + pathSeparator + cp,
-             jmod.toString())
-            .assertFailure()
-            .resultChecker(r ->
-                assertContains(r.output, "Error: duplicate resource found, etc..")
-            );
-    }
-
     @Test
     public void testEmptyFileInClasspath() throws IOException {
         Path jmod = MODS_DIR.resolve("testEmptyFileInClasspath.jmod");
--- a/jdk/test/tools/jmod/JmodTest.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/jmod/JmodTest.java	Wed Jul 05 22:01:14 2017 +0200
@@ -42,6 +42,8 @@
 import jdk.testlibrary.FileUtils;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
+
+import static java.io.File.pathSeparator;
 import static java.lang.module.ModuleDescriptor.Version;
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static java.util.stream.Collectors.toSet;
@@ -283,6 +285,58 @@
     }
 
     @Test
+    public void testDuplicateEntries() throws IOException {
+        Path jmod = MODS_DIR.resolve("testDuplicates.jmod");
+        FileUtils.deleteFileIfExistsWithRetry(jmod);
+        String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString();
+        Path lp = EXPLODED_DIR.resolve("foo").resolve("lib");
+
+        jmod("create",
+             "--class-path", cp + pathSeparator + cp,
+             jmod.toString())
+             .assertSuccess()
+             .resultChecker(r ->
+                 assertContains(r.output, "Warning: ignoring duplicate entry")
+             );
+
+        FileUtils.deleteFileIfExistsWithRetry(jmod);
+        jmod("create",
+             "--class-path", cp,
+             "--libs", lp.toString() + pathSeparator + lp.toString(),
+             jmod.toString())
+             .assertSuccess()
+             .resultChecker(r ->
+                 assertContains(r.output, "Warning: ignoring duplicate entry")
+             );
+    }
+
+    @Test
+    public void testIgnoreModuleInfoInOtherSections() throws IOException {
+        Path jmod = MODS_DIR.resolve("testIgnoreModuleInfoInOtherSections.jmod");
+        FileUtils.deleteFileIfExistsWithRetry(jmod);
+        String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString();
+
+        jmod("create",
+            "--class-path", cp,
+            "--libs", cp,
+            jmod.toString())
+            .assertSuccess()
+            .resultChecker(r ->
+                assertContains(r.output, "Warning: ignoring entry")
+            );
+
+        FileUtils.deleteFileIfExistsWithRetry(jmod);
+        jmod("create",
+             "--class-path", cp,
+             "--cmds", cp,
+             jmod.toString())
+             .assertSuccess()
+             .resultChecker(r ->
+                 assertContains(r.output, "Warning: ignoring entry")
+             );
+    }
+
+    @Test
     public void testVersion() {
         jmod("--version")
             .assertSuccess()
--- a/jdk/test/tools/launcher/VersionCheck.java	Thu Jul 28 16:08:15 2016 +0000
+++ b/jdk/test/tools/launcher/VersionCheck.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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.
  * 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 6545058 6611182 8016209 8139986
+ * @bug 6545058 6611182 8016209 8139986 8162746
  * @summary validate and test -version, -fullversion, and internal, as well as
  *          sanity checks if a tool can be launched.
  * @compile VersionCheck.java
@@ -56,7 +56,7 @@
         "jcontrol",
         "jmc",
         "jmc.ini",
-        "jp2launcher",
+        "jweblauncher",
         "jvisualvm",
         "packager",
         "ssvagent",
@@ -93,11 +93,11 @@
         "jps",
         "jrunscript",
         "jjs",
-        "jp2launcher",
         "jsadebugd",
         "jstack",
         "jstat",
         "jstatd",
+        "jweblauncher",
         "jvisualvm",
         "keytool",
         "kinit",
--- a/make/common/Modules.gmk	Thu Jul 28 16:08:15 2016 +0000
+++ b/make/common/Modules.gmk	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/nashorn/.hgtags	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Thu Jul 28 16:08:15 2016 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Functions.properties	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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	Wed Jul 05 22:01:14 2017 +0200
@@ -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