changeset 14061:266db7445241

Merge
author prr
date Mon, 28 Mar 2016 08:38:59 -0700
parents 87cccbd30faf 9e73bdac39ec
children 41e5cfe957cb
files make/src/native/genconstants/ch/genSocketOptionRegistry.c make/src/native/genconstants/fs/genSolarisConstants.c make/src/native/genconstants/fs/genUnixConstants.c src/java.base/share/classes/sun/misc/Resource.java src/java.base/share/classes/sun/misc/URLClassPath.java src/java.base/unix/classes/sun/misc/FileURLMapper.java src/java.base/windows/classes/sun/misc/FileURLMapper.java src/jdk.deploy.osx/macosx/classes/module-info.java
diffstat 58 files changed, 2987 insertions(+), 2274 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Mar 25 13:47:21 2016 -0700
+++ b/.hgtags	Mon Mar 28 08:38:59 2016 -0700
@@ -353,3 +353,4 @@
 42794e648cfe9fd67461dcbe8b7594241a84bcff jdk-9+108
 1c7bad0798900fe58f4db01ae7ffdc84f5baee8c jdk-9+109
 9417e1bcded6af5532c3b26235437ab227758877 jdk-9+110
+b2a69d66dc65ad1d3aeb3bd362cf5bb0deba040e jdk-9+111
--- a/make/gensrc/GensrcMisc.gmk	Fri Mar 25 13:47:21 2016 -0700
+++ b/make/gensrc/GensrcMisc.gmk	Mon Mar 28 08:38:59 2016 -0700
@@ -23,7 +23,7 @@
 # questions.
 #
 
-##########################################################################################
+################################################################################
 # Install the launcher name, release version string, full version
 # string and the runtime name into the VersionProps.java file.
 
@@ -39,110 +39,68 @@
 
 GENSRC_JAVA_BASE += $(BUILD_VERSION_JAVA)
 
-##########################################################################################
+################################################################################
 
-GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
-
-GENSRC_SOR_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/ch
-GENSRC_SOR_SRC_FILE := genSocketOptionRegistry.c
-GENSRC_SOR_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSocketOptionRegistry
-
-SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
-    $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
-
-$(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOR_EXE, \
-    SRC := $(GENSRC_SOR_SRC), \
-    INCLUDE_FILES := $(GENSRC_SOR_SRC_FILE), \
-    CFLAGS_windows := -nologo, \
-    LDFLAGS_windows := -nologo, \
-    TOOLCHAIN := TOOLCHAIN_BUILD, \
-    OBJECT_DIR := $(GENSRC_SOR_BIN), \
-    OUTPUT_DIR := $(GENSRC_SOR_BIN), \
-    PROGRAM := genSocketOptionRegistry))
-
-SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
-
-ifeq ($(wildcard $(SOR_PREGEN_FILE)), )
-  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE_TARGET)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
-	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
-	$(BUILD_GENSRC_SOR_EXE_TARGET) >> $@.tmp
-	$(MV) $@.tmp $@
-else
-  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
-	$(call install-file)
+ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
+  # Need to specify language since the template file has a non standard
+  # extension.
+  CPP_FLAGS += -x c
+else ifeq ($(TOOLCHAIN_TYPE), microsoft)
+  CPP_FLAGS += -nologo
 endif
 
-##########################################################################################
+# Generate a java source file from a template through the C preprocessor for the
+# target system. First extract the copyright notice at the start of the file.
+# Run the preprocessor. Filter out the default compiler stderr output on
+# Windows. Filter out all the header files output. Remove all "PREFIX_" strings
+# that were added to variable references in the template files to avoid being
+# matched by the preprocessor. Remove any #line directives left by the
+# preprocessor.
+define generate-preproc-src
+	$(call MakeDir, $(@D))
+	( $(NAWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \
+	  $(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $< \
+	      2> >($(GREP) -v '^$(<F)$$' >&2) \
+	      | $(NAWK) '/@@START_HERE@@/,0' \
+	      |  $(SED) -e 's/@@START_HERE@@/\/\/ AUTOMATICALLY GENERATED FILE - DO NOT EDIT/' \
+	      -e 's/PREFIX_//' -e 's/^#.*//' \
+	) > $@
+endef
+
+GENSRC_SOR_FILE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
+
+$(GENSRC_SOR_FILE): \
+    $(JDK_TOPDIR)/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template
+	$(generate-preproc-src)
+
+GENSRC_JAVA_BASE += $(GENSRC_SOR_FILE)
+
+################################################################################
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
 
-  GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
+  GENSRC_UC_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
 
-  GENSRC_UC_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
-  GENSRC_UC_SRC_FILE := genUnixConstants.c
-  GENSRC_UC_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genUnixConstants
+  $(GENSRC_UC_FILE): \
+      $(JDK_TOPDIR)/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template
+	$(generate-preproc-src)
 
-  UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
-      $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
-
-  $(eval $(call SetupNativeCompilation, BUILD_GENSRC_UC_EXE, \
-      SRC := $(GENSRC_UC_SRC), \
-      INCLUDE_FILES := $(GENSRC_UC_SRC_FILE), \
-      TOOLCHAIN := TOOLCHAIN_BUILD, \
-      OBJECT_DIR := $(GENSRC_UC_BIN), \
-      OUTPUT_DIR := $(GENSRC_UC_BIN), \
-      PROGRAM := genUnixConstants))
-
-  UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
-
-  ifeq ($(wildcard $(UC_PREGEN_FILE)), )
-    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE_TARGET)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
-	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
-	$(BUILD_GENSRC_UC_EXE_TARGET) >> $@.tmp
-	$(MV) $@.tmp $@
-  else
-    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
-	$(call install-file)
-  endif
+  GENSRC_JAVA_BASE += $(GENSRC_UC_FILE)
 
 endif
 
-##########################################################################################
+################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-  GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
+  GENSRC_SC_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
 
-  GENSRC_SOL_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
-  GENSRC_SOL_SRC_FILE := genSolarisConstants.c
-  GENSRC_SOL_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSolarisConstants
+  $(GENSRC_SC_FILE): \
+      $(JDK_TOPDIR)/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template
+	$(generate-preproc-src)
 
-  SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
-      $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
-
-  $(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOL_EXE, \
-      SRC := $(GENSRC_SOL_SRC), \
-      INCLUDE_FILES := $(GENSRC_SOL_SRC_FILE), \
-      TOOLCHAIN := TOOLCHAIN_BUILD, \
-      OBJECT_DIR := $(GENSRC_SOL_BIN), \
-      OUTPUT_DIR := $(GENSRC_SOL_BIN), \
-      PROGRAM := genSolarisConstants))
-
-  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java: $(BUILD_GENSRC_SOL_EXE_TARGET)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
-	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
-	$(BUILD_GENSRC_SOL_EXE_TARGET) >> $@.tmp
-	$(MV) $@.tmp $@
-
+  GENSRC_JAVA_BASE += $(GENSRC_SC_FILE)
 
 endif
 
-##########################################################################################
+################################################################################
--- a/make/gensrc/GensrcModuleLoaderMap.gmk	Fri Mar 25 13:47:21 2016 -0700
+++ b/make/gensrc/GensrcModuleLoaderMap.gmk	Mon Mar 28 08:38:59 2016 -0700
@@ -25,103 +25,7 @@
 
 include Modules.gmk
 
-BOOT_MODULES :=
-UPGRADEABLE_MDOULES :=
-AGGREGATOR_MDOULES :=
-OTHER_PLATFORM_MODULES :=
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, jdk, gensrc/GensrcModuleLoaderMap.gmk))
-
-BOOT_MODULES += \
-    java.base \
-    java.datatransfer \
-    java.desktop \
-    java.httpclient \
-    java.instrument \
-    java.logging \
-    java.management \
-    java.naming \
-    java.prefs \
-    java.rmi \
-    java.security.jgss \
-    java.security.sasl \
-    java.sql \
-    java.xml \
-    java.xml.crypto \
-    jdk.httpserver \
-    jdk.management \
-    jdk.sctp \
-    jdk.security.auth \
-    jdk.security.jgss \
-    #
-
-# to be deprivileged
-BOOT_MODULES += \
-    java.compiler \
-    java.scripting \
-    java.sql.rowset \
-    java.smartcardio \
-    jdk.charsets \
-    jdk.naming.rmi \
-    #
-
-UPGRADEABLE_MODULES += \
-    java.activation \
-    java.annotations.common \
-    java.corba \
-    java.transaction \
-    java.xml.bind \
-    java.xml.ws \
-    #
-
-AGGREGATOR_MODULES += \
-    java.compact1 \
-    java.compact2 \
-    java.compact3 \
-    java.se \
-    java.se.ee \
-    #
-
-OTHER_PLATFORM_MODULES += \
-    jdk.accessibility \
-    jdk.crypto.ec \
-    jdk.crypto.pkcs11 \
-    jdk.dynalink \
-    jdk.jsobject \
-    jdk.xml.dom \
-    jdk.localedata \
-    jdk.naming.dns \
-    jdk.scripting.nashorn \
-    jdk.zipfs \
-    #
-
-ifeq ($(OPENJDK_TARGET_OS), macsox)
-  BOOT_MODULES += jdk.deploy.osx
-endif
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  OTHER_PLATFORM_MODULES += jdk.crypto.mscapi
-endif
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  OTHER_PLATFORM_MODULES += jdk.crypto.ucrypto
-endif
-
-# Param 1 - Name of module
-define ReadImportMetaData
-  ifneq ($$(wildcard $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties), )
-    classloader :=
-    include $(IMPORT_MODULES_MAKE)/$$(strip $1)/build.properties
-    ifeq ($$(classloader), boot)
-      BOOT_MODULES += $1
-    else ifeq ($$(classloader), ext)
-      OTHER_PLATFORM_MODULES += $1
-    endif
-  endif
-endef
-
-IMPORTED_MODULES := $(call FindImportedModules)
-$(foreach m, $(IMPORTED_MODULES), $(eval $(call ReadImportMetaData, $m)))
-
+$(eval $(call ReadImportMetaData))
 
 # Replacing double-comma with a single comma is to workaround the issue
 # with some version of make on windows that doesn't substitute spaces
@@ -132,7 +36,7 @@
 )
 endef
 BOOT_MODULES_LIST := $(call SubstComma, $(BOOT_MODULES))
-PLATFORM_MODULES_LIST := $(call SubstComma, $(UPGRADEABLE_MODULES) $(AGGREGATOR_MODULES) $(OTHER_PLATFORM_MODULES))
+PLATFORM_MODULES_LIST := $(call SubstComma, $(PLATFORM_MODULES))
 
 VARDEPS_VALUE := $(BOOT_MODULES_LIST) $(PLATFORM_MODULES_LIST)
 VARDEPS_FILE := $(call DependOnVariable, VARDEPS_VALUE)
--- a/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk	Fri Mar 25 13:47:21 2016 -0700
+++ b/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk	Mon Mar 28 08:38:59 2016 -0700
@@ -27,5 +27,6 @@
 
 $(eval $(call SetupBuildLauncher, jjs, \
     MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \
+    JAVA_ARGS := -addmods ALL-SYSTEM, \
     CFLAGS := -DENABLE_ARG_FILES, \
 ))
