changeset 17817:77d046dced5d

Merge
author prr
date Tue, 29 Aug 2017 10:47:16 -0700
parents 66539c09c053 84953f6385d7
children 9bae8d7e5b8a
files test/lib/testlibrary/ClassFileInstaller.java
diffstat 75 files changed, 940 insertions(+), 358 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Aug 28 11:53:44 2017 -0700
+++ b/.hgtags	Tue Aug 29 10:47:16 2017 -0700
@@ -445,3 +445,4 @@
 4feab1acec6a9c3620a19ff379a65ab8618d0e2a jdk-9+180
 bd66ea2fdde3d60a73b5272263a7b8b0ca926a33 jdk-9+181
 6256e94781f55e6f9e04eb284298d00eb9c5e106 jdk-10+20
+4e08a69241eab6e7a67a819a7b4fe29e7398855d jdk-10+21
--- a/make/mapfiles/libnio/mapfile-linux	Mon Aug 28 11:53:44 2017 -0700
+++ b/make/mapfiles/libnio/mapfile-linux	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2017, 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
@@ -54,7 +54,6 @@
 		Java_sun_nio_ch_EPollPort_drain1;
 		Java_sun_nio_ch_EPollPort_interrupt;
 		Java_sun_nio_ch_EPollPort_socketpair;
-                Java_sun_nio_ch_FileChannelImpl_close0;
                 Java_sun_nio_ch_FileChannelImpl_initIDs;
                 Java_sun_nio_ch_FileChannelImpl_map0;
                 Java_sun_nio_ch_FileChannelImpl_position0;
--- a/make/mapfiles/libnio/mapfile-macosx	Mon Aug 28 11:53:44 2017 -0700
+++ b/make/mapfiles/libnio/mapfile-macosx	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2017, 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,7 +37,6 @@
                 Java_sun_nio_ch_DatagramDispatcher_readv0;
                 Java_sun_nio_ch_DatagramDispatcher_write0;
                 Java_sun_nio_ch_DatagramDispatcher_writev0;
-                Java_sun_nio_ch_FileChannelImpl_close0;
                 Java_sun_nio_ch_FileChannelImpl_initIDs;
                 Java_sun_nio_ch_FileChannelImpl_map0;
                 Java_sun_nio_ch_FileChannelImpl_position0;
--- a/make/mapfiles/libnio/mapfile-solaris	Mon Aug 28 11:53:44 2017 -0700
+++ b/make/mapfiles/libnio/mapfile-solaris	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2017, 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
@@ -42,7 +42,6 @@
                 Java_sun_nio_ch_DevPollArrayWrapper_poll0;
                 Java_sun_nio_ch_DevPollArrayWrapper_register;
                 Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple;
-                Java_sun_nio_ch_FileChannelImpl_close0;
                 Java_sun_nio_ch_FileChannelImpl_initIDs;
                 Java_sun_nio_ch_FileChannelImpl_map0;
                 Java_sun_nio_ch_FileChannelImpl_position0;