--- a/make/src/native/genconstants/ch/genSocketOptionRegistry.c	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#ifdef _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#endif
-
-/* Defines SO_REUSEPORT */
-#if !defined(SO_REUSEPORT)
-#ifdef _WIN32
-#define SO_REUSEPORT 0
-#elif __linux__
-#define SO_REUSEPORT 15
-#elif __solaris__
-#define SO_REUSEPORT 0x100e
-#elif defined(AIX) || defined(MACOSX)
-#define SO_REUSEPORT 0x0200
-#else
-#define SO_REUSEPORT 0
-#endif
-#endif
-
-/**
- * Generates sun.nio.ch.SocketOptionRegistry, a class that maps Java-level
- * socket options to the platform specific level and option.
- */
-
-static void out(char* s) {
-    printf("%s\n", s);
-}
-
-static void emit(const char *name, char * family, int level, int optname) {
-    printf("            map.put(new RegistryKey(%s, %s),", name, family);
-    printf(" new OptionKey(%d, %d));\n", level, optname);
-}
-
-static void emit_unspec(const char *name, int level, int optname) {
-    emit(name, "Net.UNSPEC", level, optname);
-}
-
-static  void emit_inet(const char *name, int level, int optname) {
-    emit(name, "StandardProtocolFamily.INET", level, optname);
-}
-
-static void emit_inet6(const char *name, int level, int optname) {
-    emit(name, "StandardProtocolFamily.INET6", level, optname);
-}
-
-int main(int argc, const char* argv[]) {
-    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
-    out("package sun.nio.ch;                                                            ");
-    out("import java.net.SocketOption;                                                  ");
-    out("import java.net.StandardSocketOptions;                                         ");
-    out("import java.net.ProtocolFamily;                                                ");
-    out("import java.net.StandardProtocolFamily;                                        ");
-    out("import java.util.Map;                                                          ");
-    out("import java.util.HashMap;                                                      ");
-    out("class SocketOptionRegistry {                                                   ");
-    out("    private SocketOptionRegistry() { }                                         ");
-    out("    private static class RegistryKey {                                         ");
-    out("        private final SocketOption<?> name;                                    ");
-    out("        private final ProtocolFamily family;                                   ");
-    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {             ");
-    out("            this.name = name;                                                  ");
-    out("            this.family = family;                                              ");
-    out("        }                                                                      ");
-    out("        public int hashCode() {                                                ");
-    out("            return name.hashCode() + family.hashCode();                        ");
-    out("        }                                                                      ");
-    out("        public boolean equals(Object ob) {                                     ");
-    out("            if (ob == null) return false;                                      ");
-    out("            if (!(ob instanceof RegistryKey)) return false;                    ");
-    out("            RegistryKey other = (RegistryKey)ob;                               ");
-    out("            if (this.name != other.name) return false;                         ");
-    out("            if (this.family != other.family) return false;                     ");
-    out("            return true;                                                       ");
-    out("        }                                                                      ");
-    out("    }                                                                          ");
-    out("    private static class LazyInitialization {                                  ");
-    out("        static final Map<RegistryKey,OptionKey> options = options();           ");
-    out("        private static Map<RegistryKey,OptionKey> options() {                  ");
-    out("            Map<RegistryKey,OptionKey> map =                                   ");
-    out("                new HashMap<RegistryKey,OptionKey>();                          ");
-
-    emit_unspec("StandardSocketOptions.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
-    emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
-    emit_unspec("StandardSocketOptions.SO_LINGER",    SOL_SOCKET, SO_LINGER);
-    emit_unspec("StandardSocketOptions.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
-    emit_unspec("StandardSocketOptions.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
-    emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
-    emit_unspec("StandardSocketOptions.SO_REUSEPORT", SOL_SOCKET, SO_REUSEPORT);
-    emit_unspec("StandardSocketOptions.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
-
-    emit_inet("StandardSocketOptions.IP_TOS",            IPPROTO_IP,     IP_TOS);
-    emit_inet("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
-    emit_inet("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
-    emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
-
-#ifdef AF_INET6
-    emit_inet6("StandardSocketOptions.IP_TOS",            IPPROTO_IPV6,  IPV6_TCLASS);
-    emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
-    emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
-    emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
-#endif
-
-    emit_unspec("ExtendedSocketOption.SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE);
-
-    out("            return map;                                                        ");
-    out("        }                                                                      ");
-    out("    }                                                                          ");
-    out("    public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) { ");
-    out("        RegistryKey key = new RegistryKey(name, family);                       ");
-    out("        return LazyInitialization.options.get(key);                            ");
-    out("    }                                                                          ");
-    out("}                                                                              ");
-
-    return 0;
-}
--- a/make/src/native/genconstants/fs/genSolarisConstants.c	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/acl.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-/**
- * Generates sun.nio.fs.SolarisConstants
- */
-
-static void out(char* s) {
-    printf("%s\n", s);
-}
-
-static void emit(char* name, int value) {
-    printf("    static final int %s = %d;\n", name, value);
-}
-
-static void emitX(char* name, int value) {
-    printf("    static final int %s = 0x%x;\n", name, value);
-}
-
-#define DEF(X) emit(#X, X);
-#define DEFX(X) emitX(#X, X);
-
-int main(int argc, const char* argv[]) {
-    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
-    out("package sun.nio.fs;                                                            ");
-    out("class SolarisConstants {                                                       ");
-    out("    private SolarisConstants() { }                                             ");
-
-    // extended attributes
-    DEFX(O_XATTR);
-    DEF(_PC_XATTR_ENABLED);
-
-    // ACL configuration
-    DEF(_PC_ACL_ENABLED);
-    DEFX(_ACL_ACE_ENABLED);
-
-    // ACL commands
-    DEFX(ACE_GETACL);
-    DEFX(ACE_SETACL);
-
-    // ACL mask/flags/types
-    emitX("ACE_ACCESS_ALLOWED_ACE_TYPE",        0x0000);
-    emitX("ACE_ACCESS_DENIED_ACE_TYPE",         0x0001);
-    emitX("ACE_SYSTEM_AUDIT_ACE_TYPE",          0x0002);
-    emitX("ACE_SYSTEM_ALARM_ACE_TYPE",          0x0003);
-    emitX("ACE_READ_DATA",                      0x00000001);
-    emitX("ACE_LIST_DIRECTORY",                 0x00000001);
-    emitX("ACE_WRITE_DATA",                     0x00000002);
-    emitX("ACE_ADD_FILE",                       0x00000002);
-    emitX("ACE_APPEND_DATA",                    0x00000004);
-    emitX("ACE_ADD_SUBDIRECTORY",               0x00000004);
-    emitX("ACE_READ_NAMED_ATTRS",               0x00000008);
-    emitX("ACE_WRITE_NAMED_ATTRS",              0x00000010);
-    emitX("ACE_EXECUTE",                        0x00000020);
-    emitX("ACE_DELETE_CHILD",                   0x00000040);
-    emitX("ACE_READ_ATTRIBUTES",                0x00000080);
-    emitX("ACE_WRITE_ATTRIBUTES",               0x00000100);
-    emitX("ACE_DELETE",                         0x00010000);
-    emitX("ACE_READ_ACL",                       0x00020000);
-    emitX("ACE_WRITE_ACL",                      0x00040000);
-    emitX("ACE_WRITE_OWNER",                    0x00080000);
-    emitX("ACE_SYNCHRONIZE",                    0x00100000);
-    emitX("ACE_FILE_INHERIT_ACE",               0x0001);
-    emitX("ACE_DIRECTORY_INHERIT_ACE",          0x0002);
-    emitX("ACE_NO_PROPAGATE_INHERIT_ACE",       0x0004);
-    emitX("ACE_INHERIT_ONLY_ACE",               0x0008);
-    emitX("ACE_SUCCESSFUL_ACCESS_ACE_FLAG",     0x0010);
-    emitX("ACE_FAILED_ACCESS_ACE_FLAG",         0x0020);
-    emitX("ACE_IDENTIFIER_GROUP",               0x0040);
-    emitX("ACE_OWNER",                          0x1000);
-    emitX("ACE_GROUP",                          0x2000);
-    emitX("ACE_EVERYONE",                       0x4000);
-
-    out("}                                                                              ");
-    return 0;
-}
--- a/make/src/native/genconstants/fs/genUnixConstants.c	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-/**
- * Generates sun.nio.fs.UnixConstants
- */
-
-static void out(char* s) {
-    printf("%s\n", s);
-}
-
-static void emit(char* name, int value) {
-    printf("    static final int %s = %d;\n", name, value);
-}
-
-static void emitX(char* name, int value) {
-    printf("    static final int %s = 0x%x;\n", name, value);
-}
-
-#define DEF(X) emit(#X, X);
-#define DEFX(X) emitX(#X, X);
-
-int main(int argc, const char* argv[]) {
-    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
-    out("package sun.nio.fs;                                                            ");
-    out("class UnixConstants {                                                          ");
-    out("    private UnixConstants() { }                                                ");
-
-    // open flags
-    DEF(O_RDONLY);
-    DEF(O_WRONLY);
-    DEF(O_RDWR);
-    DEFX(O_APPEND);
-    DEFX(O_CREAT);
-    DEFX(O_EXCL);
-    DEFX(O_TRUNC);
-    DEFX(O_SYNC);
-#ifndef O_DSYNC
-    // At least FreeBSD doesn't define O_DSYNC
-    emit("O_DSYNC", O_SYNC);
-#else
-    DEFX(O_DSYNC);
-#endif
-#ifdef O_NOFOLLOW
-    DEFX(O_NOFOLLOW);
-#else
-    // not supported (dummy values will not be used at runtime).
-    emitX("O_NOFOLLOW", 0x0);
-#endif
-
-    // mode masks
-    emitX("S_IAMB",
-         (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH));
-    DEF(S_IRUSR);
-    DEF(S_IWUSR);
-    DEF(S_IXUSR);
-    DEF(S_IRGRP);
-    DEF(S_IWGRP);
-    DEF(S_IXGRP);
-    DEF(S_IROTH);
-    DEF(S_IWOTH);
-    DEF(S_IXOTH);
-    DEFX(S_IFMT);
-    DEFX(S_IFREG);
-    DEFX(S_IFDIR);
-    DEFX(S_IFLNK);
-    DEFX(S_IFCHR);
-    DEFX(S_IFBLK);
-    DEFX(S_IFIFO);
-
-    // access modes
-    DEF(R_OK);
-    DEF(W_OK);
-    DEF(X_OK);
-    DEF(F_OK);
-
-    // errors
-    DEF(ENOENT);
-    DEF(ENXIO);
-    DEF(EACCES);
-    DEF(EEXIST);
-    DEF(ENOTDIR);
-    DEF(EINVAL);
-    DEF(EXDEV);
-    DEF(EISDIR);
-    DEF(ENOTEMPTY);
-    DEF(ENOSPC);
-    DEF(EAGAIN);
-    DEF(ENOSYS);
-    DEF(ELOOP);
-    DEF(EROFS);
-#ifndef ENODATA
-    // Only used in Linux java source, provide any value so it compiles
-    emit("ENODATA", ELAST);
-#else
-    DEF(ENODATA);
-#endif
-    DEF(ERANGE);
-    DEF(EMFILE);
-
-    // flags used with openat/unlinkat/etc.
-#if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)
-    DEFX(AT_SYMLINK_NOFOLLOW)
-    DEFX(AT_REMOVEDIR);
-#else
-    // not supported (dummy values will not be used at runtime).
-    emitX("AT_SYMLINK_NOFOLLOW", 0x0);
-    emitX("AT_REMOVEDIR", 0x0);
-#endif
-
-    out("}                                                                              ");
-
-    return 0;
-}
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.Arrays;
-import java.util.HashMap;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import static java.io.ObjectStreamClass.processQueue;
@@ -212,20 +212,20 @@
     /** marker for unshared objects in internal handle table */
     private static final Object unsharedMarker = new Object();
 
-    /** table mapping primitive type names to corresponding class objects */
-    private static final HashMap<String, Class<?>> primClasses
-        = new HashMap<>(8, 1.0F);
-    static {
-        primClasses.put("boolean", boolean.class);
-        primClasses.put("byte", byte.class);
-        primClasses.put("char", char.class);
-        primClasses.put("short", short.class);
-        primClasses.put("int", int.class);
-        primClasses.put("long", long.class);
-        primClasses.put("float", float.class);
-        primClasses.put("double", double.class);
-        primClasses.put("void", void.class);
-    }
+    /**
+     * immutable table mapping primitive type names to corresponding
+     * class objects
+     */
+    private static final Map<String, Class<?>> primClasses =
+        Map.of("boolean", boolean.class,
+               "byte", byte.class,
+               "char", char.class,
+               "short", short.class,
+               "int", int.class,
+               "long", long.class,
+               "float", float.class,
+               "double", double.class,
+               "void", void.class);
 
     private static class Caches {
         /** cache of subclass security audit results */
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1478,6 +1478,7 @@
      * that requires porting if there are private JDK changes occur.
      */
     private static final class MethodHandleInlineCopyStrategy {
+        static final Unsafe UNSAFE = Unsafe.getUnsafe();
 
         private MethodHandleInlineCopyStrategy() {
             // no instantiation
@@ -1512,10 +1513,9 @@
             mh = MethodHandles.dropArguments(NEW_STRING, 2, ptypes);
             mh = MethodHandles.dropArguments(mh, 0, int.class);
 
-            // In debug mode, check that remaining index is zero.
-            if (DEBUG) {
-                mh = MethodHandles.filterArgument(mh, 0, CHECK_INDEX);
-            }
+            // Safety: check that remaining index is zero -- that would mean the storage is completely
+            // overwritten, and no leakage of uninitialized data occurred.
+            mh = MethodHandles.filterArgument(mh, 0, CHECK_INDEX);
 
             // Mix in prependers. This happens when (int, byte[], byte) = (index, storage, coder) is already
             // known from the combinators below. We are assembling the string backwards, so "index" is the
@@ -1650,13 +1650,13 @@
 
         @ForceInline
         private static byte[] newArray(int length, byte coder) {
-            return new byte[length << coder];
+            return (byte[]) UNSAFE.allocateUninitializedArray(byte.class, length << coder);
         }
 
         @ForceInline
         private static int checkIndex(int index) {
             if (index != 0) {
-                throw new AssertionError("Exactness check failed: " + index + " characters left in the buffer.");
+                throw new IllegalStateException("Storage is not completely initialized, " + index + " bytes left");
             }
             return index;
         }
@@ -1721,12 +1721,7 @@
 
             NEW_STRING = lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "newString", String.class, byte[].class, byte.class);
             NEW_ARRAY  = lookupStatic(Lookup.IMPL_LOOKUP, MethodHandleInlineCopyStrategy.class, "newArray", byte[].class, int.class, byte.class);
-
-            if (DEBUG) {
-                CHECK_INDEX = lookupStatic(Lookup.IMPL_LOOKUP, MethodHandleInlineCopyStrategy.class, "checkIndex", int.class, int.class);
-            } else {
-                CHECK_INDEX = null;
-            }
+            CHECK_INDEX = lookupStatic(Lookup.IMPL_LOOKUP, MethodHandleInlineCopyStrategy.class, "checkIndex", int.class, int.class);
         }
     }
 
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java	Mon Mar 28 08:38:59 2016 -0700
@@ -48,8 +48,8 @@
 
 import jdk.internal.loader.BootLoader;
 import jdk.internal.module.Modules;
+import jdk.internal.misc.Unsafe;
 import jdk.internal.misc.VM;
-import sun.misc.Unsafe;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
--- a/src/java.base/share/classes/java/math/BigDecimal.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/math/BigDecimal.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -286,7 +286,7 @@
     private static final BigDecimal ZERO_THROUGH_TEN[] = {
         new BigDecimal(BigInteger.ZERO,       0,  0, 1),
         new BigDecimal(BigInteger.ONE,        1,  0, 1),
-        new BigDecimal(BigInteger.valueOf(2), 2,  0, 1),
+        new BigDecimal(BigInteger.TWO,        2,  0, 1),
         new BigDecimal(BigInteger.valueOf(3), 3,  0, 1),
         new BigDecimal(BigInteger.valueOf(4), 4,  0, 1),
         new BigDecimal(BigInteger.valueOf(5), 5,  0, 1),
@@ -936,7 +936,7 @@
                 rb = BigInteger.valueOf(5).pow(-exponent).multiply(compactVal);
                 scl = -exponent;
             } else { //  (exponent > 0)
-                rb = BigInteger.valueOf(2).pow(exponent).multiply(compactVal);
+                rb = BigInteger.TWO.pow(exponent).multiply(compactVal);
             }
             compactVal = compactValFor(rb);
         }
--- a/src/java.base/share/classes/java/math/BigInteger.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/math/BigInteger.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1266,9 +1266,11 @@
     public static final BigInteger ONE = valueOf(1);
 
     /**
-     * The BigInteger constant two.  (Not exported.)
+     * The BigInteger constant two.
+     *
+     * @since   9
      */
-    private static final BigInteger TWO = valueOf(2);
+    public static final BigInteger TWO = valueOf(2);
 
     /**
      * The BigInteger constant -1.  (Not exported.)
--- a/src/java.base/share/classes/java/net/URLClassLoader.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/net/URLClassLoader.java	Mon Mar 28 08:38:59 2016 -0700
@@ -49,11 +49,11 @@
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
+import jdk.internal.loader.Resource;
+import jdk.internal.loader.URLClassPath;
 import jdk.internal.misc.JavaNetAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.perf.PerfCounter;
-import sun.misc.Resource;
-import sun.misc.URLClassPath;
 import sun.net.www.ParseUtil;
 import sun.security.util.SecurityConstants;
 
--- a/src/java.base/share/classes/java/time/Instant.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/java/time/Instant.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1106,7 +1106,7 @@
      * complete units between the two instants.
      * The {@code Temporal} passed to this method is converted to a
      * {@code Instant} using {@link #from(TemporalAccessor)}.
-     * For example, the amount in days between two dates can be calculated
+     * For example, the amount in seconds between two dates can be calculated
      * using {@code startInstant.until(endInstant, SECONDS)}.
      * <p>
      * There are two equivalent ways of using this method.
--- a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java	Mon Mar 28 08:38:59 2016 -0700
@@ -56,8 +56,6 @@
 
 import jdk.internal.module.ModulePatcher.PatchedModuleReader;
 import jdk.internal.misc.VM;
-import sun.misc.URLClassPath;
-import sun.misc.Resource;
 
 
 /**
--- a/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java	Mon Mar 28 08:38:59 2016 -0700
@@ -38,7 +38,6 @@
 import jdk.internal.misc.JavaLangAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.VM;
-import sun.misc.URLClassPath;
 
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/loader/Resource.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.loader;
+
+import java.io.EOFException;
+import java.net.URL;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.io.InputStream;
+import java.security.CodeSigner;
+import java.util.jar.Manifest;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import sun.nio.ByteBuffered;
+
+/**
+ * This class is used to represent a Resource that has been loaded
+ * from the class path.
+ *
+ * @author  David Connelly
+ * @since   1.2
+ */
+public abstract class Resource {
+    /**
+     * Returns the name of the Resource.
+     */
+    public abstract String getName();
+
+    /**
+     * Returns the URL of the Resource.
+     */
+    public abstract URL getURL();
+
+    /**
+     * Returns the CodeSource URL for the Resource.
+     */
+    public abstract URL getCodeSourceURL();
+
+    /**
+     * Returns an InputStream for reading the Resource data.
+     */
+    public abstract InputStream getInputStream() throws IOException;
+
+    /**
+     * Returns the length of the Resource data, or -1 if unknown.
+     */
+    public abstract int getContentLength() throws IOException;
+
+    private InputStream cis;
+
+    /* Cache result in case getBytes is called after getByteBuffer. */
+    private synchronized InputStream cachedInputStream() throws IOException {
+        if (cis == null) {
+            cis = getInputStream();
+        }
+        return cis;
+    }
+
+    /**
+     * Returns the Resource data as an array of bytes.
+     */
+    public byte[] getBytes() throws IOException {
+        byte[] b;
+        // Get stream before content length so that a FileNotFoundException
+        // can propagate upwards without being caught too early
+        InputStream in = cachedInputStream();
+
+        // This code has been uglified to protect against interrupts.
+        // Even if a thread has been interrupted when loading resources,
+        // the IO should not abort, so must carefully retry, failing only
+        // if the retry leads to some other IO exception.
+
+        boolean isInterrupted = Thread.interrupted();
+        int len;
+        for (;;) {
+            try {
+                len = getContentLength();
+                break;
+            } catch (InterruptedIOException iioe) {
+                Thread.interrupted();
+                isInterrupted = true;
+            }
+        }
+
+        try {
+            b = new byte[0];
+            if (len == -1) len = Integer.MAX_VALUE;
+            int pos = 0;
+            while (pos < len) {
+                int bytesToRead;
+                if (pos >= b.length) { // Only expand when there's no room
+                    bytesToRead = Math.min(len - pos, b.length + 1024);
+                    if (b.length < pos + bytesToRead) {
+                        b = Arrays.copyOf(b, pos + bytesToRead);
+                    }
+                } else {
+                    bytesToRead = b.length - pos;
+                }
+                int cc = 0;
+                try {
+                    cc = in.read(b, pos, bytesToRead);
+                } catch (InterruptedIOException iioe) {
+                    Thread.interrupted();
+                    isInterrupted = true;
+                }
+                if (cc < 0) {
+                    if (len != Integer.MAX_VALUE) {
+                        throw new EOFException("Detect premature EOF");
+                    } else {
+                        if (b.length != pos) {
+                            b = Arrays.copyOf(b, pos);
+                        }
+                        break;
+                    }
+                }
+                pos += cc;
+            }
+        } finally {
+            try {
+                in.close();
+            } catch (InterruptedIOException iioe) {
+                isInterrupted = true;
+            } catch (IOException ignore) {}
+
+            if (isInterrupted) {
+                Thread.currentThread().interrupt();
+            }
+        }
+        return b;
+    }
+
+    /**
+     * Returns the Resource data as a ByteBuffer, but only if the input stream
+     * was implemented on top of a ByteBuffer. Return {@code null} otherwise.
+     * @return Resource data or null.
+     */
+    public ByteBuffer getByteBuffer() throws IOException {
+        InputStream in = cachedInputStream();
+        if (in instanceof ByteBuffered) {
+            return ((ByteBuffered)in).getByteBuffer();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the Manifest for the Resource, or null if none.
+     */
+    public Manifest getManifest() throws IOException {
+        return null;
+    }
+
+    /**
+     * Returns theCertificates for the Resource, or null if none.
+     */
+    public java.security.cert.Certificate[] getCertificates() {
+        return null;
+    }
+
+    /**
+     * Returns the code signers for the Resource, or null if none.
+     */
+    public CodeSigner[] getCodeSigners() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,1052 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.loader;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.Permission;
+import java.security.PrivilegedExceptionAction;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.Stack;
+import java.util.StringTokenizer;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.jar.JarEntry;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
+import java.util.zip.ZipFile;
+
+import jdk.internal.misc.JavaUtilZipFileAccess;
+import jdk.internal.misc.SharedSecrets;
+import sun.misc.InvalidJarIndexException;
+import sun.misc.JarIndex;
+import sun.net.util.URLUtil;
+import sun.net.www.ParseUtil;
+
+/**
+ * This class is used to maintain a search path of URLs for loading classes
+ * and resources from both JAR files and directories.
+ *
+ * @author  David Connelly
+ */
+public class URLClassPath {
+    private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
+    private static final String JAVA_HOME;
+    private static final String JAVA_VERSION;
+    private static final boolean DEBUG;
+    private static final boolean DISABLE_JAR_CHECKING;
+
+    static {
+        JAVA_HOME = java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("java.home"));
+        JAVA_VERSION = java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("java.version"));
+        DEBUG        = (java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.debug")) != null);
+        String p = java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
+        DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
+    }
+
+    /* The original search path of URLs. */
+    private ArrayList<URL> path = new ArrayList<>();
+
+    /* The stack of unopened URLs */
+    Stack<URL> urls = new Stack<>();
+
+    /* The resulting search path of Loaders */
+    ArrayList<Loader> loaders = new ArrayList<>();
+
+    /* Map of each URL opened to its corresponding Loader */
+    HashMap<String, Loader> lmap = new HashMap<>();
+
+    /* The jar protocol handler to use when creating new URLs */
+    private URLStreamHandler jarHandler;
+
+    /* Whether this URLClassLoader has been closed yet */
+    private boolean closed = false;
+
+    /**
+     * Creates a new URLClassPath for the given URLs. The URLs will be
+     * searched in the order specified for classes and resources. A URL
+     * ending with a '/' is assumed to refer to a directory. Otherwise,
+     * the URL is assumed to refer to a JAR file.
+     *
+     * @param urls the directory and JAR file URLs to search for classes
+     *        and resources
+     * @param factory the URLStreamHandlerFactory to use when creating new URLs
+     */
+    public URLClassPath(URL[] urls, URLStreamHandlerFactory factory) {
+        for (int i = 0; i < urls.length; i++) {
+            path.add(urls[i]);
+        }
+        push(urls);
+        if (factory != null) {
+            jarHandler = factory.createURLStreamHandler("jar");
+        }
+    }
+
+    public URLClassPath(URL[] urls) {
+        this(urls, null);
+    }
+
+    public synchronized List<IOException> closeLoaders() {
+        if (closed) {
+            return Collections.emptyList();
+        }
+        List<IOException> result = new LinkedList<>();
+        for (Loader loader : loaders) {
+            try {
+                loader.close();
+            } catch (IOException e) {
+                result.add (e);
+            }
+        }
+        closed = true;
+        return result;
+    }
+
+    /**
+     * Appends the specified URL to the search path of directory and JAR
+     * file URLs from which to load classes and resources.
+     * <p>
+     * If the URL specified is null or is already in the list of
+     * URLs, then invoking this method has no effect.
+     */
+    public synchronized void addURL(URL url) {
+        if (closed)
+            return;
+        synchronized (urls) {
+            if (url == null || path.contains(url))
+                return;
+
+            urls.add(0, url);
+            path.add(url);
+        }
+    }
+
+    /**
+     * Returns the original search path of URLs.
+     */
+    public URL[] getURLs() {
+        synchronized (urls) {
+            return path.toArray(new URL[path.size()]);
+        }
+    }
+
+    /**
+     * Finds the resource with the specified name on the URL search path
+     * or null if not found or security check fails.
+     *
+     * @param name      the name of the resource
+     * @param check     whether to perform a security check
+     * @return a <code>URL</code> for the resource, or <code>null</code>
+     * if the resource could not be found.
+     */
+    public URL findResource(String name, boolean check) {
+        Loader loader;
+        for (int i = 0; (loader = getLoader(i)) != null; i++) {
+            URL url = loader.findResource(name, check);
+            if (url != null) {
+                return url;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Finds the first Resource on the URL search path which has the specified
+     * name. Returns null if no Resource could be found.
+     *
+     * @param name the name of the Resource
+     * @param check     whether to perform a security check
+     * @return the Resource, or null if not found
+     */
+    public Resource getResource(String name, boolean check) {
+        if (DEBUG) {
+            System.err.println("URLClassPath.getResource(\"" + name + "\")");
+        }
+
+        Loader loader;
+        for (int i = 0; (loader = getLoader(i)) != null; i++) {
+            Resource res = loader.getResource(name, check);
+            if (res != null) {
+                return res;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Finds all resources on the URL search path with the given name.
+     * Returns an enumeration of the URL objects.
+     *
+     * @param name the resource name
+     * @return an Enumeration of all the urls having the specified name
+     */
+    public Enumeration<URL> findResources(final String name,
+                                     final boolean check) {
+        return new Enumeration<>() {
+            private int index = 0;
+            private URL url = null;
+
+            private boolean next() {
+                if (url != null) {
+                    return true;
+                } else {
+                    Loader loader;
+                    while ((loader = getLoader(index++)) != null) {
+                        url = loader.findResource(name, check);
+                        if (url != null) {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+            }
+
+            public boolean hasMoreElements() {
+                return next();
+            }
+
+            public URL nextElement() {
+                if (!next()) {
+                    throw new NoSuchElementException();
+                }
+                URL u = url;
+                url = null;
+                return u;
+            }
+        };
+    }
+
+    public Resource getResource(String name) {
+        return getResource(name, true);
+    }
+
+    /**
+     * Finds all resources on the URL search path with the given name.
+     * Returns an enumeration of the Resource objects.
+     *
+     * @param name the resource name
+     * @return an Enumeration of all the resources having the specified name
+     */
+    public Enumeration<Resource> getResources(final String name,
+                                    final boolean check) {
+        return new Enumeration<>() {
+            private int index = 0;
+            private Resource res = null;
+
+            private boolean next() {
+                if (res != null) {
+                    return true;
+                } else {
+                    Loader loader;
+                    while ((loader = getLoader(index++)) != null) {
+                        res = loader.getResource(name, check);
+                        if (res != null) {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+            }
+
+            public boolean hasMoreElements() {
+                return next();
+            }
+
+            public Resource nextElement() {
+                if (!next()) {
+                    throw new NoSuchElementException();
+                }
+                Resource r = res;
+                res = null;
+                return r;
+            }
+        };
+    }
+
+    public Enumeration<Resource> getResources(final String name) {
+        return getResources(name, true);
+    }
+
+    /*
+     * Returns the Loader at the specified position in the URL search
+     * path. The URLs are opened and expanded as needed. Returns null
+     * if the specified index is out of range.
+     */
+     private synchronized Loader getLoader(int index) {
+        if (closed) {
+            return null;
+        }
+         // Expand URL search path until the request can be satisfied
+         // or the URL stack is empty.
+        while (loaders.size() < index + 1) {
+            // Pop the next URL from the URL stack
+            URL url;
+            synchronized (urls) {
+                if (urls.empty()) {
+                    return null;
+                } else {
+                    url = urls.pop();
+                }
+            }
+            // Skip this URL if it already has a Loader. (Loader
+            // may be null in the case where URL has not been opened
+            // but is referenced by a JAR index.)
+            String urlNoFragString = URLUtil.urlNoFragString(url);
+            if (lmap.containsKey(urlNoFragString)) {
+                continue;
+            }
+            // Otherwise, create a new Loader for the URL.
+            Loader loader;
+            try {
+                loader = getLoader(url);
+                // If the loader defines a local class path then add the
+                // URLs to the list of URLs to be opened.
+                URL[] urls = loader.getClassPath();
+                if (urls != null) {
+                    push(urls);
+                }
+            } catch (IOException e) {
+                // Silently ignore for now...
+                continue;
+            }
+            // Finally, add the Loader to the search path.
+            loaders.add(loader);
+            lmap.put(urlNoFragString, loader);
+        }
+        return loaders.get(index);
+    }
+
+    /*
+     * Returns the Loader for the specified base URL.
+     */
+    private Loader getLoader(final URL url) throws IOException {
+        try {
+            return java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedExceptionAction<>() {
+                public Loader run() throws IOException {
+                    String file = url.getFile();
+                    if (file != null && file.endsWith("/")) {
+                        if ("file".equals(url.getProtocol())) {
+                            return new FileLoader(url);
+                        } else {
+                            return new Loader(url);
+                        }
+                    } else {
+                        return new JarLoader(url, jarHandler, lmap);
+                    }
+                }
+            });
+        } catch (java.security.PrivilegedActionException pae) {
+            throw (IOException)pae.getException();
+        }
+    }
+
+    /*
+     * Pushes the specified URLs onto the list of unopened URLs.
+     */
+    private void push(URL[] us) {
+        synchronized (urls) {
+            for (int i = us.length - 1; i >= 0; --i) {
+                urls.push(us[i]);
+            }
+        }
+    }
+
+    /*
+     * Check whether the resource URL should be returned.
+     * Return null on security check failure.
+     * Called by java.net.URLClassLoader.
+     */
+    public static URL checkURL(URL url) {
+        if (url != null) {
+            try {
+                check(url);
+            } catch (Exception e) {
+                return null;
+            }
+        }
+        return url;
+    }
+
+    /*
+     * Check whether the resource URL should be returned.
+     * Throw exception on failure.
+     * Called internally within this file.
+     */
+    public static void check(URL url) throws IOException {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            URLConnection urlConnection = url.openConnection();
+            Permission perm = urlConnection.getPermission();
+            if (perm != null) {
+                try {
+                    security.checkPermission(perm);
+                } catch (SecurityException se) {
+                    // fallback to checkRead/checkConnect for pre 1.2
+                    // security managers
+                    if ((perm instanceof java.io.FilePermission) &&
+                        perm.getActions().indexOf("read") != -1) {
+                        security.checkRead(perm.getName());
+                    } else if ((perm instanceof
+                        java.net.SocketPermission) &&
+                        perm.getActions().indexOf("connect") != -1) {
+                        URL locUrl = url;
+                        if (urlConnection instanceof JarURLConnection) {
+                            locUrl = ((JarURLConnection)urlConnection).getJarFileURL();
+                        }
+                        security.checkConnect(locUrl.getHost(),
+                                              locUrl.getPort());
+                    } else {
+                        throw se;
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Inner class used to represent a loader of resources and classes
+     * from a base URL.
+     */
+    private static class Loader implements Closeable {
+        private final URL base;
+        private JarFile jarfile; // if this points to a jar file
+
+        /*
+         * Creates a new Loader for the specified URL.
+         */
+        Loader(URL url) {
+            base = url;
+        }
+
+        /*
+         * Returns the base URL for this Loader.
+         */
+        URL getBaseURL() {
+            return base;
+        }
+
+        URL findResource(final String name, boolean check) {
+            URL url;
+            try {
+                url = new URL(base, ParseUtil.encodePath(name, false));
+            } catch (MalformedURLException e) {
+                throw new IllegalArgumentException("name");
+            }
+
+            try {
+                if (check) {
+                    URLClassPath.check(url);
+                }
+
+                /*
+                 * For a HTTP connection we use the HEAD method to
+                 * check if the resource exists.
+                 */
+                URLConnection uc = url.openConnection();
+                if (uc instanceof HttpURLConnection) {
+                    HttpURLConnection hconn = (HttpURLConnection)uc;
+                    hconn.setRequestMethod("HEAD");
+                    if (hconn.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) {
+                        return null;
+                    }
+                } else {
+                    // our best guess for the other cases
+                    uc.setUseCaches(false);
+                    InputStream is = uc.getInputStream();
+                    is.close();
+                }
+                return url;
+            } catch (Exception e) {
+                return null;
+            }
+        }
+
+        Resource getResource(final String name, boolean check) {
+            final URL url;
+            try {
+                url = new URL(base, ParseUtil.encodePath(name, false));
+            } catch (MalformedURLException e) {
+                throw new IllegalArgumentException("name");
+            }
+            final URLConnection uc;
+            try {
+                if (check) {
+                    URLClassPath.check(url);
+                }
+                uc = url.openConnection();
+                InputStream in = uc.getInputStream();
+                if (uc instanceof JarURLConnection) {
+                    /* Need to remember the jar file so it can be closed
+                     * in a hurry.
+                     */
+                    JarURLConnection juc = (JarURLConnection)uc;
+                    jarfile = JarLoader.checkJar(juc.getJarFile());
+                }
+            } catch (Exception e) {
+                return null;
+            }
+            return new Resource() {
+                public String getName() { return name; }
+                public URL getURL() { return url; }
+                public URL getCodeSourceURL() { return base; }
+                public InputStream getInputStream() throws IOException {
+                    return uc.getInputStream();
+                }
+                public int getContentLength() throws IOException {
+                    return uc.getContentLength();
+                }
+            };
+        }
+
+        /*
+         * Returns the Resource for the specified name, or null if not
+         * found or the caller does not have the permission to get the
+         * resource.
+         */
+        Resource getResource(final String name) {
+            return getResource(name, true);
+        }
+
+        /*
+         * close this loader and release all resources
+         * method overridden in sub-classes
+         */
+        public void close () throws IOException {
+            if (jarfile != null) {
+                jarfile.close();
+            }
+        }
+
+        /*
+         * Returns the local class path for this loader, or null if none.
+         */
+        URL[] getClassPath() throws IOException {
+            return null;
+        }
+    }
+
+    /*
+     * Inner class used to represent a Loader of resources from a JAR URL.
+     */
+    static class JarLoader extends Loader {
+        private JarFile jar;
+        private URL csu;
+        private JarIndex index;
+        private URLStreamHandler handler;
+        private HashMap<String, Loader> lmap;
+        private boolean closed = false;
+        private static final JavaUtilZipFileAccess zipAccess =
+                SharedSecrets.getJavaUtilZipFileAccess();
+
+        /*
+         * Creates a new JarLoader for the specified URL referring to
+         * a JAR file.
+         */
+        JarLoader(URL url, URLStreamHandler jarHandler,
+                  HashMap<String, Loader> loaderMap)
+            throws IOException
+        {
+            super(new URL("jar", "", -1, url + "!/", jarHandler));
+            csu = url;
+            handler = jarHandler;
+            lmap = loaderMap;
+
+            ensureOpen();
+        }
+
+        @Override
+        public void close () throws IOException {
+            // closing is synchronized at higher level
+            if (!closed) {
+                closed = true;
+                // in case not already open.
+                ensureOpen();
+                jar.close();
+            }
+        }
+
+        JarFile getJarFile () {
+            return jar;
+        }
+
+        private boolean isOptimizable(URL url) {
+            return "file".equals(url.getProtocol());
+        }
+
+        private void ensureOpen() throws IOException {
+            if (jar == null) {
+                try {
+                    java.security.AccessController.doPrivileged(
+                        new java.security.PrivilegedExceptionAction<>() {
+                            public Void run() throws IOException {
+                                if (DEBUG) {
+                                    System.err.println("Opening " + csu);
+                                    Thread.dumpStack();
+                                }
+
+                                jar = getJarFile(csu);
+                                index = JarIndex.getJarIndex(jar);
+                                if (index != null) {
+                                    String[] jarfiles = index.getJarFiles();
+                                // Add all the dependent URLs to the lmap so that loaders
+                                // will not be created for them by URLClassPath.getLoader(int)
+                                // if the same URL occurs later on the main class path.  We set
+                                // Loader to null here to avoid creating a Loader for each
+                                // URL until we actually need to try to load something from them.
+                                    for(int i = 0; i < jarfiles.length; i++) {
+                                        try {
+                                            URL jarURL = new URL(csu, jarfiles[i]);
+                                            // If a non-null loader already exists, leave it alone.
+                                            String urlNoFragString = URLUtil.urlNoFragString(jarURL);
+                                            if (!lmap.containsKey(urlNoFragString)) {
+                                                lmap.put(urlNoFragString, null);
+                                            }
+                                        } catch (MalformedURLException e) {
+                                            continue;
+                                        }
+                                    }
+                                }
+                                return null;
+                            }
+                        }
+                    );
+                } catch (java.security.PrivilegedActionException pae) {
+                    throw (IOException)pae.getException();
+                }
+            }
+        }
+
+        /* Throws if the given jar file is does not start with the correct LOC */
+        static JarFile checkJar(JarFile jar) throws IOException {
+            if (System.getSecurityManager() != null && !DISABLE_JAR_CHECKING
+                && !zipAccess.startsWithLocHeader(jar)) {
+                IOException x = new IOException("Invalid Jar file");
+                try {
+                    jar.close();
+                } catch (IOException ex) {
+                    x.addSuppressed(ex);
+                }
+                throw x;
+            }
+
+            return jar;
+        }
+
+        private JarFile getJarFile(URL url) throws IOException {
+            // Optimize case where url refers to a local jar file
+            if (isOptimizable(url)) {
+                FileURLMapper p = new FileURLMapper (url);
+                if (!p.exists()) {
+                    throw new FileNotFoundException(p.getPath());
+                }
+                return checkJar(new JarFile(new File(p.getPath()), true, ZipFile.OPEN_READ,
+                        JarFile.Release.RUNTIME));
+            }
+            URLConnection uc = (new URL(getBaseURL(), "#runtime")).openConnection();
+            uc.setRequestProperty(USER_AGENT_JAVA_VERSION, JAVA_VERSION);
+            JarFile jarFile = ((JarURLConnection)uc).getJarFile();
+            return checkJar(jarFile);
+        }
+
+        /*
+         * Returns the index of this JarLoader if it exists.
+         */
+        JarIndex getIndex() {
+            try {
+                ensureOpen();
+            } catch (IOException e) {
+                throw new InternalError(e);
+            }
+            return index;
+        }
+
+        /*
+         * Creates the resource and if the check flag is set to true, checks if
+         * is its okay to return the resource.
+         */
+        Resource checkResource(final String name, boolean check,
+            final JarEntry entry) {
+
+            final URL url;
+            try {
+                if (jar.isMultiRelease()) {
+                    // add #runtime fragment to tell JarURLConnection to use
+                    // runtime versioning if the underlying jar file is multi-release
+                    url = new URL(getBaseURL(), ParseUtil.encodePath(name, false) + "#runtime");
+                } else {
+                    url = new URL(getBaseURL(), ParseUtil.encodePath(name, false));
+                }
+                if (check) {
+                    URLClassPath.check(url);
+                }
+            } catch (MalformedURLException e) {
+                return null;
+                // throw new IllegalArgumentException("name");
+            } catch (IOException e) {
+                return null;
+            } catch (AccessControlException e) {
+                return null;
+            }
+
+            return new Resource() {
+                public String getName() { return name; }
+                public URL getURL() { return url; }
+                public URL getCodeSourceURL() { return csu; }
+                public InputStream getInputStream() throws IOException
+                    { return jar.getInputStream(entry); }
+                public int getContentLength()
+                    { return (int)entry.getSize(); }
+                public Manifest getManifest() throws IOException
+                    { return jar.getManifest(); };
+                public Certificate[] getCertificates()
+                    { return entry.getCertificates(); };
+                public CodeSigner[] getCodeSigners()
+                    { return entry.getCodeSigners(); };
+            };
+        }
+
+
+        /*
+         * Returns true iff atleast one resource in the jar file has the same
+         * package name as that of the specified resource name.
+         */
+        boolean validIndex(final String name) {
+            String packageName = name;
+            int pos;
+            if((pos = name.lastIndexOf('/')) != -1) {
+                packageName = name.substring(0, pos);
+            }
+
+            String entryName;
+            ZipEntry entry;
+            Enumeration<JarEntry> enum_ = jar.entries();
+            while (enum_.hasMoreElements()) {
+                entry = enum_.nextElement();
+                entryName = entry.getName();
+                if((pos = entryName.lastIndexOf('/')) != -1)
+                    entryName = entryName.substring(0, pos);
+                if (entryName.equals(packageName)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /*
+         * Returns the URL for a resource with the specified name
+         */
+        URL findResource(final String name, boolean check) {
+            Resource rsc = getResource(name, check);
+            if (rsc != null) {
+                return rsc.getURL();
+            }
+            return null;
+        }
+
+        /*
+         * Returns the JAR Resource for the specified name.
+         */
+        Resource getResource(final String name, boolean check) {
+            try {
+                ensureOpen();
+            } catch (IOException e) {
+                throw new InternalError(e);
+            }
+            final JarEntry entry = jar.getJarEntry(name);
+            if (entry != null)
+                return checkResource(name, check, entry);
+
+            if (index == null)
+                return null;
+
+            HashSet<String> visited = new HashSet<>();
+            return getResource(name, check, visited);
+        }
+
+        /*
+         * Version of getResource() that tracks the jar files that have been
+         * visited by linking through the index files. This helper method uses
+         * a HashSet to store the URLs of jar files that have been searched and
+         * uses it to avoid going into an infinite loop, looking for a
+         * non-existent resource
+         */
+        Resource getResource(final String name, boolean check,
+                             Set<String> visited) {
+
+            Resource res;
+            String[] jarFiles;
+            int count = 0;
+            LinkedList<String> jarFilesList = null;
+
+            /* If there no jar files in the index that can potential contain
+             * this resource then return immediately.
+             */
+            if((jarFilesList = index.get(name)) == null)
+                return null;
+
+            do {
+                int size = jarFilesList.size();
+                jarFiles = jarFilesList.toArray(new String[size]);
+                /* loop through the mapped jar file list */
+                while(count < size) {
+                    String jarName = jarFiles[count++];
+                    JarLoader newLoader;
+                    final URL url;
+
+                    try{
+                        url = new URL(csu, jarName);
+                        String urlNoFragString = URLUtil.urlNoFragString(url);
+                        if ((newLoader = (JarLoader)lmap.get(urlNoFragString)) == null) {
+                            /* no loader has been set up for this jar file
+                             * before
+                             */
+                            newLoader = AccessController.doPrivileged(
+                                new PrivilegedExceptionAction<>() {
+                                    public JarLoader run() throws IOException {
+                                        return new JarLoader(url, handler,
+                                            lmap);
+                                    }
+                                });
+
+                            /* this newly opened jar file has its own index,
+                             * merge it into the parent's index, taking into
+                             * account the relative path.
+                             */
+                            JarIndex newIndex = newLoader.getIndex();
+                            if(newIndex != null) {
+                                int pos = jarName.lastIndexOf('/');
+                                newIndex.merge(this.index, (pos == -1 ?
+                                    null : jarName.substring(0, pos + 1)));
+                            }
+
+                            /* put it in the global hashtable */
+                            lmap.put(urlNoFragString, newLoader);
+                        }
+                    } catch (java.security.PrivilegedActionException pae) {
+                        continue;
+                    } catch (MalformedURLException e) {
+                        continue;
+                    }
+
+
+                    /* Note that the addition of the url to the list of visited
+                     * jars incorporates a check for presence in the hashmap
+                     */
+                    boolean visitedURL = !visited.add(URLUtil.urlNoFragString(url));
+                    if (!visitedURL) {
+                        try {
+                            newLoader.ensureOpen();
+                        } catch (IOException e) {
+                            throw new InternalError(e);
+                        }
+                        final JarEntry entry = newLoader.jar.getJarEntry(name);
+                        if (entry != null) {
+                            return newLoader.checkResource(name, check, entry);
+                        }
+
+                        /* Verify that at least one other resource with the
+                         * same package name as the lookedup resource is
+                         * present in the new jar
+                         */
+                        if (!newLoader.validIndex(name)) {
+                            /* the mapping is wrong */
+                            throw new InvalidJarIndexException("Invalid index");
+                        }
+                    }
+
+                    /* If newLoader is the current loader or if it is a
+                     * loader that has already been searched or if the new
+                     * loader does not have an index then skip it
+                     * and move on to the next loader.
+                     */
+                    if (visitedURL || newLoader == this ||
+                            newLoader.getIndex() == null) {
+                        continue;
+                    }
+
+                    /* Process the index of the new loader
+                     */
+                    if((res = newLoader.getResource(name, check, visited))
+                            != null) {
+                        return res;
+                    }
+                }
+                // Get the list of jar files again as the list could have grown
+                // due to merging of index files.
+                jarFilesList = index.get(name);
+
+            // If the count is unchanged, we are done.
+            } while(count < jarFilesList.size());
+            return null;
+        }
+
+
+        /*
+         * Returns the JAR file local class path, or null if none.
+         */
+        URL[] getClassPath() throws IOException {
+            if (index != null) {
+                return null;
+            }
+
+            ensureOpen();
+
+            if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
+                Manifest man = jar.getManifest();
+                if (man != null) {
+                    Attributes attr = man.getMainAttributes();
+                    if (attr != null) {
+                        String value = attr.getValue(Name.CLASS_PATH);
+                        if (value != null) {
+                            return parseClassPath(csu, value);
+                        }
+                    }
+                }
+            }
+            return null;
+        }
+
+        /*
+         * Parses value of the Class-Path manifest attribute and returns
+         * an array of URLs relative to the specified base URL.
+         */
+        private URL[] parseClassPath(URL base, String value)
+            throws MalformedURLException
+        {
+            StringTokenizer st = new StringTokenizer(value);
+            URL[] urls = new URL[st.countTokens()];
+            int i = 0;
+            while (st.hasMoreTokens()) {
+                String path = st.nextToken();
+                urls[i] = new URL(base, path);
+                i++;
+            }
+            return urls;
+        }
+    }
+
+    /*
+     * Inner class used to represent a loader of classes and resources
+     * from a file URL that refers to a directory.
+     */
+    private static class FileLoader extends Loader {
+        /* Canonicalized File */
+        private File dir;
+
+        FileLoader(URL url) throws IOException {
+            super(url);
+            if (!"file".equals(url.getProtocol())) {
+                throw new IllegalArgumentException("url");
+            }
+            String path = url.getFile().replace('/', File.separatorChar);
+            path = ParseUtil.decode(path);
+            dir = (new File(path)).getCanonicalFile();
+        }
+
+        /*
+         * Returns the URL for a resource with the specified name
+         */
+        URL findResource(final String name, boolean check) {
+            Resource rsc = getResource(name, check);
+            if (rsc != null) {
+                return rsc.getURL();
+            }
+            return null;
+        }
+
+        Resource getResource(final String name, boolean check) {
+            final URL url;
+            try {
+                URL normalizedBase = new URL(getBaseURL(), ".");
+                url = new URL(getBaseURL(), ParseUtil.encodePath(name, false));
+
+                if (url.getFile().startsWith(normalizedBase.getFile()) == false) {
+                    // requested resource had ../..'s in path
+                    return null;
+                }
+
+                if (check)
+                    URLClassPath.check(url);
+
+                final File file;
+                if (name.indexOf("..") != -1) {
+                    file = (new File(dir, name.replace('/', File.separatorChar)))
+                          .getCanonicalFile();
+                    if ( !((file.getPath()).startsWith(dir.getPath())) ) {
+                        /* outside of base dir */
+                        return null;
+                    }
+                } else {
+                    file = new File(dir, name.replace('/', File.separatorChar));
+                }
+
+                if (file.exists()) {
+                    return new Resource() {
+                        public String getName() { return name; };
+                        public URL getURL() { return url; };
+                        public URL getCodeSourceURL() { return getBaseURL(); };
+                        public InputStream getInputStream() throws IOException
+                            { return new FileInputStream(file); };
+                        public int getContentLength() throws IOException
+                            { return (int)file.length(); };
+                    };
+                }
+            } catch (Exception e) {
+                return null;
+            }
+            return null;
+        }
+    }
+}
--- a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@
             Thread thread = AccessController.doPrivileged(new PrivilegedAction<Thread>() {
                 @Override
                 public Thread run() {
-                    Thread t = new InnocuousThread(new BootstrapMessageLoggerTask(owner, r));
+                    Thread t = InnocuousThread.newThread(new BootstrapMessageLoggerTask(owner, r));
                     t.setName("BootstrapMessageLoggerTask-"+t.getName());
                     return t;
                 }
@@ -904,7 +904,7 @@
                                 ? LoggingBackend.JUL_WITH_CONFIG
                                 : LoggingBackend.JUL_DEFAULT;
                         } else {
-                            // SimpleLogger is used
+                            // SimpleConsoleLogger is used
                             return LoggingBackend.NONE;
                         }
                     }
@@ -913,10 +913,10 @@
         }
     }
 
-    // We will use temporary SimpleConsoleLoggers if
+    // We will use a temporary SurrogateLogger if
     // the logging backend is JUL, there is no custom config,
     // and the LogManager has not been initialized yet.
-    private static  boolean useTemporaryLoggers() {
+    private static  boolean useSurrogateLoggers() {
         // being paranoid: this should already have been checked
         if (!isBooted()) return true;
         return DetectBackend.detectedBackend == LoggingBackend.JUL_DEFAULT
@@ -931,25 +931,24 @@
     public static synchronized boolean useLazyLoggers() {
         return !BootstrapLogger.isBooted()
                 || DetectBackend.detectedBackend == LoggingBackend.CUSTOM
-                || useTemporaryLoggers();
+                || useSurrogateLoggers();
     }
 
     // Called by LazyLoggerAccessor. This method will determine whether
     // to create a BootstrapLogger (if the VM is not yet booted),
-    // a SimpleConsoleLogger (if JUL is the default backend and there
+    // a SurrogateLogger (if JUL is the default backend and there
     // is no custom JUL configuration and LogManager is not yet initialized),
     // or a logger returned by the loaded LoggerFinder (all other cases).
     static Logger getLogger(LazyLoggerAccessor accessor) {
         if (!BootstrapLogger.isBooted()) {
             return new BootstrapLogger(accessor);
         } else {
-            boolean temporary = useTemporaryLoggers();
-            if (temporary) {
+            if (useSurrogateLoggers()) {
                 // JUL is the default backend, there is no custom configuration,
                 // LogManager has not been used.
                 synchronized(BootstrapLogger.class) {
-                    if (useTemporaryLoggers()) {
-                        return makeTemporaryLogger(accessor);
+                    if (useSurrogateLoggers()) {
+                        return createSurrogateLogger(accessor);
                     }
                 }
             }
@@ -961,46 +960,46 @@
 
     // If the backend is JUL, and there is no custom configuration, and
     // nobody has attempted to call LogManager.getLogManager() yet, then
-    // we can temporarily substitute JUL Logger with SimpleConsoleLoggers,
+    // we can temporarily substitute JUL Logger with SurrogateLoggers,
     // which avoids the cost of actually loading up the LogManager...
-    // The TemporaryLoggers class has the logic to create such temporary
+    // The RedirectedLoggers class has the logic to create such surrogate
     // loggers, and to possibly replace them with real JUL loggers if
     // someone calls LogManager.getLogManager().
-    static final class TemporaryLoggers implements
-            Function<LazyLoggerAccessor, SimpleConsoleLogger> {
+    static final class RedirectedLoggers implements
+            Function<LazyLoggerAccessor, SurrogateLogger> {
 
         // all accesses must be synchronized on the outer BootstrapLogger.class
-        final Map<LazyLoggerAccessor, SimpleConsoleLogger> temporaryLoggers =
+        final Map<LazyLoggerAccessor, SurrogateLogger> redirectedLoggers =
                 new HashMap<>();
 
         // all accesses must be synchronized on the outer BootstrapLogger.class
-        // The temporaryLoggers map will be cleared when LogManager is initialized.
+        // The redirectLoggers map will be cleared when LogManager is initialized.
         boolean cleared;
 
         @Override
         // all accesses must be synchronized on the outer BootstrapLogger.class
-        public SimpleConsoleLogger apply(LazyLoggerAccessor t) {
+        public SurrogateLogger apply(LazyLoggerAccessor t) {
             if (cleared) throw new IllegalStateException("LoggerFinder already initialized");
-            return SimpleConsoleLogger.makeSimpleLogger(t.getLoggerName(), true);
+            return SurrogateLogger.makeSurrogateLogger(t.getLoggerName());
         }
 
         // all accesses must be synchronized on the outer BootstrapLogger.class
-        SimpleConsoleLogger get(LazyLoggerAccessor a) {
+        SurrogateLogger get(LazyLoggerAccessor a) {
             if (cleared) throw new IllegalStateException("LoggerFinder already initialized");
-            return temporaryLoggers.computeIfAbsent(a, this);
+            return redirectedLoggers.computeIfAbsent(a, this);
         }
 
         // all accesses must be synchronized on the outer BootstrapLogger.class
-        Map<LazyLoggerAccessor, SimpleConsoleLogger> drainTemporaryLoggers() {
-            if (temporaryLoggers.isEmpty()) return null;
+        Map<LazyLoggerAccessor, SurrogateLogger> drainLoggersMap() {
+            if (redirectedLoggers.isEmpty()) return null;
             if (cleared) throw new IllegalStateException("LoggerFinder already initialized");
-            final Map<LazyLoggerAccessor, SimpleConsoleLogger> accessors = new HashMap<>(temporaryLoggers);
-            temporaryLoggers.clear();
+            final Map<LazyLoggerAccessor, SurrogateLogger> accessors = new HashMap<>(redirectedLoggers);
+            redirectedLoggers.clear();
             cleared = true;
             return accessors;
         }
 
-        static void resetTemporaryLoggers(Map<LazyLoggerAccessor, SimpleConsoleLogger> accessors) {
+        static void replaceSurrogateLoggers(Map<LazyLoggerAccessor, SurrogateLogger> accessors) {
             // When the backend is JUL we want to force the creation of
             // JUL loggers here: some tests are expecting that the
             // PlatformLogger will create JUL loggers as soon as the
@@ -1012,36 +1011,38 @@
             final LoggingBackend detectedBackend = DetectBackend.detectedBackend;
             final boolean lazy = detectedBackend != LoggingBackend.JUL_DEFAULT
                     && detectedBackend != LoggingBackend.JUL_WITH_CONFIG;
-            for (Map.Entry<LazyLoggerAccessor, SimpleConsoleLogger> a : accessors.entrySet()) {
+            for (Map.Entry<LazyLoggerAccessor, SurrogateLogger> a : accessors.entrySet()) {
                 a.getKey().release(a.getValue(), !lazy);
             }
         }
 
         // all accesses must be synchronized on the outer BootstrapLogger.class
-        static final TemporaryLoggers INSTANCE = new TemporaryLoggers();
+        static final RedirectedLoggers INSTANCE = new RedirectedLoggers();
     }
 
-    static synchronized Logger makeTemporaryLogger(LazyLoggerAccessor a) {
-        // accesses to TemporaryLoggers is synchronized on BootstrapLogger.class
-        return TemporaryLoggers.INSTANCE.get(a);
+    static synchronized Logger createSurrogateLogger(LazyLoggerAccessor a) {
+        // accesses to RedirectedLoggers is synchronized on BootstrapLogger.class
+        return RedirectedLoggers.INSTANCE.get(a);
     }
 
     private static volatile boolean logManagerConfigured;
 
-    private static synchronized Map<LazyLoggerAccessor, SimpleConsoleLogger>
-         releaseTemporaryLoggers() {
+    private static synchronized Map<LazyLoggerAccessor, SurrogateLogger>
+         releaseSurrogateLoggers() {
         // first check whether there's a chance that we have used
-        // temporary loggers; Will be false if logManagerConfigured is already
+        // surrogate loggers; Will be false if logManagerConfigured is already
         // true.
-        final boolean clearTemporaryLoggers = useTemporaryLoggers();
+        final boolean releaseSurrogateLoggers = useSurrogateLoggers();
 
         // then sets the flag that tells that the log manager is configured
         logManagerConfigured = true;
 
-        // finally replace all temporary loggers by real JUL loggers
-        if (clearTemporaryLoggers) {
-            // accesses to TemporaryLoggers is synchronized on BootstrapLogger.class
-            return TemporaryLoggers.INSTANCE.drainTemporaryLoggers();
+        // finally retrieves all surrogate loggers that should be replaced
+        // by real JUL loggers, and return them in the form of a redirected
+        // loggers map.
+        if (releaseSurrogateLoggers) {
+            // accesses to RedirectedLoggers is synchronized on BootstrapLogger.class
+            return RedirectedLoggers.INSTANCE.drainLoggersMap();
         } else {
             return null;
         }
@@ -1049,14 +1050,14 @@
 
     public static void redirectTemporaryLoggers() {
         // This call is synchronized on BootstrapLogger.class.
-        final Map<LazyLoggerAccessor, SimpleConsoleLogger> accessors =
-                releaseTemporaryLoggers();
+        final Map<LazyLoggerAccessor, SurrogateLogger> accessors =
+                releaseSurrogateLoggers();
 
         // We will now reset the logger accessors, triggering the
-        // (possibly lazy) replacement of any temporary logger by the
+        // (possibly lazy) replacement of any temporary surrogate logger by the
         // real logger returned from the loaded LoggerFinder.
         if (accessors != null) {
-            TemporaryLoggers.resetTemporaryLoggers(accessors);
+            RedirectedLoggers.replaceSurrogateLoggers(accessors);
         }
 
         BootstrapExecutors.flush();
--- a/src/java.base/share/classes/jdk/internal/logger/SimpleConsoleLogger.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/logger/SimpleConsoleLogger.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 import java.lang.System.Logger;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
+import sun.security.action.GetPropertyAction;
 import sun.util.logging.PlatformLogger;
 import sun.util.logging.PlatformLogger.ConfigurableBridge.LoggerConfiguration;
 
@@ -49,7 +50,19 @@
 public class SimpleConsoleLogger extends LoggerConfiguration
     implements Logger, PlatformLogger.Bridge, PlatformLogger.ConfigurableBridge {
 
-    static final PlatformLogger.Level DEFAULT_LEVEL = PlatformLogger.Level.INFO;
+    static final Level DEFAULT_LEVEL = getDefaultLevel();
+    static final PlatformLogger.Level DEFAULT_PLATFORM_LEVEL =
+            PlatformLogger.toPlatformLevel(DEFAULT_LEVEL);
+
+    static Level getDefaultLevel() {
+        String levelName = AccessController.doPrivileged(
+                new GetPropertyAction("jdk.system.logger.level", "INFO"));
+        try {
+            return Level.valueOf(levelName);
+        } catch (IllegalArgumentException iae) {
+            return Level.INFO;
+        }
+    }
 
     final String name;
     volatile PlatformLogger.Level  level;
@@ -59,8 +72,16 @@
         this.usePlatformLevel = usePlatformLevel;
     }
 
+    String getSimpleFormatString() {
+        return Formatting.SIMPLE_CONSOLE_LOGGER_FORMAT;
+    }
+
+    PlatformLogger.Level defaultPlatformLevel() {
+        return DEFAULT_PLATFORM_LEVEL;
+    }
+
     @Override
-    public String getName() {
+    public final String getName() {
         return name;
     }
 
@@ -77,12 +98,12 @@
     // ---------------------------------------------------
 
     @Override
-    public boolean isLoggable(Level level) {
+    public final boolean isLoggable(Level level) {
         return isLoggable(PlatformLogger.toPlatformLevel(level));
     }
 
     @Override
-    public void log(Level level, ResourceBundle bundle, String key, Throwable thrown) {
+    public final void log(Level level, ResourceBundle bundle, String key, Throwable thrown) {
         if (isLoggable(level)) {
             if (bundle != null) {
                 key = bundle.getString(key);
@@ -92,7 +113,7 @@
     }
 
     @Override
-    public void log(Level level, ResourceBundle bundle, String format, Object... params) {
+    public final void log(Level level, ResourceBundle bundle, String format, Object... params) {
         if (isLoggable(level)) {
             if (bundle != null) {
                 format = bundle.getString(format);
@@ -106,55 +127,55 @@
     // ---------------------------------------------------
 
     @Override
-    public boolean isLoggable(PlatformLogger.Level level) {
+    public final boolean isLoggable(PlatformLogger.Level level) {
         final PlatformLogger.Level effectiveLevel =  effectiveLevel();
         return level != PlatformLogger.Level.OFF
                 && level.ordinal() >= effectiveLevel.ordinal();
     }
 
     @Override
-    public boolean isEnabled() {
+    public final boolean isEnabled() {
         return level != PlatformLogger.Level.OFF;
     }
 
     @Override
-    public void log(PlatformLogger.Level level, String msg) {
+    public final void log(PlatformLogger.Level level, String msg) {
         if (isLoggable(level)) {
             publish(getCallerInfo(), logLevel(level), msg);
         }
     }
 
     @Override
-    public void log(PlatformLogger.Level level, String msg, Throwable thrown) {
+    public final void log(PlatformLogger.Level level, String msg, Throwable thrown) {
         if (isLoggable(level)) {
             publish(getCallerInfo(), logLevel(level), msg, thrown);
         }
     }
 
     @Override
-    public void log(PlatformLogger.Level level, String msg, Object... params) {
+    public final void log(PlatformLogger.Level level, String msg, Object... params) {
         if (isLoggable(level)) {
             publish(getCallerInfo(), logLevel(level), msg, params);
         }
     }
 
     private PlatformLogger.Level effectiveLevel() {
-        if (level == null) return DEFAULT_LEVEL;
+        if (level == null) return defaultPlatformLevel();
         return level;
     }
 
     @Override
-    public PlatformLogger.Level getPlatformLevel() {
+    public final PlatformLogger.Level getPlatformLevel() {
         return level;
     }
 
     @Override
-    public void setPlatformLevel(PlatformLogger.Level newLevel) {
+    public final void setPlatformLevel(PlatformLogger.Level newLevel) {
         level = newLevel;
     }
 
     @Override
-    public LoggerConfiguration getLoggerConfiguration() {
+    public final LoggerConfiguration getLoggerConfiguration() {
         return this;
     }
 
@@ -222,7 +243,7 @@
             }
             // Continue walking until we've found the relevant calling frame.
             // Skips logging/logger infrastructure.
-            return !isFilteredFrame(t);
+            return !Formatting.isFilteredFrame(t);
         }
 
         private boolean isLoggerImplFrame(String cname) {
@@ -256,7 +277,7 @@
         ZonedDateTime zdt = ZonedDateTime.now();
         String throwable = toString(thrown);
 
-        return String.format(Formatting.formatString,
+        return String.format(getSimpleFormatString(),
                          zdt,
                          callerInfo,
                          name,
@@ -280,31 +301,19 @@
         outputStream().print(format(level, msg, null, callerInfo));
     }
 
-    public static SimpleConsoleLogger makeSimpleLogger(String name, boolean usePlatformLevel) {
-        return new SimpleConsoleLogger(name, usePlatformLevel);
-    }
-
     public static SimpleConsoleLogger makeSimpleLogger(String name) {
         return new SimpleConsoleLogger(name, false);
     }
 
-    public static String getSimpleFormat(Function<String, String> defaultPropertyGetter) {
-        return Formatting.getSimpleFormat(defaultPropertyGetter);
-    }
-
-    public static boolean isFilteredFrame(StackFrame st) {
-        return Formatting.isFilteredFrame(st);
-    }
-
     @Override
-    public void log(PlatformLogger.Level level, Supplier<String> msgSupplier) {
+    public final void log(PlatformLogger.Level level, Supplier<String> msgSupplier) {
         if (isLoggable(level)) {
             publish(getCallerInfo(), logLevel(level), msgSupplier.get());
         }
     }
 
     @Override
-    public void log(PlatformLogger.Level level, Throwable thrown,
+    public final void log(PlatformLogger.Level level, Throwable thrown,
             Supplier<String> msgSupplier) {
         if (isLoggable(level)) {
             publish(getCallerInfo(), logLevel(level), msgSupplier.get(), thrown);
@@ -312,7 +321,7 @@
     }
 
     @Override
-    public void logp(PlatformLogger.Level level, String sourceClass,
+    public final void logp(PlatformLogger.Level level, String sourceClass,
             String sourceMethod, String msg) {
         if (isLoggable(level)) {
             publish(getCallerInfo(sourceClass, sourceMethod), logLevel(level), msg);
@@ -320,7 +329,7 @@
     }
 
     @Override
-    public void logp(PlatformLogger.Level level, String sourceClass,
+    public final void logp(PlatformLogger.Level level, String sourceClass,
             String sourceMethod, Supplier<String> msgSupplier) {
         if (isLoggable(level)) {
             publish(getCallerInfo(sourceClass, sourceMethod), logLevel(level), msgSupplier.get());
@@ -328,7 +337,7 @@
     }
 
     @Override
-    public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod,
+    public final void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod,
             String msg, Object... params) {
         if (isLoggable(level)) {
             publish(getCallerInfo(sourceClass, sourceMethod), logLevel(level), msg, params);
@@ -336,7 +345,7 @@
     }
 
     @Override
-    public void logp(PlatformLogger.Level level, String sourceClass,
+    public final void logp(PlatformLogger.Level level, String sourceClass,
             String sourceMethod, String msg, Throwable thrown) {
         if (isLoggable(level)) {
             publish(getCallerInfo(sourceClass, sourceMethod), logLevel(level), msg, thrown);
@@ -344,7 +353,7 @@
     }
 
     @Override
-    public void logp(PlatformLogger.Level level, String sourceClass,
+    public final void logp(PlatformLogger.Level level, String sourceClass,
             String sourceMethod, Throwable thrown, Supplier<String> msgSupplier) {
         if (isLoggable(level)) {
             publish(getCallerInfo(sourceClass, sourceMethod), logLevel(level), msgSupplier.get(), thrown);
@@ -352,7 +361,7 @@
     }
 
     @Override
-    public void logrb(PlatformLogger.Level level, String sourceClass,
+    public final void logrb(PlatformLogger.Level level, String sourceClass,
             String sourceMethod, ResourceBundle bundle, String key, Object... params) {
         if (isLoggable(level)) {
             String msg = bundle == null ? key : bundle.getString(key);
@@ -361,7 +370,7 @@
     }
 
     @Override
-    public void logrb(PlatformLogger.Level level, String sourceClass,
+    public final void logrb(PlatformLogger.Level level, String sourceClass,
             String sourceMethod, ResourceBundle bundle, String key, Throwable thrown) {
         if (isLoggable(level)) {
             String msg = bundle == null ? key : bundle.getString(key);
@@ -370,7 +379,7 @@
     }
 
     @Override
-    public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
+    public final void logrb(PlatformLogger.Level level, ResourceBundle bundle,
             String key, Object... params) {
         if (isLoggable(level)) {
             String msg = bundle == null ? key : bundle.getString(key);
@@ -379,7 +388,7 @@
     }
 
     @Override
-    public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
+    public final void logrb(PlatformLogger.Level level, ResourceBundle bundle,
             String key, Throwable thrown) {
         if (isLoggable(level)) {
             String msg = bundle == null ? key : bundle.getString(key);
@@ -387,21 +396,38 @@
         }
     }
 
-    private static final class Formatting {
+    static final class Formatting {
+        // The default simple log format string.
+        // Used both by SimpleConsoleLogger when java.logging is not present,
+        // and by SurrogateLogger and java.util.logging.SimpleFormatter when
+        // java.logging is present.
         static final String DEFAULT_FORMAT =
             "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n";
-        static final String FORMAT_PROP_KEY =
+
+        // The system property key that allows to change the default log format
+        // when java.logging is not present. This is used to control the formatting
+        // of the SimpleConsoleLogger.
+        static final String DEFAULT_FORMAT_PROP_KEY =
+            "jdk.system.logger.format";
+
+        // The system property key that allows to change the default log format
+        // when java.logging is present. This is used to control the formatting
+        // of the SurrogateLogger (used before java.util.logging.LogManager is
+        // initialized) and the java.util.logging.SimpleFormatter (used after
+        // java.util.logging.LogManager is  initialized).
+        static final String JUL_FORMAT_PROP_KEY =
             "java.util.logging.SimpleFormatter.format";
-        static final String formatString = getSimpleFormat(null);
+
+        // The simple console logger format string
+        static final String SIMPLE_CONSOLE_LOGGER_FORMAT =
+                getSimpleFormat(DEFAULT_FORMAT_PROP_KEY, null);
 
         // Make it easier to wrap Logger...
         static private final String[] skips;
         static {
             String additionalPkgs = AccessController.doPrivileged(
-                (PrivilegedAction<String>)
-                () -> System.getProperty("jdk.logger.packages"));
+                new GetPropertyAction("jdk.logger.packages"));
             skips = additionalPkgs == null ? new String[0] : additionalPkgs.split(",");
-
         }
 
         static boolean isFilteredFrame(StackFrame st) {
@@ -440,21 +466,29 @@
             return false;
         }
 
-        static String getSimpleFormat(Function<String, String> defaultPropertyGetter) {
-            // Using a lambda here causes
+        static String getSimpleFormat(String key, Function<String, String> defaultPropertyGetter) {
+            // Double check that 'key' is one of the expected property names:
+            // - DEFAULT_FORMAT_PROP_KEY is used to control the
+            //   SimpleConsoleLogger format when java.logging is
+            //   not present.
+            // - JUL_FORMAT_PROP_KEY is used when this method is called
+            //   from the SurrogateLogger subclass. It is used to control the
+            //   SurrogateLogger format and java.util.logging.SimpleFormatter
+            //   format when java.logging is present.
+            // This method should not be called with any other key.
+            if (!DEFAULT_FORMAT_PROP_KEY.equals(key)
+                    && !JUL_FORMAT_PROP_KEY.equals(key)) {
+                throw new IllegalArgumentException("Invalid property name: " + key);
+            }
+
+            // Do not use any lambda in this method. Using a lambda here causes
             //    jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java
             // to fail - because that test has a testcase which somehow references
-            // PlatformLogger and counts the number of generated lambda classes
-            // So we explicitely use new PrivilegedAction<String> here.
-            String format =
-                AccessController.doPrivileged(new PrivilegedAction<String>() {
-                @Override
-                public String run() {
-                    return System.getProperty(FORMAT_PROP_KEY);
-                }
-            });
+            // PlatformLogger and counts the number of generated lambda classes.
+            String format = AccessController.doPrivileged(new GetPropertyAction(key));
+
             if (format == null && defaultPropertyGetter != null) {
-                format = defaultPropertyGetter.apply(FORMAT_PROP_KEY);
+                format = defaultPropertyGetter.apply(key);
             }
             if (format != null) {
                 try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/logger/SurrogateLogger.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.logger;
+
+import java.util.function.Function;
+import sun.util.logging.PlatformLogger;
+
+/**
+ * A simple console logger used to emulate the behavior of JUL loggers when
+ * java.util.logging has no custom configuration.
+ * Surrogate loggers are usually only used temporarily, until the LogManager
+ * is initialized. At this point, the surrogates are replaced by an actual
+ * logger obtained from LogManager.
+ */
+public final class SurrogateLogger extends SimpleConsoleLogger {
+
+    private static final PlatformLogger.Level JUL_DEFAULT_LEVEL =
+            PlatformLogger.Level.INFO;
+    private static volatile String simpleFormatString;
+
+    SurrogateLogger(String name) {
+        super(name, true);
+    }
+
+    @Override
+    PlatformLogger.Level defaultPlatformLevel() {
+        return JUL_DEFAULT_LEVEL;
+    }
+
+    @Override
+    String getSimpleFormatString() {
+        if (simpleFormatString == null) {
+            simpleFormatString = getSimpleFormat(null);
+        }
+        return simpleFormatString;
+    }
+
+    public static String getSimpleFormat(Function<String, String> defaultPropertyGetter) {
+        return Formatting.getSimpleFormat(Formatting.JUL_FORMAT_PROP_KEY, defaultPropertyGetter);
+    }
+
+    public static SurrogateLogger makeSurrogateLogger(String name) {
+        return new SurrogateLogger(name);
+    }
+
+    public static boolean isFilteredFrame(StackWalker.StackFrame st) {
+        return Formatting.isFilteredFrame(st);
+    }
+}
--- a/src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java	Mon Mar 28 08:38:59 2016 -0700
@@ -45,20 +45,49 @@
     private static final long CONTEXTCLASSLOADER;
 
     private static final AtomicInteger threadNumber = new AtomicInteger(1);
-
-    public InnocuousThread(Runnable target) {
-        this(INNOCUOUSTHREADGROUP, target,
-             "InnocuousThread-" + threadNumber.getAndIncrement());
+    private static String newName() {
+        return "InnocuousThread-" + threadNumber.getAndIncrement();
     }
 
-    public InnocuousThread(Runnable target, String name) {
-        this(INNOCUOUSTHREADGROUP, target, name);
+    /**
+     * Returns a new InnocuousThread with an auto-generated thread name
+     * and its context class loader is set to the system class loader.
+     */
+    public static Thread newThread(Runnable target) {
+        return newThread(newName(), target);
     }
 
-    public InnocuousThread(ThreadGroup group, Runnable target, String name) {
+    /**
+     * Returns a new InnocuousThread with its context class loader
+     * set to the system class loader.
+     */
+    public static Thread newThread(String name, Runnable target) {
+        return new InnocuousThread(INNOCUOUSTHREADGROUP,
+                                   target,
+                                   name,
+                                   ClassLoader.getSystemClassLoader());
+    }
+
+    /**
+     * Returns a new InnocuousThread with an auto-generated thread name.
+     * Its context class loader is set to null.
+     */
+    public static Thread newSystemThread(Runnable target) {
+        return newSystemThread(newName(), target);
+    }
+
+    /**
+     * Returns a new InnocuousThread with null context class loader.
+     */
+    public static Thread newSystemThread(String name, Runnable target) {
+        return new InnocuousThread(INNOCUOUSTHREADGROUP,
+                                   target, name, null);
+    }
+
+    private InnocuousThread(ThreadGroup group, Runnable target, String name, ClassLoader tccl) {
         super(group, target, name, 0L, false);
         UNSAFE.putOrderedObject(this, INHERITEDACCESSCONTROLCONTEXT, ACC);
-        UNSAFE.putOrderedObject(this, CONTEXTCLASSLOADER, ClassLoader.getSystemClassLoader());
+        UNSAFE.putOrderedObject(this, CONTEXTCLASSLOADER, tccl);
     }
 
     @Override
--- a/src/java.base/share/classes/jdk/internal/misc/JavaNetAccess.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaNetAccess.java	Mon Mar 28 08:38:59 2016 -0700
@@ -26,7 +26,7 @@
 package jdk.internal.misc;
 
 import java.net.URLClassLoader;
-import sun.misc.URLClassPath;
+import jdk.internal.loader.URLClassPath;
 
 public interface JavaNetAccess {
     /**
--- a/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java	Mon Mar 28 08:38:59 2016 -0700
@@ -51,9 +51,9 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
+import jdk.internal.loader.Resource;
 import jdk.internal.misc.JavaLangModuleAccess;
 import jdk.internal.misc.SharedSecrets;
-import sun.misc.Resource;
 import sun.net.www.ParseUtil;
 
 
@@ -583,4 +583,4 @@
         throw new IllegalArgumentException(msg);
     }
 
-}
\ No newline at end of file
+}
--- a/src/java.base/share/classes/jdk/internal/ref/CleanerFactory.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/ref/CleanerFactory.java	Mon Mar 28 08:38:59 2016 -0700
@@ -25,24 +25,44 @@
 
 package jdk.internal.ref;
 
+import jdk.internal.misc.InnocuousThread;
+
 import java.lang.ref.Cleaner;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.concurrent.ThreadFactory;
 
 /**
- * CleanerFactory provides a Cleaner for use within OpenJDK modules.
+ * CleanerFactory provides a Cleaner for use within system modules.
  * The cleaner is created on the first reference to the CleanerFactory.
  */
 public final class CleanerFactory {
 
     /* The common Cleaner. */
-    private final static Cleaner commonCleaner = Cleaner.create();
+    private final static Cleaner commonCleaner = Cleaner.create(new ThreadFactory() {
+        @Override
+        public Thread newThread(Runnable r) {
+            return AccessController.doPrivileged(new PrivilegedAction<>() {
+                @Override
+                public Thread run() {
+                    Thread t = InnocuousThread.newSystemThread("Common-Cleaner", r);
+                    t.setPriority(Thread.MAX_PRIORITY - 2);
+                    return t;
+                }
+            });
+        }
+    });
 
     /**
-     * Cleaner for use within OpenJDK modules.
+     * Cleaner for use within system modules.
      *
-     * @return a Cleaner for use within OpenJDK modules
+     * This Cleaner will run on a thread whose context class loader
+     * is {@code null}. The system cleaning action to perform in
+     * this Cleaner should handle a {@code null} context class loader.
+     *
+     * @return a Cleaner for use within system modules
      */
     public static Cleaner cleaner() {
         return commonCleaner;
     }
-
 }
--- a/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java	Mon Mar 28 08:38:59 2016 -0700
@@ -324,10 +324,10 @@
         final AtomicInteger cleanerThreadNumber = new AtomicInteger();
 
         public Thread newThread(Runnable r) {
-            return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
+            return AccessController.doPrivileged(new PrivilegedAction<>() {
                 @Override
                 public Thread run() {
-                    Thread t = new InnocuousThread(r);
+                    Thread t = InnocuousThread.newThread(r);
                     t.setPriority(Thread.MAX_PRIORITY - 2);
                     t.setName("Cleaner-" + cleanerThreadNumber.getAndIncrement());
                     return t;
--- a/src/java.base/share/classes/module-info.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/module-info.java	Mon Mar 28 08:38:59 2016 -0700
@@ -274,7 +274,6 @@
         jdk.localedata;
     exports sun.util.logging to
         java.desktop,
-        java.httpclient,
         java.logging,
         java.prefs;
 
--- a/src/java.base/share/classes/sun/misc/Resource.java	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.io.EOFException;
-import java.net.URL;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.io.InputStream;
-import java.security.CodeSigner;
-import java.util.jar.Manifest;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import sun.nio.ByteBuffered;
-
-/**
- * This class is used to represent a Resource that has been loaded
- * from the class path.
- *
- * @author  David Connelly
- * @since   1.2
- */
-public abstract class Resource {
-    /**
-     * Returns the name of the Resource.
-     */
-    public abstract String getName();
-
-    /**
-     * Returns the URL of the Resource.
-     */
-    public abstract URL getURL();
-
-    /**
-     * Returns the CodeSource URL for the Resource.
-     */
-    public abstract URL getCodeSourceURL();
-
-    /**
-     * Returns an InputStream for reading the Resource data.
-     */
-    public abstract InputStream getInputStream() throws IOException;
-
-    /**
-     * Returns the length of the Resource data, or -1 if unknown.
-     */
-    public abstract int getContentLength() throws IOException;
-
-    private InputStream cis;
-
-    /* Cache result in case getBytes is called after getByteBuffer. */
-    private synchronized InputStream cachedInputStream() throws IOException {
-        if (cis == null) {
-            cis = getInputStream();
-        }
-        return cis;
-    }
-
-    /**
-     * Returns the Resource data as an array of bytes.
-     */
-    public byte[] getBytes() throws IOException {
-        byte[] b;
-        // Get stream before content length so that a FileNotFoundException
-        // can propagate upwards without being caught too early
-        InputStream in = cachedInputStream();
-
-        // This code has been uglified to protect against interrupts.
-        // Even if a thread has been interrupted when loading resources,
-        // the IO should not abort, so must carefully retry, failing only
-        // if the retry leads to some other IO exception.
-
-        boolean isInterrupted = Thread.interrupted();
-        int len;
-        for (;;) {
-            try {
-                len = getContentLength();
-                break;
-            } catch (InterruptedIOException iioe) {
-                Thread.interrupted();
-                isInterrupted = true;
-            }
-        }
-
-        try {
-            b = new byte[0];
-            if (len == -1) len = Integer.MAX_VALUE;
-            int pos = 0;
-            while (pos < len) {
-                int bytesToRead;
-                if (pos >= b.length) { // Only expand when there's no room
-                    bytesToRead = Math.min(len - pos, b.length + 1024);
-                    if (b.length < pos + bytesToRead) {
-                        b = Arrays.copyOf(b, pos + bytesToRead);
-                    }
-                } else {
-                    bytesToRead = b.length - pos;
-                }
-                int cc = 0;
-                try {
-                    cc = in.read(b, pos, bytesToRead);
-                } catch (InterruptedIOException iioe) {
-                    Thread.interrupted();
-                    isInterrupted = true;
-                }
-                if (cc < 0) {
-                    if (len != Integer.MAX_VALUE) {
-                        throw new EOFException("Detect premature EOF");
-                    } else {
-                        if (b.length != pos) {
-                            b = Arrays.copyOf(b, pos);
-                        }
-                        break;
-                    }
-                }
-                pos += cc;
-            }
-        } finally {
-            try {
-                in.close();
-            } catch (InterruptedIOException iioe) {
-                isInterrupted = true;
-            } catch (IOException ignore) {}
-
-            if (isInterrupted) {
-                Thread.currentThread().interrupt();
-            }
-        }
-        return b;
-    }
-
-    /**
-     * Returns the Resource data as a ByteBuffer, but only if the input stream
-     * was implemented on top of a ByteBuffer. Return {@code null} otherwise.
-     * @return Resource data or null.
-     */
-    public ByteBuffer getByteBuffer() throws IOException {
-        InputStream in = cachedInputStream();
-        if (in instanceof ByteBuffered) {
-            return ((ByteBuffered)in).getByteBuffer();
-        }
-        return null;
-    }
-
-    /**
-     * Returns the Manifest for the Resource, or null if none.
-     */
-    public Manifest getManifest() throws IOException {
-        return null;
-    }
-
-    /**
-     * Returns theCertificates for the Resource, or null if none.
-     */
-    public java.security.cert.Certificate[] getCertificates() {
-        return null;
-    }
-
-    /**
-     * Returns the code signers for the Resource, or null if none.
-     */
-    public CodeSigner[] getCodeSigners() {
-        return null;
-    }
-}
--- a/src/java.base/share/classes/sun/misc/URLClassPath.java	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1080 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.CodeSigner;
-import java.security.Permission;
-import java.security.PrivilegedExceptionAction;
-import java.security.cert.Certificate;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-import java.util.jar.JarEntry;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
-import java.util.zip.ZipFile;
-
-import jdk.internal.misc.JavaUtilZipFileAccess;
-import jdk.internal.misc.SharedSecrets;
-import sun.net.util.URLUtil;
-import sun.net.www.ParseUtil;
-
-/**
- * This class is used to maintain a search path of URLs for loading classes
- * and resources from both JAR files and directories.
- *
- * @author  David Connelly
- */
-public class URLClassPath {
-    private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
-    private static final String JAVA_HOME;
-    private static final String JAVA_VERSION;
-    private static final boolean DEBUG;
-    private static final boolean DISABLE_JAR_CHECKING;
-
-    static {
-        JAVA_HOME = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("java.home"));
-        JAVA_VERSION = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("java.version"));
-        DEBUG        = (java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.debug")) != null);
-        String p = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
-        DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
-    }
-
-    /* The original search path of URLs. */
-    private ArrayList<URL> path = new ArrayList<>();
-
-    /* The stack of unopened URLs */
-    Stack<URL> urls = new Stack<>();
-
-    /* The resulting search path of Loaders */
-    ArrayList<Loader> loaders = new ArrayList<>();
-
-    /* Map of each URL opened to its corresponding Loader */
-    HashMap<String, Loader> lmap = new HashMap<>();
-
-    /* The jar protocol handler to use when creating new URLs */
-    private URLStreamHandler jarHandler;
-
-    /* Whether this URLClassLoader has been closed yet */
-    private boolean closed = false;
-
-    /**
-     * Creates a new URLClassPath for the given URLs. The URLs will be
-     * searched in the order specified for classes and resources. A URL
-     * ending with a '/' is assumed to refer to a directory. Otherwise,
-     * the URL is assumed to refer to a JAR file.
-     *
-     * @param urls the directory and JAR file URLs to search for classes
-     *        and resources
-     * @param factory the URLStreamHandlerFactory to use when creating new URLs
-     */
-    public URLClassPath(URL[] urls, URLStreamHandlerFactory factory) {
-        for (int i = 0; i < urls.length; i++) {
-            path.add(urls[i]);
-        }
-        push(urls);
-        if (factory != null) {
-            jarHandler = factory.createURLStreamHandler("jar");
-        }
-    }
-
-    public URLClassPath(URL[] urls) {
-        this(urls, null);
-    }
-
-    public synchronized List<IOException> closeLoaders() {
-        if (closed) {
-            return Collections.emptyList();
-        }
-        List<IOException> result = new LinkedList<>();
-        for (Loader loader : loaders) {
-            try {
-                loader.close();
-            } catch (IOException e) {
-                result.add (e);
-            }
-        }
-        closed = true;
-        return result;
-    }
-
-    /**
-     * Appends the specified URL to the search path of directory and JAR
-     * file URLs from which to load classes and resources.
-     * <p>
-     * If the URL specified is null or is already in the list of
-     * URLs, then invoking this method has no effect.
-     */
-    public synchronized void addURL(URL url) {
-        if (closed)
-            return;
-        synchronized (urls) {
-            if (url == null || path.contains(url))
-                return;
-
-            urls.add(0, url);
-            path.add(url);
-        }
-    }
-
-    /**
-     * Returns the original search path of URLs.
-     */
-    public URL[] getURLs() {
-        synchronized (urls) {
-            return path.toArray(new URL[path.size()]);
-        }
-    }
-
-    /**
-     * Finds the resource with the specified name on the URL search path
-     * or null if not found or security check fails.
-     *
-     * @param name      the name of the resource
-     * @param check     whether to perform a security check
-     * @return a <code>URL</code> for the resource, or <code>null</code>
-     * if the resource could not be found.
-     */
-    public URL findResource(String name, boolean check) {
-        Loader loader;
-        for (int i = 0; (loader = getLoader(i)) != null; i++) {
-            URL url = loader.findResource(name, check);
-            if (url != null) {
-                return url;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Finds the first Resource on the URL search path which has the specified
-     * name. Returns null if no Resource could be found.
-     *
-     * @param name the name of the Resource
-     * @param check     whether to perform a security check
-     * @return the Resource, or null if not found
-     */
-    public Resource getResource(String name, boolean check) {
-        if (DEBUG) {
-            System.err.println("URLClassPath.getResource(\"" + name + "\")");
-        }
-
-        Loader loader;
-        for (int i = 0; (loader = getLoader(i)) != null; i++) {
-            Resource res = loader.getResource(name, check);
-            if (res != null) {
-                return res;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Finds all resources on the URL search path with the given name.
-     * Returns an enumeration of the URL objects.
-     *
-     * @param name the resource name
-     * @return an Enumeration of all the urls having the specified name
-     */
-    public Enumeration<URL> findResources(final String name,
-                                     final boolean check) {
-        return new Enumeration<>() {
-            private int index = 0;
-            private URL url = null;
-
-            private boolean next() {
-                if (url != null) {
-                    return true;
-                } else {
-                    Loader loader;
-                    while ((loader = getLoader(index++)) != null) {
-                        url = loader.findResource(name, check);
-                        if (url != null) {
-                            return true;
-                        }
-                    }
-                    return false;
-                }
-            }
-
-            public boolean hasMoreElements() {
-                return next();
-            }
-
-            public URL nextElement() {
-                if (!next()) {
-                    throw new NoSuchElementException();
-                }
-                URL u = url;
-                url = null;
-                return u;
-            }
-        };
-    }
-
-    public Resource getResource(String name) {
-        return getResource(name, true);
-    }
-
-    /**
-     * Finds all resources on the URL search path with the given name.
-     * Returns an enumeration of the Resource objects.
-     *
-     * @param name the resource name
-     * @return an Enumeration of all the resources having the specified name
-     */
-    public Enumeration<Resource> getResources(final String name,
-                                    final boolean check) {
-        return new Enumeration<>() {
-            private int index = 0;
-            private Resource res = null;
-
-            private boolean next() {
-                if (res != null) {
-                    return true;
-                } else {
-                    Loader loader;
-                    while ((loader = getLoader(index++)) != null) {
-                        res = loader.getResource(name, check);
-                        if (res != null) {
-                            return true;
-                        }
-                    }
-                    return false;
-                }
-            }
-
-            public boolean hasMoreElements() {
-                return next();
-            }
-
-            public Resource nextElement() {
-                if (!next()) {
-                    throw new NoSuchElementException();
-                }
-                Resource r = res;
-                res = null;
-                return r;
-            }
-        };
-    }
-
-    public Enumeration<Resource> getResources(final String name) {
-        return getResources(name, true);
-    }
-
-    /*
-     * Returns the Loader at the specified position in the URL search
-     * path. The URLs are opened and expanded as needed. Returns null
-     * if the specified index is out of range.
-     */
-     private synchronized Loader getLoader(int index) {
-        if (closed) {
-            return null;
-        }
-         // Expand URL search path until the request can be satisfied
-         // or the URL stack is empty.
-        while (loaders.size() < index + 1) {
-            // Pop the next URL from the URL stack
-            URL url;
-            synchronized (urls) {
-                if (urls.empty()) {
-                    return null;
-                } else {
-                    url = urls.pop();
-                }
-            }
-            // Skip this URL if it already has a Loader. (Loader
-            // may be null in the case where URL has not been opened
-            // but is referenced by a JAR index.)
-            String urlNoFragString = URLUtil.urlNoFragString(url);
-            if (lmap.containsKey(urlNoFragString)) {
-                continue;
-            }
-            // Otherwise, create a new Loader for the URL.
-            Loader loader;
-            try {
-                loader = getLoader(url);
-                // If the loader defines a local class path then add the
-                // URLs to the list of URLs to be opened.
-                URL[] urls = loader.getClassPath();
-                if (urls != null) {
-                    push(urls);
-                }
-            } catch (IOException e) {
-                // Silently ignore for now...
-                continue;
-            }
-            // Finally, add the Loader to the search path.
-            loaders.add(loader);
-            lmap.put(urlNoFragString, loader);
-        }
-        return loaders.get(index);
-    }
-
-    /*
-     * Returns the Loader for the specified base URL.
-     */
-    private Loader getLoader(final URL url) throws IOException {
-        try {
-            return java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedExceptionAction<>() {
-                public Loader run() throws IOException {
-                    String file = url.getFile();
-                    if (file != null && file.endsWith("/")) {
-                        if ("file".equals(url.getProtocol())) {
-                            return new FileLoader(url);
-                        } else {
-                            return new Loader(url);
-                        }
-                    } else {
-                        return new JarLoader(url, jarHandler, lmap);
-                    }
-                }
-            });
-        } catch (java.security.PrivilegedActionException pae) {
-            throw (IOException)pae.getException();
-        }
-    }
-
-    /*
-     * Pushes the specified URLs onto the list of unopened URLs.
-     */
-    private void push(URL[] us) {
-        synchronized (urls) {
-            for (int i = us.length - 1; i >= 0; --i) {
-                urls.push(us[i]);
-            }
-        }
-    }
-
-    /**
-     * Convert class path specification into an array of file URLs.
-     *
-     * The path of the file is encoded before conversion into URL
-     * form so that reserved characters can safely appear in the path.
-     */
-    public static URL[] pathToURLs(String path) {
-        StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
-        URL[] urls = new URL[st.countTokens()];
-        int count = 0;
-        while (st.hasMoreTokens()) {
-            File f = new File(st.nextToken());
-            try {
-                f = new File(f.getCanonicalPath());
-            } catch (IOException x) {
-                // use the non-canonicalized filename
-            }
-            try {
-                urls[count++] = ParseUtil.fileToEncodedURL(f);
-            } catch (IOException x) { }
-        }
-
-        if (urls.length != count) {
-            URL[] tmp = new URL[count];
-            System.arraycopy(urls, 0, tmp, 0, count);
-            urls = tmp;
-        }
-        return urls;
-    }
-
-    /*
-     * Check whether the resource URL should be returned.
-     * Return null on security check failure.
-     * Called by java.net.URLClassLoader.
-     */
-    public static URL checkURL(URL url) {
-        if (url != null) {
-            try {
-                check(url);
-            } catch (Exception e) {
-                return null;
-            }
-        }
-        return url;
-    }
-
-    /*
-     * Check whether the resource URL should be returned.
-     * Throw exception on failure.
-     * Called internally within this file.
-     */
-    public static void check(URL url) throws IOException {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            URLConnection urlConnection = url.openConnection();
-            Permission perm = urlConnection.getPermission();
-            if (perm != null) {
-                try {
-                    security.checkPermission(perm);
-                } catch (SecurityException se) {
-                    // fallback to checkRead/checkConnect for pre 1.2
-                    // security managers
-                    if ((perm instanceof java.io.FilePermission) &&
-                        perm.getActions().indexOf("read") != -1) {
-                        security.checkRead(perm.getName());
-                    } else if ((perm instanceof
-                        java.net.SocketPermission) &&
-                        perm.getActions().indexOf("connect") != -1) {
-                        URL locUrl = url;
-                        if (urlConnection instanceof JarURLConnection) {
-                            locUrl = ((JarURLConnection)urlConnection).getJarFileURL();
-                        }
-                        security.checkConnect(locUrl.getHost(),
-                                              locUrl.getPort());
-                    } else {
-                        throw se;
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Inner class used to represent a loader of resources and classes
-     * from a base URL.
-     */
-    private static class Loader implements Closeable {
-        private final URL base;
-        private JarFile jarfile; // if this points to a jar file
-
-        /*
-         * Creates a new Loader for the specified URL.
-         */
-        Loader(URL url) {
-            base = url;
-        }
-
-        /*
-         * Returns the base URL for this Loader.
-         */
-        URL getBaseURL() {
-            return base;
-        }
-
-        URL findResource(final String name, boolean check) {
-            URL url;
-            try {
-                url = new URL(base, ParseUtil.encodePath(name, false));
-            } catch (MalformedURLException e) {
-                throw new IllegalArgumentException("name");
-            }
-
-            try {
-                if (check) {
-                    URLClassPath.check(url);
-                }
-
-                /*
-                 * For a HTTP connection we use the HEAD method to
-                 * check if the resource exists.
-                 */
-                URLConnection uc = url.openConnection();
-                if (uc instanceof HttpURLConnection) {
-                    HttpURLConnection hconn = (HttpURLConnection)uc;
-                    hconn.setRequestMethod("HEAD");
-                    if (hconn.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) {
-                        return null;
-                    }
-                } else {
-                    // our best guess for the other cases
-                    uc.setUseCaches(false);
-                    InputStream is = uc.getInputStream();
-                    is.close();
-                }
-                return url;
-            } catch (Exception e) {
-                return null;
-            }
-        }
-
-        Resource getResource(final String name, boolean check) {
-            final URL url;
-            try {
-                url = new URL(base, ParseUtil.encodePath(name, false));
-            } catch (MalformedURLException e) {
-                throw new IllegalArgumentException("name");
-            }
-            final URLConnection uc;
-            try {
-                if (check) {
-                    URLClassPath.check(url);
-                }
-                uc = url.openConnection();
-                InputStream in = uc.getInputStream();
-                if (uc instanceof JarURLConnection) {
-                    /* Need to remember the jar file so it can be closed
-                     * in a hurry.
-                     */
-                    JarURLConnection juc = (JarURLConnection)uc;
-                    jarfile = JarLoader.checkJar(juc.getJarFile());
-                }
-            } catch (Exception e) {
-                return null;
-            }
-            return new Resource() {
-                public String getName() { return name; }
-                public URL getURL() { return url; }
-                public URL getCodeSourceURL() { return base; }
-                public InputStream getInputStream() throws IOException {
-                    return uc.getInputStream();
-                }
-                public int getContentLength() throws IOException {
-                    return uc.getContentLength();
-                }
-            };
-        }
-
-        /*
-         * Returns the Resource for the specified name, or null if not
-         * found or the caller does not have the permission to get the
-         * resource.
-         */
-        Resource getResource(final String name) {
-            return getResource(name, true);
-        }
-
-        /*
-         * close this loader and release all resources
-         * method overridden in sub-classes
-         */
-        public void close () throws IOException {
-            if (jarfile != null) {
-                jarfile.close();
-            }
-        }
-
-        /*
-         * Returns the local class path for this loader, or null if none.
-         */
-        URL[] getClassPath() throws IOException {
-            return null;
-        }
-    }
-
-    /*
-     * Inner class used to represent a Loader of resources from a JAR URL.
-     */
-    static class JarLoader extends Loader {
-        private JarFile jar;
-        private URL csu;
-        private JarIndex index;
-        private URLStreamHandler handler;
-        private HashMap<String, Loader> lmap;
-        private boolean closed = false;
-        private static final JavaUtilZipFileAccess zipAccess =
-                SharedSecrets.getJavaUtilZipFileAccess();
-
-        /*
-         * Creates a new JarLoader for the specified URL referring to
-         * a JAR file.
-         */
-        JarLoader(URL url, URLStreamHandler jarHandler,
-                  HashMap<String, Loader> loaderMap)
-            throws IOException
-        {
-            super(new URL("jar", "", -1, url + "!/", jarHandler));
-            csu = url;
-            handler = jarHandler;
-            lmap = loaderMap;
-
-            ensureOpen();
-        }
-
-        @Override
-        public void close () throws IOException {
-            // closing is synchronized at higher level
-            if (!closed) {
-                closed = true;
-                // in case not already open.
-                ensureOpen();
-                jar.close();
-            }
-        }
-
-        JarFile getJarFile () {
-            return jar;
-        }
-
-        private boolean isOptimizable(URL url) {
-            return "file".equals(url.getProtocol());
-        }
-
-        private void ensureOpen() throws IOException {
-            if (jar == null) {
-                try {
-                    java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedExceptionAction<>() {
-                            public Void run() throws IOException {
-                                if (DEBUG) {
-                                    System.err.println("Opening " + csu);
-                                    Thread.dumpStack();
-                                }
-
-                                jar = getJarFile(csu);
-                                index = JarIndex.getJarIndex(jar);
-                                if (index != null) {
-                                    String[] jarfiles = index.getJarFiles();
-                                // Add all the dependent URLs to the lmap so that loaders
-                                // will not be created for them by URLClassPath.getLoader(int)
-                                // if the same URL occurs later on the main class path.  We set
-                                // Loader to null here to avoid creating a Loader for each
-                                // URL until we actually need to try to load something from them.
-                                    for(int i = 0; i < jarfiles.length; i++) {
-                                        try {
-                                            URL jarURL = new URL(csu, jarfiles[i]);
-                                            // If a non-null loader already exists, leave it alone.
-                                            String urlNoFragString = URLUtil.urlNoFragString(jarURL);
-                                            if (!lmap.containsKey(urlNoFragString)) {
-                                                lmap.put(urlNoFragString, null);
-                                            }
-                                        } catch (MalformedURLException e) {
-                                            continue;
-                                        }
-                                    }
-                                }
-                                return null;
-                            }
-                        }
-                    );
-                } catch (java.security.PrivilegedActionException pae) {
-                    throw (IOException)pae.getException();
-                }
-            }
-        }
-
-        /* Throws if the given jar file is does not start with the correct LOC */
-        static JarFile checkJar(JarFile jar) throws IOException {
-            if (System.getSecurityManager() != null && !DISABLE_JAR_CHECKING
-                && !zipAccess.startsWithLocHeader(jar)) {
-                IOException x = new IOException("Invalid Jar file");
-                try {
-                    jar.close();
-                } catch (IOException ex) {
-                    x.addSuppressed(ex);
-                }
-                throw x;
-            }
-
-            return jar;
-        }
-
-        private JarFile getJarFile(URL url) throws IOException {
-            // Optimize case where url refers to a local jar file
-            if (isOptimizable(url)) {
-                FileURLMapper p = new FileURLMapper (url);
-                if (!p.exists()) {
-                    throw new FileNotFoundException(p.getPath());
-                }
-                return checkJar(new JarFile(new File(p.getPath()), true, ZipFile.OPEN_READ,
-                        JarFile.Release.RUNTIME));
-            }
-            URLConnection uc = (new URL(getBaseURL(), "#runtime")).openConnection();
-            uc.setRequestProperty(USER_AGENT_JAVA_VERSION, JAVA_VERSION);
-            JarFile jarFile = ((JarURLConnection)uc).getJarFile();
-            return checkJar(jarFile);
-        }
-
-        /*
-         * Returns the index of this JarLoader if it exists.
-         */
-        JarIndex getIndex() {
-            try {
-                ensureOpen();
-            } catch (IOException e) {
-                throw new InternalError(e);
-            }
-            return index;
-        }
-
-        /*
-         * Creates the resource and if the check flag is set to true, checks if
-         * is its okay to return the resource.
-         */
-        Resource checkResource(final String name, boolean check,
-            final JarEntry entry) {
-
-            final URL url;
-            try {
-                if (jar.isMultiRelease()) {
-                    // add #runtime fragment to tell JarURLConnection to use
-                    // runtime versioning if the underlying jar file is multi-release
-                    url = new URL(getBaseURL(), ParseUtil.encodePath(name, false) + "#runtime");
-                } else {
-                    url = new URL(getBaseURL(), ParseUtil.encodePath(name, false));
-                }
-                if (check) {
-                    URLClassPath.check(url);
-                }
-            } catch (MalformedURLException e) {
-                return null;
-                // throw new IllegalArgumentException("name");
-            } catch (IOException e) {
-                return null;
-            } catch (AccessControlException e) {
-                return null;
-            }
-
-            return new Resource() {
-                public String getName() { return name; }
-                public URL getURL() { return url; }
-                public URL getCodeSourceURL() { return csu; }
-                public InputStream getInputStream() throws IOException
-                    { return jar.getInputStream(entry); }
-                public int getContentLength()
-                    { return (int)entry.getSize(); }
-                public Manifest getManifest() throws IOException
-                    { return jar.getManifest(); };
-                public Certificate[] getCertificates()
-                    { return entry.getCertificates(); };
-                public CodeSigner[] getCodeSigners()
-                    { return entry.getCodeSigners(); };
-            };
-        }
-
-
-        /*
-         * Returns true iff atleast one resource in the jar file has the same
-         * package name as that of the specified resource name.
-         */
-        boolean validIndex(final String name) {
-            String packageName = name;
-            int pos;
-            if((pos = name.lastIndexOf('/')) != -1) {
-                packageName = name.substring(0, pos);
-            }
-
-            String entryName;
-            ZipEntry entry;
-            Enumeration<JarEntry> enum_ = jar.entries();
-            while (enum_.hasMoreElements()) {
-                entry = enum_.nextElement();
-                entryName = entry.getName();
-                if((pos = entryName.lastIndexOf('/')) != -1)
-                    entryName = entryName.substring(0, pos);
-                if (entryName.equals(packageName)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /*
-         * Returns the URL for a resource with the specified name
-         */
-        URL findResource(final String name, boolean check) {
-            Resource rsc = getResource(name, check);
-            if (rsc != null) {
-                return rsc.getURL();
-            }
-            return null;
-        }
-
-        /*
-         * Returns the JAR Resource for the specified name.
-         */
-        Resource getResource(final String name, boolean check) {
-            try {
-                ensureOpen();
-            } catch (IOException e) {
-                throw new InternalError(e);
-            }
-            final JarEntry entry = jar.getJarEntry(name);
-            if (entry != null)
-                return checkResource(name, check, entry);
-
-            if (index == null)
-                return null;
-
-            HashSet<String> visited = new HashSet<>();
-            return getResource(name, check, visited);
-        }
-
-        /*
-         * Version of getResource() that tracks the jar files that have been
-         * visited by linking through the index files. This helper method uses
-         * a HashSet to store the URLs of jar files that have been searched and
-         * uses it to avoid going into an infinite loop, looking for a
-         * non-existent resource
-         */
-        Resource getResource(final String name, boolean check,
-                             Set<String> visited) {
-
-            Resource res;
-            String[] jarFiles;
-            int count = 0;
-            LinkedList<String> jarFilesList = null;
-
-            /* If there no jar files in the index that can potential contain
-             * this resource then return immediately.
-             */
-            if((jarFilesList = index.get(name)) == null)
-                return null;
-
-            do {
-                int size = jarFilesList.size();
-                jarFiles = jarFilesList.toArray(new String[size]);
-                /* loop through the mapped jar file list */
-                while(count < size) {
-                    String jarName = jarFiles[count++];
-                    JarLoader newLoader;
-                    final URL url;
-
-                    try{
-                        url = new URL(csu, jarName);
-                        String urlNoFragString = URLUtil.urlNoFragString(url);
-                        if ((newLoader = (JarLoader)lmap.get(urlNoFragString)) == null) {
-                            /* no loader has been set up for this jar file
-                             * before
-                             */
-                            newLoader = AccessController.doPrivileged(
-                                new PrivilegedExceptionAction<>() {
-                                    public JarLoader run() throws IOException {
-                                        return new JarLoader(url, handler,
-                                            lmap);
-                                    }
-                                });
-
-                            /* this newly opened jar file has its own index,
-                             * merge it into the parent's index, taking into
-                             * account the relative path.
-                             */
-                            JarIndex newIndex = newLoader.getIndex();
-                            if(newIndex != null) {
-                                int pos = jarName.lastIndexOf('/');
-                                newIndex.merge(this.index, (pos == -1 ?
-                                    null : jarName.substring(0, pos + 1)));
-                            }
-
-                            /* put it in the global hashtable */
-                            lmap.put(urlNoFragString, newLoader);
-                        }
-                    } catch (java.security.PrivilegedActionException pae) {
-                        continue;
-                    } catch (MalformedURLException e) {
-                        continue;
-                    }
-
-
-                    /* Note that the addition of the url to the list of visited
-                     * jars incorporates a check for presence in the hashmap
-                     */
-                    boolean visitedURL = !visited.add(URLUtil.urlNoFragString(url));
-                    if (!visitedURL) {
-                        try {
-                            newLoader.ensureOpen();
-                        } catch (IOException e) {
-                            throw new InternalError(e);
-                        }
-                        final JarEntry entry = newLoader.jar.getJarEntry(name);
-                        if (entry != null) {
-                            return newLoader.checkResource(name, check, entry);
-                        }
-
-                        /* Verify that at least one other resource with the
-                         * same package name as the lookedup resource is
-                         * present in the new jar
-                         */
-                        if (!newLoader.validIndex(name)) {
-                            /* the mapping is wrong */
-                            throw new InvalidJarIndexException("Invalid index");
-                        }
-                    }
-
-                    /* If newLoader is the current loader or if it is a
-                     * loader that has already been searched or if the new
-                     * loader does not have an index then skip it
-                     * and move on to the next loader.
-                     */
-                    if (visitedURL || newLoader == this ||
-                            newLoader.getIndex() == null) {
-                        continue;
-                    }
-
-                    /* Process the index of the new loader
-                     */
-                    if((res = newLoader.getResource(name, check, visited))
-                            != null) {
-                        return res;
-                    }
-                }
-                // Get the list of jar files again as the list could have grown
-                // due to merging of index files.
-                jarFilesList = index.get(name);
-
-            // If the count is unchanged, we are done.
-            } while(count < jarFilesList.size());
-            return null;
-        }
-
-
-        /*
-         * Returns the JAR file local class path, or null if none.
-         */
-        URL[] getClassPath() throws IOException {
-            if (index != null) {
-                return null;
-            }
-
-            ensureOpen();
-
-            if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
-                Manifest man = jar.getManifest();
-                if (man != null) {
-                    Attributes attr = man.getMainAttributes();
-                    if (attr != null) {
-                        String value = attr.getValue(Name.CLASS_PATH);
-                        if (value != null) {
-                            return parseClassPath(csu, value);
-                        }
-                    }
-                }
-            }
-            return null;
-        }
-
-        /*
-         * Parses value of the Class-Path manifest attribute and returns
-         * an array of URLs relative to the specified base URL.
-         */
-        private URL[] parseClassPath(URL base, String value)
-            throws MalformedURLException
-        {
-            StringTokenizer st = new StringTokenizer(value);
-            URL[] urls = new URL[st.countTokens()];
-            int i = 0;
-            while (st.hasMoreTokens()) {
-                String path = st.nextToken();
-                urls[i] = new URL(base, path);
-                i++;
-            }
-            return urls;
-        }
-    }
-
-    /*
-     * Inner class used to represent a loader of classes and resources
-     * from a file URL that refers to a directory.
-     */
-    private static class FileLoader extends Loader {
-        /* Canonicalized File */
-        private File dir;
-
-        FileLoader(URL url) throws IOException {
-            super(url);
-            if (!"file".equals(url.getProtocol())) {
-                throw new IllegalArgumentException("url");
-            }
-            String path = url.getFile().replace('/', File.separatorChar);
-            path = ParseUtil.decode(path);
-            dir = (new File(path)).getCanonicalFile();
-        }
-
-        /*
-         * Returns the URL for a resource with the specified name
-         */
-        URL findResource(final String name, boolean check) {
-            Resource rsc = getResource(name, check);
-            if (rsc != null) {
-                return rsc.getURL();
-            }
-            return null;
-        }
-
-        Resource getResource(final String name, boolean check) {
-            final URL url;
-            try {
-                URL normalizedBase = new URL(getBaseURL(), ".");
-                url = new URL(getBaseURL(), ParseUtil.encodePath(name, false));
-
-                if (url.getFile().startsWith(normalizedBase.getFile()) == false) {
-                    // requested resource had ../..'s in path
-                    return null;
-                }
-
-                if (check)
-                    URLClassPath.check(url);
-
-                final File file;
-                if (name.indexOf("..") != -1) {
-                    file = (new File(dir, name.replace('/', File.separatorChar)))
-                          .getCanonicalFile();
-                    if ( !((file.getPath()).startsWith(dir.getPath())) ) {
-                        /* outside of base dir */
-                        return null;
-                    }
-                } else {
-                    file = new File(dir, name.replace('/', File.separatorChar));
-                }
-
-                if (file.exists()) {
-                    return new Resource() {
-                        public String getName() { return name; };
-                        public URL getURL() { return url; };
-                        public URL getCodeSourceURL() { return getBaseURL(); };
-                        public InputStream getInputStream() throws IOException
-                            { return new FileInputStream(file); };
-                        public int getContentLength() throws IOException
-                            { return (int)file.length(); };
-                    };
-                }
-            } catch (Exception e) {
-                return null;
-            }
-            return null;
-        }
-    }
-}
--- a/src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java	Mon Mar 28 08:38:59 2016 -0700
@@ -96,12 +96,9 @@
             java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<>() {
                 public Void run() {
-                    keepAliveTimer = new InnocuousThread(cache, "Keep-Alive-Timer");
+                    keepAliveTimer = InnocuousThread.newSystemThread("Keep-Alive-Timer", cache);
                     keepAliveTimer.setDaemon(true);
                     keepAliveTimer.setPriority(Thread.MAX_PRIORITY - 2);
-                    // Set the context class loader to null in order to avoid
-                    // keeping a strong reference to an application classloader.
-                    keepAliveTimer.setContextClassLoader(null);
                     keepAliveTimer.start();
                     return null;
                 }
--- a/src/java.base/share/classes/sun/net/www/http/KeepAliveStream.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/sun/net/www/http/KeepAliveStream.java	Mon Mar 28 08:38:59 2016 -0700
@@ -173,12 +173,9 @@
                 java.security.AccessController.doPrivileged(
                     new java.security.PrivilegedAction<Void>() {
                     public Void run() {
-                        cleanerThread = new InnocuousThread(queue, "Keep-Alive-SocketCleaner");
+                        cleanerThread = InnocuousThread.newSystemThread("Keep-Alive-SocketCleaner", queue);
                         cleanerThread.setDaemon(true);
                         cleanerThread.setPriority(Thread.MAX_PRIORITY - 2);
-                        // Set the context class loader to null in order to avoid
-                        // keeping a strong reference to an application classloader.
-                        cleanerThread.setContextClassLoader(null);
                         cleanerThread.start();
                         return null;
                     }
--- a/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java	Mon Mar 28 08:38:59 2016 -0700
@@ -41,8 +41,8 @@
 import jdk.internal.jimage.ImageReader;
 import jdk.internal.jimage.ImageReaderFactory;
 
-import sun.misc.URLClassPath;
-import sun.misc.Resource;
+import jdk.internal.loader.URLClassPath;
+import jdk.internal.loader.Resource;
 import sun.net.www.ParseUtil;
 import sun.net.www.URLConnection;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+@@END_COPYRIGHT@@
+
+#include <stdio.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#endif
+
+/* Defines SO_REUSEPORT */
+#if !defined(SO_REUSEPORT)
+#ifdef _WIN32
+#define SO_REUSEPORT 0
+#elif __linux__
+#define SO_REUSEPORT 15
+#elif __solaris__
+#define SO_REUSEPORT 0x100e
+#elif defined(AIX) || defined(MACOSX)
+#define SO_REUSEPORT 0x0200
+#else
+#define SO_REUSEPORT 0
+#endif
+#endif
+
+/* On Solaris, "sun" is defined as a macro. Undefine to make package
+   declaration valid */
+#undef sun
+
+/* To be able to name the Java constants the same as the C constants without
+   having the preprocessor rewrite those identifiers, add PREFIX_ to all
+   identifiers matching a C constant. The PREFIX_ is filtered out in the
+   makefile. */
+
+@@START_HERE@@
+
+package sun.nio.ch;
+import java.net.SocketOption;
+import java.net.StandardSocketOptions;
+import java.net.ProtocolFamily;
+import java.net.StandardProtocolFamily;
+import java.util.Map;
+import java.util.HashMap;
+class SocketOptionRegistry {
+
+    private SocketOptionRegistry() { }
+
+    private static class RegistryKey {
+        private final SocketOption<?> name;
+        private final ProtocolFamily family;
+        RegistryKey(SocketOption<?> name, ProtocolFamily family) {
+            this.name = name;
+            this.family = family;
+        }
+        public int hashCode() {
+            return name.hashCode() + family.hashCode();
+        }
+        public boolean equals(Object ob) {
+            if (ob == null) return false;
+            if (!(ob instanceof RegistryKey)) return false;
+            RegistryKey other = (RegistryKey)ob;
+            if (this.name != other.name) return false;
+            if (this.family != other.family) return false;
+            return true;
+        }
+    }
+
+    private static class LazyInitialization {
+
+        static final Map<RegistryKey,OptionKey> options = options();
+
+        private static Map<RegistryKey,OptionKey> options() {
+            Map<RegistryKey,OptionKey> map =
+                new HashMap<RegistryKey,OptionKey>();
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_BROADCAST,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_BROADCAST));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_KEEPALIVE,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_KEEPALIVE));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_LINGER,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_LINGER));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_SNDBUF,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_SNDBUF));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_RCVBUF,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_RCVBUF));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_REUSEADDR,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_REUSEADDR));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_SO_REUSEPORT,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_REUSEPORT));
+            // IPPROTO_TCP is 6
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_TCP_NODELAY,
+                Net.UNSPEC), new OptionKey(6, TCP_NODELAY));
+
+            // IPPROTO_IP is 0
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_TOS,
+                StandardProtocolFamily.INET), new OptionKey(0, IP_TOS));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_MULTICAST_IF,
+                StandardProtocolFamily.INET), new OptionKey(0, IP_MULTICAST_IF));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_MULTICAST_TTL,
+                StandardProtocolFamily.INET), new OptionKey(0, IP_MULTICAST_TTL));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_MULTICAST_LOOP,
+                StandardProtocolFamily.INET), new OptionKey(0, IP_MULTICAST_LOOP));
+
+#ifdef AF_INET6
+            // IPPROTO_IPV6 is 41
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_TOS,
+                StandardProtocolFamily.INET6), new OptionKey(41, IPV6_TCLASS));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_MULTICAST_IF,
+                StandardProtocolFamily.INET6), new OptionKey(41, IPV6_MULTICAST_IF));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_MULTICAST_TTL,
+                StandardProtocolFamily.INET6), new OptionKey(41, IPV6_MULTICAST_HOPS));
+            map.put(new RegistryKey(StandardSocketOptions.PREFIX_IP_MULTICAST_LOOP,
+                StandardProtocolFamily.INET6), new OptionKey(41, IPV6_MULTICAST_LOOP));
+#endif
+
+            map.put(new RegistryKey(ExtendedSocketOption.PREFIX_SO_OOBINLINE,
+                Net.UNSPEC), new OptionKey(SOL_SOCKET, SO_OOBINLINE));
+            return map;
+        }
+    }
+
+    public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) {
+        RegistryKey key = new RegistryKey(name, family);
+        return LazyInitialization.options.get(key);
+    }
+}
--- a/src/java.base/share/classes/sun/nio/ch/ThreadPool.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/sun/nio/ch/ThreadPool.java	Mon Mar 28 08:38:59 2016 -0700
@@ -82,7 +82,7 @@
         } else {
             return (Runnable r) -> {
                 PrivilegedAction<Thread> action = () -> {
-                    Thread t = new InnocuousThread(r);
+                    Thread t = InnocuousThread.newThread(r);
                     t.setDaemon(true);
                     return t;
                };
--- a/src/java.base/share/classes/sun/nio/fs/NativeBuffer.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/sun/nio/fs/NativeBuffer.java	Mon Mar 28 08:38:59 2016 -0700
@@ -25,8 +25,9 @@
 
 package sun.nio.fs;
 
+import java.lang.ref.Cleaner.Cleanable;
 import jdk.internal.misc.Unsafe;
-import jdk.internal.ref.Cleaner;
+import jdk.internal.ref.CleanerFactory;
 
 /**
  * A light-weight buffer in native memory.
@@ -37,7 +38,7 @@
 
     private final long address;
     private final int size;
-    private final Cleaner cleaner;
+    private final Cleanable cleanable;
 
     // optional "owner" to avoid copying
     // (only safe for use by thread-local caches)
@@ -56,7 +57,8 @@
     NativeBuffer(int size) {
         this.address = unsafe.allocateMemory(size);
         this.size = size;
-        this.cleaner = Cleaner.create(this, new Deallocator(address));
+        this.cleanable = CleanerFactory.cleaner()
+                                       .register(this, new Deallocator(address));
     }
 
     void release() {
@@ -72,7 +74,7 @@
     }
 
     void free() {
-        cleaner.clean();
+        cleanable.clean();
     }
 
     // not synchronized; only safe for use by thread-local caches
--- a/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -115,10 +115,31 @@
 
         byte[] encoded = null;
         try {
+            boolean needFailover = false;
             Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
-            boolean needFailover = !KeyUtil.isOracleJCEProvider(
-                    cipher.getProvider().getName());
+            try {
+                // Try UNWRAP_MODE mode firstly.
+                cipher.init(Cipher.UNWRAP_MODE, privateKey,
+                        new TlsRsaPremasterSecretParameterSpec(
+                                maxVersion.v, currentVersion.v),
+                        generator);
+
+                // The provider selection can be delayed, please don't call
+                // any Cipher method before the call to Cipher.init().
+                needFailover = !KeyUtil.isOracleJCEProvider(
+                        cipher.getProvider().getName());
+            } catch (InvalidKeyException | UnsupportedOperationException iue) {
+                if (debug != null && Debug.isOn("handshake")) {
+                    System.out.println("The Cipher provider " +
+                        cipher.getProvider().getName() +
+                        " caused exception: " + iue.getMessage());
+                }
+
+                needFailover = true;
+            }
+
             if (needFailover) {
+                // Use DECRYPT_MODE and dispose the previous initialization.
                 cipher.init(Cipher.DECRYPT_MODE, privateKey);
                 boolean failed = false;
                 try {
@@ -134,10 +155,7 @@
                                 maxVersion.v, currentVersion.v,
                                 encoded, generator);
             } else {
-                cipher.init(Cipher.UNWRAP_MODE, privateKey,
-                        new TlsRsaPremasterSecretParameterSpec(
-                                maxVersion.v, currentVersion.v),
-                        generator);
+                // the cipher should have been initialized
                 preMaster = (SecretKey)cipher.unwrap(encrypted,
                         "TlsRsaPremasterSecret", Cipher.SECRET_KEY);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/solaris/classes/sun/nio/fs/SolarisConstants.java.template	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@@END_COPYRIGHT@@
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/acl.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* On Solaris, "sun" is defined as a macro. Undefine to make package
+   declaration valid */
+#undef sun
+
+/* To be able to name the Java constants the same as the C constants without
+   having the preprocessor rewrite those identifiers, add PREFIX_ to all
+   identifiers matching a C constant. The PREFIX_ is filtered out in the
+   makefile. */
+
+@@START_HERE@@
+
+package sun.nio.fs;
+class SolarisConstants {
+
+    private SolarisConstants() { }
+
+    static final int PREFIX_O_XATTR = O_XATTR;
+    static final int PREFIX__PC_XATTR_ENABLED = _PC_XATTR_ENABLED;
+    static final int PREFIX__PC_ACL_ENABLED = _PC_ACL_ENABLED;
+    static final int PREFIX__ACL_ACE_ENABLED = _ACL_ACE_ENABLED;
+    static final int PREFIX_ACE_GETACL = ACE_GETACL;
+    static final int PREFIX_ACE_SETACL = ACE_SETACL;
+    static final int PREFIX_ACE_ACCESS_ALLOWED_ACE_TYPE = ACE_ACCESS_ALLOWED_ACE_TYPE;
+    static final int PREFIX_ACE_ACCESS_DENIED_ACE_TYPE = ACE_ACCESS_DENIED_ACE_TYPE;
+    static final int PREFIX_ACE_SYSTEM_AUDIT_ACE_TYPE = ACE_SYSTEM_AUDIT_ACE_TYPE;
+    static final int PREFIX_ACE_SYSTEM_ALARM_ACE_TYPE = ACE_SYSTEM_ALARM_ACE_TYPE;
+    static final int PREFIX_ACE_READ_DATA = ACE_READ_DATA;
+    static final int PREFIX_ACE_LIST_DIRECTORY = ACE_LIST_DIRECTORY;
+    static final int PREFIX_ACE_WRITE_DATA = ACE_WRITE_DATA;
+    static final int PREFIX_ACE_ADD_FILE = ACE_ADD_FILE;
+    static final int PREFIX_ACE_APPEND_DATA = ACE_APPEND_DATA;
+    static final int PREFIX_ACE_ADD_SUBDIRECTORY = ACE_ADD_SUBDIRECTORY;
+    static final int PREFIX_ACE_READ_NAMED_ATTRS = ACE_READ_NAMED_ATTRS;
+    static final int PREFIX_ACE_WRITE_NAMED_ATTRS = ACE_WRITE_NAMED_ATTRS;
+    static final int PREFIX_ACE_EXECUTE = ACE_EXECUTE;
+    static final int PREFIX_ACE_DELETE_CHILD = ACE_DELETE_CHILD;
+    static final int PREFIX_ACE_READ_ATTRIBUTES = ACE_READ_ATTRIBUTES;
+    static final int PREFIX_ACE_WRITE_ATTRIBUTES = ACE_WRITE_ATTRIBUTES;
+    static final int PREFIX_ACE_DELETE = ACE_DELETE;
+    static final int PREFIX_ACE_READ_ACL = ACE_READ_ACL;
+    static final int PREFIX_ACE_WRITE_ACL = ACE_WRITE_ACL;
+    static final int PREFIX_ACE_WRITE_OWNER = ACE_WRITE_OWNER;
+    static final int PREFIX_ACE_SYNCHRONIZE = ACE_SYNCHRONIZE;
+    static final int PREFIX_ACE_FILE_INHERIT_ACE = ACE_FILE_INHERIT_ACE;
+    static final int PREFIX_ACE_DIRECTORY_INHERIT_ACE = ACE_DIRECTORY_INHERIT_ACE;
+    static final int PREFIX_ACE_NO_PROPAGATE_INHERIT_ACE = ACE_NO_PROPAGATE_INHERIT_ACE;
+    static final int PREFIX_ACE_INHERIT_ONLY_ACE = ACE_INHERIT_ONLY_ACE;
+    static final int PREFIX_ACE_SUCCESSFUL_ACCESS_ACE_FLAG = ACE_SUCCESSFUL_ACCESS_ACE_FLAG;
+    static final int PREFIX_ACE_FAILED_ACCESS_ACE_FLAG = ACE_FAILED_ACCESS_ACE_FLAG;
+    static final int PREFIX_ACE_IDENTIFIER_GROUP = ACE_IDENTIFIER_GROUP;
+    static final int PREFIX_ACE_OWNER = ACE_OWNER;
+    static final int PREFIX_ACE_GROUP = ACE_GROUP;
+    static final int PREFIX_ACE_EVERYONE = ACE_EVERYONE;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/unix/classes/jdk/internal/loader/FileURLMapper.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.loader;
+
+import java.net.URL;
+import java.io.File;
+import sun.net.www.ParseUtil;
+
+/**
+ * (Solaris) platform specific handling for file: URLs .
+ * urls must not contain a hostname in the authority field
+ * other than "localhost".
+ *
+ * This implementation could be updated to map such URLs
+ * on to /net/host/...
+ *
+ * @author      Michael McMahon
+ */
+
+public class FileURLMapper {
+
+    URL url;
+    String path;
+
+    public FileURLMapper (URL url) {
+        this.url = url;
+    }
+
+    /**
+     * @return the platform specific path corresponding to the URL
+     *  so long as the URL does not contain a hostname in the authority field.
+     */
+
+    public String getPath () {
+        if (path != null) {
+            return path;
+        }
+        String host = url.getHost();
+        if (host == null || "".equals(host) || "localhost".equalsIgnoreCase (host)) {
+            path = url.getFile();
+            path = ParseUtil.decode (path);
+        }
+        return path;
+    }
+
+    /**
+     * Checks whether the file identified by the URL exists.
+     */
+    public boolean exists () {
+        String s = getPath ();
+        if (s == null) {
+            return false;
+        } else {
+            File f = new File (s);
+            return f.exists();
+        }
+    }
+}
--- a/src/java.base/unix/classes/sun/misc/FileURLMapper.java	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.net.URL;
-import java.io.File;
-import sun.net.www.ParseUtil;
-
-/**
- * (Solaris) platform specific handling for file: URLs .
- * urls must not contain a hostname in the authority field
- * other than "localhost".
- *
- * This implementation could be updated to map such URLs
- * on to /net/host/...
- *
- * @author      Michael McMahon
- */
-
-public class FileURLMapper {
-
-    URL url;
-    String path;
-
-    public FileURLMapper (URL url) {
-        this.url = url;
-    }
-
-    /**
-     * @return the platform specific path corresponding to the URL
-     *  so long as the URL does not contain a hostname in the authority field.
-     */
-
-    public String getPath () {
-        if (path != null) {
-            return path;
-        }
-        String host = url.getHost();
-        if (host == null || "".equals(host) || "localhost".equalsIgnoreCase (host)) {
-            path = url.getFile();
-            path = ParseUtil.decode (path);
-        }
-        return path;
-    }
-
-    /**
-     * Checks whether the file identified by the URL exists.
-     */
-    public boolean exists () {
-        String s = getPath ();
-        if (s == null) {
-            return false;
-        } else {
-            File f = new File (s);
-            return f.exists();
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+@@END_COPYRIGHT@@
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* On Solaris, "sun" is defined as a macro. Undefine to make package
+   declaration valid */
+#undef sun
+
+/* To be able to name the Java constants the same as the C constants without
+   having the preprocessor rewrite those identifiers, add PREFIX_ to all
+   identifiers matching a C constant. The PREFIX_ is filtered out in the
+   makefile. */
+
+@@START_HERE@@
+
+package sun.nio.fs;
+class UnixConstants {
+    private UnixConstants() { }
+    static final int PREFIX_O_RDONLY = O_RDONLY;
+    static final int PREFIX_O_WRONLY = O_WRONLY;
+    static final int PREFIX_O_RDWR = O_RDWR;
+    static final int PREFIX_O_APPEND = O_APPEND;
+    static final int PREFIX_O_CREAT = O_CREAT;
+    static final int PREFIX_O_EXCL = O_EXCL;
+    static final int PREFIX_O_TRUNC = O_TRUNC;
+    static final int PREFIX_O_SYNC = O_SYNC;
+
+#ifndef O_DSYNC
+    // At least FreeBSD doesn't define O_DSYNC
+    static final int PREFIX_O_DSYNC = O_SYNC;
+#else
+    static final int PREFIX_O_DSYNC = O_DSYNC;
+#endif
+
+#ifdef O_NOFOLLOW
+    static final int PREFIX_O_NOFOLLOW = O_NOFOLLOW;
+#else
+    // not supported (dummy values will not be used at runtime).
+    static final int PREFIX_O_NOFOLLOW = 00;
+#endif
+
+
+    static final int PREFIX_S_IAMB =
+        (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
+    static final int PREFIX_S_IRUSR = S_IRUSR;
+    static final int PREFIX_S_IWUSR = S_IWUSR;
+    static final int PREFIX_S_IXUSR = S_IXUSR;
+    static final int PREFIX_S_IRGRP = S_IRGRP;
+    static final int PREFIX_S_IWGRP = S_IWGRP;
+    static final int PREFIX_S_IXGRP = S_IXGRP;
+    static final int PREFIX_S_IROTH = S_IROTH;
+    static final int PREFIX_S_IWOTH = S_IWOTH;
+    static final int PREFIX_S_IXOTH = S_IXOTH;
+
+    static final int PREFIX_S_IFMT = S_IFMT;
+    static final int PREFIX_S_IFREG = S_IFREG;
+    static final int PREFIX_S_IFDIR = S_IFDIR;
+    static final int PREFIX_S_IFLNK = S_IFLNK;
+    static final int PREFIX_S_IFCHR = S_IFCHR;
+    static final int PREFIX_S_IFBLK = S_IFBLK;
+    static final int PREFIX_S_IFIFO = S_IFIFO;
+    static final int PREFIX_R_OK = R_OK;
+    static final int PREFIX_W_OK = W_OK;
+    static final int PREFIX_X_OK = X_OK;
+    static final int PREFIX_F_OK = F_OK;
+    static final int PREFIX_ENOENT = ENOENT;
+    static final int PREFIX_ENXIO = ENXIO;
+    static final int PREFIX_EACCES = EACCES;
+    static final int PREFIX_EEXIST = EEXIST;
+    static final int PREFIX_ENOTDIR = ENOTDIR;
+    static final int PREFIX_EINVAL = EINVAL;
+    static final int PREFIX_EXDEV = EXDEV;
+    static final int PREFIX_EISDIR = EISDIR;
+    static final int PREFIX_ENOTEMPTY = ENOTEMPTY;
+    static final int PREFIX_ENOSPC = ENOSPC;
+    static final int PREFIX_EAGAIN = EAGAIN;
+    static final int PREFIX_ENOSYS = ENOSYS;
+    static final int PREFIX_ELOOP = ELOOP;
+    static final int PREFIX_EROFS = EROFS;
+
+#ifndef ENODATA
+    // Only used in Linux java source, provide any value so it compiles
+    static final int PREFIX_ENODATA = ELAST;
+#else
+    static final int PREFIX_ENODATA = ENODATA;
+#endif
+
+    static final int PREFIX_ERANGE = ERANGE;
+    static final int PREFIX_EMFILE = EMFILE;
+
+    // flags used with openat/unlinkat/etc.
+#if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)
+    static final int PREFIX_AT_SYMLINK_NOFOLLOW = AT_SYMLINK_NOFOLLOW;
+    static final int PREFIX_AT_REMOVEDIR = AT_REMOVEDIR;
+#else
+    // not supported (dummy values will not be used at runtime).
+    static final int PREFIX_AT_SYMLINK_NOFOLLOW = 00;
+    static final int PREFIX_AT_REMOVEDIR = 00;
+#endif
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/windows/classes/jdk/internal/loader/FileURLMapper.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.loader;
+
+import java.net.URL;
+import java.io.File;
+import sun.net.www.ParseUtil;
+
+/**
+ * (Windows) Platform specific handling for file: URLs . In particular deals
+ * with network paths mapping them to UNCs.
+ *
+ * @author      Michael McMahon
+ */
+
+public class FileURLMapper {
+
+    URL url;
+    String file;
+
+    public FileURLMapper (URL url) {
+        this.url = url;
+    }
+
+    /**
+     * @return the platform specific path corresponding to the URL, and in particular
+     *  returns a UNC when the authority contains a hostname
+     */
+
+    public String getPath () {
+        if (file != null) {
+            return file;
+        }
+        String host = url.getHost();
+        if (host != null && !host.equals("") &&
+            !"localhost".equalsIgnoreCase(host)) {
+            String rest = url.getFile();
+            String s = host + ParseUtil.decode (url.getFile());
+            file = "\\\\"+ s.replace('/', '\\');
+            return file;
+        }
+        String path = url.getFile().replace('/', '\\');
+        file = ParseUtil.decode(path);
+        return file;
+    }
+
+    public boolean exists() {
+        String path = getPath();
+        File f = new File (path);
+        return f.exists();
+    }
+}
--- a/src/java.base/windows/classes/sun/misc/FileURLMapper.java	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.net.URL;
-import java.io.File;
-import sun.net.www.ParseUtil;
-
-/**
- * (Windows) Platform specific handling for file: URLs . In particular deals
- * with network paths mapping them to UNCs.
- *
- * @author      Michael McMahon
- */
-
-public class FileURLMapper {
-
-    URL url;
-    String file;
-
-    public FileURLMapper (URL url) {
-        this.url = url;
-    }
-
-    /**
-     * @return the platform specific path corresponding to the URL, and in particular
-     *  returns a UNC when the authority contains a hostname
-     */
-
-    public String getPath () {
-        if (file != null) {
-            return file;
-        }
-        String host = url.getHost();
-        if (host != null && !host.equals("") &&
-            !"localhost".equalsIgnoreCase(host)) {
-            String rest = url.getFile();
-            String s = host + ParseUtil.decode (url.getFile());
-            file = "\\\\"+ s.replace('/', '\\');
-            return file;
-        }
-        String path = url.getFile().replace('/', '\\');
-        file = ParseUtil.decode(path);
-        return file;
-    }
-
-    public boolean exists() {
-        String path = getPath();
-        File f = new File (path);
-        return f.exists();
-    }
-}
--- a/src/java.httpclient/share/classes/java/net/http/Log.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.httpclient/share/classes/java/net/http/Log.java	Mon Mar 28 08:38:59 2016 -0700
@@ -24,7 +24,6 @@
 package java.net.http;
 
 import java.util.Locale;
-import sun.util.logging.PlatformLogger;
 
 /**
  * -Djava.net.HttpClient.log=errors,requests,headers,frames[:type:type2:..],content
@@ -35,9 +34,11 @@
  *
  * Logger name is "java.net.http.HttpClient"
  */
-class Log {
+// implements System.Logger in order to be skipped when printing the caller's
+// information
+abstract class Log implements System.Logger {
 
-    final static String logProp = "java.net.http.HttpClient.log";
+    static final String logProp = "java.net.http.HttpClient.log";
 
     public static final int OFF = 0;
     public static final int ERRORS = 0x1;
@@ -55,7 +56,7 @@
     public static final int ALL = CONTROL| DATA | WINDOW_UPDATES;
     static int frametypes;
 
-    static sun.util.logging.PlatformLogger logger;
+    static final System.Logger logger;
 
     static {
         String s = Utils.getNetProperty(logProp);
@@ -111,7 +112,9 @@
             }
         }
         if (logging != OFF) {
-            logger = PlatformLogger.getLogger("java.net.http.HttpClient");
+            logger = System.getLogger("java.net.http.HttpClient");
+        } else {
+            logger = null;
         }
     }
 
@@ -137,34 +140,38 @@
 
     static void logError(String s) {
         if (errors())
-            logger.info("ERROR: " + s);
+            logger.log(Level.INFO, "ERROR: " + s);
     }
 
     static void logError(Throwable t) {
         if (errors()) {
             String s = Utils.stackTrace(t);
-            logger.info("ERROR: " + s);
+            logger.log(Level.INFO, "ERROR: " + s);
         }
     }
 
     static void logSSL(String s) {
         if (ssl())
-            logger.info("SSL: " + s);
+            logger.log(Level.INFO, "SSL: " + s);
     }
 
     static void logRequest(String s) {
         if (requests())
-            logger.info("REQUEST: " + s);
+            logger.log(Level.INFO, "REQUEST: " + s);
     }
 
     static void logResponse(String s) {
         if (requests())
-            logger.info("RESPONSE: " + s);
+            logger.log(Level.INFO, "RESPONSE: " + s);
     }
 
     static void logHeaders(String s) {
         if (headers())
-            logger.info("HEADERS: " + s);
+            logger.log(Level.INFO, "HEADERS: " + s);
     }
+
+    // not instantiable
+    private Log() {}
+
 // END HTTP2
 }
--- a/src/java.logging/share/classes/java/util/logging/LogRecord.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.logging/share/classes/java/util/logging/LogRecord.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,7 @@
 import java.security.PrivilegedAction;
 import java.time.Clock;
 import java.util.function.Predicate;
-
-import static jdk.internal.logger.SimpleConsoleLogger.isFilteredFrame;
+import static jdk.internal.logger.SurrogateLogger.isFilteredFrame;
 
 /**
  * LogRecord objects are used to pass logging requests between
--- a/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 import java.io.*;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
-import jdk.internal.logger.SimpleConsoleLogger;
+import jdk.internal.logger.SurrogateLogger;
 
 /**
  * Print a brief summary of the {@code LogRecord} in a human readable
@@ -64,7 +64,7 @@
     }
 
     private final String format =
-        SimpleConsoleLogger.getSimpleFormat(SimpleFormatter::getLoggingProperty);
+        SurrogateLogger.getSimpleFormat(SimpleFormatter::getLoggingProperty);
 
     /**
      * Format the given LogRecord.
--- a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java	Mon Mar 28 08:38:59 2016 -0700
@@ -25,10 +25,15 @@
 
 package sun.rmi.registry;
 
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
+import java.io.File;
 import java.io.FilePermission;
 import java.io.IOException;
 import java.net.*;
@@ -333,6 +338,30 @@
     }
 
     /**
+     * Convert class path specification into an array of file URLs.
+     *
+     * The path of the file is converted to a URI then into URL
+     * form so that reserved characters can safely appear in the path.
+     */
+    private static URL[] pathToURLs(String path) {
+        List<URL> paths = new ArrayList<>();
+        for (String entry: path.split(File.pathSeparator)) {
+            Path p = Paths.get(entry);
+            try {
+                p = p.toRealPath();
+            } catch (IOException x) {
+                p = p.toAbsolutePath();
+            }
+            try {
+                paths.add(p.toUri().toURL());
+            } catch (MalformedURLException e) {
+                //ignore / skip entry
+            }
+        }
+        return paths.toArray(new URL[0]);
+    }
+
+    /**
      * Main program to start a registry. <br>
      * The port number can be specified on the command line.
      */
@@ -362,7 +391,7 @@
             if (envcp == null) {
                 envcp = ".";            // preserve old default behavior
             }
-            URL[] urls = sun.misc.URLClassPath.pathToURLs(envcp);
+            URL[] urls = pathToURLs(envcp);
             ClassLoader cl = new URLClassLoader(urls);
 
             /*
--- a/src/jdk.deploy.osx/macosx/classes/module-info.java	Fri Mar 25 13:47:21 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-module jdk.deploy.osx {
-    requires java.desktop;
-    requires java.scripting;
-}
-
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Mon Mar 28 08:38:59 2016 -0700
@@ -155,9 +155,13 @@
 
     @Override
     public void configure(Map<String, String> config) {
-        priorityList = Arrays.stream(config.get(NAME).split(","))
-            .map(Locale.LanguageRange::new)
-            .collect(Collectors.toList());
+        try {
+            priorityList = Arrays.stream(config.get(NAME).split(","))
+                .map(Locale.LanguageRange::new)
+                .collect(Collectors.toList());
+        } catch (IllegalArgumentException iae) {
+            throw new PluginException(iae.getLocalizedMessage());
+        }
     }
 
     @Override
@@ -168,7 +172,7 @@
         // jdk.localedata module validation
         Set<String> packages = module.getAllPackages();
         if (!packages.containsAll(LOCALEDATA_PACKAGES)) {
-            throw new PluginException("Missing locale data packages in jdk.localedata:\n\t" +
+            throw new PluginException(PluginsResourceBundle.getMessage(NAME + ".missingpackages") +
                 LOCALEDATA_PACKAGES.stream()
                     .filter(pn -> !packages.contains(pn))
                     .collect(Collectors.joining(",\n\t")));
@@ -186,6 +190,10 @@
 
         filtered = filterLocales(available);
 
+        if (filtered.isEmpty()) {
+            throw new PluginException(PluginsResourceBundle.getMessage(NAME + ".nomatchinglocales"));
+        }
+
         try {
             String value = META_FILES + filtered.stream()
                 .map(s -> includeLocaleFilePatterns(s))
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties	Fri Mar 25 13:47:21 2016 -0700
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties	Mon Mar 28 08:38:59 2016 -0700
@@ -68,9 +68,18 @@
 
 zip.description=ZIP Compression
 
-include-locales.argument=<langtag>[,<langtag>]*
+include-locales.argument=\
+<langtag>[,<langtag>]*
 
-include-locales.description=BCP 47 language tags separated by a comma, allowing locale matching\ndefined in RFC 4647. eg: en,ja,*-IN
+include-locales.description=\
+BCP 47 language tags separated by a comma, allowing locale matching\n\
+defined in RFC 4647. eg: en,ja,*-IN
+
+include-locales.missingpackages=\
+Missing locale data packages in jdk.localedata:\n\t
+
+include-locales.nomatchinglocales=\
+No matching locales found. Check the specified pattern.
 
 main.status.ok=Functional.
 
--- a/test/ProblemList.txt	Fri Mar 25 13:47:21 2016 -0700
+++ b/test/ProblemList.txt	Mon Mar 28 08:38:59 2016 -0700
@@ -198,6 +198,7 @@
 
 # 7158947, Solaris 11
 java/nio/file/WatchService/Basic.java				solaris-all
+java/nio/file/WatchService/MayFlies.java			solaris-all
 java/nio/file/WatchService/LotsOfEvents.java			solaris-all
 
 # 8149712
@@ -354,6 +355,9 @@
 # 8059906 fails on solaris and macosx, 8151901 
 tools/pack200/Pack200Test.java                                  generic-all
 
+# 8152622
+tools/pack200/Pack200Props.java                                 macosx-all
+
 # 8068049 
 tools/launcher/FXLauncherTest.java                              linux-all,macosx-all
 
--- a/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Mon Mar 28 08:38:59 2016 -0700
@@ -181,7 +181,7 @@
         }
 
         System.Logger createSimpleLogger(String name) {
-            PrivilegedAction<System.Logger> pa = () -> SimpleConsoleLogger.makeSimpleLogger(name, false);
+            PrivilegedAction<System.Logger> pa = () -> SimpleConsoleLogger.makeSimpleLogger(name);
             return AccessController.doPrivileged(pa);
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/System/LoggerFinder/internal/SimpleConsoleLoggerTest/SimpleConsoleLoggerTest.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,561 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.UncheckedIOException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Supplier;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import jdk.internal.logger.SimpleConsoleLogger;
+import jdk.internal.logger.SurrogateLogger;
+import sun.util.logging.PlatformLogger;
+
+/**
+ * @test
+ * @bug     8140364
+ * @summary JDK implementation specific unit test for SimpleConsoleLogger.
+ *          Tests the behavior of SimpleConsoleLogger.
+ * @modules java.base/sun.util.logging
+ *          java.base/jdk.internal.logger
+ * @build SimpleConsoleLoggerTest
+ * @run  main/othervm SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=OFF SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=ERROR SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=WARNING SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=INFO SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=DEBUG SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=TRACE SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=ALL SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=WOMBAT SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=FINEST SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=DEBUG -Djava.util.logging.SimpleFormatter.format=++++_%2$s%n%4$s:_%5$s%6$s%n SimpleConsoleLoggerTest
+ * @run  main/othervm -Djdk.system.logger.level=DEBUG -Djdk.system.logger.format=++++_%2$s%n%4$s:_%5$s%6$s%n SimpleConsoleLoggerTest
+ *
+ * @author danielfuchs
+ */
+public class SimpleConsoleLoggerTest {
+
+    static final RuntimePermission LOGGERFINDER_PERMISSION =
+                new RuntimePermission("loggerFinder");
+    final static boolean VERBOSE = false;
+
+    public static class MyBundle extends ResourceBundle {
+
+        final ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
+
+        @Override
+        protected Object handleGetObject(String key) {
+            if (key.contains(" (translated)")) {
+                throw new RuntimeException("Unexpected key: " + key);
+            }
+            return map.computeIfAbsent(key, k -> k.toUpperCase(Locale.ROOT) + " (translated)");
+        }
+
+        @Override
+        public Enumeration<String> getKeys() {
+            return Collections.enumeration(map.keySet());
+        }
+
+    }
+    public static class MyLoggerBundle extends MyBundle {
+
+    }
+
+
+    static class ErrorStream extends PrintStream {
+
+        static AtomicBoolean forward = new AtomicBoolean();
+        ByteArrayOutputStream out;
+        String saved = "";
+        public ErrorStream(ByteArrayOutputStream out) {
+            super(out);
+            this.out = out;
+        }
+
+        @Override
+        public void write(int b) {
+            super.write(b);
+            if (forward.get()) err.write(b);
+        }
+
+        @Override
+        public void write(byte[] b) throws IOException {
+            super.write(b);
+            if (forward.get()) err.write(b);
+        }
+
+        @Override
+        public void write(byte[] buf, int off, int len) {
+            super.write(buf, off, len);
+            if (forward.get()) err.write(buf, off, len);
+        }
+
+        public String peek() {
+            flush();
+            return out.toString();
+        }
+
+        public String drain() {
+            flush();
+            String res = out.toString();
+            out.reset();
+            return res;
+        }
+
+        public void store() {
+            flush();
+            saved = out.toString();
+            out.reset();
+        }
+
+        public void restore() {
+            out.reset();
+            try {
+                out.write(saved.getBytes());
+            } catch(IOException io) {
+                throw new UncheckedIOException(io);
+            }
+        }
+
+        static final PrintStream err = System.err;
+        static final ErrorStream errorStream = new ErrorStream(new ByteArrayOutputStream());
+    }
+
+    private static StringBuilder appendProperty(StringBuilder b, String name) {
+        String value = System.getProperty(name);
+        if (value == null) return b;
+        return b.append(name).append("=").append(value).append('\n');
+    }
+
+    public static void main(String[] args) {
+        Locale.setDefault(Locale.ENGLISH);
+        System.setErr(ErrorStream.errorStream);
+        try {
+            test(args);
+        } finally {
+            try {
+                System.setErr(ErrorStream.err);
+            } catch (Error | RuntimeException x) {
+                x.printStackTrace(ErrorStream.err);
+            }
+        }
+    }
+
+
+    public static void test(String[] args) {
+
+        ErrorStream.errorStream.restore();
+        String l = System.getProperty("jdk.system.logger.level");
+        String f = System.getProperty("jdk.system.logger.format");
+        String jf = System.getProperty("java.util.logging.SimpleFormatter.format");
+        System.out.println("Running test: "
+            + "\n\tjdk.system.logger.level=\"" + l + "\""
+            + "\n\tjdk.system.logger.format=\"" + f + "\""
+            + "\n\tjava.util.logging.SimpleFormatter.format=\"" + jf + "\"");
+
+        test(l,f,jf);
+        System.out.println("\nPASSED: tested " + SEQUENCER.get() + " test cases");
+    }
+
+    static final AtomicLong SEQUENCER = new AtomicLong();
+    public static void test(String defaultLevel, String defaultFormat, String julFormat) {
+
+        final Map<Logger, String> loggerDescMap = new HashMap<>();
+
+        SimpleConsoleLogger simple = SimpleConsoleLogger.makeSimpleLogger("test.logger");
+        loggerDescMap.put(simple, "SimpleConsoleLogger.makeSimpleLogger(\"test.logger\")");
+        SimpleConsoleLogger temporary = SurrogateLogger.makeSurrogateLogger("test.logger");
+        loggerDescMap.put(temporary, "SurrogateLogger.makeSimpleLogger(\"test.logger\")");
+
+        Level level;
+        try {
+            level = defaultLevel == null ? null : Level.valueOf(defaultLevel);
+        } catch (IllegalArgumentException ex) {
+            level = null;
+        }
+        testLogger(loggerDescMap, simple, level, false, defaultFormat);
+        testLogger(loggerDescMap, temporary, null, true, julFormat);
+    }
+
+    public static class Foo {
+
+    }
+
+    static void verbose(String msg) {
+       if (VERBOSE) {
+           System.out.println(msg);
+       }
+    }
+
+    static String getName(Level level, boolean usePlatformLevel) {
+        if (usePlatformLevel) {
+            return PlatformLogger.toPlatformLevel(level).name();
+        } else {
+            return level.getName();
+        }
+    }
+
+    // Calls the 8 methods defined on Logger and verify the
+    // parameters received by the underlying TestProvider.LoggerImpl
+    // logger.
+    private static void testLogger(Map<Logger, String> loggerDescMap,
+            SimpleConsoleLogger simple,
+            Level defaultLevel,
+            boolean usePlatformLevel,
+            String defaultFormat) {
+
+        System.out.println("Testing " + loggerDescMap.get(simple) + " [" + simple +"]");
+
+        String formatStrMarker = defaultFormat == null ? ""
+                : defaultFormat.startsWith("++++") ? "++++" : "";
+        String unexpectedMarker = defaultFormat == null ? "++++"
+                : defaultFormat.startsWith("++++") ? "????" : "++++";
+        String formatStrSpec = defaultFormat == null ? "[date]"
+                : defaultFormat.startsWith("++++") ? "++++" : "????";
+        String sep = defaultFormat == null ? ": " : ":_";
+        String sepw = defaultFormat == null ? " " : "_";
+
+        Foo foo = new Foo();
+        String fooMsg = foo.toString();
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                ErrorStream.errorStream.drain();
+                String desc = "logger.log(messageLevel, foo): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, foo);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF
+                    || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + fooMsg;
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(expected)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + expected
+                                + "\n>>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+        String msg = "blah";
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, \"blah\"): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, msg);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF
+                    || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + msg;
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(expected)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + expected
+                                + "\n>>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+        Supplier<String> fooSupplier = new Supplier<String>() {
+            @Override
+            public String get() {
+                return this.toString();
+            }
+        };
+
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, fooSupplier): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, fooSupplier);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF
+                    || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + fooSupplier.get();
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(expected)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + expected
+                                + "\n>>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+
+        String format = "two params [{1} {2}]";
+        Object arg1 = foo;
+        Object arg2 = msg;
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, format, params...): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, format, foo, msg);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    String msgFormat = format;
+                    String text = java.text.MessageFormat.format(msgFormat, foo, msg);
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + text;
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || !logged.contains(expected)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + expected
+                                + "\n>>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+        Throwable thrown = new Exception("OK: log me!");
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, \"blah\", thrown): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, msg, thrown);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    thrown.printStackTrace(new PrintStream(baos));
+                    String text = baos.toString();
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + msg;
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || !logged.contains(expected)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(text)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + msg +"\n"
+                                + text
+                                + ">>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, thrown, fooSupplier): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, fooSupplier, thrown);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    thrown.printStackTrace(new PrintStream(baos));
+                    String text = baos.toString();
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + fooSupplier.get();
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || !logged.contains(expected)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(text)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + expected +"\n"
+                                + text
+                                + ">>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+        ResourceBundle bundle = ResourceBundle.getBundle(MyBundle.class.getName());
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, bundle, format, params...): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, bundle, format, foo, msg);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    String text = java.text.MessageFormat.format(bundle.getString(format), foo, msg);
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(getName(messageLevel, usePlatformLevel) + sep + text)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + getName(messageLevel, usePlatformLevel) + " " + text
+                                + "\n>>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+        for (Level loggerLevel : defaultLevel == null
+                ? EnumSet.of(Level.INFO) : EnumSet.of(defaultLevel)) {
+            for (Level messageLevel : Level.values()) {
+                String desc = "logger.log(messageLevel, bundle, \"blah\", thrown): loggerLevel="
+                        + loggerLevel+", messageLevel="+messageLevel;
+                SEQUENCER.incrementAndGet();
+                simple.log(messageLevel, bundle, msg, thrown);
+                if (loggerLevel == Level.OFF || messageLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) {
+                    if (!ErrorStream.errorStream.peek().isEmpty()) {
+                        throw new RuntimeException("unexpected event in queue for "
+                                + desc +": " + "\n\t" + ErrorStream.errorStream.drain());
+                    }
+                } else {
+                    String logged = ErrorStream.errorStream.drain();
+                    String textMsg = bundle.getString(msg);
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    thrown.printStackTrace(new PrintStream(baos));
+                    String text = baos.toString();
+                    String expected = getName(messageLevel, usePlatformLevel) + sep + textMsg;
+                    if (!logged.contains("SimpleConsoleLoggerTest testLogger")
+                        || !logged.contains(formatStrMarker)
+                        || !logged.contains(expected)
+                        || logged.contains(unexpectedMarker)
+                        || !logged.contains(text)) {
+                        throw new RuntimeException("mismatch for " + desc
+                                + "\n\texpected:" + "\n<<<<\n"
+                                + formatStrSpec + sepw + "SimpleConsoleLoggerTest testLogger\n"
+                                + expected +"\n"
+                                + text
+                                + ">>>>"
+                                + "\n\t  actual:"
+                                + "\n<<<<\n" + logged + ">>>>\n");
+                    } else {
+                        verbose("Got expected results for "
+                                + desc + "\n<<<<\n" + logged + ">>>>\n");
+                    }
+                }
+            }
+        }
+
+    }
+}
--- a/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /* @test
  * @bug 7184932
  * @summary Test asynchronous close and interrupt of timed socket adapter methods
- * @key randomness
+ * @key randomness intermittent
  */
 
 import java.io.*;
--- a/test/javax/net/ssl/DTLS/WeakCipherSuite.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/test/javax/net/ssl/DTLS/WeakCipherSuite.java	Mon Mar 28 08:38:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 /*
  * @test
  * @bug 8043758
+ * @key intermittent
  * @summary Datagram Transport Layer Security (DTLS)
  * @modules java.base/sun.security.util
  * @build DTLSOverDatagram
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/bind/jxc/8073872/Foo.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"fooObject"})
+@XmlRootElement(name = "Foo")
+
+public class Foo {
+
+    protected List<Foo> fooObject;
+
+    public List<Foo> getFooObject() {
+        if (fooObject == null) {
+            fooObject = new ArrayList<Foo>();
+        }
+        return this.fooObject;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/bind/jxc/8073872/SchemagenStackOverflow.java	Mon Mar 28 08:38:59 2016 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8073872
+ * @summary test that stackoverflow is not observable when element
+ *          references containing class
+ * @modules java.xml
+ * @modules java.xml.bind
+ * @compile Foo.java
+ * @run testng/othervm SchemagenStackOverflow
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.stream.Collectors;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class SchemagenStackOverflow {
+
+    @Test
+    public void schemagenStackOverflowTest() throws Exception {
+        // Create new instance of JAXB context
+        JAXBContext context = JAXBContext.newInstance(Foo.class);
+        context.generateSchema(new TestOutputResolver());
+
+        // Read schema content from file
+        String content = Files.lines(resultSchemaFile).collect(Collectors.joining(""));
+        System.out.println("Generated schema content:" + content);
+
+        // Check if schema was generated: check class and list object names
+        Assert.assertTrue(content.contains("name=\"Foo\""));
+        Assert.assertTrue(content.contains("name=\"fooObject\""));
+    }
+
+    // Schemagen output resolver
+    class TestOutputResolver extends SchemaOutputResolver {
+        @Override
+        public Result createOutput(String namespaceUri, String fileName)
+                throws IOException {
+            return new StreamResult(resultSchemaFile.toFile());
+        }
+    }
+
+    // Schemagen output file name and path
+    static final String SCHEMA_FILENAME = "generatedSchema.xsd";
+    Path resultSchemaFile = Paths.get(System.getProperty("user.dir", "."))
+            .resolve(SCHEMA_FILENAME);
+
+}
--- a/test/tools/jlink/SecurityTest.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/test/tools/jlink/SecurityTest.java	Mon Mar 28 08:38:59 2016 -0700
@@ -25,7 +25,7 @@
  * @test
  * @summary Test JlinkPermission
  * @author Jean-Francois Denise
- * @run main SecurityTest
+ * @run main/othervm SecurityTest
  */
 
 import java.security.AccessControlException;
@@ -36,16 +36,11 @@
     public static void main(String[] args) throws Exception {
         new Jlink();
         System.setSecurityManager(new SecurityManager());
-        boolean failed = false;
         try {
             new Jlink();
-            failed = true;
+            throw new Exception("Call should have failed");
         } catch (AccessControlException ex) {
-            //XXX OK.
+            // expected exception
         }
-        if (failed) {
-            throw new Exception("Call should have failed");
-        }
-
     }
 }
--- a/test/tools/jlink/plugins/IncludeLocalesPluginTest.java	Fri Mar 25 13:47:21 2016 -0700
+++ b/test/tools/jlink/plugins/IncludeLocalesPluginTest.java	Mon Mar 28 08:38:59 2016 -0700
@@ -21,26 +21,18 @@
  * questions.
  */
 
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Layer;
-import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
-import java.util.stream.Stream;
 
 import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.internal.PluginRepository;
+import jdk.tools.jlink.internal.TaskHelper;
+import jdk.tools.jlink.internal.plugins.PluginsResourceBundle;
 import tests.Helper;
 import tests.JImageGenerator;
 import tests.JImageValidator;
+import tests.Result;
 
 /*
  * @test
@@ -50,6 +42,7 @@
  * @modules java.base/jdk.internal.jimage
  *          jdk.jdeps/com.sun.tools.classfile
  *          jdk.jlink/jdk.tools.jlink.internal
+ *          jdk.jlink/jdk.tools.jlink.internal.plugins
  *          jdk.jlink/jdk.tools.jmod
  *          jdk.jlink/jdk.tools.jimage
  *          jdk.compiler
@@ -65,6 +58,7 @@
     private final static int EXPECTED_LOCATIONS     = 1;
     private final static int UNEXPECTED_PATHS       = 2;
     private final static int AVAILABLE_LOCALES      = 3;
+    private final static int ERROR_MESSAGE          = 4;
 
     private final static Object[][] testData = {
         // without --include-locales option: should include all locales
@@ -144,6 +138,7 @@
             "yav_CM yo yo_BJ yo_NG zgh zgh_MA zh zh_CN zh_CN_#Hans zh_HK " +
             "zh_HK_#Hans zh_HK_#Hant zh_MO_#Hans zh_MO_#Hant zh_SG zh_SG_#Hans " +
             "zh_TW zh_TW_#Hant zh__#Hans zh__#Hant zu zu_ZA",
+            "",
         },
 
         // All English/Japanese locales
@@ -173,6 +168,7 @@
             "en_PW en_RW en_SB en_SC en_SD en_SG en_SH en_SL en_SS en_SX en_SZ " +
             "en_TC en_TK en_TO en_TT en_TV en_TZ en_UG en_UM en_US en_US_POSIX " +
             "en_VC en_VG en_VI en_VU en_WS en_ZA en_ZM en_ZW ja ja_JP ja_JP_JP_#u-ca-japanese",
+            "",
         },
 
         // All locales in India
@@ -201,6 +197,7 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
             " as_IN bn_IN bo_IN brx_IN en en_IN en_US en_US_POSIX gu_IN hi_IN kn_IN " +
             "kok_IN ks_IN_#Arab ml_IN mr_IN ne_IN or_IN pa_IN_#Guru ta_IN te_IN ur_IN",
+            "",
         },
 
         // Thai
@@ -220,6 +217,7 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
             " en en_US en_US_POSIX th th_TH th_TH_TH_#u-nu-thai",
+            "",
         },
 
         // Hong Kong
@@ -242,6 +240,7 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
             " en en_US en_US_POSIX zh_HK zh_HK_#Hans zh_HK_#Hant",
+            "",
         },
 
         // Norwegian
@@ -265,6 +264,7 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
             " en en_US en_US_POSIX nb nb_NO nb_SJ nn nn_NO no no_NO no_NO_NY",
+            "",
         },
 
         // Hebrew/Indonesian/Yiddish
@@ -290,6 +290,25 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
             " en en_US en_US_POSIX in in_ID iw iw_IL ji ji_001",
+            "",
+        },
+
+        // Error case: No matching locales
+        {"--include-locales=xyz",
+            null,
+            null,
+            null,
+            new PluginException(
+                PluginsResourceBundle.getMessage("include-locales.nomatchinglocales"))
+                .toString(),
+        },
+
+        // Error case: Invalid argument
+        {"--include-locales=zh_HK",
+            null,
+            null,
+            null,
+            "range=zh_hk",
         },
     };
 
@@ -304,20 +323,28 @@
 
         for (Object[] data : testData) {
             // create image for each test data
-            Path image = JImageGenerator.getJLinkTask()
+            Result result = JImageGenerator.getJLinkTask()
                     .modulePath(helper.defaultModulePath())
                     .output(helper.createNewImageDir(moduleName))
                     .addMods("jdk.localedata")
                     .option((String)data[INCLUDE_LOCALES_OPTION])
-                    .call().assertSuccess();
+                    .call();
 
-            // test locale data entries
-            testLocaleDataEntries(image,
-                (List<String>)data[EXPECTED_LOCATIONS],
-                (List<String>)data[UNEXPECTED_PATHS]);
+            String errorMsg = (String)data[ERROR_MESSAGE];
+            if (errorMsg.isEmpty()) {
+                Path image = result.assertSuccess();
 
-            // test available locales
-            testAvailableLocales(image, (String)data[AVAILABLE_LOCALES]);
+                // test locale data entries
+                testLocaleDataEntries(image,
+                    (List<String>)data[EXPECTED_LOCATIONS],
+                    (List<String>)data[UNEXPECTED_PATHS]);
+
+                // test available locales
+                testAvailableLocales(image, (String)data[AVAILABLE_LOCALES]);
+            } else {
+                result.assertFailure(new TaskHelper(TaskHelper.JLINK_BUNDLE)
+                    .getMessage("error.prefix") + " " +errorMsg);
+            }
         }
     }