--- a/src/java.base/share/classes/java/lang/BootstrapMethodError.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/BootstrapMethodError.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, 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
@@ -30,7 +30,7 @@
  * failed to find its bootstrap method,
  * or the bootstrap method has failed to provide a
  * {@linkplain java.lang.invoke.CallSite call site} with a {@linkplain java.lang.invoke.CallSite#getTarget target}
- * of the correct {@linkplain java.lang.invoke.MethodHandle#type method type}.
+ * of the correct {@linkplain java.lang.invoke.MethodHandle#type() method type}.
  *
  * @author John Rose, JSR 292 EG
  * @since 1.7
--- a/src/java.base/share/classes/java/lang/ModuleLayer.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/ModuleLayer.java	Tue Aug 29 10:47:16 2017 -0700
@@ -822,7 +822,7 @@
 
     /**
      * Returns the module with the given name in this layer, or if not in this
-     * layer, the {@linkplain #parents parent} layers. Finding a module in
+     * layer, the {@linkplain #parents() parent} layers. Finding a module in
      * parent layers is equivalent to invoking {@code findModule} on each
      * parent, in search order, until the module is found or all parents have
      * been searched. In a <em>tree of layers</em>  then this is equivalent to
@@ -854,7 +854,7 @@
 
     /**
      * Returns the {@code ClassLoader} for the module with the given name. If
-     * a module of the given name is not in this layer then the {@link #parents
+     * a module of the given name is not in this layer then the {@link #parents()
      * parent} layers are searched in the manner specified by {@link
      * #findModule(String) findModule}.
      *
--- a/src/java.base/share/classes/java/lang/ProcessBuilder.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/ProcessBuilder.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -1149,7 +1149,7 @@
      * The {@link Process#getInputStream standard output} of all processes
      * except the last process are <i>null input streams</i>.
      * <p>
-     * The {@link #redirectErrorStream} of each ProcessBuilder applies to the
+     * The {@link #redirectErrorStream()} of each ProcessBuilder applies to the
      * respective process.  If set to {@code true}, the error stream is written
      * to the same stream as standard output.
      * <p>
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Aug 29 10:47:16 2017 -0700
@@ -47,9 +47,9 @@
  * Method handles are dynamically and strongly typed according to their parameter and return types.
  * They are not distinguished by the name or the defining class of their underlying methods.
  * A method handle must be invoked using a symbolic type descriptor which matches
- * the method handle's own {@linkplain #type type descriptor}.
+ * the method handle's own {@linkplain #type() type descriptor}.
  * <p>
- * Every method handle reports its type descriptor via the {@link #type type} accessor.
+ * Every method handle reports its type descriptor via the {@link #type() type} accessor.
  * This type descriptor is a {@link java.lang.invoke.MethodType MethodType} object,
  * whose structure is a series of classes, one of which is
  * the return type of the method (or {@code void.class} if none).
@@ -468,7 +468,7 @@
     /**
      * Invokes the method handle, allowing any caller type descriptor, but requiring an exact type match.
      * The symbolic type descriptor at the call site of {@code invokeExact} must
-     * exactly match this method handle's {@link #type type}.
+     * exactly match this method handle's {@link #type() type}.
      * No conversions are allowed on arguments or return values.
      * <p>
      * When this method is observed via the Core Reflection API,
@@ -489,7 +489,7 @@
      * Invokes the method handle, allowing any caller type descriptor,
      * and optionally performing conversions on arguments and return values.
      * <p>
-     * If the call site's symbolic type descriptor exactly matches this method handle's {@link #type type},
+     * If the call site's symbolic type descriptor exactly matches this method handle's {@link #type() type},
      * the call proceeds as if by {@link #invokeExact invokeExact}.
      * <p>
      * Otherwise, the call proceeds as if this method handle were first
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Aug 29 10:47:16 2017 -0700
@@ -131,7 +131,7 @@
      * It can only be used to create method handles to public members of
      * public classes in packages that are exported unconditionally.
      * <p>
-     * As a matter of pure convention, the {@linkplain Lookup#lookupClass lookup class}
+     * As a matter of pure convention, the {@linkplain Lookup#lookupClass() lookup class}
      * of this lookup object will be {@link java.lang.Object}.
      *
      * @apiNote The use of Object is conventional, and because the lookup modes are
@@ -259,10 +259,10 @@
      * Therefore, method handle access
      * restrictions must be enforced when a method handle is created.
      * The caller class against which those restrictions are enforced
-     * is known as the {@linkplain #lookupClass lookup class}.
+     * is known as the {@linkplain #lookupClass() lookup class}.
      * <p>
      * A lookup class which needs to create method handles will call
-     * {@link MethodHandles#lookup MethodHandles.lookup} to create a factory for itself.
+     * {@link MethodHandles#lookup() MethodHandles.lookup} to create a factory for itself.
      * When the {@code Lookup} factory object is created, the identity of the lookup class is
      * determined, and securely stored in the {@code Lookup} object.
      * The lookup class (or its delegates) may then use factory methods
@@ -776,7 +776,7 @@
         /**
          * Creates a lookup on the specified new lookup class.
          * The resulting object will report the specified
-         * class as its own {@link #lookupClass lookupClass}.
+         * class as its own {@link #lookupClass() lookupClass}.
          * <p>
          * However, the resulting {@code Lookup} object is guaranteed
          * to have no more access capabilities than the original.
@@ -4602,7 +4602,7 @@
      * <li>At this point, every non-init function parameter list is effectively identical to the internal parameter
      * list {@code (V... A...)}, but some lists may be shorter. For every non-init function with a short parameter list,
      * pad out the end of the list.
-     * <li>Argument lists are padded out by {@linkplain #dropArgumentsToMatch dropping unused trailing arguments}.
+     * <li>Argument lists are padded out by {@linkplain #dropArgumentsToMatch(MethodHandle, int, List, int) dropping unused trailing arguments}.
      * </ol>
      * <p>
      * <em>Final observations.</em><ol type="a">
@@ -4697,7 +4697,7 @@
      * }</pre></blockquote>
      * Note that the parameter type lists {@code (V...)} and {@code (A...)} have been expanded
      * to their full length, even though individual clause functions may neglect to take them all.
-     * As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch}.
+     * As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch(MethodHandle, int, List, int)}.
      *
      * @apiNote Example:
      * <blockquote><pre>{@code
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Tue Aug 29 10:47:16 2017 -0700
@@ -25,19 +25,24 @@
 
 package java.lang.invoke;
 
+import jdk.internal.misc.Unsafe;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Label;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.vm.annotation.ForceInline;
-import jdk.internal.misc.Unsafe;
+import sun.invoke.util.Wrapper;
+import sun.security.action.GetPropertyAction;
 
 import java.lang.invoke.MethodHandles.Lookup;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.function.Function;
-import sun.security.action.GetPropertyAction;
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
@@ -319,12 +324,12 @@
     }
 
     private static final class RecipeElement {
-        private final Object value;
+        private final String value;
         private final int argPos;
         private final char tag;
 
         public RecipeElement(Object cnst) {
-            this.value = Objects.requireNonNull(cnst);
+            this.value = String.valueOf(Objects.requireNonNull(cnst));
             this.argPos = -1;
             this.tag = TAG_CONST;
         }
@@ -335,7 +340,7 @@
             this.tag = TAG_ARG;
         }
 
-        public Object getValue() {
+        public String getValue() {
             assert (tag == TAG_CONST);
             return value;
         }
@@ -923,8 +928,7 @@
                 for (RecipeElement el : recipe.getElements()) {
                     switch (el.getTag()) {
                         case TAG_CONST:
-                            Object cnst = el.getValue();
-                            len += cnst.toString().length();
+                            len += el.getValue().length();
                             break;
                         case TAG_ARG:
                             /*
@@ -983,9 +987,8 @@
                     String desc;
                     switch (el.getTag()) {
                         case TAG_CONST:
-                            Object cnst = el.getValue();
-                            mv.visitLdcInsn(cnst);
-                            desc = getSBAppendDesc(cnst.getClass());
+                            mv.visitLdcInsn(el.getValue());
+                            desc = getSBAppendDesc(String.class);
                             break;
                         case TAG_ARG:
                             Class<?> cl = arr[el.getArgPos()];
@@ -1273,8 +1276,7 @@
             for (RecipeElement el : recipe.getElements()) {
                 switch (el.getTag()) {
                     case TAG_CONST:
-                        Object cnst = el.getValue();
-                        initial += cnst.toString().length();
+                        initial += el.getValue().length();
                         break;
                     case TAG_ARG:
                         final int i = el.getArgPos();
@@ -1303,9 +1305,8 @@
                 MethodHandle appender;
                 switch (el.getTag()) {
                     case TAG_CONST:
-                        Object constant = el.getValue();
-                        MethodHandle mh = appender(adaptToStringBuilder(constant.getClass()));
-                        appender = MethodHandles.insertArguments(mh, 1, constant);
+                        MethodHandle mh = appender(adaptToStringBuilder(String.class));
+                        appender = MethodHandles.insertArguments(mh, 1, el.getValue());
                         break;
                     case TAG_ARG:
                         int ac = el.getArgPos();
@@ -1506,8 +1507,7 @@
                 mh = MethodHandles.dropArguments(mh, 2, int.class);
                 switch (el.getTag()) {
                     case TAG_CONST: {
-                        Object cnst = el.getValue();
-                        MethodHandle prepender = MethodHandles.insertArguments(prepender(cnst.getClass()), 3, cnst);
+                        MethodHandle prepender = MethodHandles.insertArguments(prepender(String.class), 3, el.getValue());
                         mh = MethodHandles.foldArguments(mh, 1, prepender,
                                 2, 0, 3 // index, storage, coder
                         );
@@ -1550,10 +1550,9 @@
             for (RecipeElement el : recipe.getElements()) {
                 switch (el.getTag()) {
                     case TAG_CONST:
-                        Object constant = el.getValue();
-                        String s = constant.toString();
-                        initialCoder = (byte) coderMixer(String.class).invoke(initialCoder, s);
-                        initialLen += s.length();
+                        String constant = el.getValue();
+                        initialCoder = (byte) coderMixer(String.class).invoke(initialCoder, constant);
+                        initialLen += constant.length();
                         break;
                     case TAG_ARG:
                         int ac = el.getArgPos();
@@ -1621,7 +1620,8 @@
         private static final Function<Class<?>, MethodHandle> PREPEND = new Function<Class<?>, MethodHandle>() {
             @Override
             public MethodHandle apply(Class<?> c) {
-                return lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "prepend", int.class, int.class, byte[].class, byte.class, c);
+                return lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "prepend", int.class, int.class, byte[].class, byte.class,
+                        Wrapper.asPrimitiveType(c));
             }
         };
 
@@ -1629,7 +1629,8 @@
         private static final Function<Class<?>, MethodHandle> CODER_MIX = new Function<Class<?>, MethodHandle>() {
             @Override
             public MethodHandle apply(Class<?> c) {
-                return lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "mixCoder", byte.class, byte.class, c);
+                return lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "mixCoder", byte.class, byte.class,
+                        Wrapper.asPrimitiveType(c));
             }
         };
 
@@ -1637,7 +1638,8 @@
         private static final Function<Class<?>, MethodHandle> LENGTH_MIX = new Function<Class<?>, MethodHandle>() {
             @Override
             public MethodHandle apply(Class<?> c) {
-                return lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "mixLen", int.class, int.class, c);
+                return lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "mixLen", int.class, int.class,
+                        Wrapper.asPrimitiveType(c));
             }
         };
 
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1826,7 +1826,7 @@
          *         value associated with method name (indicating the method
          *         name does not correspond to a {@code VarHandle}
          *         signature-polymorphic method name).
-         * @see #methodName
+         * @see #methodName()
          */
         public static AccessMode valueFromMethodName(String methodName) {
             AccessMode am = methodNameToAccessMode.get(methodName);
--- a/src/java.base/share/classes/java/lang/module/Configuration.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/module/Configuration.java	Tue Aug 29 10:47:16 2017 -0700
@@ -47,7 +47,8 @@
 
 /**
  * A configuration that is the result of <a href="package-summary.html#resolution">
- * resolution</a> or resolution with <a href="#service-binding">service binding</a>.
+ * resolution</a> or resolution with
+ * <a href="{@docRoot}/java/lang/module/Configuration.html#service-binding">service binding</a>.
  *
  * <p> A configuration encapsulates the <em>readability graph</em> that is the
  * output of resolution. A readability graph is a directed graph whose vertices
@@ -421,7 +422,7 @@
      * resolve} except that the graph of resolved modules is augmented
      * with modules induced by the service-use dependence relation. </p>
      *
-     * <p id="service-binding"> More specifically, the root modules are
+     * <p><a id="service-binding"></a>More specifically, the root modules are
      * resolved as if by calling {@code resolve}. The resolved modules, and
      * all modules in the parent configurations, with {@link ModuleDescriptor#uses()
      * service dependences} are then examined. All modules found by the given
@@ -520,7 +521,7 @@
 
     /**
      * Finds a resolved module in this configuration, or if not in this
-     * configuration, the {@linkplain #parents parent} configurations.
+     * configuration, the {@linkplain #parents() parent} configurations.
      * Finding a module in parent configurations is equivalent to invoking
      * {@code findModule} on each parent, in search order, until the module
      * is found or all parents have been searched. In a <em>tree of
--- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1331,7 +1331,7 @@
     /**
      * <p> Returns {@code true} if this is an open module. </p>
      *
-     * <p> This method is equivalent to testing if the set of {@link #modifiers
+     * <p> This method is equivalent to testing if the set of {@link #modifiers()
      * modifiers} contains the {@link Modifier#OPEN OPEN} modifier. </p>
      *
      * @return  {@code true} if this is an open module
@@ -1343,7 +1343,7 @@
     /**
      * <p> Returns {@code true} if this is an automatic module. </p>
      *
-     * <p> This method is equivalent to testing if the set of {@link #modifiers
+     * <p> This method is equivalent to testing if the set of {@link #modifiers()
      * modifiers} contains the {@link Modifier#OPEN AUTOMATIC} modifier. </p>
      *
      * @return  {@code true} if this is an automatic module
@@ -1689,7 +1689,7 @@
          * @return This builder
          *
          * @throws IllegalStateException
-         *         If the {@link Exports#source package} is already declared as
+         *         If the {@link Exports#source() package} is already declared as
          *         exported or this builder is for an automatic module
          */
         public Builder exports(Exports e) {
--- a/src/java.base/share/classes/java/net/URLStreamHandler.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/net/URLStreamHandler.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, 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
@@ -531,7 +531,6 @@
      * @param   ref       the reference.
      * @exception       SecurityException       if the protocol handler of the URL is
      *                                  different from this one
-     * @see     java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
      * @since 1.3
      */
        protected void setURL(URL u, String protocol, String host, int port,
--- a/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -45,7 +45,7 @@
  * invoked, these methods should be used within a
  * {@code try}&nbsp;...&nbsp;{@code finally} block:
  *
- * <blockquote><pre>
+ * <blockquote><pre id="be">
  * boolean completed = false;
  * try {
  *     begin();
--- a/src/java.base/share/classes/java/nio/channels/spi/AbstractSelector.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/nio/channels/spi/AbstractSelector.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -45,7 +45,7 @@
  * invoked, these methods should be used within a
  * {@code try}&nbsp;...&nbsp;{@code finally} block:
  *
- * <blockquote><pre>
+ * <blockquote><pre id="be">
  * try {
  *     begin();
  *     // Perform blocking I/O operation here
--- a/src/java.base/share/classes/java/nio/file/FileSystems.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/nio/file/FileSystems.java	Tue Aug 29 10:47:16 2017 -0700
@@ -50,7 +50,7 @@
  * machine. If the process of loading or initializing the default provider fails
  * then an unspecified error is thrown.
  *
- * <p> The first invocation of the {@link FileSystemProvider#installedProviders
+ * <p> The first invocation of the {@link FileSystemProvider#installedProviders()
  * installedProviders} method, by way of invoking any of the {@code
  * newFileSystem} methods defined by this class, locates and loads all
  * installed file system providers. Installed providers are loaded using the
--- a/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/nio/file/attribute/AclEntry.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, 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
@@ -48,7 +48,7 @@
  *    {@link AclEntryPermission permissions}
  *    </p></li>
  *
- *    <li><p> The {@link #flags flags} component is a set of {@link AclEntryFlag
+ *    <li><p> The {@link #flags() flags} component is a set of {@link AclEntryFlag
  *    flags} to indicate how entries are inherited and propagated </p></li>
  * </ol>
  *
--- a/src/java.base/share/classes/java/security/PKCS12Attribute.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/security/PKCS12Attribute.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,8 @@
         // Validate value
         int length = value.length();
         String[] values;
-        if (value.charAt(0) == '[' && value.charAt(length - 1) == ']') {
+        if (length > 1 &&
+                value.charAt(0) == '[' && value.charAt(length - 1) == ']') {
             values = value.substring(1, length - 1).split(", ");
         } else {
             values = new String[]{ value };
--- a/src/java.base/share/classes/java/text/NumberFormat.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/text/NumberFormat.java	Tue Aug 29 10:47:16 2017 -0700
@@ -181,6 +181,17 @@
  * The subclass may provide its own implementation and specification about
  * {@code NullPointerException}.
  *
+ * <p>
+ * The default implementation provides rounding modes defined
+ * in {@link java.math.RoundingMode} for formatting numbers. It
+ * uses the {@linkplain java.math.RoundingMode#HALF_EVEN
+ * round half-even algorithm}. To change the rounding mode use
+ * {@link #setRoundingMode(java.math.RoundingMode) setRoundingMode}.
+ * The {@code NumberFormat} returned by the static factory methods is
+ * configured to round floating point numbers using half-even
+ * rounding (see {@link java.math.RoundingMode#HALF_EVEN
+ * RoundingMode.HALF_EVEN}) for formatting.
+ *
  * @see          DecimalFormat
  * @see          ChoiceFormat
  * @author       Mark Davis
--- a/src/java.base/share/classes/java/time/chrono/HijrahEra.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/time/chrono/HijrahEra.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, 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
@@ -64,10 +64,13 @@
 import static java.time.temporal.ChronoField.ERA;
 
 import java.time.DateTimeException;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalField;
 import java.time.temporal.UnsupportedTemporalTypeException;
 import java.time.temporal.ValueRange;
+import java.util.Locale;
 
 /**
  * An era in the Hijrah calendar system.
@@ -155,4 +158,18 @@
         return Era.super.range(field);
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * @param style {@inheritDoc}
+     * @param locale {@inheritDoc}
+     */
+    @Override
+    public String getDisplayName(TextStyle style, Locale locale) {
+        return new DateTimeFormatterBuilder()
+            .appendText(ERA, style)
+            .toFormatter(locale)
+            .withChronology(HijrahChronology.INSTANCE)
+            .format(HijrahDate.now());
+    }
 }
--- a/src/java.base/share/classes/java/time/chrono/JapaneseEra.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/time/chrono/JapaneseEra.java	Tue Aug 29 10:47:16 2017 -0700
@@ -73,6 +73,7 @@
 import java.io.Serializable;
 import java.time.DateTimeException;
 import java.time.LocalDate;
+import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.TextStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalField;
@@ -253,7 +254,12 @@
             Objects.requireNonNull(locale, "locale");
             return style.asNormal() == TextStyle.NARROW ? getAbbreviation() : getName();
         }
-        return Era.super.getDisplayName(style, locale);
+
+        return new DateTimeFormatterBuilder()
+            .appendText(ERA, style)
+            .toFormatter(locale)
+            .withChronology(JapaneseChronology.INSTANCE)
+            .format(this == MEIJI ? MEIJI_6_ISODATE : since);
     }
 
     //-----------------------------------------------------------------------
--- a/src/java.base/share/classes/java/time/chrono/MinguoEra.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/time/chrono/MinguoEra.java	Tue Aug 29 10:47:16 2017 -0700
@@ -61,7 +61,12 @@
  */
 package java.time.chrono;
 
+import static java.time.temporal.ChronoField.ERA;
+
 import java.time.DateTimeException;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
+import java.util.Locale;
 
 /**
  * An era in the Minguo calendar system.
@@ -153,4 +158,19 @@
         return ordinal();
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * @param style {@inheritDoc}
+     * @param locale {@inheritDoc}
+     */
+    @Override
+    public String getDisplayName(TextStyle style, Locale locale) {
+        return new DateTimeFormatterBuilder()
+            .appendText(ERA, style)
+            .toFormatter(locale)
+            .withChronology(MinguoChronology.INSTANCE)
+            .format(this == ROC ? MinguoDate.of(1, 1, 1) : MinguoDate.of(0, 1, 1));
+    }
+
 }
--- a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java	Tue Aug 29 10:47:16 2017 -0700
@@ -61,7 +61,12 @@
  */
 package java.time.chrono;
 
+import static java.time.temporal.ChronoField.ERA;
+
 import java.time.DateTimeException;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
+import java.util.Locale;
 
 /**
  * An era in the Thai Buddhist calendar system.
@@ -153,4 +158,19 @@
         return ordinal();
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * @param style {@inheritDoc}
+     * @param locale {@inheritDoc}
+     */
+    @Override
+    public String getDisplayName(TextStyle style, Locale locale) {
+        return new DateTimeFormatterBuilder()
+            .appendText(ERA, style)
+            .toFormatter(locale)
+            .withChronology(ThaiBuddhistChronology.INSTANCE)
+            .format(this == BE ? ThaiBuddhistDate.of(1, 1, 1) : ThaiBuddhistDate.of(0, 1, 1));
+    }
+
 }
--- a/src/java.base/share/classes/java/util/Calendar.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/Calendar.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1399,7 +1399,7 @@
         /**
          * Sets the week definition parameters to the values given by
          * {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} that are
-         * used to determine the <a href="Calendar.html#First_Week">first
+         * used to determine the <a href="Calendar.html#first_week">first
          * week</a> of a year. The parameters given by this method have
          * precedence over the default values given by the
          * {@linkplain #setLocale(Locale) locale}.
--- a/src/java.base/share/classes/java/util/Collection.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/Collection.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -171,10 +171,10 @@
      *         element
      * @throws ClassCastException if the type of the specified element
      *         is incompatible with this collection
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
      *         collection does not permit null elements
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      */
     boolean contains(Object o);
 
@@ -301,10 +301,10 @@
      * @return {@code true} if an element was removed as a result of this call
      * @throws ClassCastException if the type of the specified element
      *         is incompatible with this collection
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
      *         collection does not permit null elements
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      * @throws UnsupportedOperationException if the {@code remove} operation
      *         is not supported by this collection
      */
@@ -323,11 +323,11 @@
      * @throws ClassCastException if the types of one or more elements
      *         in the specified collection are incompatible with this
      *         collection
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified collection contains one
      *         or more null elements and this collection does not permit null
      *         elements
-     *         (<a href="#optional-restrictions">optional</a>),
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null.
      * @see    #contains(Object)
      */
@@ -373,11 +373,11 @@
      * @throws ClassCastException if the types of one or more elements
      *         in this collection are incompatible with the specified
      *         collection
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this collection contains one or more
      *         null elements and the specified collection does not support
      *         null elements
-     *         (<a href="#optional-restrictions">optional</a>),
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
@@ -432,11 +432,11 @@
      * @throws ClassCastException if the types of one or more elements
      *         in this collection are incompatible with the specified
      *         collection
-     *         (<a href="#optional-restrictions">optional</a>)
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this collection contains one or more
      *         null elements and the specified collection does not permit null
      *         elements
-     *         (<a href="#optional-restrictions">optional</a>),
+     *         (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
--- a/src/java.base/share/classes/java/util/Formatter.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/Formatter.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1229,7 +1229,7 @@
  *     than the number of digits which would appear after the decimal point in
  *     the string returned by {@link Float#toString(float)} or {@link
  *     Double#toString(double)} respectively, then the value will be rounded
- *     using the {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
+ *     using the {@linkplain java.math.RoundingMode#HALF_UP round half up
  *     algorithm}.  Otherwise, zeros may be appended to reach the precision.
  *     For a canonical representation of the value, use {@link
  *     Float#toString(float)} or {@link Double#toString(double)} as
@@ -1298,7 +1298,7 @@
  *     than the number of digits which would appear after the decimal point in
  *     the string returned by {@link Float#toString(float)} or {@link
  *     Double#toString(double)} respectively, then the value will be rounded
- *     using the {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
+ *     using the {@linkplain java.math.RoundingMode#HALF_UP round half up
  *     algorithm}.  Otherwise, zeros may be appended to reach the precision.
  *     For a canonical representation of the value, use {@link
  *     Float#toString(float)} or {@link Double#toString(double)} as
@@ -1461,7 +1461,7 @@
  *     specified then the default value is {@code 6}.  If the precision is
  *     less than the number of digits to the right of the decimal point then
  *     the value will be rounded using the
- *     {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
+ *     {@linkplain java.math.RoundingMode#HALF_UP round half up
  *     algorithm}.  Otherwise, zeros may be appended to reach the precision.
  *     For a canonical representation of the value, use {@link
  *     BigDecimal#toString()}.
@@ -1524,7 +1524,7 @@
  *     specified then the default value is {@code 6}.  If the precision is
  *     less than the number of digits to the right of the decimal point
  *     then the value will be rounded using the
- *     {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
+ *     {@linkplain java.math.RoundingMode#HALF_UP round half up
  *     algorithm}.  Otherwise, zeros may be appended to reach the precision.
  *     For a canonical representation of the value, use {@link
  *     BigDecimal#toString()}.
--- a/src/java.base/share/classes/java/util/Properties.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/Properties.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1345,7 +1345,6 @@
         return map.remove(key, value);
     }
 
-    /** @hidden */
     @Override
     public synchronized boolean replace(Object key, Object oldValue, Object newValue) {
         return map.replace(key, oldValue, newValue);
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Tue Aug 29 10:47:16 2017 -0700
@@ -49,7 +49,9 @@
  * and termination methods surrounding the main task processing loop.
  * If you do create such a subclass, you will also need to supply a
  * custom {@link ForkJoinPool.ForkJoinWorkerThreadFactory} to
- * {@linkplain ForkJoinPool#ForkJoinPool use it} in a {@code ForkJoinPool}.
+ * {@linkplain ForkJoinPool#ForkJoinPool(int, ForkJoinWorkerThreadFactory,
+ * UncaughtExceptionHandler, boolean, int, int, int, Predicate, long, TimeUnit)
+ * use it} in a {@code ForkJoinPool}.
  *
  * @since 1.7
  * @author Doug Lea
--- a/src/java.base/share/classes/java/util/jar/package-info.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/jar/package-info.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, 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,7 +37,7 @@
  * <ul>
  *   <li><b>Info-ZIP file format</b> - The JAR format is based on the Info-ZIP
  *       file format. See
- *       <a href="../zip/package-summary.html#package_description">java.util.zip
+ *       <a href="../zip/package-summary.html#package.description">java.util.zip
  *       package description.</a> <p>
  *       In JAR files, all file names must be encoded in the UTF-8 encoding.
  *   <li><a href="{@docRoot}/../specs/jar/jar.html">
--- a/src/java.base/share/classes/java/util/stream/package-info.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/stream/package-info.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, 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
@@ -415,7 +415,7 @@
  * elements -- but a properly constructed reduce operation is inherently
  * parallelizable, so long as the function(s) used to process the elements
  * are <a href="package-summary.html#Associativity">associative</a> and
- * <a href="package-summary.html#NonInterfering">stateless</a>.
+ * <a href="package-summary.html#Statelessness">stateless</a>.
  * For example, given a stream of numbers for which we want to find the sum, we
  * can write:
  * <pre>{@code
--- a/src/java.base/share/classes/java/util/zip/Deflater.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Deflater.java	Tue Aug 29 10:47:16 2017 -0700
@@ -30,7 +30,7 @@
  * popular ZLIB compression library. The ZLIB compression library was
  * initially developed as part of the PNG graphics standard and is not
  * protected by patents. It is fully described in the specifications at
- * the <a href="package-summary.html#package_description">java.util.zip
+ * the <a href="package-summary.html#package.description">java.util.zip
  * package description</a>.
  *
  * <p>The following code fragment demonstrates a trivial compression
--- a/src/java.base/share/classes/java/util/zip/Inflater.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/java/util/zip/Inflater.java	Tue Aug 29 10:47:16 2017 -0700
@@ -30,7 +30,7 @@
  * popular ZLIB compression library. The ZLIB compression library was
  * initially developed as part of the PNG graphics standard and is not
  * protected by patents. It is fully described in the specifications at
- * the <a href="package-summary.html#package_description">java.util.zip
+ * the <a href="package-summary.html#package.description">java.util.zip
  * package description</a>.
  *
  * <p>The following code fragment demonstrates a trivial compression
--- a/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -213,7 +213,7 @@
      *
      * @param   sequenceNumber
      *          the sequence number (unsigned long) of the produced or
-     *          consumed SSL/TLS/DTLS record, or ${@code -1L} if no record
+     *          consumed SSL/TLS/DTLS record, or {@code -1L} if no record
      *          produced or consumed
      *
      * @throws  IllegalArgumentException
@@ -299,7 +299,7 @@
      *           implementation.
      *
      * @return  the sequence number of the produced or consumed SSL/TLS/DTLS
-     *          record; or ${@code -1L} if no record is produced or consumed,
+     *          record; or {@code -1L} if no record is produced or consumed,
      *          or this operation is not supported by the underlying provider
      *
      * @see     java.lang.Long#compareUnsigned(long, long)
--- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Tue Aug 29 10:47:16 2017 -0700
@@ -215,10 +215,10 @@
 
 
         // Step 2a: If --validate-modules is specified then the VM needs to
-        // start with only java.base, all other options are ignored.
+        // start with only system modules, all other options are ignored.
 
-        if (getAndRemoveProperty("jdk.module.minimumBoot") != null) {
-            return createMinimalBootLayer();
+        if (getAndRemoveProperty("jdk.module.validation") != null) {
+            return createBootLayerForValidation();
         }
 
 
@@ -421,12 +421,19 @@
     }
 
     /**
-     * Create a "minimal" boot module layer that only contains java.base.
+     * Create a boot module layer for validation that resolves all
+     * system modules.
      */
-    private static ModuleLayer createMinimalBootLayer() {
+    private static ModuleLayer createBootLayerForValidation() {
+        Set<String> allSystem = ModuleFinder.ofSystem().findAll()
+            .stream()
+            .map(ModuleReference::descriptor)
+            .map(ModuleDescriptor::name)
+            .collect(Collectors.toSet());
+
         Configuration cf = SharedSecrets.getJavaLangModuleAccess()
             .resolveAndBind(ModuleFinder.ofSystem(),
-                            Set.of(JAVA_BASE),
+                            allSystem,
                             null);
 
         Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
--- a/src/java.base/share/native/libjli/java.c	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/share/native/libjli/java.c	Tue Aug 29 10:47:16 2017 -0700
@@ -1296,7 +1296,7 @@
         } else if (JLI_StrCmp(arg, "--show-resolved-modules") == 0) {
             showResolvedModules = JNI_TRUE;
         } else if (JLI_StrCmp(arg, "--validate-modules") == 0) {
-            AddOption("-Djdk.module.minimumBoot=true", NULL);
+            AddOption("-Djdk.module.validation=true", NULL);
             validateModules = JNI_TRUE;
         } else if (JLI_StrCmp(arg, "--describe-module") == 0 ||
                    JLI_StrCCmp(arg, "--describe-module=") == 0 ||
--- a/src/java.base/unix/native/libnio/ch/FileChannelImpl.c	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/unix/native/libnio/ch/FileChannelImpl.c	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -140,18 +140,6 @@
 }
 
 
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo)
-{
-    jint fd = fdval(env, fdo);
-    if (fd != -1) {
-        jlong result = close(fd);
-        if (result < 0) {
-            JNU_ThrowIOExceptionWithLastError(env, "Close failed");
-        }
-    }
-}
-
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
                                             jobject srcFDO,
--- a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -176,7 +176,5 @@
 
     static native void close0(FileDescriptor fd) throws IOException;
 
-    static native void closeByHandle(long fd) throws IOException;
-
     static native long duplicateHandle(long fd) throws IOException;
 }
--- a/src/java.base/windows/native/libnio/ch/FileChannelImpl.c	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/windows/native/libnio/ch/FileChannelImpl.c	Tue Aug 29 10:47:16 2017 -0700
@@ -165,18 +165,6 @@
     return (jlong)where.QuadPart;
 }
 
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo)
-{
-    HANDLE h = (HANDLE)(handleval(env, fdo));
-    if (h != INVALID_HANDLE_VALUE) {
-        BOOL result = CloseHandle(h);
-        if (result == 0) {
-            JNU_ThrowIOExceptionWithLastError(env, "Close failed");
-        }
-    }
-}
-
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
                                             jobject srcFD,
--- a/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c	Tue Aug 29 10:47:16 2017 -0700
@@ -433,8 +433,10 @@
     }
 }
 
-static void closeFile(JNIEnv *env, jlong fd) {
-    HANDLE h = (HANDLE)fd;
+JNIEXPORT void JNICALL
+Java_sun_nio_ch_FileDispatcherImpl_close0(JNIEnv *env, jclass clazz, jobject fdo)
+{
+    HANDLE h = (HANDLE)handleval(env, fdo);
     if (h != INVALID_HANDLE_VALUE) {
         int result = CloseHandle(h);
         if (result == 0)
@@ -442,19 +444,6 @@
     }
 }
 
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_FileDispatcherImpl_close0(JNIEnv *env, jclass clazz, jobject fdo)
-{
-    jlong fd = handleval(env, fdo);
-    closeFile(env, fd);
-}
-
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_FileDispatcherImpl_closeByHandle(JNIEnv *env, jclass clazz, jlong fd)
-{
-    closeFile(env, fd);
-}
-
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileDispatcherImpl_duplicateHandle(JNIEnv *env, jclass this, jlong handle)
 {
--- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -307,11 +307,7 @@
             this.flags = new boolean[NUM_FLAGS];
         }
 
-        if (this.flags[RENEWABLE_TICKET_FLAG]) {
-           if (renewTill == null) {
-               throw new IllegalArgumentException("The renewable period "
-                       + "end time cannot be null for renewable tickets.");
-           }
+        if (this.flags[RENEWABLE_TICKET_FLAG] && renewTill != null) {
            this.renewTill = new Date(renewTill.getTime());
         }
 
@@ -579,6 +575,12 @@
         if (!isRenewable()) {
             throw new RefreshFailedException("This ticket is not renewable");
         }
+
+        if (getRenewTill() == null) {
+            // Renewable ticket without renew-till. Illegal and ignored.
+            return;
+        }
+
         if (System.currentTimeMillis() > getRenewTill().getTime()) {
             throw new RefreshFailedException("This ticket is past "
                                            + "its last renewal time.");
--- a/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 import sun.security.krb5.internal.crypto.*;
 import java.io.IOException;
 import java.net.UnknownHostException;
+import java.time.Instant;
 
 /**
  * This class encapsulates a Kerberos TGS-REQ that is sent from the
@@ -285,7 +286,12 @@
         throws IOException, KrbException, UnknownHostException {
         KerberosTime req_till = null;
         if (till == null) {
-            req_till = new KerberosTime(0);
+            String d = Config.getInstance().get("libdefaults", "ticket_lifetime");
+            if (d != null) {
+                req_till = new KerberosTime(Instant.now().plusSeconds(Config.duration(d)));
+            } else {
+                req_till = new KerberosTime(0); // Choose KDC maximum allowed
+            }
         } else {
             req_till = till;
         }
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -994,6 +994,10 @@
             if (!creds.isRenewable())
                 throw new RefreshFailedException("This ticket" +
                                 " is not renewable");
+            if (creds.getRenewTill() == null) {
+                // Renewable ticket without renew-till. Illegal and ignored.
+                return creds;
+            }
             if (System.currentTimeMillis() > cred.getRenewTill().getTime())
                 throw new RefreshFailedException("This ticket is past "
                                              + "its last renewal time.");
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Tue Aug 29 10:47:16 2017 -0700
@@ -310,7 +310,10 @@
 
     @Override
     public boolean startsWith(Path other) {
-        final ZipPath o = checkPath(other);
+        Objects.requireNonNull(other, "other");
+        if (!(other instanceof ZipPath))
+            return false;
+        final ZipPath o = (ZipPath)other;
         if (o.isAbsolute() != this.isAbsolute() ||
             o.path.length > this.path.length)
             return false;
@@ -327,7 +330,10 @@
 
     @Override
     public boolean endsWith(Path other) {
-        final ZipPath o = checkPath(other);
+        Objects.requireNonNull(other, "other");
+        if (!(other instanceof ZipPath))
+            return false;
+        final ZipPath o = (ZipPath)other;
         int olast = o.path.length - 1;
         if (olast > 0 && o.path[olast] == '/')
             olast--;
--- a/test/TEST.ROOT	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/TEST.ROOT	Tue Aug 29 10:47:16 2017 -0700
@@ -26,7 +26,17 @@
 groups=TEST.groups [closed/TEST.groups]
 
 # Allow querying of various System properties in @requires clauses
-requires.properties=sun.arch.data.model java.runtime.name
+#
+# Source files for classes that will be used at the beginning of each test suite run,
+# to determine additional characteristics of the system for use with the @requires tag.
+# Note: compiled bootlibs code will be located in the folder 'bootClasses'
+requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java [../../closed/test/jtreg-ext/requires/VMPropsExt.java]
+requires.extraPropDefns.bootlibs = ../../test/lib/sun ../../test/lib/jdk/test/lib/Platform.java
+requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:bootClasses
+requires.properties= \
+    sun.arch.data.model \
+    java.runtime.name \
+    vm.cds
 
 # Minimum jtreg version
 requiredVersion=4.2 b08
--- a/test/com/sun/jdi/cds/CDSBreakpointTest.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/com/sun/jdi/cds/CDSBreakpointTest.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 8054386
  * @summary java debugging test for CDS
+ * @requires vm.cds
  * @modules jdk.jdi
  *          java.management
  *          jdk.jartool/sun.tools.jar
--- a/test/com/sun/jdi/cds/CDSDeleteAllBkptsTest.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/com/sun/jdi/cds/CDSDeleteAllBkptsTest.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 8054386
  * @summary java debugging test for CDS
+ * @requires vm.cds
  * @modules jdk.jdi
  *          java.management
  *          jdk.jartool/sun.tools.jar
--- a/test/com/sun/jdi/cds/CDSFieldWatchpoints.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/com/sun/jdi/cds/CDSFieldWatchpoints.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 8054386
  * @summary java debugging test for CDS
+ * @requires vm.cds
  * @modules jdk.jdi
  *          java.management
  *          jdk.jartool/sun.tools.jar
--- a/test/java/lang/String/concat/StringConcatFactoryInvariants.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/java/lang/String/concat/StringConcatFactoryInvariants.java	Tue Aug 29 10:47:16 2017 -0700
@@ -70,7 +70,33 @@
         String methodName = "foo";
         MethodType mt = MethodType.methodType(String.class, String.class, int.class);
         String recipe = "" + TAG_ARG + TAG_ARG + TAG_CONST;
-        String[] constants = new String[]{"bar"};
+        Object[][] constants = new Object[][] {
+                new String[] { "bar" },
+                new Integer[] { 1 },
+                new Short[] { 2 },
+                new Long[] { 3L },
+                new Boolean[] { true },
+                new Character[] { 'a' },
+                new Byte[] { -128 },
+                new Class[] { String.class },
+                new MethodHandle[] { MethodHandles.constant(String.class, "constant") },
+                new MethodType[] { MethodType.methodType(String.class) }
+        };
+        // The string representation that should end up if the corresponding
+        // Object[] in constants is used as an argument to makeConcatWithConstants
+        String[] constantString = new String[] {
+                "bar",
+                "1",
+                "2",
+                "3",
+                "true",
+                "a",
+                "-128",
+                "class java.lang.String",
+                "MethodHandle()String",
+                "()String"
+        };
+
 
         final int LIMIT = 200;
 
@@ -109,8 +135,10 @@
         }
 
         {
-            CallSite cs = StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, recipe, constants);
-            test("foo42bar", (String) cs.getTarget().invokeExact("foo", 42));
+            for (int i = 0; i < constants.length; i++) {
+                CallSite cs = StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, recipe, constants[i]);
+                test("foo42".concat(constantString[i]), (String) cs.getTarget().invokeExact("foo", 42));
+            }
         }
 
         // Simple factory, check for nulls:
@@ -124,20 +152,27 @@
                 () -> StringConcatFactory.makeConcat(lookup, methodName, null));
 
         // Advanced factory, check for nulls:
-        failNPE("Lookup is null",
-                () -> StringConcatFactory.makeConcatWithConstants(null, methodName, mt, recipe, constants));
+        for (int i = 0; i < constants.length; i++) {
+            final Object[] consts = constants[i];
 
-        failNPE("Method name is null",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, null, mt, recipe, constants));
+            failNPE("Lookup is null",
+                    () -> StringConcatFactory.makeConcatWithConstants(null, methodName, mt, recipe, consts));
 
-        failNPE("MethodType is null",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, null, recipe, constants));
+            failNPE("Method name is null",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, null, mt, recipe, consts));
 
-        failNPE("Recipe is null",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, null, constants));
+            failNPE("MethodType is null",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, null, recipe, consts));
+
+            failNPE("Recipe is null",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, null, consts));
+        }
 
         failNPE("Constants vararg is null",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, recipe, null));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, recipe, (Object[]) null));
+
+        failNPE("Constant argument is null",
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mt, recipe, new Object[] { null }));
 
         // Simple factory, check for return type
         fail("Return type: void",
@@ -159,23 +194,26 @@
                 () -> StringConcatFactory.makeConcat(lookup, methodName, MethodType.methodType(Serializable.class, String.class, int.class)));
 
         // Advanced factory, check for return types
-        fail("Return type: void",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(void.class, String.class, int.class), recipe, constants));
+        for (int i = 0; i < constants.length; i++) {
+            final Object[] consts = constants[i];
+            fail("Return type: void",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(void.class, String.class, int.class), recipe, consts));
 
-        fail("Return type: int",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(int.class, String.class, int.class), recipe, constants));
+            fail("Return type: int",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(int.class, String.class, int.class), recipe, consts));
 
-        fail("Return type: StringBuilder",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(StringBuilder.class, String.class, int.class), recipe, constants));
+            fail("Return type: StringBuilder",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(StringBuilder.class, String.class, int.class), recipe, consts));
 
-        ok("Return type: Object",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(Object.class, String.class, int.class), recipe, constants));
+            ok("Return type: Object",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(Object.class, String.class, int.class), recipe, consts));
 
-        ok("Return type: CharSequence",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(CharSequence.class, String.class, int.class), recipe, constants));
+            ok("Return type: CharSequence",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(CharSequence.class, String.class, int.class), recipe, consts));
 
-        ok("Return type: Serializable",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(Serializable.class, String.class, int.class), recipe, constants));
+            ok("Return type: Serializable",
+                    () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(Serializable.class, String.class, int.class), recipe, consts));
+        }
 
         // Simple factory: check for dynamic arguments overflow
         ok("Dynamic arguments is under limit",
@@ -189,13 +227,13 @@
 
         // Advanced factory: check for dynamic arguments overflow
         ok("Dynamic arguments is under limit",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtUnderThreshold, recipeUnderThreshold, constants));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtUnderThreshold, recipeUnderThreshold, constants[0]));
 
         ok("Dynamic arguments is at the limit",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeThreshold, constants));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeThreshold, constants[0]));
 
         fail("Dynamic arguments is over the limit",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtOverThreshold, recipeOverThreshold, constants));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtOverThreshold, recipeOverThreshold, constants[0]));
 
         // Advanced factory: check for mismatched recipe and Constants
         ok("Static arguments and recipe match",
@@ -206,17 +244,17 @@
 
         // Advanced factory: check for mismatched recipe and dynamic arguments
         fail("Dynamic arguments and recipe mismatch",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeUnderThreshold, constants));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeUnderThreshold, constants[0]));
 
         ok("Dynamic arguments and recipe match",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeThreshold, constants));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeThreshold, constants[0]));
 
         fail("Dynamic arguments and recipe mismatch",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeOverThreshold, constants));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, mtThreshold, recipeOverThreshold, constants[0]));
 
         // Test passing array as constant
         {
-            String[] arg = {"boo", "bar"};
+            Object[] arg = {"boo", "bar"};
 
             CallSite cs1 = StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(String.class, int.class), "" + TAG_ARG + TAG_CONST + TAG_CONST, arg);
             test("42boobar", (String) cs1.getTarget().invokeExact(42));
@@ -227,7 +265,7 @@
                 () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(String.class, int.class), "" + TAG_ARG + TAG_CONST, "foo"));
 
         failNPE("Cannot pass null constants",
-                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(String.class, int.class), "" + TAG_ARG + TAG_CONST, new String[]{null}));
+                () -> StringConcatFactory.makeConcatWithConstants(lookup, methodName, MethodType.methodType(String.class, int.class), "" + TAG_ARG + TAG_CONST, new Object[]{null}));
 
         // Simple factory: test empty arguments
         ok("Ok to pass empty arguments",
--- a/test/java/net/ipv6tests/TcpTest.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/java/net/ipv6tests/TcpTest.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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 4868820
  * @key intermittent
  * @summary IPv6 support for Windows XP and 2003 server
+ * @run main TcpTest -d
  */
 
 import java.net.*;
@@ -126,6 +127,9 @@
         } catch (IOException e) { }
         server.close ();
         c1.close ();
+        if (c2 != null) {
+            c2.close();
+        }
 
         /* now try IPv6 only */
 
@@ -137,11 +141,15 @@
 
         c1 = new Socket (ia6addr, port);
         try {
+            dprintln ("connecting to " + ia4addr);
             c2 = new Socket (ia4addr, port);
             throw new RuntimeException ("connect to IPv4 address should be refused");
         } catch (IOException e) { }
         server.close ();
         c1.close ();
+        if (c2 != null) {
+            c2.close();
+        }
 
         System.out.println ("Test2: OK");
     }
--- a/test/java/rmi/testlibrary/TestSocketFactory.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/java/rmi/testlibrary/TestSocketFactory.java	Tue Aug 29 10:47:16 2017 -0700
@@ -45,20 +45,43 @@
 import java.util.Set;
 
 import org.testng.Assert;
-import org.testng.TestNG;
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
 
+/*
+ * @test
+ * @summary TestSocket Factory and tests of the basic trigger, match, and replace functions
+ * @run testng TestSocketFactory
+ * @bug 8186539
+ */
 
 /**
  * A RMISocketFactory utility factory to log RMI stream contents and to
- * match and replace output stream contents to simulate failures.
+ * trigger, and then match and replace output stream contents to simulate failures.
+ * <p>
+ * The trigger is a sequence of bytes that must be found before looking
+ * for the bytes to match and replace.  If the trigger sequence is empty
+ * matching is immediately enabled. While waiting for the trigger to be found
+ * bytes written to the streams are written through to the output stream.
+ * The when triggered and when a trigger is non-empty, matching looks for
+ * the sequence of bytes supplied.  If the sequence is empty, no matching or
+ * replacement is performed.
+ * While waiting for a complete match, the partial matched bytes are not
+ * written to the output stream.  When the match is incomplete, the partial
+ * matched bytes are written to the output.  When a match is complete the
+ * full replacement byte array is written to the output.
+ * <p>
+ * The trigger, match, and replacement bytes arrays can be changed at any
+ * time and immediately reset and restart matching.  Changes are propagated
+ * to all of the sockets created from the factories immediately.
  */
 public class TestSocketFactory extends RMISocketFactory
         implements RMIClientSocketFactory, RMIServerSocketFactory, Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    private volatile transient byte[] triggerBytes;
+
     private volatile transient byte[] matchBytes;
 
     private volatile transient byte[] replaceBytes;
@@ -67,6 +90,8 @@
 
     private transient final List<InterposeServerSocket> serverSockets = new ArrayList<>();
 
+    static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
+
     public static final boolean DEBUG = false;
 
     /**
@@ -82,28 +107,51 @@
     }
 
     /**
-     * Create a socket factory that creates InputStreams that log
-     * and OutputStreams that log .
+     * Create a socket factory that creates InputStreams
+     * and OutputStreams that log.
      */
     public TestSocketFactory() {
-        this.matchBytes = new byte[0];
-        this.replaceBytes = this.matchBytes;
-        System.out.printf("Creating TestSocketFactory()%n");
+        this.triggerBytes = EMPTY_BYTE_ARRAY;
+        this.matchBytes = EMPTY_BYTE_ARRAY;
+        this.replaceBytes = EMPTY_BYTE_ARRAY;
     }
 
+    /**
+     * Set the match and replacement bytes, with an empty trigger.
+     * The match and replacements are propagated to all existing sockets.
+     *
+     * @param matchBytes bytes to match
+     * @param replaceBytes bytes to replace the matched bytes
+     */
     public void setMatchReplaceBytes(byte[] matchBytes, byte[] replaceBytes) {
+        setMatchReplaceBytes(EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+    }
+
+    /**
+     * Set the trigger, match, and replacement bytes.
+     * The trigger, match, and replacements are propagated to all existing sockets.
+     *
+     * @param triggerBytes array of bytes to use as a trigger, may be zero length
+     * @param matchBytes bytes to match after the trigger has been seen
+     * @param replaceBytes bytes to replace the matched bytes
+     */
+    public void setMatchReplaceBytes(byte[] triggerBytes, byte[] matchBytes,
+                                     byte[] replaceBytes) {
+        this.triggerBytes = Objects.requireNonNull(triggerBytes, "triggerBytes");
         this.matchBytes = Objects.requireNonNull(matchBytes, "matchBytes");
         this.replaceBytes = Objects.requireNonNull(replaceBytes, "replaceBytes");
-        sockets.forEach( s -> s.setMatchReplaceBytes(matchBytes, replaceBytes));
-        serverSockets.forEach( s -> s.setMatchReplaceBytes(matchBytes, replaceBytes));
-
+        sockets.forEach( s -> s.setMatchReplaceBytes(triggerBytes, matchBytes,
+                replaceBytes));
+        serverSockets.forEach( s -> s.setMatchReplaceBytes(triggerBytes, matchBytes,
+                replaceBytes));
     }
 
     @Override
     public Socket createSocket(String host, int port) throws IOException {
         Socket socket = RMISocketFactory.getDefaultSocketFactory()
                 .createSocket(host, port);
-        InterposeSocket s = new InterposeSocket(socket, matchBytes, replaceBytes);
+        InterposeSocket s = new InterposeSocket(socket,
+                triggerBytes, matchBytes, replaceBytes);
         sockets.add(s);
         return s;
     }
@@ -122,7 +170,8 @@
 
         ServerSocket serverSocket = RMISocketFactory.getDefaultSocketFactory()
                 .createServerSocket(port);
-        InterposeServerSocket ss = new InterposeServerSocket(serverSocket, matchBytes, replaceBytes);
+        InterposeServerSocket ss = new InterposeServerSocket(serverSocket,
+                triggerBytes, matchBytes, replaceBytes);
         serverSockets.add(ss);
         return ss;
     }
@@ -139,13 +188,15 @@
     /**
      * An InterposeSocket wraps a socket that produces InputStreams
      * and OutputStreams that log the traffic.
-     * The OutputStreams it produces match an array of bytes and replace them.
+     * The OutputStreams it produces watch for a trigger and then
+     * match an array of bytes and replace them.
      * Useful for injecting protocol and content errors.
      */
     public static class InterposeSocket extends Socket {
         private final Socket socket;
         private InputStream in;
         private MatchReplaceOutputStream out;
+        private volatile byte[] triggerBytes;
         private volatile byte[] matchBytes;
         private volatile byte[] replaceBytes;
         private final ByteArrayOutputStream inLogStream;
@@ -153,8 +204,28 @@
         private final String name;
         private static volatile int num = 0;    // index for created InterposeSockets
 
+        /**
+         * Construct a socket that interposes on a socket to match and replace.
+         * The trigger is empty.
+         * @param socket the underlying socket
+         * @param matchBytes the bytes that must match
+         * @param replaceBytes the replacement bytes
+         */
         public InterposeSocket(Socket socket, byte[] matchBytes, byte[] replaceBytes) {
+            this(socket, EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+        }
+
+        /**
+         * Construct a socket that interposes on a socket to match and replace.
+         * @param socket the underlying socket
+         * @param triggerBytes array of bytes to enable matching
+         * @param matchBytes the bytes that must match
+         * @param replaceBytes the replacement bytes
+         */
+        public InterposeSocket(Socket socket, byte[]
+                triggerBytes, byte[] matchBytes, byte[] replaceBytes) {
             this.socket = socket;
+            this.triggerBytes = Objects.requireNonNull(triggerBytes, "triggerBytes");
             this.matchBytes = Objects.requireNonNull(matchBytes, "matchBytes");
             this.replaceBytes = Objects.requireNonNull(replaceBytes, "replaceBytes");
             this.inLogStream = new ByteArrayOutputStream();
@@ -164,10 +235,32 @@
                     + socket.getLocalPort() + " <  " + socket.getPort();
         }
 
+        /**
+         * Set the match and replacement bytes, with an empty trigger.
+         * The match and replacements are propagated to all existing sockets.
+         *
+         * @param matchBytes bytes to match
+         * @param replaceBytes bytes to replace the matched bytes
+         */
         public void setMatchReplaceBytes(byte[] matchBytes, byte[] replaceBytes) {
+            this.setMatchReplaceBytes(EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+        }
+
+        /**
+         * Set the trigger, match, and replacement bytes.
+         * The trigger, match, and replacements are propagated to the
+         * MatchReplaceOutputStream.
+         *
+         * @param triggerBytes array of bytes to use as a trigger, may be zero length
+         * @param matchBytes bytes to match after the trigger has been seen
+         * @param replaceBytes bytes to replace the matched bytes
+         */
+        public void setMatchReplaceBytes(byte[] triggerBytes, byte[] matchBytes,
+                                         byte[] replaceBytes) {
+            this.triggerBytes = triggerBytes;
             this.matchBytes = matchBytes;
             this.replaceBytes = replaceBytes;
-            out.setMatchReplaceBytes(matchBytes, replaceBytes);
+            out.setMatchReplaceBytes(triggerBytes, matchBytes, replaceBytes);
         }
 
         @Override
@@ -278,7 +371,8 @@
                 OutputStream o = socket.getOutputStream();
                 String name = Thread.currentThread().getName() + ": "
                         + socket.getLocalPort() + "  > " + socket.getPort();
-                out = new MatchReplaceOutputStream(o, name, outLogStream, matchBytes, replaceBytes);
+                out = new MatchReplaceOutputStream(o, name, outLogStream,
+                        triggerBytes, matchBytes, replaceBytes);
                 DEBUG("Created new MatchReplaceOutputStream: %s%n", name);
             }
             return out;
@@ -308,20 +402,63 @@
      */
     public static class InterposeServerSocket extends ServerSocket {
         private final ServerSocket socket;
+        private volatile byte[] triggerBytes;
         private volatile byte[] matchBytes;
         private volatile byte[] replaceBytes;
         private final List<InterposeSocket> sockets = new ArrayList<>();
 
-        public InterposeServerSocket(ServerSocket socket, byte[] matchBytes, byte[] replaceBytes) throws IOException {
+        /**
+         * Construct a server socket that interposes on a socket to match and replace.
+         * The trigger is empty.
+         * @param socket the underlying socket
+         * @param matchBytes the bytes that must match
+         * @param replaceBytes the replacement bytes
+         */
+        public InterposeServerSocket(ServerSocket socket, byte[] matchBytes,
+                                     byte[] replaceBytes) throws IOException {
+            this(socket, EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+        }
+
+        /**
+         * Construct a server socket that interposes on a socket to match and replace.
+         * @param socket the underlying socket
+         * @param triggerBytes array of bytes to enable matching
+         * @param matchBytes the bytes that must match
+         * @param replaceBytes the replacement bytes
+         */
+        public InterposeServerSocket(ServerSocket socket, byte[] triggerBytes,
+                                     byte[] matchBytes, byte[] replaceBytes) throws IOException {
             this.socket = socket;
+            this.triggerBytes = Objects.requireNonNull(triggerBytes, "triggerBytes");
             this.matchBytes = Objects.requireNonNull(matchBytes, "matchBytes");
             this.replaceBytes = Objects.requireNonNull(replaceBytes, "replaceBytes");
         }
 
+        /**
+         * Set the match and replacement bytes, with an empty trigger.
+         * The match and replacements are propagated to all existing sockets.
+         *
+         * @param matchBytes bytes to match
+         * @param replaceBytes bytes to replace the matched bytes
+         */
         public void setMatchReplaceBytes(byte[] matchBytes, byte[] replaceBytes) {
+            setMatchReplaceBytes(EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+        }
+
+        /**
+         * Set the trigger, match, and replacement bytes.
+         * The trigger, match, and replacements are propagated to all existing sockets.
+         *
+         * @param triggerBytes array of bytes to use as a trigger, may be zero length
+         * @param matchBytes bytes to match after the trigger has been seen
+         * @param replaceBytes bytes to replace the matched bytes
+         */
+        public void setMatchReplaceBytes(byte[] triggerBytes, byte[] matchBytes,
+                                         byte[] replaceBytes) {
+            this.triggerBytes = triggerBytes;
             this.matchBytes = matchBytes;
             this.replaceBytes = replaceBytes;
-            sockets.forEach(s -> s.setMatchReplaceBytes(matchBytes, replaceBytes));
+            sockets.forEach(s -> s.setMatchReplaceBytes(triggerBytes, matchBytes, replaceBytes));
         }
         /**
          * Return a snapshot of the current list of sockets created from this server socket.
@@ -386,7 +523,8 @@
         }
 
         @Override
-        public <T> ServerSocket setOption(SocketOption<T> name, T value) throws IOException {
+        public <T> ServerSocket setOption(SocketOption<T> name, T value)
+                throws IOException {
             return socket.setOption(name, value);
         }
 
@@ -463,22 +601,33 @@
     }
 
     /**
-     * An OutputStream that replaces one string of bytes with another.
+     * An OutputStream that looks for a trigger to enable matching and
+     * replaces one string of bytes with another.
      * If any range matches, the match starts after the partial match.
      */
     static class MatchReplaceOutputStream extends OutputStream {
         private final OutputStream out;
         private final String name;
+        private volatile byte[] triggerBytes;
         private volatile byte[] matchBytes;
         private volatile byte[] replaceBytes;
+        int triggerIndex;
         int matchIndex;
         private int bytesOut = 0;
         private final OutputStream log;
 
         MatchReplaceOutputStream(OutputStream out, String name, OutputStream log,
                                  byte[] matchBytes, byte[] replaceBytes) {
+            this(out, name, log, EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+        }
+
+        MatchReplaceOutputStream(OutputStream out, String name, OutputStream log,
+                                 byte[] triggerBytes, byte[] matchBytes,
+                                 byte[] replaceBytes) {
             this.out = out;
             this.name = name;
+            this.triggerBytes = Objects.requireNonNull(triggerBytes, "triggerBytes");
+            triggerIndex = 0;
             this.matchBytes = Objects.requireNonNull(matchBytes, "matchBytes");
             this.replaceBytes = Objects.requireNonNull(replaceBytes, "replaceBytes");
             matchIndex = 0;
@@ -486,8 +635,15 @@
         }
 
         public void setMatchReplaceBytes(byte[] matchBytes, byte[] replaceBytes) {
-            this.matchBytes = matchBytes;
-            this.replaceBytes = replaceBytes;
+            setMatchReplaceBytes(EMPTY_BYTE_ARRAY, matchBytes, replaceBytes);
+        }
+
+        public void setMatchReplaceBytes(byte[] triggerBytes, byte[] matchBytes,
+                                         byte[] replaceBytes) {
+            this.triggerBytes = Objects.requireNonNull(triggerBytes, "triggerBytes");
+            triggerIndex = 0;
+            this.matchBytes = Objects.requireNonNull(matchBytes, "matchBytes");
+            this.replaceBytes = Objects.requireNonNull(replaceBytes, "replaceBytes");
             matchIndex = 0;
         }
 
@@ -495,36 +651,52 @@
         public void write(int b) throws IOException {
             b = b & 0xff;
             if (matchBytes.length == 0) {
+                // fast path, no match
                 out.write(b);
                 log.write(b);
                 bytesOut++;
                 return;
             }
-            if (b == (matchBytes[matchIndex] & 0xff)) {
-                if (++matchIndex >= matchBytes.length) {
-                    matchIndex = 0;
-                    DEBUG( "TestSocketFactory MatchReplace %s replaced %d bytes at offset: %d (x%04x)%n",
-                            name, replaceBytes.length, bytesOut, bytesOut);
-                    out.write(replaceBytes);
-                    log.write(replaceBytes);
-                    bytesOut += replaceBytes.length;
-                }
+            // if trigger not satisfied, keep looking
+            if (triggerBytes.length != 0 && triggerIndex < triggerBytes.length) {
+                out.write(b);
+                log.write(b);
+                bytesOut++;
+
+                triggerIndex = (b == (triggerBytes[triggerIndex] & 0xff))
+                        ? ++triggerIndex    // matching advance
+                        : 0;                // no match, reset
             } else {
-                if (matchIndex > 0) {
-                    // mismatch, write out any that matched already
-                    DEBUG("Partial match %s matched %d bytes at offset: %d (0x%04x), expected: x%02x, actual: x%02x%n",
-                            name, matchIndex, bytesOut, bytesOut, matchBytes[matchIndex], b);
-                    out.write(matchBytes, 0, matchIndex);
-                    log.write(matchBytes, 0, matchIndex);
-                    bytesOut += matchIndex;
-                    matchIndex = 0;
-                }
+                // trigger not used or has been satisfied
                 if (b == (matchBytes[matchIndex] & 0xff)) {
-                    matchIndex++;
+                    if (++matchIndex >= matchBytes.length) {
+                        matchIndex = 0;
+                        triggerIndex = 0;       // match/replace ok, reset trigger
+                        DEBUG("TestSocketFactory MatchReplace %s replaced %d bytes " +
+                                "at offset: %d (x%04x)%n",
+                                name, replaceBytes.length, bytesOut, bytesOut);
+                        out.write(replaceBytes);
+                        log.write(replaceBytes);
+                        bytesOut += replaceBytes.length;
+                    }
                 } else {
-                    out.write(b);
-                    log.write(b);
-                    bytesOut++;
+                    if (matchIndex > 0) {
+                        // mismatch, write out any that matched already
+                        DEBUG("Partial match %s matched %d bytes at offset: %d (0x%04x), " +
+                                " expected: x%02x, actual: x%02x%n",
+                                name, matchIndex, bytesOut, bytesOut, matchBytes[matchIndex], b);
+                        out.write(matchBytes, 0, matchIndex);
+                        log.write(matchBytes, 0, matchIndex);
+                        bytesOut += matchIndex;
+                        matchIndex = 0;
+                    }
+                    if (b == (matchBytes[matchIndex] & 0xff)) {
+                        matchIndex++;
+                    } else {
+                        out.write(b);
+                        log.write(b);
+                        bytesOut++;
+                    }
                 }
             }
         }
@@ -548,18 +720,44 @@
         }
     }
 
-    private static byte[] orig = new byte[]{
+    private static byte[] obj1Data = new byte[] {
+            0x7e, 0x7e, 0x7e,
             (byte) 0x80, 0x05,
-            0x73, 0x72, 0x00, 0x12, // TC_OBJECT, TC_CLASSDESC, length = 18
-            0x6A, 0x61, 0x76, 0x61, 0x2E, 0x72, 0x6D, 0x69, 0x2E, // "java.rmi."
-            0x64, 0x67, 0x63, 0x2E, 0x4C, 0x65, 0x61, 0x73, 0x65  // "dgc.Lease"
+            0x7f, 0x7f, 0x7f,
+            0x73, 0x72, 0x00, 0x10, // TC_OBJECT, TC_CLASSDESC, length = 16
+            (byte)'j', (byte)'a', (byte)'v', (byte)'a', (byte)'.',
+            (byte)'l', (byte)'a', (byte)'n', (byte)'g', (byte)'.',
+            (byte)'n', (byte)'u', (byte)'m', (byte)'b', (byte)'e', (byte)'r'
     };
-    private static byte[] repl = new byte[]{
+    private static byte[] obj1Result = new byte[] {
+            0x7e, 0x7e, 0x7e,
             (byte) 0x80, 0x05,
-            0x73, 0x72, 0x00, 0x12, // TC_OBJECT, TC_CLASSDESC, length = 18
-            0x6A, 0x61, 0x76, 0x61, 0x2E, (byte) 'l', (byte) 'a', (byte) 'n', (byte) 'g',
-            0x2E, (byte) 'R', (byte) 'u', (byte) 'n', (byte) 'n', (byte) 'a', (byte) 'b', (byte) 'l',
-            (byte) 'e'
+            0x7f, 0x7f, 0x7f,
+            0x73, 0x72, 0x00, 0x11, // TC_OBJECT, TC_CLASSDESC, length = 17
+            (byte)'j', (byte)'a', (byte)'v', (byte)'a', (byte)'.',
+            (byte)'l', (byte)'a', (byte)'n', (byte)'g', (byte)'.',
+            (byte)'I', (byte)'n', (byte)'t', (byte)'e', (byte)'g', (byte)'e', (byte)'r'
+    };
+    private static byte[] obj1Trigger = new byte[] {
+            (byte) 0x80, 0x05
+    };
+    private static byte[] obj1Trigger2 = new byte[] {
+            0x7D, 0x7D, 0x7D, 0x7D,
+    };
+    private static byte[] obj1Trigger3 = new byte[] {
+            0x7F,
+    };
+    private static byte[] obj1Match = new byte[] {
+            0x73, 0x72, 0x00, 0x10, // TC_OBJECT, TC_CLASSDESC, length = 16
+            (byte)'j', (byte)'a', (byte)'v', (byte)'a', (byte)'.',
+            (byte)'l', (byte)'a', (byte)'n', (byte)'g', (byte)'.',
+            (byte)'n', (byte)'u', (byte)'m', (byte)'b', (byte)'e', (byte)'r'
+    };
+    private static byte[] obj1Repl = new byte[] {
+            0x73, 0x72, 0x00, 0x11, // TC_OBJECT, TC_CLASSDESC, length = 17
+            (byte)'j', (byte)'a', (byte)'v', (byte)'a', (byte)'.',
+            (byte)'l', (byte)'a', (byte)'n', (byte)'g', (byte)'.',
+            (byte)'I', (byte)'n', (byte)'t', (byte)'e', (byte)'g', (byte)'e', (byte)'r'
     };
 
     @DataProvider(name = "MatchReplaceData")
@@ -574,26 +772,42 @@
         byte[] bytes6 = new byte[]{1, 2, 0x10, 0x20, 0x30};
 
         return new Object[][]{
-                {new byte[]{}, new byte[]{}, empty, empty},
-                {new byte[]{}, new byte[]{}, byte1, byte1},
-                {new byte[]{3, 4}, new byte[]{4, 3}, byte1, bytes2}, //swap bytes
-                {new byte[]{3, 4}, new byte[]{0x10, 0x20, 0x30, 0x40}, byte1, bytes4}, // insert
-                {new byte[]{1, 2, 0x10, 0x20}, new byte[]{}, bytes4, bytes5}, // delete head
-                {new byte[]{0x40, 5, 6}, new byte[]{}, bytes4, bytes6},   // delete tail
-                {new byte[]{0x40, 0x50}, new byte[]{0x60, 0x50}, bytes4, bytes4}, // partial match, replace nothing
-                {bytes4a, bytes3, bytes4, bytes4}, // long partial match, not replaced
-                {orig, repl, orig, repl},
+                {EMPTY_BYTE_ARRAY, new byte[]{}, new byte[]{},
+                        empty, empty},
+                {EMPTY_BYTE_ARRAY, new byte[]{}, new byte[]{},
+                        byte1, byte1},
+                {EMPTY_BYTE_ARRAY, new byte[]{3, 4}, new byte[]{4, 3},
+                        byte1, bytes2}, //swap bytes
+                {EMPTY_BYTE_ARRAY, new byte[]{3, 4}, new byte[]{0x10, 0x20, 0x30, 0x40},
+                        byte1, bytes4}, // insert
+                {EMPTY_BYTE_ARRAY, new byte[]{1, 2, 0x10, 0x20}, new byte[]{},
+                        bytes4, bytes5}, // delete head
+                {EMPTY_BYTE_ARRAY, new byte[]{0x40, 5, 6}, new byte[]{},
+                        bytes4, bytes6},   // delete tail
+                {EMPTY_BYTE_ARRAY, new byte[]{0x40, 0x50}, new byte[]{0x60, 0x50},
+                        bytes4, bytes4}, // partial match, replace nothing
+                {EMPTY_BYTE_ARRAY, bytes4a, bytes3,
+                        bytes4, bytes4}, // long partial match, not replaced
+                {EMPTY_BYTE_ARRAY, obj1Match, obj1Repl,
+                        obj1Match, obj1Repl},
+                {obj1Trigger, obj1Match, obj1Repl,
+                        obj1Data, obj1Result},
+                {obj1Trigger3, obj1Match, obj1Repl,
+                        obj1Data, obj1Result}, // different trigger, replace
+                {obj1Trigger2, obj1Match, obj1Repl,
+                        obj1Data, obj1Data},  // no trigger, no replace
         };
     }
 
-    @Test(enabled = true, dataProvider = "MatchReplaceData")
-    static void test3(byte[] match, byte[] replace,
+    @Test(dataProvider = "MatchReplaceData")
+    public static void test1(byte[] trigger, byte[] match, byte[] replace,
                       byte[] input, byte[] expected) {
-        System.out.printf("match: %s, replace: %s%n", Arrays.toString(match), Arrays.toString(replace));
+        System.out.printf("trigger: %s, match: %s, replace: %s%n", Arrays.toString(trigger),
+                Arrays.toString(match), Arrays.toString(replace));
         try (ByteArrayOutputStream output = new ByteArrayOutputStream();
         ByteArrayOutputStream log = new ByteArrayOutputStream();
              OutputStream out = new MatchReplaceOutputStream(output, "test3",
-                     log, match, replace)) {
+                     log, trigger, match, replace)) {
             out.write(input);
             byte[] actual = output.toByteArray();
             long index = Arrays.mismatch(actual, expected);
@@ -608,7 +822,4 @@
             Assert.fail("unexpected exception", ioe);
         }
     }
-
-
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/time/test/java/time/chrono/TestEraDisplayName.java	Tue Aug 29 10:47:16 2017 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2017, 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 test.java.time.chrono;
+
+import java.time.*;
+import java.time.chrono.*;
+import java.time.format.*;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Tests Era.getDisplayName() correctly returns the name based on each
+ * chrono implementation.
+ * Note: The exact result may depend on locale data provider's implementation.
+ *
+ * @bug 8171049
+ */
+@Test
+public class TestEraDisplayName {
+    private static final Locale THAI = Locale.forLanguageTag("th-TH");
+    private static final Locale EGYPT = Locale.forLanguageTag("ar-EG");
+
+    @DataProvider(name="eraDisplayName")
+    Object[][] eraDisplayName() {
+        return new Object[][] {
+            // Era, text style, displyay locale, expected name
+            // IsoEra
+            { IsoEra.BCE,   TextStyle.FULL,     Locale.US,      "Before Christ" },
+            { IsoEra.CE,    TextStyle.FULL,     Locale.US,      "Anno Domini" },
+            { IsoEra.BCE,   TextStyle.FULL,     Locale.JAPAN,   "\u7d00\u5143\u524d" },
+            { IsoEra.CE,    TextStyle.FULL,     Locale.JAPAN,   "\u897f\u66a6" },
+            { IsoEra.BCE,   TextStyle.SHORT,    Locale.US,      "BC" },
+            { IsoEra.CE,    TextStyle.SHORT,    Locale.US,      "AD" },
+            { IsoEra.BCE,   TextStyle.SHORT,    Locale.JAPAN,   "\u7d00\u5143\u524d" },
+            { IsoEra.CE,    TextStyle.SHORT,    Locale.JAPAN,   "\u897f\u66a6" },
+            { IsoEra.BCE,   TextStyle.NARROW,   Locale.US,      "B" },
+            { IsoEra.CE,    TextStyle.NARROW,   Locale.US,      "A" },
+            { IsoEra.BCE,   TextStyle.NARROW,   Locale.JAPAN,   "BC" },
+            { IsoEra.CE,    TextStyle.NARROW,   Locale.JAPAN,   "AD" },
+
+            // JapaneseEra
+            { JapaneseEra.MEIJI,    TextStyle.FULL,     Locale.US,      "Meiji" },
+            { JapaneseEra.TAISHO,   TextStyle.FULL,     Locale.US,      "Taisho" },
+            { JapaneseEra.SHOWA,    TextStyle.FULL,     Locale.US,      "Showa" },
+            { JapaneseEra.HEISEI,   TextStyle.FULL,     Locale.US,      "Heisei" },
+            { JapaneseEra.MEIJI,    TextStyle.FULL,     Locale.JAPAN,   "\u660e\u6cbb" },
+            { JapaneseEra.TAISHO,   TextStyle.FULL,     Locale.JAPAN,   "\u5927\u6b63" },
+            { JapaneseEra.SHOWA,    TextStyle.FULL,     Locale.JAPAN,   "\u662d\u548c" },
+            { JapaneseEra.HEISEI,   TextStyle.FULL,     Locale.JAPAN,   "\u5e73\u6210" },
+            { JapaneseEra.MEIJI,    TextStyle.SHORT,    Locale.US,      "Meiji" },
+            { JapaneseEra.TAISHO,   TextStyle.SHORT,    Locale.US,      "Taisho" },
+            { JapaneseEra.SHOWA,    TextStyle.SHORT,    Locale.US,      "Showa" },
+            { JapaneseEra.HEISEI,   TextStyle.SHORT,    Locale.US,      "Heisei" },
+            { JapaneseEra.MEIJI,    TextStyle.SHORT,    Locale.JAPAN,   "\u660e\u6cbb" },
+            { JapaneseEra.TAISHO,   TextStyle.SHORT,    Locale.JAPAN,   "\u5927\u6b63" },
+            { JapaneseEra.SHOWA,    TextStyle.SHORT,    Locale.JAPAN,   "\u662d\u548c" },
+            { JapaneseEra.HEISEI,   TextStyle.SHORT,    Locale.JAPAN,   "\u5e73\u6210" },
+            { JapaneseEra.MEIJI,    TextStyle.NARROW,   Locale.US,      "M" },
+            { JapaneseEra.TAISHO,   TextStyle.NARROW,   Locale.US,      "T" },
+            { JapaneseEra.SHOWA,    TextStyle.NARROW,   Locale.US,      "S" },
+            { JapaneseEra.HEISEI,   TextStyle.NARROW,   Locale.US,      "H" },
+            { JapaneseEra.MEIJI,    TextStyle.NARROW,   Locale.JAPAN,   "M" },
+            { JapaneseEra.TAISHO,   TextStyle.NARROW,   Locale.JAPAN,   "T" },
+            { JapaneseEra.SHOWA,    TextStyle.NARROW,   Locale.JAPAN,   "S" },
+            { JapaneseEra.HEISEI,   TextStyle.NARROW,   Locale.JAPAN,   "H" },
+
+            // ThaiBuddhistEra
+            { ThaiBuddhistEra.BEFORE_BE,    TextStyle.FULL, Locale.US,      "BC" },
+            { ThaiBuddhistEra.BE,           TextStyle.FULL, Locale.US,      "BE" },
+            { ThaiBuddhistEra.BEFORE_BE,    TextStyle.FULL, THAI,           "BC" },
+            { ThaiBuddhistEra.BE,           TextStyle.FULL, THAI,
+                "\u0e1e\u0e38\u0e17\u0e18\u0e28\u0e31\u0e01\u0e23\u0e32\u0e0a" },
+            { ThaiBuddhistEra.BEFORE_BE,    TextStyle.SHORT, Locale.US,     "BC" },
+            { ThaiBuddhistEra.BE,           TextStyle.SHORT, Locale.US,     "BE" },
+            { ThaiBuddhistEra.BEFORE_BE,    TextStyle.SHORT, THAI,
+                "\u0e1b\u0e35\u0e01\u0e48\u0e2d\u0e19\u0e04\u0e23\u0e34\u0e2a" +
+                "\u0e15\u0e4c\u0e01\u0e32\u0e25\u0e17\u0e35\u0e48" },
+            { ThaiBuddhistEra.BE,           TextStyle.SHORT, THAI,  "\u0e1e.\u0e28." },
+            { ThaiBuddhistEra.BEFORE_BE,    TextStyle.NARROW, Locale.US,    "BC" },
+            { ThaiBuddhistEra.BE,           TextStyle.NARROW, Locale.US,    "BE" },
+            { ThaiBuddhistEra.BEFORE_BE,    TextStyle.NARROW, THAI,         "BC" },
+            { ThaiBuddhistEra.BE,           TextStyle.NARROW, THAI,         "\u0e1e.\u0e28." },
+
+            // MinguoEra
+            { MinguoEra.BEFORE_ROC, TextStyle.FULL,     Locale.US,      "Before R.O.C." },
+            { MinguoEra.ROC,        TextStyle.FULL,     Locale.US,      "Minguo" },
+            { MinguoEra.BEFORE_ROC, TextStyle.FULL,     Locale.TAIWAN,  "\u6c11\u570b\u524d" },
+            { MinguoEra.ROC,        TextStyle.FULL,     Locale.TAIWAN,  "\u6c11\u570b" },
+            { MinguoEra.BEFORE_ROC, TextStyle.SHORT,    Locale.US,      "Before R.O.C." },
+            { MinguoEra.ROC,        TextStyle.SHORT,    Locale.US,      "Minguo" },
+            { MinguoEra.BEFORE_ROC, TextStyle.SHORT,    Locale.TAIWAN,  "\u6c11\u570b\u524d" },
+            { MinguoEra.ROC,        TextStyle.SHORT,    Locale.TAIWAN,  "\u6c11\u570b" },
+            { MinguoEra.BEFORE_ROC, TextStyle.NARROW,   Locale.US,      "Before R.O.C." },
+            { MinguoEra.ROC,        TextStyle.NARROW,   Locale.US,      "Minguo" },
+            { MinguoEra.BEFORE_ROC, TextStyle.NARROW,   Locale.TAIWAN,  "\u6c11\u570b\u524d" },
+            { MinguoEra.ROC,        TextStyle.NARROW,   Locale.TAIWAN,  "\u6c11\u570b" },
+
+            // HijrahEra
+            { HijrahEra.AH, TextStyle.FULL,     Locale.US,  "AH" },
+            { HijrahEra.AH, TextStyle.FULL,     EGYPT,      "\u0647\u0640" },
+            { HijrahEra.AH, TextStyle.SHORT,    Locale.US,  "AH" },
+            { HijrahEra.AH, TextStyle.SHORT,    EGYPT,      "\u0647\u0640" },
+            { HijrahEra.AH, TextStyle.NARROW,   Locale.US,  "AH" },
+            { HijrahEra.AH, TextStyle.NARROW,   EGYPT,      "\u0647\u0640" },
+        };
+    }
+
+    @Test(dataProvider="eraDisplayName")
+    public void test_eraDisplayName(Era era, TextStyle style, Locale locale, String expected) {
+        assertEquals(era.getDisplayName(style, locale), expected);
+    }
+}
--- a/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation1Test.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation1Test.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -65,17 +65,6 @@
 public class SubjectDelegation1Test {
 
     public static void main(String[] args) throws Exception {
-        // Check for supported operating systems: Solaris
-        //
-        // This test runs only on Solaris due to CR 6285916
-        //
-        String osName = System.getProperty("os.name");
-        System.out.println("os.name = " + osName);
-        if (!osName.equals("SunOS")) {
-            System.out.println("This test runs on Solaris only.");
-            System.out.println("Bye! Bye!");
-            return;
-        }
         String policyFile = args[0];
         String testResult = args[1];
         System.out.println("Policy file = " + policyFile);
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy11	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy11	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.delegate";
 };
 
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy12	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy12	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.delegate";
 };
 
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy13	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy13	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
 };
 
 grant principal javax.management.remote.JMXPrincipal "monitorRole" {
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy14	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy14	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
 };
 
 grant principal javax.management.remote.JMXPrincipal "monitorRole" {
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy15	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy15	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.monitorRole";
 };
 
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy16	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy16	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.monitorRole";
 };
 
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy21	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy21	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.security.SecurityPermission "createAccessControlContext";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy22	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy22	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.lang.RuntimePermission "*";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy23	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy23	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.lang.RuntimePermission "*";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy24	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy24	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy25	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy25	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy31	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy31	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.lang.RuntimePermission "*";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy32	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy32	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.lang.RuntimePermission "*";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy33	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy33	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.lang.RuntimePermission "*";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy34	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy34	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy35	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy35	Tue Aug 29 10:47:16 2017 -0700
@@ -1,4 +1,4 @@
-grant codebase "file:/-" {
+grant {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
--- a/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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,10 +27,9 @@
  * @summary JSR 292: Cannot create more than 16 instances of an anonymous class
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @library /lib/testlibrary
+ * @library /test/lib
  * @author  Robert Field
  * @compile -XDignore.symbol.file ManyNewInstanceAnonTest.java
- * @build jdk.testlibrary.*
  * @run main ClassFileInstaller ManyNewInstanceAnonTest
  * @run main/othervm -Xbootclasspath/a:. -Xverify:all ManyNewInstanceAnonTest
  * @run main/othervm -Xbootclasspath/a:. -Xverify:all -Dsun.reflection.noInflation=true ManyNewInstanceAnonTest
--- a/test/jdk/nio/zipfs/PathOps.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/jdk/nio/zipfs/PathOps.java	Tue Aug 29 10:47:16 2017 -0700
@@ -27,11 +27,13 @@
 import java.nio.file.Files;
 import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.ProviderMismatchException;
 
 /**
  *
  * @test
- * @bug 8038500 8040059 8139956 8146754 8172921
+ * @bug 8038500 8040059 8139956 8146754 8172921 8186142
  * @summary Tests path operations for zip provider.
  *
  * @run main PathOps
@@ -571,16 +573,46 @@
 
     }
 
+    static void mismatchedProviders() {
+        header("ProviderMismatchException");
+        Path path = fs.getPath("foo");
+        Path other = Paths.get("foo");
+        try {
+            path.compareTo(other);
+            throw new RuntimeException("ProviderMismatchException not thrown");
+        } catch (ProviderMismatchException pme) {}
+
+        try {
+            path.resolve(other);
+            throw new RuntimeException("ProviderMismatchException not thrown");
+        } catch (ProviderMismatchException pme) {}
+
+        try {
+            path.relativize(other);
+            throw new RuntimeException("ProviderMismatchException not thrown");
+        } catch (ProviderMismatchException pme) {}
+
+        try {
+            if (path.startsWith(other))
+                throw new RuntimeException("providerMismatched startsWith() returns true ");
+            if (path.endsWith(other))
+                throw new RuntimeException("providerMismatched endsWith() returns true ");
+        } catch (ProviderMismatchException pme) {
+            throw new RuntimeException("ProviderMismatchException is thrown for starts/endsWith()");
+        }
+    }
+
     public static void main(String[] args) throws IOException {
         // create empty JAR file, test doesn't require any contents
         Path emptyJar = Utils.createJarFile("empty.jar");
 
         fs = FileSystems.newFileSystem(emptyJar, null);
         try {
-        npes();
-        doPathOpTests();
+            npes();
+            mismatchedProviders();
+            doPathOpTests();
         } finally {
-        fs.close();
+            fs.close();
+        }
     }
 }
-}
--- a/test/lib/testlibrary/ClassFileInstaller.java	Mon Aug 28 11:53:44 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 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 java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-
-/**
- * Dump a class file for a class on the class path in the current directory
- */
-public class ClassFileInstaller {
-    /**
-     * @param args The names of the classes to dump
-     * @throws Exception
-     */
-    public static void main(String... args) throws Exception {
-        for (String arg : args) {
-            ClassLoader cl = ClassFileInstaller.class.getClassLoader();
-
-            // Convert dotted class name to a path to a class file
-            String pathName = arg.replace('.', '/').concat(".class");
-            InputStream is = cl.getResourceAsStream(pathName);
-
-            // Create the class file's package directory
-            Path p = Paths.get(pathName);
-            Path parent = p.getParent();
-            if (parent != null) {
-                Files.createDirectories(parent);
-            }
-            // Create the class file
-            Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
-        }
-    }
-}
--- a/test/sun/security/krb5/auto/KDC.java	Mon Aug 28 11:53:44 2017 -0700
+++ b/test/sun/security/krb5/auto/KDC.java	Tue Aug 29 10:47:16 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, 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
@@ -30,8 +30,6 @@
 import java.security.SecureRandom;
 import java.time.Instant;
 import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalAmount;
-import java.time.temporal.TemporalUnit;
 import java.util.*;
 import java.util.concurrent.*;
 
@@ -734,7 +732,7 @@
             if (till == null) {
                 throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO
             } else if (till.isZero()) {
-                till = new KerberosTime(new Date().getTime() + 1000 * 3600 * 11);
+                till = new KerberosTime(new Date().getTime() + 1000 * DEFAULT_LIFETIME);
             }
 
             boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1];
@@ -811,6 +809,18 @@
             }
             bFlags[Krb5.TKT_OPTS_INITIAL] = true;
 
+            KerberosTime renewTill = etp.renewTill;
+            if (renewTill != null && body.kdcOptions.get(KDCOptions.RENEW)) {
+                // till should never pass renewTill
+                if (till.greaterThan(renewTill)) {
+                    till = renewTill;
+                }
+                if (System.getProperty("test.set.null.renew") != null) {
+                    // Testing 8186576, see NullRenewUntil.java.
+                    renewTill = null;
+                }
+            }
+
             TicketFlags tFlags = new TicketFlags(bFlags);
             EncTicketPart enc = new EncTicketPart(
                     tFlags,
@@ -819,7 +829,7 @@
                     new TransitedEncoding(1, new byte[0]),  // TODO
                     new KerberosTime(new Date()),
                     body.from,
-                    till, etp.renewTill,
+                    till, renewTill,
                     body.addresses != null ? body.addresses
                             : etp.caddr,
                     null);
@@ -844,7 +854,7 @@
                     tFlags,
                     new KerberosTime(new Date()),
                     body.from,
-                    till, etp.renewTill,
+                    till, renewTill,
                     service,
                     body.addresses
                     );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/krb5/auto/NullRenewUntil.java	Tue Aug 29 10:47:16 2017 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 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 8186576
+ * @summary KerberosTicket does not properly handle renewable tickets
+ *          at the end of their lifetime
+ * @library /test/lib
+ * @compile -XDignore.symbol.file NullRenewUntil.java
+ * @run main/othervm -Dtest.set.null.renew NullRenewUntil
+ */
+
+import jdk.test.lib.Asserts;
+import sun.security.krb5.Config;
+
+import javax.security.auth.kerberos.KerberosTicket;
+
+public class NullRenewUntil {
+
+    public static void main(String[] args) throws Exception {
+
+        OneKDC kdc = new OneKDC(null);
+
+        KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
+                "ticket_lifetime = 10s",
+                "renew_lifetime = 11s");
+        Config.refresh();
+
+        KerberosTicket ticket = Context
+                .fromUserPass(OneKDC.USER, OneKDC.PASS, false).s()
+                .getPrivateCredentials(KerberosTicket.class).iterator().next();
+
+        System.out.println(ticket);
+        Asserts.assertTrue(ticket.getRenewTill() != null, ticket.toString());
+
+        Thread.sleep(2000);
+
+        ticket.refresh();
+        System.out.println(ticket);
+        Asserts.assertTrue(ticket.getRenewTill() == null, ticket.toString());
+
+        Thread.sleep(2000);
+        ticket.refresh();
+        System.out.println(ticket);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/pkcs12/EmptyAlias.java	Tue Aug 29 10:47:16 2017 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 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 8173181
+ * @summary KeyStore regression due to default keystore being changed to PKCS12
+ */
+
+import java.io.*;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+
+/**
+ * Test that a PKCS12 keystore entry can be created with an empty alias name.
+ */
+public class EmptyAlias {
+
+    private static final String DIR = System.getProperty("test.src", ".");
+    private static final String CERT = DIR + "/trusted.pem";
+    private static final String EMPTY_ALIAS = "";
+
+    public static void main(String[] args) throws Exception {
+        KeyStore keystore = KeyStore.getInstance("PKCS12");
+        keystore.load(null, null);
+
+        keystore.setCertificateEntry(EMPTY_ALIAS, loadCertificate(CERT));
+        KeyStore.Entry entry = keystore.getEntry(EMPTY_ALIAS, null);
+
+        if (entry == null) {
+            throw new Exception(
+                "Error retrieving keystore entry using its (empty) alias");
+        }
+
+        System.out.println("OK");
+    }
+
+    private static Certificate loadCertificate(String certFile)
+            throws Exception {
+        X509Certificate cert = null;
+        try (FileInputStream certStream = new FileInputStream(certFile)) {
+            CertificateFactory factory =
+                CertificateFactory.getInstance("X.509");
+            return factory.generateCertificate(certStream);
+        }
+    }
+}