Merge
authorduke
Wed, 05 Jul 2017 17:16:45 +0200
changeset 5833 7bfbb213574d
parent 5832 9962977aef86 (current diff)
parent 5827 735b0ef474b5 (diff)
child 5839 8b2b529e6752
Merge
--- a/.hgtags-top-repo	Tue Jun 29 22:31:39 2010 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 17:16:45 2017 +0200
@@ -73,3 +73,4 @@
 cf71cb5151166f35433afebaf67dbf34a704a170 jdk7-b96
 5e197c942c6ebd8b92f324a31049c5f1d26d40ef jdk7-b97
 6cea9984d73d74de0cd01f30d07ac0a1ed196117 jdk7-b98
+e7f18db469a3e947b7096bfd12e87380e5a042cd jdk7-b99
--- a/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2010, 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,10 +29,6 @@
   TOPDIR:=.
 endif
 
-ifndef CONTROL_TOPDIR
-  CONTROL_TOPDIR=$(TOPDIR)
-endif
-
 # Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
 OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
 OPENJDK_BUILDDIR:=$(shell \
@@ -120,7 +116,7 @@
 all_product_build:: 
 	@$(FINISH_ECHO)
 
-# Generis build of basic repo series
+# Generic build of basic repo series
 generic_build_repo_series::
 	$(MKDIR) -p $(OUTPUTDIR)
 	$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
@@ -179,11 +175,15 @@
 #     The install process needs to know what the DEBUG_NAME is, so
 #     look for INSTALL_DEBUG_NAME in the install rules.
 #
+#   NOTE: On windows, do not use $(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME).
+#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
+#         not be the same location.
+#
 
 # Location of fresh bootdir output
 ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
 FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image
-FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)-$(DEBUG_NAME)/j2sdk-image
+FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image
   
 create_fresh_product_bootdir: FRC
 	@$(START_ECHO)
@@ -248,10 +248,14 @@
 	        generic_build_repo_series
 	@$(FINISH_ECHO)
 
+#   NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME).
+#         Due to the use of short paths in $(ABS_OUTPUTDIR), this may 
+#         not be the same location.
+
 generic_debug_build:
 	@$(START_ECHO)
 	$(MAKE) \
-		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
+		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \
 	        DEBUG_NAME=$(DEBUG_NAME) \
 		GENERATE_DOCS=false \
 	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
@@ -348,8 +352,8 @@
 
 clobber::
 	$(RM) -r $(OUTPUTDIR)/*
-	$(RM) -r $(OUTPUTDIR)-debug/*
-	$(RM) -r $(OUTPUTDIR)-fastdebug/*
+	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/*
+	$(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/*
 	-($(RMDIR) -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1; $(TRUE))
 
 clean: clobber
@@ -551,6 +555,56 @@
 endif
 
 ################################################################
+# rule to test
+################################################################
+
+.NOTPARALLEL: test
+
+test: test_clean test_start test_summary
+
+test_start:
+	@$(ECHO) "Tests started at `$(DATE)`"
+
+test_clean:
+	$(RM) $(OUTPUTDIR)/test_failures.txt $(OUTPUTDIR)/test_log.txt
+
+test_summary: $(OUTPUTDIR)/test_failures.txt
+	@$(ECHO) "#################################################"
+	@$(ECHO) "Tests completed at `$(DATE)`"
+	@( $(EGREP) '^TEST STATS:' $(OUTPUTDIR)/test_log.txt \
+          || $(ECHO) "No TEST STATS seen in log" )
+	@$(ECHO) "For complete details see: $(OUTPUTDIR)/test_log.txt"
+	@$(ECHO) "#################################################"
+	@if [ -s $< ] ; then                                           \
+          $(ECHO) "ERROR: Test failure count: `$(CAT) $< | $(WC) -l`"; \
+          $(CAT) $<;                                                   \
+          exit 1;                                                      \
+        else                                                           \
+          $(ECHO) "Success! No failures detected";                     \
+        fi
+
+# Get failure list from log
+$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
+	@$(RM) $@
+	@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) > $@
+
+# Get log file of all tests run
+JDK_TO_TEST := $(shell 							\
+  if [ -d "$(ABS_OUTPUTDIR)/j2sdk-image" ] ; then 			\
+    $(ECHO) "$(ABS_OUTPUTDIR)/j2sdk-image"; 				\
+  elif [ -d "$(ABS_OUTPUTDIR)/bin" ] ; then 				\
+    $(ECHO) "$(ABS_OUTPUTDIR)"; 					\
+  elif [ "$(PRODUCT_HOME)" != "" -a -d "$(PRODUCT_HOME)/bin" ] ; then 	\
+    $(ECHO) "$(PRODUCT_HOME)"; 						\
+  fi 									\
+)
+$(OUTPUTDIR)/test_log.txt:
+	$(RM) $@
+	( $(CD) test &&                                     \
+          $(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) \
+        ) | tee $@
+
+################################################################
 # JPRT rule to build
 ################################################################
 
@@ -560,7 +614,7 @@
 #  PHONY
 ################################################################
 
-.PHONY: all \
+.PHONY: all  test test_start test_summary test_clean \
 	generic_build_repo_series \
 	what clobber insane \
         dev dev-build dev-sanity dev-clobber \
--- a/corba/.hgtags	Tue Jun 29 22:31:39 2010 -0700
+++ b/corba/.hgtags	Wed Jul 05 17:16:45 2017 +0200
@@ -73,3 +73,4 @@
 edc2a2659c77dabc55cb55bb617bad89e3a05bb3 jdk7-b96
 4ec9d59374caa1e5d72fa802291b4d66955a4936 jdk7-b97
 3b99409057e4c255da946f9f540d051a5ef4ab23 jdk7-b98
+95db968660e7d87c345d5cf3dc2e3db037fb7220 jdk7-b99
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java	Wed Jul 05 17:16:45 2017 +0200
@@ -75,7 +75,7 @@
         args[1] = (arg1 != null ? arg1.toString() : "null");
         args[2] = (arg2 != null ? arg2.toString() : "null");
 
-        return java.text.MessageFormat.format(format, args);
+        return java.text.MessageFormat.format(format, (Object[]) args);
     }
 
     private static boolean resourcesInitialized = false;
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java	Wed Jul 05 17:16:45 2017 +0200
@@ -350,7 +350,7 @@
 
         if (useToString) {
             try {
-                cls.getDeclaredMethod( "toString", null ) ;
+                cls.getDeclaredMethod( "toString", (Class[])null ) ;
                 return true ;
             } catch (Exception exc) {
                 return false ;
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java	Wed Jul 05 17:16:45 2017 +0200
@@ -108,8 +108,8 @@
 
             try {
                 helperClass = Class.forName( helperName, true, loader ) ;
-                Method idMethod = helperClass.getDeclaredMethod( "id", null ) ;
-                setId( (String)idMethod.invoke( null, null ) ) ;
+                Method idMethod = helperClass.getDeclaredMethod( "id", (Class[])null ) ;
+                setId( (String)idMethod.invoke( null, (Object[])null ) ) ;
             } catch (Exception ex) {
                 throw wrapper.badHelperIdMethod( ex, helperName ) ;
             }
--- a/corba/src/share/classes/org/omg/CORBA/ORB.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/corba/src/share/classes/org/omg/CORBA/ORB.java	Wed Jul 05 17:16:45 2017 +0200
@@ -589,7 +589,7 @@
                 this.getClass().getMethod("create_operation_list", argc);
 
             // OK, the method exists, so invoke it and be happy.
-            Object[] argx = { oper };
+            java.lang.Object[] argx = { oper };
             return (org.omg.CORBA.NVList)meth.invoke(this, argx);
         }
         catch( java.lang.reflect.InvocationTargetException exs ) {
--- a/corba/src/share/classes/sun/corba/Bridge.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/corba/src/share/classes/sun/corba/Bridge.java	Wed Jul 05 17:16:45 2017 +0200
@@ -187,7 +187,7 @@
         try {
             // Invoke the ObjectInputStream.latestUserDefinedLoader method
             return (ClassLoader)latestUserDefinedLoaderMethod.invoke(null,
-                                                                     NO_ARGS);
+                                                                     (Object[])NO_ARGS);
         } catch (InvocationTargetException ite) {
             Error err = new Error(
                 "sun.corba.Bridge.latestUserDefinedLoader: " + ite ) ;
--- a/hotspot/.hgtags	Tue Jun 29 22:31:39 2010 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 17:16:45 2017 +0200
@@ -102,3 +102,4 @@
 573e8ea5fd68e8e51eb6308d283ac3b3889d15e0 hs19-b02
 5f42499e57adc16380780f40541e1a66cd601891 jdk7-b97
 8a045b3f5c13eaad92ff4baf15ca671845fcad1a jdk7-b98
+6a236384a379642b5a2398e2819db9ab4e711e9b jdk7-b99
--- a/hotspot/make/windows/makefiles/defs.make	Tue Jun 29 22:31:39 2010 -0700
+++ b/hotspot/make/windows/makefiles/defs.make	Wed Jul 05 17:16:45 2017 +0200
@@ -32,6 +32,17 @@
 PATH_SEP = ;
 
 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
+ifeq ($(ARCH_DATA_MODEL),32)
+  ARCH_DATA_MODEL=32
+  PLATFORM=windows-i586
+  VM_PLATFORM=windows_i486
+  HS_ARCH=x86
+  MAKE_ARGS += ARCH=x86
+  MAKE_ARGS += BUILDARCH=i486
+  MAKE_ARGS += Platform_arch=x86
+  MAKE_ARGS += Platform_arch_model=x86_32
+endif
+
 ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) x86),)
   ARCH_DATA_MODEL=32
   PLATFORM=windows-i586
@@ -43,55 +54,57 @@
   MAKE_ARGS += Platform_arch_model=x86_32
 endif
 
-ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) ia64),)
-  ARCH_DATA_MODEL=64
-  PLATFORM=windows-ia64
-  VM_PLATFORM=windows_ia64
-  HS_ARCH=ia64
-  MAKE_ARGS += LP64=1
-  MAKE_ARGS += ARCH=ia64
-  MAKE_ARGS += BUILDARCH=ia64
-  MAKE_ARGS += Platform_arch=ia64
-  MAKE_ARGS += Platform_arch_model=ia64
-endif
+ifneq ($(ARCH_DATA_MODEL),32)
+  ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) ia64),)
+    ARCH_DATA_MODEL=64
+    PLATFORM=windows-ia64
+    VM_PLATFORM=windows_ia64
+    HS_ARCH=ia64
+    MAKE_ARGS += LP64=1
+    MAKE_ARGS += ARCH=ia64
+    MAKE_ARGS += BUILDARCH=ia64
+    MAKE_ARGS += Platform_arch=ia64
+    MAKE_ARGS += Platform_arch_model=ia64
+  endif
 
 # http://support.microsoft.com/kb/888731 : this can be either
 # AMD64 for AMD, or EM64T for Intel chips.
-ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) AMD64),)
-  ARCH_DATA_MODEL=64
-  PLATFORM=windows-amd64
-  VM_PLATFORM=windows_amd64
-  HS_ARCH=x86
-  MAKE_ARGS += LP64=1
-  MAKE_ARGS += ARCH=x86
-  MAKE_ARGS += BUILDARCH=amd64
-  MAKE_ARGS += Platform_arch=x86
-  MAKE_ARGS += Platform_arch_model=x86_64
-endif
+  ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) AMD64),)
+    ARCH_DATA_MODEL=64
+    PLATFORM=windows-amd64
+    VM_PLATFORM=windows_amd64
+    HS_ARCH=x86
+    MAKE_ARGS += LP64=1
+    MAKE_ARGS += ARCH=x86
+    MAKE_ARGS += BUILDARCH=amd64
+    MAKE_ARGS += Platform_arch=x86
+    MAKE_ARGS += Platform_arch_model=x86_64
+  endif
 
 ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) EM64T),)
-  ARCH_DATA_MODEL=64
-  PLATFORM=windows-amd64
-  VM_PLATFORM=windows_amd64
-  HS_ARCH=x86
-  MAKE_ARGS += LP64=1
-  MAKE_ARGS += ARCH=x86
-  MAKE_ARGS += BUILDARCH=amd64
-  MAKE_ARGS += Platform_arch=x86
-  MAKE_ARGS += Platform_arch_model=x86_64
-endif
+    ARCH_DATA_MODEL=64
+    PLATFORM=windows-amd64
+    VM_PLATFORM=windows_amd64
+    HS_ARCH=x86
+    MAKE_ARGS += LP64=1
+    MAKE_ARGS += ARCH=x86
+    MAKE_ARGS += BUILDARCH=amd64
+    MAKE_ARGS += Platform_arch=x86
+    MAKE_ARGS += Platform_arch_model=x86_64
+  endif
 
 # NB later OS versions than 2003 may report "Intel64"
-ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) Intel64),)
-  ARCH_DATA_MODEL=64
-  PLATFORM=windows-amd64
-  VM_PLATFORM=windows_amd64
-  HS_ARCH=x86
-  MAKE_ARGS += LP64=1
-  MAKE_ARGS += ARCH=x86
-  MAKE_ARGS += BUILDARCH=amd64
-  MAKE_ARGS += Platform_arch=x86
-  MAKE_ARGS += Platform_arch_model=x86_64
+  ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) Intel64),)
+    ARCH_DATA_MODEL=64
+    PLATFORM=windows-amd64
+    VM_PLATFORM=windows_amd64
+    HS_ARCH=x86
+    MAKE_ARGS += LP64=1
+    MAKE_ARGS += ARCH=x86
+    MAKE_ARGS += BUILDARCH=amd64
+    MAKE_ARGS += Platform_arch=x86
+    MAKE_ARGS += Platform_arch_model=x86_64
+  endif
 endif
 
 JDK_INCLUDE_SUBDIR=win32
--- a/jdk/.hgtags	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/.hgtags	Wed Jul 05 17:16:45 2017 +0200
@@ -73,3 +73,4 @@
 51b9e5dbc2da0631414484b934ac3fb62e48a2c6 jdk7-b96
 b1903d7528d33b521df42bc9291bdcdd2f444a29 jdk7-b97
 82593186fa54ab12f17af31f86a7bf364efaf4df jdk7-b98
+2587c9f0b60dc3146b4247b8674ada456a643d6f jdk7-b99
--- a/jdk/make/common/Defs-linux.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/common/Defs-linux.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -320,6 +320,7 @@
 endif
 override LIBPOSIX4               =
 override LIBSOCKET               =
+override LIBNSL                  =
 override LIBTHREAD               =
 override MOOT_PRIORITIES         = true
 override NO_INTERRUPTIBLE_IO     = true
--- a/jdk/make/common/Defs-solaris.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/common/Defs-solaris.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -645,6 +645,9 @@
 # Socket library
 LIBSOCKET = -lsocket
 
+# Network Services library
+LIBNSL = -lnsl
+
 # GLOBAL_KPIC: If set means all libraries are PIC, position independent code
 #    EXCEPT for select compiles
 #    If a .o file is compiled non-PIC then it should be forced
--- a/jdk/make/common/Release.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/common/Release.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -54,6 +54,13 @@
 # This is a stopgap until 6839872 is fixed.
 EXCLUDE_PROPWARN_PKGS += sun.dyn
 
+#
+# Include the exported private packages in ct.sym.
+# This is an interim solution until the ct.sym is replaced
+# with a new module system (being discussed for JDK 7).
+#
+EXPORTED_PRIVATE_PKGS = com.sun.servicetag
+
 # 64-bit solaris has a few special cases. We define the variable
 # SOLARIS64 for use in this Makefile to easily test those cases
 ifeq ($(PLATFORM), solaris)
@@ -982,7 +989,7 @@
 	    -processor com.sun.tools.javac.sym.CreateSymbols \
 	    -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
 	    -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
-	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS)
+	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
 	$(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
 	    -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
 	@$(java-vm-cleanup)
--- a/jdk/make/common/shared/Defs-control.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/common/shared/Defs-control.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -35,9 +35,6 @@
   JDK_MAKE_SHARED_DIR = $(JDK_TOPDIR)/make/common/shared
 endif
 
-ifndef CONTROL_TOPDIR
-  CONTROL_TOPDIR=$(TOPDIR)
-endif
 ifndef HOTSPOT_TOPDIR
   HOTSPOT_TOPDIR=$(TOPDIR)/hotspot
 endif
--- a/jdk/make/docs/CORE_PKGS.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/docs/CORE_PKGS.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -234,6 +234,7 @@
   javax.xml.ws.http                              \
   javax.xml.ws.soap                              \
   javax.xml.ws.spi                               \
+  javax.xml.ws.spi.http                          \
   javax.xml.ws.wsaddressing                      \
   javax.xml.transform                            \
   javax.xml.transform.sax                        \
--- a/jdk/make/java/hpi/hpi_common.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/java/hpi/hpi_common.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -86,5 +86,5 @@
 # Things that must be linked in.
 #
 ifneq ($(PLATFORM), windows)
-OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl
+OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) $(LIBM) -ldl
 endif
--- a/jdk/make/java/java/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/java/java/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -204,7 +204,7 @@
 OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
 		       -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib
 else
-OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -lnsl -ldl \
+OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \
 		-L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
 endif
 
--- a/jdk/make/java/java_hprof_demo/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/java/java_hprof_demo/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -84,7 +84,7 @@
 ifeq ($(PLATFORM), windows)
   OTHER_LDLIBS += wsock32.lib winmm.lib
 else
-  OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl
+  OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl
 endif
 
 #
--- a/jdk/make/java/net/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/java/net/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -96,7 +96,7 @@
 ifeq ($(PLATFORM), windows)
   OTHER_LDLIBS = ws2_32.lib $(JVMLIB)
 else
-  OTHER_LDLIBS = $(LIBSOCKET) -lnsl -ldl $(JVMLIB)
+  OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB)
 endif
 ifeq ($(PLATFORM), linux)
   OTHER_LDLIBS += -lpthread
--- a/jdk/make/jpda/transport/socket/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/jpda/transport/socket/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -38,11 +38,11 @@
 include $(BUILDDIR)/common/Defs.gmk
 
 ifeq ($(PLATFORM), linux)
-  OTHER_LDLIBS += -lnsl $(LIBSOCKET) -lpthread
+  OTHER_LDLIBS += $(LIBNSL) $(LIBSOCKET) -lpthread
 endif
 
 ifeq ($(PLATFORM), solaris)
-  OTHER_LDLIBS += -lnsl $(LIBSOCKET)
+  OTHER_LDLIBS += $(LIBNSL) $(LIBSOCKET)
 endif
 
 ifeq ($(PLATFORM), windows)
--- a/jdk/make/mkdemo/jvmti/hprof/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/mkdemo/jvmti/hprof/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -39,10 +39,10 @@
   EXTRA_LIBS += wsock32.lib winmm.lib
 endif
 ifeq ($(PLATFORM), solaris)
-  OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl
+  OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl
 endif
 ifeq ($(PLATFORM), linux)
-  OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl -lpthread
+  OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl -lpthread
 endif
 
 #
--- a/jdk/make/netbeans/README	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/netbeans/README	Wed Jul 05 17:16:45 2017 +0200
@@ -204,8 +204,8 @@
         note that pretty much regardless of your hardware, this *will* take
         a long time, and use *lots* of disk space (more than 3GB). The
         results of the build are in
-        *install-dir*/control/build/*platform*-*arch* and
-        *install-dir*/control/build/*platform*-*arch*-fastdebug.
+        *install-dir*/build/*platform*-*arch* and
+        *install-dir*/build/*platform*-*arch*-fastdebug.
 
         Consult the project's README file for details.
 
--- a/jdk/make/netbeans/world/README	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/netbeans/world/README	Wed Jul 05 17:16:45 2017 +0200
@@ -10,6 +10,6 @@
 Please note: the results of building this project are *not* put in the place
 used by other projects.  In this case, the results are place in
 
-    <install-dir>/control/build/<platform>-<arch>
+    <install-dir>/build/<platform>-<arch>
 and
-    <install-dir>/control/build/<platform>-<arch>-fastdebug
+    <install-dir>/build/<platform>-<arch>-fastdebug
--- a/jdk/make/netbeans/world/build.xml	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/netbeans/world/build.xml	Wed Jul 05 17:16:45 2017 +0200
@@ -34,11 +34,11 @@
     <import file="../common/shared.xml"/>
 
     <target name="-build-make" depends="-make.init" if="use.make">
-        <make-run target="dev" dir="${root}/../control/make" opts="SKIP_COMPARE_IMAGES=true"/>
+        <make-run target="dev" dir="${root}/.." opts="SKIP_COMPARE_IMAGES=true"/>
     </target>
 
     <target name="-clean-make" depends="-make.init" if="use.make">
-        <make-run target="clean" dir="${root}/../control/make"/>
+        <make-run target="clean" dir="${root}/.."/>
     </target>
 
 </project>
--- a/jdk/make/sun/nio/cs/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/sun/nio/cs/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -37,7 +37,7 @@
 # This re-directs all the class files to a separate location
 CLASSDESTDIR = $(TEMPDIR)/classes
 
-OTHER_JAVACFLAGS += -Xlint:serial -Werror
+OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
 include $(BUILDDIR)/common/Defs.gmk
 
 #
--- a/jdk/make/sun/pisces/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/sun/pisces/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -52,5 +52,11 @@
 
 copy-files: $(FILES_copy)
 
-$(SERVICEDIR)/%: $(SHARE_SRC)/classes/sun/java2d/pisces/META-INF/services/%
+ifneq ($(PLATFORM), windows)
+ SERVICE_SRC = $(PLATFORM_SRC)
+else
+ SERVICE_SRC = $(SHARE_SRC)
+endif
+
+$(SERVICEDIR)/%: $(SERVICE_SRC)/classes/sun/java2d/pisces/META-INF/services/%
 	$(install-file)
--- a/jdk/make/sun/security/mscapi/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/sun/security/mscapi/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -150,6 +150,7 @@
 # Rules
 #
 CLASSDESTDIR = $(TEMPDIR)/classes
+JAVAHFLAGS += -classpath $(CLASSDESTDIR)
 
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 
--- a/jdk/make/sun/security/pkcs11/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/sun/security/pkcs11/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -148,6 +148,7 @@
 # Rules
 #
 CLASSDESTDIR = $(TEMPDIR)/classes
+JAVAHFLAGS += -classpath $(CLASSDESTDIR)
 
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 
--- a/jdk/make/sun/tools/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/make/sun/tools/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -49,7 +49,8 @@
 
 # Extra jstat files
 FILES_copy += \
-  $(CLASSDESTDIR)/sun/tools/jstat/resources/jstat_options
+  $(CLASSDESTDIR)/sun/tools/jstat/resources/jstat_options \
+  $(CLASSDESTDIR)/sun/tools/jstat/resources/jstat_unsupported_options
 
 # Extra jhat files
 JHAT_RESOURCEDIR = $(CLASSDESTDIR)/com/sun/tools/hat/resources
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Wed Jul 05 17:16:45 2017 +0200
@@ -424,7 +424,7 @@
             State rv;
             rv = super.getState();
             if (rv != State.DISABLED
-                && ! comboBox.isEditable()
+                && comboBox != null && ! comboBox.isEditable()
                 && XPStyle.getXP().isSkinDefined(comboBox,
                                                  Part.CP_DROPDOWNBUTTONRIGHT)) {
                 /*
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/Constants.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/Constants.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
@@ -47,10 +47,13 @@
 
     public final static short JAVA5_MAX_CLASS_MAJOR_VERSION = 49;
     public final static short JAVA5_MAX_CLASS_MINOR_VERSION = 0;
-    // NOTE: ASSUMED for now
+
     public final static short JAVA6_MAX_CLASS_MAJOR_VERSION = 50;
     public final static short JAVA6_MAX_CLASS_MINOR_VERSION = 0;
 
+    public final static short JAVA7_MAX_CLASS_MAJOR_VERSION = 51;
+    public final static short JAVA7_MAX_CLASS_MINOR_VERSION = 0;
+
     public final static int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
     public final static int JAVA5_PACKAGE_MAJOR_VERSION = 150;
     public final static int JAVA5_PACKAGE_MINOR_VERSION = 7;
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
@@ -57,8 +57,8 @@
     // These fields can be adjusted by driver properties.
     short min_class_majver = JAVA_MIN_CLASS_MAJOR_VERSION;
     short min_class_minver = JAVA_MIN_CLASS_MINOR_VERSION;
-    short max_class_majver = JAVA6_MAX_CLASS_MAJOR_VERSION;
-    short max_class_minver = JAVA6_MAX_CLASS_MINOR_VERSION;
+    short max_class_majver = JAVA7_MAX_CLASS_MAJOR_VERSION;
+    short max_class_minver = JAVA7_MAX_CLASS_MINOR_VERSION;
 
     short observed_max_class_majver = min_class_majver;
     short observed_max_class_minver = min_class_minver;
@@ -122,13 +122,16 @@
     void choosePackageVersion() {
         assert(package_majver <= 0);  // do not call this twice
         int classver = getHighestClassVersion();
-        if (classver != 0 &&
-            (classver >>> 16) < JAVA6_MAX_CLASS_MAJOR_VERSION) {
-            // There are only old classfiles in this segment.
+        if (classver == 0 || (classver >>> 16) < JAVA6_MAX_CLASS_MAJOR_VERSION) {
+            // There are only old classfiles in this segment or resources
             package_majver = JAVA5_PACKAGE_MAJOR_VERSION;
             package_minver = JAVA5_PACKAGE_MINOR_VERSION;
+        } else if ((classver >>> 16) == JAVA6_MAX_CLASS_MAJOR_VERSION) {
+            package_majver = JAVA6_PACKAGE_MAJOR_VERSION;
+            package_minver = JAVA6_PACKAGE_MINOR_VERSION;
         } else {
-            // Normal case.  Use the newest archive format.
+            // Normal case.  Use the newest archive format, when available
+            // TODO: replace the following with JAVA7* when the need arises
             package_majver = JAVA6_PACKAGE_MAJOR_VERSION;
             package_minver = JAVA6_PACKAGE_MINOR_VERSION;
         }
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003,2010 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
@@ -90,8 +90,8 @@
         props.put(Utils.PACK_DEFAULT_TIMEZONE,
                   String.valueOf(Boolean.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)));
 
-        // Limit segment size to less than a megabyte.
-        props.put(Pack200.Packer.SEGMENT_LIMIT, ""+(1*1000*1000));
+        // The segment size is unlimited
+        props.put(Pack200.Packer.SEGMENT_LIMIT, "");
 
         // Preserve file ordering by default.
         props.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.TRUE);
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java	Wed Jul 05 17:16:45 2017 +0200
@@ -41,7 +41,7 @@
  * @author Raul Benito(Of the xerces copy, and little adaptations).
  * @author Anli Shundi
  * @author Christian Geuer-Pollmann
- * @see <A HREF="ftp://ftp.isi.edu/in-notes/rfc2045.txt">RFC 2045</A>
+ * @see <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</A>
  * @see com.sun.org.apache.xml.internal.security.transforms.implementations.TransformBase64Decode
  */
 public class Base64 {
--- a/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java	Wed Jul 05 17:16:45 2017 +0200
@@ -31,7 +31,7 @@
 
 /**
  * A principal identified by a distinguished name as specified by
- * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>.
+ * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
  *
  * <p>
  * After successful authentication, a user {@link java.security.Principal}
@@ -122,7 +122,7 @@
 
     /**
      * Creates a string representation of this principal's name in the format
-     * defined by <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
+     * defined by <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
      * If the name has zero components an empty string is returned.
      *
      * @return The principal's string name.
--- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,7 +33,7 @@
 
 /**
   * Implements the CRAM-MD5 SASL client-side mechanism.
-  * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>).
+  * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>).
   * CRAM-MD5 has no initial response. It receives bytes from
   * the server as a challenge, which it hashes by using MD5 and the password.
   * It concatenates the authentication ID with this result and returns it
--- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,7 +38,7 @@
 
 /**
   * Implements the CRAM-MD5 SASL server-side mechanism.
-  * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>).
+  * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>).
   * CRAM-MD5 has no initial response.
   *
   * client <---- M={random, timestamp, server-fqdn} ------- server
--- a/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java	Wed Jul 05 17:16:45 2017 +0200
@@ -29,7 +29,7 @@
 
 /**
   * Implements the EXTERNAL SASL client mechanism.
-  * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>).
+  * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>).
   * The EXTERNAL mechanism returns the optional authorization ID as
   * the initial response. It processes no challenges.
   *
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java	Wed Jul 05 17:16:45 2017 +0200
@@ -39,10 +39,10 @@
 
 /**
   * Implements the GSSAPI SASL client mechanism for Kerberos V5.
-  * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>,
+  * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>,
   * <a HREF="http://www.ietf.org/internet-drafts/draft-ietf-cat-sasl-gssapi-04.txt">draft-ietf-cat-sasl-gssapi-04.txt</a>).
   * It uses the Java Bindings for GSSAPI
-  * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2853.txt">RFC 2853</A>)
+  * (<A HREF="http://www.ietf.org/rfc/rfc2853.txt">RFC 2853</A>)
   * for getting GSSAPI/Kerberos V5 support.
   *
   * The client/server interactions are:
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java	Wed Jul 05 17:16:45 2017 +0200
@@ -39,7 +39,7 @@
 
 /**
   * Implements the GSSAPI SASL server mechanism for Kerberos V5.
-  * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>,
+  * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>,
   * <a HREF="http://www.ietf.org/internet-drafts/draft-ietf-cat-sasl-gssapi-00.txt">draft-ietf-cat-sasl-gssapi-00.txt</a>).
   *
   * Expects thread's Subject to contain server's Kerberos credentials
--- a/jdk/src/share/classes/com/sun/servicetag/Registry.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/servicetag/Registry.java	Wed Jul 05 17:16:45 2017 +0200
@@ -67,7 +67,6 @@
     // The stclient output has to be an exported interface
     private static final String INSTANCE_URN_DESC = "Product instance URN=";
     private static boolean initialized = false;
-    private static boolean supportsHelperClass = true; // default
     private static File stclient = null;
     private static String stclientPath = null;
     private static Registry registry = new Registry();
@@ -81,17 +80,6 @@
 
     private synchronized static String getSTclient() {
         if (!initialized) {
-            // the system property always overrides the default setting
-            if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) {
-                supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED);
-            }
-
-            // This is only used for testing
-            stclientPath = System.getProperty(SVCTAG_STCLIENT_CMD);
-            if (stclientPath != null) {
-                return stclientPath;
-            }
-
             // Initialization to determine the platform's stclient pathname
             String os = System.getProperty("os.name");
             if (os.equals("SunOS")) {
@@ -108,10 +96,26 @@
             initialized = true;
         }
 
+        boolean supportsHelperClass = true; // default
+        if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) {
+            // the system property always overrides the default setting
+            supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED);
+        }
+
+        if (!supportsHelperClass) {
+            // disable system registry
+            return null;
+        }
+
+        // This is only used for testing
+        String path = System.getProperty(SVCTAG_STCLIENT_CMD);
+        if (path != null) {
+            return path;
+        }
+
         // com.sun.servicetag package has to be compiled with JDK 5 as well
         // JDK 5 doesn't support the File.canExecute() method.
         // Risk not checking isExecute() for the stclient command is very low.
-
         if (stclientPath == null && stclient != null && stclient.exists()) {
             stclientPath = stclient.getAbsolutePath();
         }
@@ -142,8 +146,8 @@
      * @return {@code true} if the {@code Registry} class is supported;
      * otherwise, return {@code false}.
      */
-    public static boolean isSupported() {
-        return (getSTclient() != null && supportsHelperClass);
+    public static synchronized boolean isSupported() {
+        return getSTclient() != null;
     }
 
     private static List<String> getCommandList() {
Binary file jdk/src/share/classes/com/sun/servicetag/resources/jdk_header.png has changed
--- a/jdk/src/share/classes/com/sun/servicetag/resources/register.html	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/register.html	Wed Jul 05 17:16:45 2017 +0200
@@ -53,13 +53,13 @@
   </tr>
   <tr>
     <td>&nbsp;</td>
-    <td><p class="style1">Thank you for installing the
+    <td><p class="style1">Thank you for installing the 
         <strong> Java Development Kit @@JDK_VERSION@@ </strong>
-        from Sun Microsystems. </p>
+        from Oracle Corporation. </p>
         <p class="style1">Registering your product will give you the following benefits:</p>
         <ul class="style1">
           <li> Notification of new versions, patches, and updates</li>
-          <li> Special offers on Sun developer products, services and training </li>
+          <li> Special offers on Oracle developer products, services and training </li>
           <li> Access to early releases and documentation </li>
         </ul>
         <p class="style1">Product registration is FREE, quick and easy!</p>
@@ -68,11 +68,11 @@
           <table width="708" border="0" cellspacing="0" cellpadding="3">
             <tr valign="top">
               <td width="126" height="35">
-              <form name="form1" method="post" action="@@REGISTRATION_URL@@">
+              <form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
                 <input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
                 <input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';"  value="Register My JDK">
               </form></td>
-              <td width="570"><span class="style3">You need to be connected to the Internet to register this Sun product. </span></td>
+              <td width="570"><span class="style3">You need to be connected to the Internet to register this Oracle product. </span></td>
             </tr>
           </table>
         </blockquote>
@@ -81,16 +81,16 @@
     <tr>
        <td>&nbsp;</td>
        <td bgcolor="#f1f7df">
-       <p class="style3">Sun Microsystems, Inc. respects your privacy.
-    We will use your personal information for communications
-    and management of your Sun Online Account, the services
-    and applications you access using your Sun Online Account,
+       <p class="style3">Oracle Corporation respects your privacy. 
+    We will use your personal information for communications 
+    and management of your Sun Online Account, the services 
+    and applications you access using your Sun Online Account, 
     and the products and systems you register with your Sun Online Account.</p>
-                <p class="style3">For more information on the data that will be collected as
+                <p class="style3">For more information on the data that will be collected as 
           part of the registration process and how it will be managed <br>
-          see <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>. <br>
+          see <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>. <br>      
           <br>
-          For more information on Sun's Privacy Policy see <a href="http://www.sun.com/privacy/">http://www.sun.com/privacy/</a> or contact <a class="moz-txt-link-rfc2396E" href="mailto:privacy@sun.com">privacy@sun.com.</a></p></td>
+          For more information on Oracle's Privacy Policy see <a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> or contact <a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">privacy_ww@oracle.com.</a></p></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
--- a/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html	Wed Jul 05 17:16:45 2017 +0200
@@ -50,11 +50,11 @@
   <tr>
     <td>&nbsp;</td>
 
-    <td><p class="style1">Sun Microsystems の<strong> Java Development Kit @@JDK_VERSION@@ </strong>をインストールしていただき、ありがとうございます。 </p>
+    <td><p class="style1">Oracle Corporation の<strong> Java Development Kit @@JDK_VERSION@@ </strong>をインストールしていただき、ありがとうございます。 </p>
         <p class="style1">製品登録をすると、次のような特典を受けることができます。</p>
         <ul class="style1">
           <li> 最新のバージョン、パッチ、および更新についての通知</li>
-          <li> Sun の開発者向け製品、サービス、およびトレーニングの特別販売 </li>
+          <li> Oracle の開発者向け製品、サービス、およびトレーニングの特別販売 </li>
           <li> アーリーリリースおよびドキュメントへのアクセス </li>
         </ul>
         <p class="style1">製品登録は無料であり、迅速で簡単です。</p>
@@ -62,11 +62,11 @@
           <p class="style1">必要になるのは、Sun 開発者向けネットワークアカウントまたはその他の Sun オンラインアカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。 </p>
           <table width="708" border="0" cellspacing="0" cellpadding="3">
             <tr valign="top">
-              <td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@">
+              <td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
 			  <input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
                 <input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';"  value="JDK 製品登録">
               </form></td>
-              <td width="570"><span class="style3">この Sun 製品を登録するには、インターネットに接続している必要があります。 </span></td>
+              <td width="570"><span class="style3">この Oracle 製品を登録するには、インターネットに接続している必要があります。 </span></td>
             </tr>
 	  </table>
 	</blockquote>
@@ -75,8 +75,8 @@
    <tr>
        <td>&nbsp;</td>
 	<td bgcolor="#f1f7df">
-        <p class="style3">Sun Microsystems, Inc. は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Sun オンラインアカウント、お客様が Sun オンラインアカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Sun オンラインアカウントで登録する製品とシステムの通信と管理に使用します。</p>
-                <p class="style3">登録の際に収集されるデータや、それらがどのように管理されるかについての詳細は、<br><a href="http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html</a> を参照してください。 <br> <br> Sun のプライバシーポリシーについての詳細は、<a href="http://jp.sun.com/privacy/">http://jp.sun.com/privacy/</a> を参照するか、<a class="moz-txt-link-rfc2396E" href="http://jp.sun.com/cgi-bin/contact/comment.cgi?url=http://jp.sun.com/privacy/">お問い合わせフォーム</a>からお問い合わせください。</p></td>
+        <p class="style3">Oracle Corporation は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Sun オンラインアカウント、お客様が Sun オンラインアカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Sun オンラインアカウントで登録する製品とシステムの通信と管理に使用します。</p>
+                <p class="style3">登録の際に収集されるデータや、それらがどのように管理されるかについての詳細は、<br><a href="http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html</a> を参照してください。 <br> <br> Oracle のプライバシーポリシーについての詳細は、<a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> を参照するか、<a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">お問い合わせフォーム</a>からお問い合わせください。</p></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
--- a/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html	Wed Jul 05 17:16:45 2017 +0200
@@ -51,11 +51,11 @@
   <tr>
     <td>&nbsp;</td>
 
-<td><p class="style1">感谢您安装 Sun Microsystems 的 <strong>Java Development Kit @@JDK_VERSION@@</strong>。 </p>
+<td><p class="style1">感谢您安装 Oracle Corporation 的 <strong>Java Development Kit @@JDK_VERSION@@</strong>。 </p>
 <p class="style1">注册产品后您将获得如下增值服务:</p>
         <ul class="style1">
 <li> 获得新版本、修补程序和更新的通知服务</li>
-<li> 获得有关 Sun 开发者产品、服务和培训的优惠 </li>
+<li> 获得有关 Oracle 开发者产品、服务和培训的优惠 </li>
 <li> 获得对早期版本和文档的访问权限 </li>
         </ul>
 <p class="style1">产品注册是免费的,即快速又轻松!</p>
@@ -63,11 +63,11 @@
 <p class="style1">您需要具有 Sun 开发者网络或其他 Sun 联机帐户。如果您没有,系统将提示您创建一个。 </p>
           <table width="708" border="0" cellspacing="0" cellpadding="3">
             <tr valign="top">
-              <td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@">
+              <td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
 			  <input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
 <input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';"  value="注册我的 JDK">
               </form></td>
-<td width="570"><span class="style3">您需要连接到 Internet 来注册此 Sun 产品。 </span></td>
+<td width="570"><span class="style3">您需要连接到 Internet 来注册此 Oracle 产品。 </span></td>
             </tr>
 	  </table>
 	</blockquote>
@@ -76,8 +76,8 @@
     <tr>
        <td>&nbsp;</td>
 	<td bgcolor="#f1f7df">
-        <p class="style3">Sun Microsystems, Inc. 尊重您的隐私。我们会将您的个人信息用于通信和 Sun 联机帐户的管理、Sun 联机帐户访问的服务和应用程序以及用于使用 Sun 联机帐户注册的产品和系统。</p>
-<p class="style3">有关注册过程中收集的数据以及这些数据的管理方式的更多信息,<br>请访问 <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>。<br> <br>有关 Sun 隐私政策的更多信息,请访问 <a href="http://www.sun.com/privacy/">http://www.sun.com/privacy/</a> 或与 <a class="moz-txt-link-rfc2396E" href="mailto:privacy@sun.com">privacy@sun.com</a> 联系。</p></td>
+        <p class="style3">Oracle 尊重您的隐私。我们会将您的个人信息用于通信和 Sun 联机帐户的管理、Sun 联机帐户访问的服务和应用程序以及用于使用 Sun 联机帐户注册的产品和系统。</p>
+<p class="style3">有关注册过程中收集的数据以及这些数据的管理方式的更多信息,<br>请访问 <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>。<br> <br>有关 Oracle 隐私政策的更多信息,请访问 <a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> 或与 <a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">privacy_ww@oracle.com</a> 联系。</p></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
--- a/jdk/src/share/classes/java/lang/AssertionError.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/lang/AssertionError.java	Wed Jul 05 17:16:45 2017 +0200
@@ -66,7 +66,7 @@
      * defined in <i>The Java Language Specification, Second
      * Edition</i>, Section 15.18.1.1.
      *<p>
-     * If the specified object is an instance of <tt>Throwable</tt>, it
+     * If the specified object is an instance of {@code Throwable}, it
      * becomes the <i>cause</i> of the newly constructed assertion error.
      *
      * @param detailMessage value to be used in constructing detail message
@@ -149,4 +149,21 @@
     public AssertionError(double detailMessage) {
         this("" +  detailMessage);
     }
+
+    /**
+     * Constructs a new {@code AssertionError} with the specified
+     * detail message and cause.
+     *
+     * <p>Note that the detail message associated with
+     * {@code cause} is <i>not</i> automatically incorporated in
+     * this error's detail message.
+     *
+     * @param  message the detail message, may be {@code null}
+     * @param  cause the cause, may be {@code null}
+     *
+     * @since 1.7
+     */
+    public AssertionError(String message, Throwable cause) {
+        super(message, cause);
+    }
 }
--- a/jdk/src/share/classes/java/lang/Math.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/lang/Math.java	Wed Jul 05 17:16:45 2017 +0200
@@ -681,9 +681,9 @@
 
     private static Random randomNumberGenerator;
 
-    private static synchronized void initRNG() {
-        if (randomNumberGenerator == null)
-            randomNumberGenerator = new Random();
+    private static synchronized Random initRNG() {
+        Random rnd = randomNumberGenerator;
+        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
     }
 
     /**
@@ -694,9 +694,11 @@
      *
      * <p>When this method is first called, it creates a single new
      * pseudorandom-number generator, exactly as if by the expression
-     * <blockquote>{@code new java.util.Random}</blockquote> This
-     * new pseudorandom-number generator is used thereafter for all
-     * calls to this method and is used nowhere else.
+     *
+     * <blockquote>{@code new java.util.Random()}</blockquote>
+     *
+     * This new pseudorandom-number generator is used thereafter for
+     * all calls to this method and is used nowhere else.
      *
      * <p>This method is properly synchronized to allow correct use by
      * more than one thread. However, if many threads need to generate
@@ -705,11 +707,12 @@
      *
      * @return  a pseudorandom {@code double} greater than or equal
      * to {@code 0.0} and less than {@code 1.0}.
-     * @see     java.util.Random#nextDouble()
+     * @see Random#nextDouble()
      */
     public static double random() {
-        if (randomNumberGenerator == null) initRNG();
-        return randomNumberGenerator.nextDouble();
+        Random rnd = randomNumberGenerator;
+        if (rnd == null) rnd = initRNG();
+        return rnd.nextDouble();
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/ProcessBuilder.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/lang/ProcessBuilder.java	Wed Jul 05 17:16:45 2017 +0200
@@ -418,6 +418,8 @@
      * Implements a <a href="#redirect-output">null input stream</a>.
      */
     static class NullInputStream extends InputStream {
+        static final NullInputStream INSTANCE = new NullInputStream();
+        private NullInputStream() {}
         public int read()      { return -1; }
         public int available() { return 0; }
     }
@@ -426,6 +428,8 @@
      * Implements a <a href="#redirect-input">null output stream</a>.
      */
     static class NullOutputStream extends OutputStream {
+        static final NullOutputStream INSTANCE = new NullOutputStream();
+        private NullOutputStream() {}
         public void write(int b) throws IOException {
             throw new IOException("Stream closed");
         }
--- a/jdk/src/share/classes/java/lang/StrictMath.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/lang/StrictMath.java	Wed Jul 05 17:16:45 2017 +0200
@@ -667,9 +667,9 @@
 
     private static Random randomNumberGenerator;
 
-    private static synchronized void initRNG() {
-        if (randomNumberGenerator == null)
-            randomNumberGenerator = new Random();
+    private static synchronized Random initRNG() {
+        Random rnd = randomNumberGenerator;
+        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
     }
 
     /**
@@ -680,9 +680,11 @@
      *
      * <p>When this method is first called, it creates a single new
      * pseudorandom-number generator, exactly as if by the expression
-     * <blockquote>{@code new java.util.Random}</blockquote> This
-     * new pseudorandom-number generator is used thereafter for all
-     * calls to this method and is used nowhere else.
+     *
+     * <blockquote>{@code new java.util.Random()}</blockquote>
+     *
+     * This new pseudorandom-number generator is used thereafter for
+     * all calls to this method and is used nowhere else.
      *
      * <p>This method is properly synchronized to allow correct use by
      * more than one thread. However, if many threads need to generate
@@ -691,11 +693,12 @@
      *
      * @return  a pseudorandom {@code double} greater than or equal
      * to {@code 0.0} and less than {@code 1.0}.
-     * @see     java.util.Random#nextDouble()
+     * @see Random#nextDouble()
      */
     public static double random() {
-        if (randomNumberGenerator == null) initRNG();
-        return randomNumberGenerator.nextDouble();
+        Random rnd = randomNumberGenerator;
+        if (rnd == null) rnd = initRNG();
+        return rnd.nextDouble();
     }
 
     /**
--- a/jdk/src/share/classes/java/net/URI.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/net/URI.java	Wed Jul 05 17:16:45 2017 +0200
@@ -457,7 +457,7 @@
  * @author Mark Reinhold
  * @since 1.4
  *
- * @see <a href="http://ietf.org/rfc/rfc2279.txt"><i>RFC&nbsp;2279: UTF-8, a
+ * @see <a href="http://www.ietf.org/rfc/rfc2279.txt"><i>RFC&nbsp;2279: UTF-8, a
  * transformation format of ISO 10646</i></a>, <br><a
  * href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC&nbsp;2373: IPv6 Addressing
  * Architecture</i></a>, <br><a
--- a/jdk/src/share/classes/java/nio/charset/package.html	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/nio/charset/package.html	Wed Jul 05 17:16:45 2017 +0200
@@ -48,7 +48,7 @@
 
 <p> A <i>charset</i> is named mapping between sequences of sixteen-bit Unicode
 characters and sequences of bytes, in the sense defined in <a
-href="http://ietf.org/rfc/rfc2278.txt"><i>RFC&nbsp;2278</i></a>.  A
+href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC&nbsp;2278</i></a>.  A
 <i>decoder</i> is an engine which transforms bytes in a specific charset into
 characters, and an <i>encoder</i> is an engine which transforms characters into
 bytes.  Encoders and decoders operate on byte and character buffers.  They are
--- a/jdk/src/share/classes/java/security/Security.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/security/Security.java	Wed Jul 05 17:16:45 2017 +0200
@@ -678,7 +678,7 @@
             spiMap.put(type, clazz);
             return clazz;
         } catch (ClassNotFoundException e) {
-            throw (Error)new AssertionError("Spi class not found").initCause(e);
+            throw new AssertionError("Spi class not found", e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/Collections.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/util/Collections.java	Wed Jul 05 17:16:45 2017 +0200
@@ -463,10 +463,10 @@
      *         its list-iterator does not support the <tt>set</tt> operation.
      */
     public static void shuffle(List<?> list) {
-        if (r == null) {
-            r = new Random();
-        }
-        shuffle(list, r);
+        Random rnd = r;
+        if (rnd == null)
+            r = rnd = new Random();
+        shuffle(list, rnd);
     }
     private static Random r;
 
--- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Wed Jul 05 17:16:45 2017 +0200
@@ -73,10 +73,10 @@
     private long rnd;
 
     /**
-     * Initialization flag to permit the first and only allowed call
-     * to setSeed (inside Random constructor) to succeed.  We can't
-     * allow others since it would cause setting seed in one part of a
-     * program to unintentionally impact other usages by the thread.
+     * Initialization flag to permit calls to setSeed to succeed only
+     * while executing the Random constructor.  We can't allow others
+     * since it would cause setting seed in one part of a program to
+     * unintentionally impact other usages by the thread.
      */
     boolean initialized;
 
@@ -98,11 +98,10 @@
 
     /**
      * Constructor called only by localRandom.initialValue.
-     * We rely on the fact that the superclass no-arg constructor
-     * invokes setSeed exactly once to initialize.
      */
     ThreadLocalRandom() {
         super();
+        initialized = true;
     }
 
     /**
@@ -123,7 +122,6 @@
     public void setSeed(long seed) {
         if (initialized)
             throw new UnsupportedOperationException();
-        initialized = true;
         rnd = (seed ^ multiplier) & mask;
     }
 
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003,2010, 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
@@ -212,10 +212,18 @@
      * to produce a specific bytewise image for any given transmission
      * ordering of archive elements.)
      * <p>
-     * In order to maintain backward compatibility, if the input JAR-files are
-     * solely comprised of 1.5 (or  lesser) classfiles, a 1.5 compatible
-     * pack file is  produced.  Otherwise a 1.6 compatible pack200 file is
-     * produced.
+     * In order to maintain backward compatibility, the pack file's version is
+     * set to accommodate the class files present in the input JAR file. In
+     * other words, the pack file version will be the latest, if the class files
+     * are the latest and conversely the pack file version will be the oldest
+     * if the class file versions are also the oldest. For intermediate class
+     * file versions the corresponding pack file version will be used.
+     * For example:
+     *    If the input JAR-files are solely comprised of 1.5  (or  lesser)
+     * class files, a 1.5 compatible pack file is  produced. This will also be
+     * the case for archives that have no class files.
+     *    If the input JAR-files contains a 1.6 class file, then the pack file
+     * version will be set to 1.6.
      * <p>
      * @since 1.5
      */
@@ -236,9 +244,10 @@
          * input file to be transmitted in the segment, along with the size
          * of its name and other transmitted properties.
          * <p>
-         * The default is 1000000 (a million bytes).  This allows input JAR files
-         * of moderate size to be transmitted in one segment.  It also puts
-         * a limit on memory requirements for packers and unpackers.
+         * The default is -1, which means the packer will always create a single
+         * segment output file. In cases where extremely large output files are
+         * generated, users are strongly encouraged to use segmenting or break
+         * up the input file into smaller JARs.
          * <p>
          * A 10Mb JAR packed without this limit will
          * typically pack about 10% smaller, but the packer may require
--- a/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java	Wed Jul 05 17:16:45 2017 +0200
@@ -107,10 +107,10 @@
  * significant in the <code><em>url-path</em></code>.</p>
  *
  * @see <a
- * href="ftp://ftp.rfc-editor.org/in-notes/rfc2609.txt">RFC 2609,
+ * href="http://www.ietf.org/rfc/rfc2609.txt">RFC 2609,
  * "Service Templates and <code>Service:</code> Schemes"</a>
  * @see <a
- * href="ftp://ftp.rfc-editor.org/in-notes/rfc3111.txt">RFC 3111,
+ * href="http://www.ietf.org/rfc/rfc3111.txt">RFC 3111,
  * "Service Location Protocol Modifications for IPv6"</a>
  *
  * @since 1.5
--- a/jdk/src/share/classes/javax/naming/ldap/LdapName.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/LdapName.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,7 +42,7 @@
 
 /**
  * This class represents a distinguished name as specified by
- * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>.
+ * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
  * A distinguished name, or DN, is composed of an ordered list of
  * components called <em>relative distinguished name</em>s, or RDNs.
  * Details of a DN's syntax are described in RFC 2253.
@@ -115,7 +115,7 @@
      *
      * @param name  This is a non-null distinguished name formatted
      * according to the rules defined in
-     * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
      *
      * @throws InvalidNameException if a syntax violation is detected.
      * @see Rdn#escapeValue(Object value)
@@ -614,7 +614,7 @@
 
     /**
      * Returns a string representation of this LDAP name in a format
-     * defined by <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>
+     * defined by <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * and described in the class description. If the name has zero
      * components an empty string is returned.
      *
--- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Wed Jul 05 17:16:45 2017 +0200
@@ -45,7 +45,7 @@
 /**
  * This class represents a relative distinguished name, or RDN, which is a
  * component of a distinguished name as specified by
- * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
+ * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
  * An example of an RDN is "OU=Sales+CN=J.Smith". In this example,
  * the RDN consist of multiple attribute type/value pairs. The
  * RDN is parsed as described in the class description for
@@ -117,7 +117,7 @@
      * {@link javax.naming.directory.Attributes Attributes}.
      * <p>
      * The string attribute values are not interpretted as
-     * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * formatted RDN strings. That is, the values are used
      * literally (not parsed) and assumed to be unescaped.
      *
@@ -152,7 +152,7 @@
     /**
      * Constructs an Rdn from the given string.
      * This constructor takes a string formatted according to the rules
-     * defined in <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>
+     * defined in <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * and described in the class description for
      * {@link javax.naming.ldap.LdapName}.
      *
@@ -180,7 +180,7 @@
      * Constructs an Rdn from the given attribute type and
      * value.
      * The string attribute values are not interpretted as
-     * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * formatted RDN strings. That is, the values are used
      * literally (not parsed) and assumed to be unescaped.
      *
@@ -216,7 +216,7 @@
     /*
      * Adds the given attribute type and value to this Rdn.
      * The string attribute values are not interpretted as
-     * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * formatted RDN strings. That is the values are used
      * literally (not parsed) and assumed to be unescaped.
      *
@@ -280,7 +280,7 @@
 
     /**
      * Returns this Rdn as a string represented in a format defined by
-     * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a> and described
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> and described
      * in the class description for {@link javax.naming.ldap.LdapName LdapName}.
      *
      * @return The string representation of the Rdn.
@@ -503,7 +503,7 @@
     /**
      * Given the value of an attribute, returns a string escaped according
      * to the rules specified in
-     * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>.
      * <p>
      * For example, if the val is "Sue, Grabbit and Runn", the escaped
      * value returned by this method is "Sue\, Grabbit and Runn".
@@ -582,7 +582,7 @@
     /**
      * Given an attribute value string formated according to the rules
      * specified in
-     * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>,
+     * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>,
      * returns the unformated value.  Escapes and quotes are
      * stripped away, and hex-encoded UTF-8 is converted to equivalent
      * UTF-16 characters. Returns a string value as a String, and a
--- a/jdk/src/share/classes/javax/net/ssl/SSLContext.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/net/ssl/SSLContext.java	Wed Jul 05 17:16:45 2017 +0200
@@ -160,7 +160,7 @@
      *
      * @param protocol the standard name of the requested protocol.
      *          See Appendix A in the <a href=
-     *  "{@docRoot}/../technotes/guides//security/jsse/JSSERefGuide.html#AppA">
+     *  "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html#AppA">
      *          Java Secure Socket Extension Reference Guide </a>
      *          for information about standard protocol names.
      *
--- a/jdk/src/share/classes/javax/print/DocFlavor.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/print/DocFlavor.java	Wed Jul 05 17:16:45 2017 +0200
@@ -450,7 +450,7 @@
     /**
      * A String representing the host operating system encoding.
      * This will follow the conventions documented in
-     * <a href="http://ietf.org/rfc/rfc2278.txt">
+     * <a href="http://www.ietf.org/rfc/rfc2278.txt">
      * <i>RFC&nbsp;2278:&nbsp;IANA Charset Registration Procedures</i></a>
      * except where historical names are returned for compatibility with
      * previous versions of the Java platform.
--- a/jdk/src/share/classes/javax/swing/BorderFactory.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/BorderFactory.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 
 import java.awt.Color;
 import java.awt.Font;
-import javax.swing.JComponent;
 import javax.swing.border.*;
 
 /**
@@ -74,10 +73,20 @@
         return new LineBorder(color, thickness);
     }
 
-//    public static Border createLineBorder(Color color, int thickness,
-//                                      boolean drawRounded)  {
-//        return new JLineBorder(color, thickness, drawRounded);
-//    }
+    /**
+     * Creates a line border with the specified color, thickness, and corner shape.
+     *
+     * @param color      the color of the border
+     * @param thickness  the thickness of the border
+     * @param rounded    whether or not border corners should be round
+     * @return the {@code Border} object
+     *
+     * @see LineBorder#LineBorder(Color, int, boolean)
+     * @since 1.7
+     */
+    public static Border createLineBorder(Color color, int thickness, boolean rounded) {
+        return new LineBorder(color, thickness, rounded);
+    }
 
 //// BevelBorder /////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
@@ -180,7 +189,115 @@
         }
         return null;
     }
+
+//// SoftBevelBorder ///////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+    private static Border sharedSoftRaisedBevel;
+    private static Border sharedSoftLoweredBevel;
+
+    /**
+     * Creates a beveled border with a raised edge and softened corners,
+     * using brighter shades of the component's current background color
+     * for highlighting, and darker shading for shadows.
+     * In a raised border, highlights are on top and shadows are underneath.
+     *
+     * @return the {@code Border} object
+     *
+     * @since 1.7
+     */
+    public static Border createRaisedSoftBevelBorder() {
+        if (sharedSoftRaisedBevel == null) {
+            sharedSoftRaisedBevel = new SoftBevelBorder(BevelBorder.RAISED);
+        }
+        return sharedSoftRaisedBevel;
+    }
+
+    /**
+     * Creates a beveled border with a lowered edge and softened corners,
+     * using brighter shades of the component's current background color
+     * for highlighting, and darker shading for shadows.
+     * In a lowered border, shadows are on top and highlights are underneath.
+     *
+     * @return the {@code Border} object
+     *
+     * @since 1.7
+     */
+    public static Border createLoweredSoftBevelBorder() {
+        if (sharedSoftLoweredBevel == null) {
+            sharedSoftLoweredBevel = new SoftBevelBorder(BevelBorder.LOWERED);
+        }
+        return sharedSoftLoweredBevel;
+    }
+
+    /**
+     * Creates a beveled border of the specified type with softened corners,
+     * using brighter shades of the component's current background color
+     * for highlighting, and darker shading for shadows.
+     * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
+     *
+     * @param type  a type of a bevel
+     * @return the {@code Border} object or {@code null}
+     *         if the specified type is not valid
+     *
+     * @see BevelBorder#BevelBorder(int)
+     * @since 1.7
+     */
+    public static Border createSoftBevelBorder(int type) {
+        if (type == BevelBorder.RAISED) {
+            return createRaisedSoftBevelBorder();
+        }
+        if (type == BevelBorder.LOWERED) {
+            return createLoweredSoftBevelBorder();
+        }
+        return null;
+    }
+
+    /**
+     * Creates a beveled border of the specified type with softened corners,
+     * using the specified highlighting and shadowing.
+     * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
+     * The outer edge of the highlight area uses
+     * a brighter shade of the {@code highlight} color.
+     * The inner edge of the shadow area uses
+     * a brighter shade of the {@code shadow} color.
+     *
+     * @param type       a type of a bevel
+     * @param highlight  a basic color of the highlight area
+     * @param shadow     a basic color of the shadow area
+     * @return the {@code Border} object
+     *
+     * @see BevelBorder#BevelBorder(int, Color, Color)
+     * @since 1.7
+     */
+    public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) {
+        return new BevelBorder(type, highlight, shadow);
+    }
+
+    /**
+     * Creates a beveled border of the specified type with softened corners,
+     * using the specified colors for the inner and outer edges
+     * of the highlight and the shadow areas.
+     * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
+     * Note: The shadow inner and outer colors are switched
+     * for a lowered bevel border.
+     *
+     * @param type            a type of a bevel
+     * @param highlightOuter  a color of the outer edge of the highlight area
+     * @param highlightInner  a color of the inner edge of the highlight area
+     * @param shadowOuter     a color of the outer edge of the shadow area
+     * @param shadowInner     a color of the inner edge of the shadow area
+     * @return the {@code Border} object
+     *
+     * @see BevelBorder#BevelBorder(int, Color, Color, Color, Color)
+     * @since 1.7
+     */
+    public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) {
+        return new BevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner);
+    }
+
 //// EtchedBorder ///////////////////////////////////////////////////////////
+
     static final Border sharedEtchedBorder = new EtchedBorder();
     private static Border sharedRaisedEtchedBorder;
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java	Wed Jul 05 17:16:45 2017 +0200
@@ -658,8 +658,7 @@
                     }
                     try {
                         _colorTypes.add((ColorType)checkCast(typeClass.
-                              getField(typeName.substring(classIndex,
-                              typeName.length() - classIndex)).
+                              getField(typeName.substring(classIndex)).
                               get(typeClass), ColorType.class));
                     } catch (NoSuchFieldException nsfe) {
                         throw new SAXException("Unable to find color type: " +
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Wed Jul 05 17:16:45 2017 +0200
@@ -363,18 +363,24 @@
                     SynthIcon.getIconWidth(handleIcon, context) : 0;
                 Dimension compDim;
                 for (int i = 0; i < tb.getComponentCount(); i++) {
-                    compDim = tb.getComponent(i).getMinimumSize();
-                    dim.width += compDim.width;
-                    dim.height = Math.max(dim.height, compDim.height);
+                    Component component = tb.getComponent(i);
+                    if (component.isVisible()) {
+                        compDim = component.getMinimumSize();
+                        dim.width += compDim.width;
+                        dim.height = Math.max(dim.height, compDim.height);
+                    }
                 }
             } else {
                 dim.height = tb.isFloatable() ?
                     SynthIcon.getIconHeight(handleIcon, context) : 0;
                 Dimension compDim;
                 for (int i = 0; i < tb.getComponentCount(); i++) {
-                    compDim = tb.getComponent(i).getMinimumSize();
-                    dim.width = Math.max(dim.width, compDim.width);
-                    dim.height += compDim.height;
+                    Component component = tb.getComponent(i);
+                    if (component.isVisible()) {
+                        compDim = component.getMinimumSize();
+                        dim.width = Math.max(dim.width, compDim.width);
+                        dim.height += compDim.height;
+                    }
                 }
             }
             dim.width += insets.left + insets.right;
@@ -395,18 +401,24 @@
                     SynthIcon.getIconWidth(handleIcon, context) : 0;
                 Dimension compDim;
                 for (int i = 0; i < tb.getComponentCount(); i++) {
-                    compDim = tb.getComponent(i).getPreferredSize();
-                    dim.width += compDim.width;
-                    dim.height = Math.max(dim.height, compDim.height);
+                    Component component = tb.getComponent(i);
+                    if (component.isVisible()) {
+                        compDim = component.getPreferredSize();
+                        dim.width += compDim.width;
+                        dim.height = Math.max(dim.height, compDim.height);
+                    }
                 }
             } else {
                 dim.height = tb.isFloatable() ?
                     SynthIcon.getIconHeight(handleIcon, context) : 0;
                 Dimension compDim;
                 for (int i = 0; i < tb.getComponentCount(); i++) {
-                    compDim = tb.getComponent(i).getPreferredSize();
-                    dim.width = Math.max(dim.width, compDim.width);
-                    dim.height += compDim.height;
+                    Component component = tb.getComponent(i);
+                    if (component.isVisible()) {
+                        compDim = component.getPreferredSize();
+                        dim.width = Math.max(dim.width, compDim.width);
+                        dim.height += compDim.height;
+                    }
                 }
             }
             dim.width += insets.left + insets.right;
@@ -469,22 +481,24 @@
 
                 for (int i = 0; i < tb.getComponentCount(); i++) {
                     c = tb.getComponent(i);
-                    d = c.getPreferredSize();
-                    int y, h;
-                    if (d.height >= baseH || c instanceof JSeparator) {
-                        // Fill available height
-                        y = baseY;
-                        h = baseH;
-                    } else {
-                        // Center component vertically in the available space
-                        y = baseY + (baseH / 2) - (d.height / 2);
-                        h = d.height;
+                    if (c.isVisible()) {
+                        d = c.getPreferredSize();
+                        int y, h;
+                        if (d.height >= baseH || c instanceof JSeparator) {
+                            // Fill available height
+                            y = baseY;
+                            h = baseH;
+                        } else {
+                            // Center component vertically in the available space
+                            y = baseY + (baseH / 2) - (d.height / 2);
+                            h = d.height;
+                        }
+                        //if the component is a "glue" component then add to its
+                        //width the extraSpacePerGlue it is due
+                        if (isGlue(c)) d.width += extraSpacePerGlue;
+                        c.setBounds(ltr ? x : x - d.width, y, d.width, h);
+                        x = ltr ? x + d.width : x - d.width;
                     }
-                    //if the component is a "glue" component then add to its
-                    //width the extraSpacePerGlue it is due
-                    if (isGlue(c)) d.width += extraSpacePerGlue;
-                    c.setBounds(ltr ? x : x - d.width, y, d.width, h);
-                    x = ltr ? x + d.width : x - d.width;
                 }
             } else {
                 int handleHeight = tb.isFloatable() ?
@@ -512,29 +526,31 @@
 
                 for (int i = 0; i < tb.getComponentCount(); i++) {
                     c = tb.getComponent(i);
-                    d = c.getPreferredSize();
-                    int x, w;
-                    if (d.width >= baseW || c instanceof JSeparator) {
-                        // Fill available width
-                        x = baseX;
-                        w = baseW;
-                    } else {
-                        // Center component horizontally in the available space
-                        x = baseX + (baseW / 2) - (d.width / 2);
-                        w = d.width;
+                    if (c.isVisible()) {
+                        d = c.getPreferredSize();
+                        int x, w;
+                        if (d.width >= baseW || c instanceof JSeparator) {
+                            // Fill available width
+                            x = baseX;
+                            w = baseW;
+                        } else {
+                            // Center component horizontally in the available space
+                            x = baseX + (baseW / 2) - (d.width / 2);
+                            w = d.width;
+                        }
+                        //if the component is a "glue" component then add to its
+                        //height the extraSpacePerGlue it is due
+                        if (isGlue(c)) d.height += extraSpacePerGlue;
+                        c.setBounds(x, y, w, d.height);
+                        y += d.height;
                     }
-                    //if the component is a "glue" component then add to its
-                    //height the extraSpacePerGlue it is due
-                    if (isGlue(c)) d.height += extraSpacePerGlue;
-                    c.setBounds(x, y, w, d.height);
-                    y += d.height;
                 }
             }
             context.dispose();
         }
 
         private boolean isGlue(Component c) {
-            if (c instanceof Box.Filler) {
+            if (c.isVisible() && c instanceof Box.Filler) {
                 Box.Filler f = (Box.Filler)c;
                 Dimension min = f.getMinimumSize();
                 Dimension pref = f.getPreferredSize();
--- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,15 +25,12 @@
 package javax.swing.text;
 
 import java.awt.Color;
-import java.awt.Component;
 import java.awt.Font;
-import java.awt.FontMetrics;
 import java.awt.font.TextAttribute;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Stack;
@@ -41,15 +38,14 @@
 import java.util.ArrayList;
 import java.io.IOException;
 import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.Serializable;
-import javax.swing.Icon;
 import javax.swing.event.*;
 import javax.swing.undo.AbstractUndoableEdit;
 import javax.swing.undo.CannotRedoException;
 import javax.swing.undo.CannotUndoException;
 import javax.swing.undo.UndoableEdit;
 import javax.swing.SwingUtilities;
+import static sun.swing.SwingUtilities2.IMPLIED_CR;
 
 /**
  * A document that can be marked up with character and paragraph
@@ -782,9 +778,18 @@
             // Check for the composed text element. If it is, merge the character attributes
             // into this element as well.
             if (Utilities.isComposedTextAttributeDefined(attr)) {
-                ((MutableAttributeSet)attr).addAttributes(cattr);
-                ((MutableAttributeSet)attr).addAttribute(AbstractDocument.ElementNameAttribute,
-                                                         AbstractDocument.ContentElementName);
+                MutableAttributeSet mattr = (MutableAttributeSet) attr;
+                mattr.addAttributes(cattr);
+                mattr.addAttribute(AbstractDocument.ElementNameAttribute,
+                        AbstractDocument.ContentElementName);
+
+                // Assure that the composed text element is named properly
+                // and doesn't have the CR attribute defined.
+                mattr.addAttribute(StyleConstants.NameAttribute,
+                        AbstractDocument.ContentElementName);
+                if (mattr.isDefined(IMPLIED_CR)) {
+                    mattr.removeAttribute(IMPLIED_CR);
+                }
             }
 
             ElementSpec[] spec = new ElementSpec[parseBuffer.size()];
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java	Wed Jul 05 17:16:45 2017 +0200
@@ -32,6 +32,7 @@
 
 import javax.swing.UIManager;
 import sun.swing.SwingUtilities2;
+import static sun.swing.SwingUtilities2.IMPLIED_CR;
 
 /**
  * A GlyphView is a styled chunk of text that represents a view
@@ -1061,7 +1062,6 @@
     int length;
     // if it is an implied newline character
     boolean impliedCR;
-    private static final String IMPLIED_CR = "CR";
     boolean skipWidth;
 
     /**
--- a/jdk/src/share/classes/javax/swing/text/Utilities.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/Utilities.java	Wed Jul 05 17:16:45 2017 +0200
@@ -404,6 +404,24 @@
     }
 
     /**
+     * Adjust text offset so that the length of a resulting string as a whole
+     * fits into the specified width.
+     */
+    static int adjustOffsetForFractionalMetrics(
+            Segment s, FontMetrics fm, int offset, int width) {
+        // Sometimes the offset returned by getTabbedTextOffset is beyond the
+        // available area, when fractional metrics are enabled. We should
+        // guard against this.
+        if (offset < s.count) {
+            while (offset > 0 &&
+                    fm.charsWidth(s.array, s.offset, offset + 1) > width) {
+                offset--;
+            }
+        }
+        return offset;
+    }
+
+    /**
      * Determine where to break the given text to fit
      * within the given span. This tries to find a word boundary.
      * @param s  the source of the text
@@ -425,7 +443,7 @@
         int txtCount = s.count;
         int index = Utilities.getTabbedTextOffset(s, metrics, x0, x,
                                                   e, startOffset, false);
-
+        index = adjustOffsetForFractionalMetrics(s, metrics, index, x - x0);
 
         if (index >= txtCount - 1) {
             return txtCount;
--- a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java	Wed Jul 05 17:16:45 2017 +0200
@@ -108,7 +108,7 @@
 
         try {
             if (line.isLeaf()) {
-                drawText(line, p0, p1, g, x, y);
+                 drawText(line, p0, p1, g, x, y);
             } else {
                 // this line contains the composed text.
                 int idx = line.getElementIndex(p0);
@@ -239,9 +239,11 @@
                                                 tabBase, tabBase + currentWidth,
                                                 this, p0);
         } else {
-            p = p0 + Utilities.getTabbedTextOffset(segment, metrics,
-                                                   tabBase, tabBase + currentWidth,
-                                                   this, p0, false);
+            int offset = Utilities.getTabbedTextOffset(segment, metrics,
+                    tabBase, tabBase + currentWidth, this, p0, false);
+            offset = Utilities.adjustOffsetForFractionalMetrics(
+                    segment, metrics, offset, currentWidth);
+            p = p0 + offset;
         }
         SegmentCache.releaseSharedSegment(segment);
         return p;
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Wed Jul 05 17:16:45 2017 +0200
@@ -24,20 +24,17 @@
  */
 package javax.swing.text.html;
 
-import java.awt.Color;
-import java.awt.Component;
 import java.awt.font.TextAttribute;
 import java.util.*;
 import java.net.URL;
-import java.net.URLEncoder;
 import java.net.MalformedURLException;
 import java.io.*;
 import javax.swing.*;
 import javax.swing.event.*;
 import javax.swing.text.*;
 import javax.swing.undo.*;
-import java.text.Bidi;
 import sun.swing.SwingUtilities2;
+import static sun.swing.SwingUtilities2.IMPLIED_CR;
 
 /**
  * A document that models HTML.  The purpose of this model is to
@@ -1819,7 +1816,6 @@
     static String MAP_PROPERTY = "__MAP__";
 
     private static char[] NEWLINE;
-    private static final String IMPLIED_CR = "CR";
 
     /**
      * I18N property key.
--- a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java	Wed Jul 05 17:16:45 2017 +0200
@@ -32,7 +32,7 @@
 import java.awt.Color;
 
 /** PNG - Portable Network Graphics - image file reader.
-    See <a href=ftp://ds.internic.net/rfc/rfc2083.txt>RFC2083</a> for details. */
+    See <a href=http://www.ietf.org/rfc/rfc2083.txt>RFC2083</a> for details. */
 
 /* this is changed
 public class PNGImageDecoder extends FilterInputStream implements Runnable
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/io/ByteToCharISO2022.java	Wed Jul 05 17:16:45 2017 +0200
@@ -124,15 +124,15 @@
         switch(shiftFlag) {
         case SOFlag:
             tmpIndex = curSODes;
-            tmpConverter = (ByteToCharConverter [])SOConverter;
+            tmpConverter = SOConverter;
             break;
         case SS2Flag:
             tmpIndex = curSS2Des;
-            tmpConverter = (ByteToCharConverter [])SS2Converter;
+            tmpConverter = SS2Converter;
             break;
         case SS3Flag:
             tmpIndex = curSS3Des;
-            tmpConverter = (ByteToCharConverter [])SS3Converter;
+            tmpConverter = SS3Converter;
             break;
         }
 
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java	Wed Jul 05 17:16:45 2017 +0200
@@ -141,7 +141,7 @@
                         } else {
                             savedSize = 2;
                             savedBytes[0] = (byte)byte1;
-                            savedBytes[1] = (byte)input[readOff + inputSize];
+                            savedBytes[1] = input[readOff + inputSize];
                             inputSize++;
                         }
                         break;
--- a/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java	Wed Jul 05 17:16:45 2017 +0200
@@ -34,14 +34,12 @@
     private final static int SJIS1B_MASK = 0x04;
     private final static int EUCJP_KANA1_MASK = 0x08;
     private final static int EUCJP_KANA2_MASK = 0x10;
-    private static byte[] maskTable1;
-    private static byte[] maskTable2;
+    private final static byte[] maskTable1 = JISAutoDetect.getByteMask1();
+    private final static byte[] maskTable2 = JISAutoDetect.getByteMask2();
 
     private final static int SS2 = 0x8e;
     private final static int SS3 = 0x8f;
 
-    private final static JISAutoDetect nioCoder = new JISAutoDetect();
-
     // SJISName is set to either "SJIS" or "MS932"
     private String SJISName;
     private String EUCJPName;
@@ -57,8 +55,6 @@
         defaultConv = new ByteToCharISO8859_1();
         defaultConv.subChars = subChars;
         defaultConv.subMode = subMode;
-        maskTable1 = nioCoder.getByteMask1();
-        maskTable2 = nioCoder.getByteMask2();
     }
 
     public int flush(char [] output, int outStart, int outEnd)
@@ -133,7 +129,7 @@
                                 break;
                             }
                             if ((mask == SJIS2B_MASK) || (mask == SJIS1B_MASK)
-                                || (nioCoder.canBeSJIS1B(firstmask) && secondmask == 0)) {
+                                || (JISAutoDetect.canBeSJIS1B(firstmask) && secondmask == 0)) {
                                 convName = SJISName;
                                 break;
                             }
@@ -145,15 +141,15 @@
                             // character boundary. If we tried both
                             // possibilities here, it might be able to be
                             // determined correctly.
-                            if ((byte1 == SS3) && nioCoder.canBeEUCJP(secondmask)) {
+                            if ((byte1 == SS3) && JISAutoDetect.canBeEUCJP(secondmask)) {
                                 if (cnt+1 < inEnd) {
                                     int nextbyte = input[cnt+1] & 0xff;
-                                    if (! nioCoder.canBeEUCJP(maskTable2[nextbyte]))
+                                    if (! JISAutoDetect.canBeEUCJP(maskTable2[nextbyte]))
                                         convName = SJISName;
                                 } else
                                     convName = SJISName;
                             }
-                            if (nioCoder.canBeEUCKana(firstmask, secondmask))
+                            if (JISAutoDetect.canBeEUCKana(firstmask, secondmask))
                                 euckana++;
                         } else {
                             if ((firstmask & SJIS1B_MASK) != 0) {
--- a/jdk/src/share/classes/sun/io/CharToBytePCK.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/io/CharToBytePCK.java	Wed Jul 05 17:16:45 2017 +0200
@@ -66,7 +66,7 @@
 
          switch (ch) {
             case '\u2015':
-                return (int)0x815C;
+                return 0x815C;
             case '\u2014':
                 return 0;
             default:
--- a/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,2 @@
-# Jules Rendering Engine module
-sun.java2d.jules.JulesRenderingEngine
-
 #  Pisces Rendering Engine module
-sun.java2d.pisces.PiscesRenderingEngine
\ No newline at end of file
+sun.java2d.pisces.PiscesRenderingEngine
--- a/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java	Wed Jul 05 17:16:45 2017 +0200
@@ -171,10 +171,9 @@
 
     // Must hold dc.blockingLock()
     //
-    private void receive(ByteBuffer bb) throws IOException {
+    private SocketAddress receive(ByteBuffer bb) throws IOException {
         if (timeout == 0) {
-            dc.receive(bb);
-            return;
+            return dc.receive(bb);
         }
 
         // Implement timeout with a selector
@@ -183,8 +182,9 @@
         dc.configureBlocking(false);
         try {
             int n;
-            if (dc.receive(bb) != null)
-                return;
+            SocketAddress sender;
+            if ((sender = dc.receive(bb)) != null)
+                return sender;
             sel = Util.getTemporarySelector(dc);
             sk = dc.register(sel, SelectionKey.OP_READ);
             long to = timeout;
@@ -194,8 +194,8 @@
                 long st = System.currentTimeMillis();
                 int ns = sel.select(to);
                 if (ns > 0 && sk.isReadable()) {
-                    if (dc.receive(bb) != null)
-                        return;
+                    if ((sender = dc.receive(bb)) != null)
+                        return sender;
                 }
                 sel.selectedKeys().remove(sk);
                 to -= System.currentTimeMillis() - st;
@@ -222,7 +222,8 @@
                     ByteBuffer bb = ByteBuffer.wrap(p.getData(),
                                                     p.getOffset(),
                                                     p.getLength());
-                    receive(bb);
+                    SocketAddress sender = receive(bb);
+                    p.setSocketAddress(sender);
                     p.setLength(bb.position() - p.getOffset());
                 }
             } catch (IOException x) {
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java	Wed Jul 05 17:16:45 2017 +0200
@@ -144,11 +144,7 @@
     }
 
     public void close() throws IOException {
-        try {
-            ssc.close();
-        } catch (Exception x) {
-            Net.translateException(x);
-        }
+        ssc.close();
     }
 
     public ServerSocketChannel getChannel() {
--- a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Wed Jul 05 17:16:45 2017 +0200
@@ -404,11 +404,7 @@
     }
 
     public void close() throws IOException {
-        try {
-            sc.close();
-        } catch (Exception x) {
-            Net.translateToSocketException(x);
-        }
+        sc.close();
     }
 
     public void shutdownInput() throws IOException {
--- a/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java	Wed Jul 05 17:16:45 2017 +0200
@@ -103,7 +103,7 @@
     public final static char[] B2C_UNMAPPABLE;
     static {
         B2C_UNMAPPABLE = new char[0x100];
-        Arrays.fill(B2C_UNMAPPABLE, (char)UNMAPPABLE_DECODING);
+        Arrays.fill(B2C_UNMAPPABLE, UNMAPPABLE_DECODING);
     }
 
     public static class Decoder extends CharsetDecoder
@@ -374,7 +374,7 @@
         static final char[] b2cSB;
         static {
             b2cSB = new char[0x100];
-            Arrays.fill(b2cSB, (char)UNMAPPABLE_DECODING);
+            Arrays.fill(b2cSB, UNMAPPABLE_DECODING);
         }
         Decoder_EBCDIC_DBCSONLY(Charset cs, char[][] b2c, int b2Min, int b2Max) {
             super(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP.java	Wed Jul 05 17:16:45 2017 +0200
@@ -79,8 +79,10 @@
         JIS_X_0201.Decoder decoderJ0201;
         JIS_X_0212_Decoder decoderJ0212;
 
-        short[] j0208Index1;
-        String[] j0208Index2;
+        private static final short[] j0208Index1 =
+          JIS_X_0208_Decoder.getIndex1();
+        private static final String[] j0208Index2 =
+          JIS_X_0208_Decoder.getIndex2();
 
         protected Decoder(Charset cs) {
             super(cs);
@@ -88,8 +90,6 @@
             decoderJ0212 = new JIS_X_0212_Decoder(cs);
             start = 0xa1;
             end = 0xfe;
-            j0208Index1 = super.getIndex1();
-            j0208Index2 = super.getIndex2();
         }
         protected char decode0212(int byte1, int byte2) {
              return decoderJ0212.decodeDouble(byte1, byte2);
@@ -238,8 +238,10 @@
         JIS_X_0201.Encoder encoderJ0201;
         JIS_X_0212_Encoder encoderJ0212;
 
-        short[] j0208Index1;
-        String[] j0208Index2;
+        private static final short[] j0208Index1 =
+          JIS_X_0208_Encoder.getIndex1();
+        private static final String[] j0208Index2 =
+          JIS_X_0208_Encoder.getIndex2();
 
         private final Surrogate.Parser sgp = new Surrogate.Parser();
 
@@ -247,8 +249,6 @@
             super(cs, 3.0f, 3.0f);
             encoderJ0201 = new JIS_X_0201.Encoder(cs);
             encoderJ0212 = new JIS_X_0212_Encoder(cs);
-            j0208Index1 = super.getIndex1();
-            j0208Index2 = super.getIndex2();
         }
 
         public boolean canEncode(char c) {
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java	Wed Jul 05 17:16:45 2017 +0200
@@ -65,20 +65,18 @@
 
     private static class Decoder extends CharsetDecoder {
         JIS_X_0201.Decoder decoderJ0201;
-        JIS_X_0208_Decoder decodeMappingJ0208;
         protected final char REPLACE_CHAR='\uFFFD';
 
-        short[] jis0208Index1;
-        String[] jis0208Index2;
+        private static final int start = 0xa1;
+        private static final int end = 0xfe;
+        private static final short[] jis0208Index1 =
+            JIS_X_0208_Decoder.getIndex1();
+        private static final String[] jis0208Index2 =
+            JIS_X_0208_Decoder.getIndex2();
 
         private Decoder(Charset cs) {
             super(cs, 1.0f, 1.0f);
             decoderJ0201 = new JIS_X_0201.Decoder(cs);
-            decodeMappingJ0208 = new JIS_X_0208_Decoder(cs);
-            decodeMappingJ0208.start = 0xa1;
-            decodeMappingJ0208.end = 0xfe;
-            jis0208Index1 = decodeMappingJ0208.getIndex1();
-            jis0208Index2 = decodeMappingJ0208.getIndex2();
         }
 
         protected char convSingleByte(int b) {
@@ -93,11 +91,11 @@
             }
 
             if (((byte1 < 0) || (byte1 > jis0208Index1.length))
-                || ((byte2 < decodeMappingJ0208.start) || (byte2 > decodeMappingJ0208.end)))
+                || ((byte2 < start) || (byte2 > end)))
                 return REPLACE_CHAR;
 
-            int n = (jis0208Index1[byte1 - 0x80] & 0xf) * (decodeMappingJ0208.end - decodeMappingJ0208.start + 1)
-                    + (byte2 - decodeMappingJ0208.start);
+            int n = (jis0208Index1[byte1 - 0x80] & 0xf) * (end - start + 1)
+                    + (byte2 - start);
             return jis0208Index2[jis0208Index1[byte1 - 0x80] >> 4].charAt(n);
         }
 
@@ -213,18 +211,16 @@
     private static class Encoder extends CharsetEncoder {
 
         JIS_X_0201.Encoder encoderJ0201;
-        JIS_X_0208_Encoder encoderJ0208;
 
         private final Surrogate.Parser sgp = new Surrogate.Parser();
-        short[] jis0208Index1;
-        String[] jis0208Index2;
+        private static final short[] jis0208Index1 =
+            JIS_X_0208_Encoder.getIndex1();
+        private static final String[] jis0208Index2 =
+            JIS_X_0208_Encoder.getIndex2();
 
         private Encoder(Charset cs) {
             super(cs, 2.0f, 2.0f);
             encoderJ0201 = new JIS_X_0201.Encoder(cs);
-            encoderJ0208 = new JIS_X_0208_Encoder(cs);
-            jis0208Index1 = encoderJ0208.getIndex1();
-            jis0208Index2 = encoderJ0208.getIndex2();
         }
 
         public boolean canEncode(char c) {
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_Open.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_Open.java	Wed Jul 05 17:16:45 2017 +0200
@@ -75,8 +75,12 @@
         JIS_X_0212_Solaris_Decoder decodeMappingJ0212;
         JIS_X_0208_Solaris_Decoder decodeMappingJ0208;
 
-        short[] j0208Index1;
-        String[] j0208Index2;
+        private static final short[] j0208Index1 =
+          JIS_X_0208_Solaris_Decoder.getIndex1();
+        private static final String[] j0208Index2 =
+          JIS_X_0208_Solaris_Decoder.getIndex2();
+        private static final int start = 0xa1;
+        private static final int end = 0xfe;
 
         protected final char REPLACE_CHAR='\uFFFD';
 
@@ -84,11 +88,6 @@
             super(cs);
             decoderJ0201 = new JIS_X_0201.Decoder(cs);
             decodeMappingJ0212 = new JIS_X_0212_Solaris_Decoder(cs);
-            decodeMappingJ0208 = new JIS_X_0208_Solaris_Decoder(cs);
-            decodeMappingJ0208.start = 0xa1;
-            decodeMappingJ0208.end = 0xfe;
-            j0208Index1 = decodeMappingJ0208.getIndex1();
-            j0208Index2 = decodeMappingJ0208.getIndex2();
         }
 
 
@@ -103,9 +102,9 @@
             }
 
             if (((byte1 < 0)
-                || (byte1 > decodeMappingJ0208.getIndex1().length))
-                || ((byte2 < decodeMappingJ0208.start)
-                || (byte2 > decodeMappingJ0208.end)))
+                || (byte1 > j0208Index1.length))
+                || ((byte2 < start)
+                || (byte2 > end)))
                 return REPLACE_CHAR;
 
             char result = super.decodeDouble(byte1, byte2);
@@ -113,8 +112,8 @@
                 return result;
             } else {
                 int n = (j0208Index1[byte1 - 0x80] & 0xf) *
-                        (decodeMappingJ0208.end - decodeMappingJ0208.start + 1)
-                        + (byte2 - decodeMappingJ0208.start);
+                        (end - start + 1)
+                        + (byte2 - start);
                 return j0208Index2[j0208Index1[byte1 - 0x80] >> 4].charAt(n);
             }
         }
@@ -125,10 +124,11 @@
 
         JIS_X_0201.Encoder encoderJ0201;
         JIS_X_0212_Solaris_Encoder encoderJ0212;
-        JIS_X_0208_Solaris_Encoder encoderJ0208;
 
-        short[] j0208Index1;
-        String[] j0208Index2;
+        private static final short[] j0208Index1 =
+            JIS_X_0208_Solaris_Encoder.getIndex1();
+        private static final String[] j0208Index2 =
+            JIS_X_0208_Solaris_Encoder.getIndex2();
 
         private final Surrogate.Parser sgp = new Surrogate.Parser();
 
@@ -136,9 +136,6 @@
             super(cs);
             encoderJ0201 = new JIS_X_0201.Encoder(cs);
             encoderJ0212 = new JIS_X_0212_Solaris_Encoder(cs);
-            encoderJ0208 = new JIS_X_0208_Solaris_Encoder(cs);
-            j0208Index1 = encoderJ0208.getIndex1();
-            j0208Index2 = encoderJ0208.getIndex2();
         }
 
         protected int encodeSingle(char inputChar, byte[] outputByte) {
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_TW.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_TW.java	Wed Jul 05 17:16:45 2017 +0200
@@ -423,7 +423,7 @@
                     if (dst.remaining() < outSize)
                         return CoderResult.OVERFLOW;
                     for (int i = 0; i < outSize; i++)
-                        dst.put((byte)bb[i]);
+                        dst.put(bb[i]);
                     mark += inSize;
                 }
                 return CoderResult.UNDERFLOW;
--- a/jdk/src/share/classes/sun/nio/cs/ext/GB18030.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/GB18030.java	Wed Jul 05 17:16:45 2017 +0200
@@ -12339,7 +12339,7 @@
             int start = 0x40, end = 0xFE;
             if (((byte1 < 0) || (byte1 > index1.length))
                 || ((byte2 < start) || (byte2 > end)))
-                return (char)'\uFFFD';
+                return '\uFFFD';
 
             int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
             return index2[index1[byte1] >> 4].charAt(n);
--- a/jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java	Wed Jul 05 17:16:45 2017 +0200
@@ -43,7 +43,7 @@
 
         private char[][] b2cBmp;
         private char[][] b2cSupp;
-        private static DoubleByte.Decoder big5Dec;
+        private DoubleByte.Decoder big5Dec;
 
         protected Decoder(Charset cs,
                           DoubleByte.Decoder big5Dec,
@@ -355,7 +355,7 @@
                             c2b[hi] = new char[0x100];
                             Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
                         }
-                        c2b[hi][c & 0xff] = (char)bb;
+                        c2b[hi][c & 0xff] = bb;
                     }
                     c++;
                 }
--- a/jdk/src/share/classes/sun/nio/cs/ext/ISO2022.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/ISO2022.java	Wed Jul 05 17:16:45 2017 +0200
@@ -104,15 +104,15 @@
             switch(shiftFlag) {
             case SOFlag:
                 tmpIndex = curSODes;
-                tmpDecoder = (CharsetDecoder [])SODecoder;
+                tmpDecoder = SODecoder;
                 break;
             case SS2Flag:
                 tmpIndex = curSS2Des;
-                tmpDecoder = (CharsetDecoder [])SS2Decoder;
+                tmpDecoder = SS2Decoder;
                 break;
             case SS3Flag:
                 tmpIndex = curSS3Des;
-                tmpDecoder = (CharsetDecoder [])SS3Decoder;
+                tmpDecoder = SS3Decoder;
                 break;
             }
 
--- a/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java	Wed Jul 05 17:16:45 2017 +0200
@@ -82,11 +82,11 @@
      * with the sun.io JISAutoDetect implementation
      */
 
-    public byte[] getByteMask1() {
+    public static byte[] getByteMask1() {
         return Decoder.maskTable1;
     }
 
-    public byte[] getByteMask2() {
+    public static byte[] getByteMask2() {
         return Decoder.maskTable2;
     }
 
--- a/jdk/src/share/classes/sun/nio/cs/ext/PCK.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/PCK.java	Wed Jul 05 17:16:45 2017 +0200
@@ -101,17 +101,15 @@
     private static class Encoder extends SJIS.Encoder {
 
         private JIS_X_0201.Encoder jis0201;
-        private JIS_X_0208_Solaris_Encoder jis0208;
 
-        short[] j0208Index1;
-        String[] j0208Index2;
+        private static final short[] j0208Index1 =
+            JIS_X_0208_Solaris_Encoder.getIndex1();
+        private static final String[] j0208Index2 =
+            JIS_X_0208_Solaris_Encoder.getIndex2();
 
         private Encoder(Charset cs) {
             super(cs);
             jis0201 = new JIS_X_0201.Encoder(cs);
-            jis0208 = new JIS_X_0208_Solaris_Encoder(cs);
-            j0208Index1 = jis0208.getIndex1();
-            j0208Index2 = jis0208.getIndex2();
         }
 
         protected int encodeDouble(char ch) {
@@ -121,7 +119,7 @@
 
             switch (ch) {
                 case '\u2015':
-                    return (int)0x815C;
+                    return 0x815C;
                 case '\u2014':
                     return 0;
                 default:
--- a/jdk/src/share/classes/sun/nio/cs/ext/SJIS.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/SJIS.java	Wed Jul 05 17:16:45 2017 +0200
@@ -114,14 +114,14 @@
 
         private JIS_X_0201.Encoder jis0201;
 
-        short[] j0208Index1;
-        String[] j0208Index2;
+        private static final short[] j0208Index1 =
+            JIS_X_0208_Encoder.getIndex1();
+        private static final String[] j0208Index2 =
+            JIS_X_0208_Encoder.getIndex2();
 
         protected Encoder(Charset cs) {
             super(cs);
             jis0201 = new JIS_X_0201.Encoder(cs);
-            j0208Index1 = super.getIndex1();
-            j0208Index2 = super.getIndex2();
         }
 
         protected int encodeSingle(char inputChar) {
--- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java	Wed Jul 05 17:16:45 2017 +0200
@@ -188,24 +188,13 @@
             etypes = EType.getBuiltInDefaults();
         }
 
-        // set the preferred etype for preauth
-        if ((pa_exists) && (pa_etype != EncryptedData.ETYPE_NULL)) {
-            if (DEBUG) {
-                System.out.println("Pre-Authentication: " +
-                        "Set preferred etype = " + pa_etype);
-            }
-            if (EType.isSupported(pa_etype)) {
-                // reset etypes to preferred value
-                etypes = new int[1];
-                etypes[0] = pa_etype;
-            }
-        }
-
         EncryptionKey[] encKeys = new EncryptionKey[etypes.length];
         for (int i = 0; i < etypes.length; i++) {
             if (EType.isSupported(etypes[i])) {
+                byte[] s2kparams = (pa_exists && etypes[i] == pa_etype)
+                        ? pa_s2kparams : null;
                 encKeys[i] = new EncryptionKey(
-                        stringToKey(password, salt, pa_s2kparams, etypes[i]),
+                        stringToKey(password, salt, s2kparams, etypes[i]),
                         etypes[i], null);
             } else {
                 if (DEBUG) {
--- a/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java	Wed Jul 05 17:16:45 2017 +0200
@@ -342,20 +342,20 @@
         }
 
         princName = cname;
-
-        EncryptionKey key = null;
-        int[] tktETypes = EType.getDefaults("default_tkt_enctypes");
-        if (pa_exists && pa_etype != EncryptedData.ETYPE_NULL) {
-            if (DEBUG) {
-                System.out.println("Pre-Authenticaton: find key for etype = " + pa_etype);
-            }
-            key = EncryptionKey.findKey(pa_etype, keys);
-        } else {
-            key = EncryptionKey.findKey(tktETypes[0], keys);
-        }
-
+        int[] tktETypes = EType.getDefaults("default_tkt_enctypes", keys);
         PAData[] paData = null;
         if (PA_ENC_TIMESTAMP_REQUIRED) {
+            EncryptionKey key = null;
+            if (pa_etype != EncryptedData.ETYPE_NULL) {
+                if (DEBUG) {
+                    System.out.println("Pre-Authenticaton: find key for etype = " + pa_etype);
+                }
+                key = EncryptionKey.findKey(pa_etype, keys);
+            } else {
+                if (tktETypes.length > 0) {
+                    key = EncryptionKey.findKey(tktETypes[0], keys);
+                }
+            }
             if (DEBUG) {
                 System.out.println("AS-REQ: Add PA_ENC_TIMESTAMP now");
             }
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java	Wed Jul 05 17:16:45 2017 +0200
@@ -286,6 +286,19 @@
                         salt = info.getSalt();
                         if (DEBUG) {
                             System.out.println("\t PA-ETYPE-INFO etype = " + etype);
+                            System.out.println("\t PA-ETYPE-INFO salt = " + salt);
+                        }
+                        while (der.data.available() > 0) {
+                            value = der.data.getDerValue();
+                            info = new ETypeInfo(value);
+                            if (DEBUG) {
+                                etype = info.getEType();
+                                System.out.println("\t salt for " + etype
+                                        + " is " + info.getSalt());
+                            }
+                            if (salt == null || salt.isEmpty()) {
+                                salt = info.getSalt();
+                            }
                         }
                     }
                     break;
@@ -299,6 +312,19 @@
                         s2kparams = info2.getParams();
                         if (DEBUG) {
                             System.out.println("\t PA-ETYPE-INFO2 etype = " + etype);
+                            System.out.println("\t PA-ETYPE-INFO salt = " + salt);
+                        }
+                        while (der.data.available() > 0) {
+                            value = der.data.getDerValue();
+                            info2 = new ETypeInfo2(value);
+                            if (DEBUG) {
+                                etype = info2.getEType();
+                                System.out.println("\t salt for " + etype
+                                        + " is " + info2.getSalt());
+                            }
+                            if (salt == null || salt.isEmpty()) {
+                                salt = info2.getSalt();
+                            }
                         }
                     }
                     break;
--- a/jdk/src/share/classes/sun/security/validator/PKIXValidator.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/security/validator/PKIXValidator.java	Wed Jul 05 17:16:45 2017 +0200
@@ -53,7 +53,7 @@
     private int certPathLength = -1;
 
     // needed only for the validator
-    private Map<X500Principal, X509Certificate> trustedSubjects;
+    private Map<X500Principal, List<PublicKey>> trustedSubjects;
     private CertificateFactory factory;
 
     private boolean plugin = false;
@@ -95,9 +95,17 @@
         if (TRY_VALIDATOR == false) {
             return;
         }
-        trustedSubjects = new HashMap<X500Principal, X509Certificate>();
+        trustedSubjects = new HashMap<X500Principal, List<PublicKey>>();
         for (X509Certificate cert : trustedCerts) {
-            trustedSubjects.put(cert.getSubjectX500Principal(), cert);
+            X500Principal dn = cert.getSubjectX500Principal();
+            List<PublicKey> keys;
+            if (trustedSubjects.containsKey(dn)) {
+                keys = trustedSubjects.get(dn);
+            } else {
+                keys = new ArrayList<PublicKey>();
+                trustedSubjects.put(dn, keys);
+            }
+            keys.add(cert.getPublicKey());
         }
         try {
             factory = CertificateFactory.getInstance("X.509");
@@ -161,13 +169,21 @@
                     // chain is not ordered correctly, call builder instead
                     return doBuild(chain, otherCerts);
                 }
-                if (trustedSubjects.containsKey(dn)
-                        && trustedSubjects.get(dn).getPublicKey()
-                            .equals(cert.getPublicKey())) {
+
+                // Check if chain[i] is already trusted. It may be inside
+                // trustedCerts, or has the same dn and public key as a cert
+                // inside trustedCerts. The latter happens when a CA has
+                // updated its cert with a stronger signature algorithm in JRE
+                // but the weak one is still in circulation.
+
+                if (trustedCerts.contains(cert) ||          // trusted cert
+                        (trustedSubjects.containsKey(dn) && // replacing ...
+                         trustedSubjects.get(dn).contains(  // ... weak cert
+                            cert.getPublicKey()))) {
                     if (i == 0) {
                         return new X509Certificate[] {chain[0]};
                     }
-                    // Remove and call validator
+                    // Remove and call validator on partial chain [0 .. i-1]
                     X509Certificate[] newChain = new X509Certificate[i];
                     System.arraycopy(chain, 0, newChain, 0, i);
                     return doValidate(newChain);
@@ -217,14 +233,17 @@
         return doBuild(chain, otherCerts);
     }
 
-    private boolean isSignatureValid(X509Certificate iss, X509Certificate sub) {
+    private boolean isSignatureValid(List<PublicKey> keys, X509Certificate sub) {
         if (plugin) {
-            try {
-                sub.verify(iss.getPublicKey());
-            } catch (Exception ex) {
-                return false;
+            for (PublicKey key: keys) {
+                try {
+                    sub.verify(key);
+                    return true;
+                } catch (Exception ex) {
+                    continue;
+                }
             }
-            return true;
+            return false;
         }
         return true; // only check if PLUGIN is set
     }
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Wed Jul 05 17:16:45 2017 +0200
@@ -109,6 +109,12 @@
                           new StringBuffer("AATextInfoPropertyKey");
 
     /**
+     * Attribute key for the content elements.  If it is set on an element, the
+     * element is considered to be a line break.
+     */
+    public static final String IMPLIED_CR = "CR";
+
+    /**
      * Used to tell a text component, being used as an editor for table
      * or tree, how many clicks it took to start editing.
      */
--- a/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java	Wed Jul 05 17:16:45 2017 +0200
@@ -127,7 +127,7 @@
 
     public static SortOrder getColumnSortOrder(JTable table, int column) {
         SortOrder rv = null;
-        if (table.getRowSorter() == null) {
+        if (table == null || table.getRowSorter() == null) {
             return rv;
         }
         java.util.List<? extends RowSorter.SortKey> sortKeys =
--- a/jdk/src/share/classes/sun/tools/jstat/Arguments.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/tools/jstat/Arguments.java	Wed Jul 05 17:16:45 2017 +0200
@@ -47,6 +47,7 @@
 
     private static final String JVMSTAT_USERDIR = ".jvmstat";
     private static final String OPTIONS_FILENAME = "jstat_options";
+    private static final String UNSUPPORTED_OPTIONS_FILENAME = "jstat_unsupported_options";
     private static final String ALL_NAMES = "\\w*";
 
     private Comparator<Monitor> comparator;
@@ -411,8 +412,8 @@
         return optionFormat;
     }
 
-    public URL[] optionsSources() {
-        URL[] sources = new URL[2];
+    public List<URL> optionsSources() {
+        List<URL> sources = new ArrayList<URL>();
         int i = 0;
 
         String filename = OPTIONS_FILENAME;
@@ -421,7 +422,7 @@
             String userHome = System.getProperty("user.home");
             String userDir = userHome + "/" + JVMSTAT_USERDIR;
             File home = new File(userDir + "/" + filename);
-            sources[i++] = home.toURL();
+            sources.add(home.toURI().toURL());
         } catch (Exception e) {
             if (debug) {
                 System.err.println(e.getMessage());
@@ -430,8 +431,15 @@
             throw new IllegalArgumentException("Internal Error: Bad URL: "
                                                + e.getMessage());
         }
-        sources[i] = this.getClass().getResource("resources/" + filename);
-        assert sources[i] != null;
+        URL u = this.getClass().getResource("resources/" + filename);
+        assert u != null;
+        sources.add(u);
+
+        if (showUnsupported) {
+            u = this.getClass().getResource("resources/" +  UNSUPPORTED_OPTIONS_FILENAME);
+            assert u != null;
+            sources.add(u);
+        }
         return sources;
     }
 }
--- a/jdk/src/share/classes/sun/tools/jstat/OptionFinder.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/tools/jstat/OptionFinder.java	Wed Jul 05 17:16:45 2017 +0200
@@ -39,9 +39,9 @@
 
     private static final boolean debug = false;
 
-    URL[] optionsSources;
+    List<URL> optionsSources;
 
-    public OptionFinder(URL[] optionsSources) {
+    public OptionFinder(List<URL> optionsSources) {
         this.optionsSources = optionsSources;
     }
 
@@ -59,24 +59,25 @@
         return of;
     }
 
-    protected OptionFormat getOptionFormat(String option, URL[] sources) {
+    protected OptionFormat getOptionFormat(String option, List<URL> sources) {
         OptionFormat of = null;
-        for (int i = 0; (i < sources.length) && (of == null); i++) {
+        for (URL u : sources) {
             try {
-                URL u = sources[i];
                 Reader r = new BufferedReader(
                         new InputStreamReader(u.openStream()));
                 of = new Parser(r).parse(option);
+                if (of != null)
+                    break;
             } catch (IOException e) {
                 if (debug) {
-                    System.err.println("Error processing " + sources[i]
+                    System.err.println("Error processing " + u
                                        + " : " + e.getMessage());
                     e.printStackTrace();
                 }
             } catch (ParserException e) {
                 // Exception in parsing the options file.
-                System.err.println(sources[i] + ": " + e.getMessage());
-                System.err.println("Parsing of " + sources[i] + " aborted");
+                System.err.println(u + ": " + e.getMessage());
+                System.err.println("Parsing of " + u + " aborted");
             }
         }
         return of;
--- a/jdk/src/share/classes/sun/tools/jstat/OptionLister.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/tools/jstat/OptionLister.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,9 +37,9 @@
  */
 public class OptionLister {
     private static final boolean debug = false;
-    private URL[] sources;
+    private List<URL> sources;
 
-    public OptionLister(URL[] sources) {
+    public OptionLister(List<URL> sources) {
         this.sources = sources;
     }
 
@@ -54,9 +54,8 @@
 
         Set<OptionFormat> options = new TreeSet<OptionFormat>(c);
 
-        for (int i = 0; i < sources.length; i++) {
+        for (URL u : sources) {
             try {
-                URL u = sources[i];
                 Reader r = new BufferedReader(
                         new InputStreamReader(u.openStream()));
                 Set<OptionFormat> s = new Parser(r).parseOptions();
@@ -68,8 +67,8 @@
                 }
             } catch (ParserException e) {
                 // Exception in parsing the options file.
-                System.err.println(sources[i] + ": " + e.getMessage());
-                System.err.println("Parsing of " + sources[i] + " aborted");
+                System.err.println(u + ": " + e.getMessage());
+                System.err.println("Parsing of " + u + " aborted");
             }
         }
 
--- a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options	Wed Jul 05 17:16:45 2017 +0200
@@ -37,7 +37,7 @@
 option class {
   column {
     header "^Loaded^"	/* Number of classes loaded */
-    data java.cls.loadedClasses
+    data (java.cls.loadedClasses + java.cls.sharedLoadedClasses)
     align right
     scale raw
     width 5
@@ -45,7 +45,7 @@
   }
   column {
     header "^Bytes^"	/* Accumulated Size of classes loaded */
-    data sun.cls.loadedBytes
+    data (sun.cls.loadedBytes + sun.cls.sharedLoadedBytes)
     align right
     scale K
     width 7
@@ -53,7 +53,7 @@
   }
   column {
     header "^Unloaded^"	/* Number of classes unloaded */
-    data java.cls.unloadedClasses
+    data (java.cls.unloadedClasses + java.cls.sharedUnloadedClasses)
     align right
     width 5
     scale raw
@@ -61,7 +61,7 @@
   }
   column {
     header "^Bytes^"	/* Accumulated size of classes unloaded */
-    data sun.cls.unloadedBytes
+    data (sun.cls.unloadedBytes + sun.cls.sharedUnloadedBytes)
     align right
     scale K
     width 7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2010, 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.
+ */
+
+option classload {
+  column {
+    header "^Loaded^"	/* Number of classes loaded */
+    data (java.cls.loadedClasses + java.cls.sharedLoadedClasses)
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Time^"	/* Accumulated time for class loading */
+    data sun.cls.time/sun.os.hrt.frequency
+    scale sec
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "^Inited^"	/* Number of initialized classes */
+    data sun.cls.initializedClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Time^"	/* Accumulated time for class initialization */
+    data sun.cls.classInitTime.self/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "Shared^"	/* Number of system classes loaded from shared archive */
+    data java.cls.sharedLoadedClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Kbytes^"	/* Accumulated Size of classes loaded */
+    data sun.cls.sharedLoadedBytes
+    align right
+    scale K
+    width 7
+    format "0.0"
+  }
+  column {
+    header "LoadTime^"	/* Accumulated time for loading classes from shared archive */
+    data sun.cls.sharedClassLoadTime/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "^SysClass^"	/* Number of system classes loaded */
+    data java.cls.loadedClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Kbytes^"	/* Bytes read from system class files */
+    data sun.cls.sysClassBytes
+    align right
+    scale K
+    width 7
+    format "0.0"
+  }
+  column {
+    header "LoadTime^"	/* Accumulated time for loading non-shared system classes */
+    data sun.cls.sysClassLoadTime/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "Lookup^"	/* Time spent in looking up/reading of system classes */
+    data sun.cls.lookupSysClassTime/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "Parse^"	/* Time spent in parsing system classes */
+    data sun.cls.parseClassTime.self/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "^Linked^"	/* Number of linked classes */
+    data sun.cls.linkedClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Time^"	/* Accumulated time for class linking */
+    data sun.cls.classInitTime.self/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "^Verified^"	/* Number of verified classes */
+    data sun.cls.verifiedClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Time^"	/* Accumulated time for class verification */
+    data sun.cls.classVerifyTime.self/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "AppClass^"	/* Number of loaded application classes */
+    data sun.cls.appClassLoadCount
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Kbytes^"	/* Bytes read from app class files */
+    data sun.cls.appClassBytes
+    align right
+    scale K
+    width 7
+    format "0.0"
+  }
+  column {
+    header "AppCL^"	/* Accumulated time for loading app classes */
+    data sun.cls.appClassLoadTime/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "^DefineClass^"	/* Number of defineClass calls */
+    data sun.cls.defineAppClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Time^"	/* Accumulated time for defineClass */
+    data sun.cls.defineAppClassTime.self/sun.os.hrt.frequency
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "^FindClass^"	/* Number of findClass calls */
+    data sun.classloader.findClasses
+    align right
+    scale raw
+    width 5
+    format "0"
+  }
+  column {
+    header "Time^"	/* Accumulated time for findClass */
+    data sun.classloader.findClassTime/1000000000
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "Delegation^"	/* Parent class loader delegation time */
+    data sun.classloader.parentDelegationTime/1000000000
+    scale raw 
+    align right
+    width 10
+    format "0.000"
+  }
+  column {
+    header "URLCL Read^"	/* Accumulated time for URLClassLoader reading bytes */
+    data sun.urlClassLoader.readClassBytesTime/1000000000
+    scale raw
+    align right
+    width 10
+    format "0.000"
+  }
+}
+
--- a/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt	Wed Jul 05 17:16:45 2017 +0200
@@ -132,7 +132,7 @@
     LIBRARY=lib$(LIBNAME).so
     LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
     # Libraries we are dependent on
-    LIBRARIES= -lnsl -ldl -lc
+    LIBRARIES= -ldl -lc
     # Building a shared library
     LINK_SHARED=$(LINK.c) -shared -o $@
 endif
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c	Wed Jul 05 17:16:45 2017 +0200
@@ -182,7 +182,7 @@
     int success = 0;
 
     stream->read(stream, sig, SIG_BYTES);
-    if (!png_check_sig(sig, SIG_BYTES)) {
+    if (png_sig_cmp(sig, 0, SIG_BYTES)) {
         goto done;
     }
     success = SplashDecodePng(splash, my_png_read_stream, stream);
--- a/jdk/src/share/native/sun/font/freetypeScaler.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/share/native/sun/font/freetypeScaler.c	Wed Jul 05 17:16:45 2017 +0200
@@ -490,22 +490,23 @@
 
     /* ascent */
     ax = 0;
-    ay = -(jfloat) FT26Dot6ToFloat(
-                       scalerInfo->face->size->metrics.ascender +
-                       bmodifier/2);
+    ay = -(jfloat) FT26Dot6ToFloat(FT_MulFix(
+                       ((jlong) scalerInfo->face->ascender + bmodifier/2),
+                       (jlong) scalerInfo->face->size->metrics.y_scale));
     /* descent */
     dx = 0;
-    dy = -(jfloat) FT26Dot6ToFloat(
-                       scalerInfo->face->size->metrics.descender +
-                       bmodifier/2);
+    dy = -(jfloat) FT26Dot6ToFloat(FT_MulFix(
+                       ((jlong) scalerInfo->face->descender + bmodifier/2),
+                       (jlong) scalerInfo->face->size->metrics.y_scale));
     /* baseline */
     bx = by = 0;
 
     /* leading */
     lx = 0;
-    ly = (jfloat) FT26Dot6ToFloat(
-                      scalerInfo->face->size->metrics.height +
-                      bmodifier) + ay - dy;
+    ly = (jfloat) FT26Dot6ToFloat(FT_MulFix(
+                      (jlong) scalerInfo->face->height + bmodifier,
+                      (jlong) scalerInfo->face->size->metrics.y_scale))
+                  + ay - dy;
     /* max advance */
     mx = (jfloat) FT26Dot6ToFloat(
                      scalerInfo->face->size->metrics.max_advance +
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux	Wed Jul 05 17:16:45 2017 +0200
@@ -25,25 +25,42 @@
 
 package java.lang;
 
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadFactory;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 
-/* java.lang.Process subclass in the UNIX environment.
+/**
+ * java.lang.Process subclass in the UNIX environment.
  *
  * @author Mario Wolczko and Ross Knippel.
  * @author Konstantin Kladko (ported to Linux)
+ * @author Martin Buchholz
  */
-
 final class UNIXProcess extends Process {
     private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
         = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
 
-    private int pid;
+    private final int pid;
     private int exitcode;
     private boolean hasExited;
 
-    private OutputStream stdin_stream;
-    private InputStream  stdout_stream;
-    private InputStream  stderr_stream;
+    private /* final */ OutputStream stdin;
+    private /* final */ InputStream  stdout;
+    private /* final */ InputStream  stderr;
 
     /* this is for the reaping thread */
     private native int waitForProcessExit(int pid);
@@ -51,155 +68,136 @@
     /**
      * Create a process using fork(2) and exec(2).
      *
-     * @param std_fds array of file descriptors.  Indexes 0, 1, and
-     *        2 correspond to standard input, standard output and
-     *        standard error, respectively.  On input, a value of -1
-     *        means to create a pipe to connect child and parent
-     *        processes.  On output, a value which is not -1 is the
-     *        parent pipe fd corresponding to the pipe which has
-     *        been created.  An element of this array is -1 on input
-     *        if and only if it is <em>not</em> -1 on output.
+     * @param fds an array of three file descriptors.
+     *        Indexes 0, 1, and 2 correspond to standard input,
+     *        standard output and standard error, respectively.  On
+     *        input, a value of -1 means to create a pipe to connect
+     *        child and parent processes.  On output, a value which
+     *        is not -1 is the parent pipe fd corresponding to the
+     *        pipe which has been created.  An element of this array
+     *        is -1 on input if and only if it is <em>not</em> -1 on
+     *        output.
      * @return the pid of the subprocess
      */
     private native int forkAndExec(byte[] prog,
                                    byte[] argBlock, int argc,
                                    byte[] envBlock, int envc,
                                    byte[] dir,
-                                   int[] std_fds,
+                                   int[] fds,
                                    boolean redirectErrorStream)
         throws IOException;
 
-    /* In the process constructor we wait on this gate until the process    */
-    /* has been created. Then we return from the constructor.               */
-    /* fork() is called by the same thread which later waits for the process */
-    /* to terminate */
-
-    private static class Gate {
+    /**
+     * The thread factory used to create "process reaper" daemon threads.
+     */
+    private static class ProcessReaperThreadFactory implements ThreadFactory {
+        private final static ThreadGroup group = getRootThreadGroup();
 
-        private boolean exited = false;
-        private IOException savedException;
-
-        synchronized void exit() { /* Opens the gate */
-           exited = true;
-           this.notify();
+        private static ThreadGroup getRootThreadGroup() {
+            return AccessController.doPrivileged
+            (new PrivilegedAction<ThreadGroup> () {
+            public ThreadGroup run() {
+                ThreadGroup root = Thread.currentThread().getThreadGroup();
+                while (root.getParent() != null)
+                    root = root.getParent();
+                return root;
+            }});
         }
 
-        synchronized void waitForExit() { /* wait until the gate is open */
-            boolean interrupted = false;
-            while (!exited) {
-                try {
-                    this.wait();
-                } catch (InterruptedException e) {
-                    interrupted = true;
-                }
-            }
-            if (interrupted) {
-                Thread.currentThread().interrupt();
-            }
-        }
-
-        void setException (IOException e) {
-            savedException = e;
-        }
-
-        IOException getException() {
-            return savedException;
+        public Thread newThread(Runnable grimReaper) {
+            // Our thread stack requirement is quite modest.
+            Thread t = new Thread(group, grimReaper, "process reaper", 32768);
+            t.setDaemon(true);
+            // A small attempt (probably futile) to avoid priority inversion
+            t.setPriority(Thread.MAX_PRIORITY);
+            return t;
         }
     }
 
+    /**
+     * The thread pool of "process reaper" daemon threads.
+     */
+    private static final Executor processReaperExecutor
+        = Executors.newCachedThreadPool(new ProcessReaperThreadFactory());
+
     UNIXProcess(final byte[] prog,
                 final byte[] argBlock, final int argc,
                 final byte[] envBlock, final int envc,
                 final byte[] dir,
-                final int[] std_fds,
+                final int[] fds,
                 final boolean redirectErrorStream)
-    throws IOException {
+            throws IOException {
+
+        pid = forkAndExec(prog,
+                          argBlock, argc,
+                          envBlock, envc,
+                          dir,
+                          fds,
+                          redirectErrorStream);
 
-        final Gate gate = new Gate();
-        /*
-         * For each subprocess forked a corresponding reaper thread
-         * is started.  That thread is the only thread which waits
-         * for the subprocess to terminate and it doesn't hold any
-         * locks while doing so.  This design allows waitFor() and
-         * exitStatus() to be safely executed in parallel (and they
-         * need no native code).
-         */
+        try {
+            AccessController.doPrivileged
+            (new PrivilegedExceptionAction<Void>() {
+                public Void run() throws IOException {
+                    initStreams(fds);
+                    return null;
+                }});
+        } catch (PrivilegedActionException ex) {
+            throw (IOException) ex.getException();
+        }
+    }
+
+    static FileDescriptor newFileDescriptor(int fd) {
+        FileDescriptor fileDescriptor = new FileDescriptor();
+        fdAccess.set(fileDescriptor, fd);
+        return fileDescriptor;
+    }
 
-        java.security.AccessController.doPrivileged(
-        new java.security.PrivilegedAction<Void>() {
-        public Void run() {
-            Thread t = new Thread("process reaper") {
-                    public void run() {
-                        try {
-                            pid = forkAndExec(prog,
-                                              argBlock, argc,
-                                              envBlock, envc,
-                                              dir,
-                                              std_fds,
-                                              redirectErrorStream);
-                        } catch (IOException e) {
-                            gate.setException(e); /*remember to rethrow later*/
-                            gate.exit();
-                            return;
-                        }
-                        java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Void>() {
-                    public Void run() {
-                        if (std_fds[0] == -1)
-                            stdin_stream = new ProcessBuilder.NullOutputStream();
-                        else {
-                            FileDescriptor stdin_fd = new FileDescriptor();
-                            fdAccess.set(stdin_fd, std_fds[0]);
-                            stdin_stream = new BufferedOutputStream(
-                                new FileOutputStream(stdin_fd));
-                        }
+    void initStreams(int[] fds) throws IOException {
+        stdin = (fds[0] == -1) ?
+            ProcessBuilder.NullOutputStream.INSTANCE :
+            new ProcessPipeOutputStream(fds[0]);
+
+        stdout = (fds[1] == -1) ?
+            ProcessBuilder.NullInputStream.INSTANCE :
+            new ProcessPipeInputStream(fds[1]);
+
+        stderr = (fds[2] == -1) ?
+            ProcessBuilder.NullInputStream.INSTANCE :
+            new ProcessPipeInputStream(fds[2]);
 
-                        if (std_fds[1] == -1)
-                            stdout_stream = new ProcessBuilder.NullInputStream();
-                        else {
-                            FileDescriptor stdout_fd = new FileDescriptor();
-                            fdAccess.set(stdout_fd, std_fds[1]);
-                            stdout_stream = new BufferedInputStream(
-                                new FileInputStream(stdout_fd));
-                        }
-
-                        if (std_fds[2] == -1)
-                            stderr_stream = new ProcessBuilder.NullInputStream();
-                        else {
-                            FileDescriptor stderr_fd = new FileDescriptor();
-                            fdAccess.set(stderr_fd, std_fds[2]);
-                            stderr_stream = new FileInputStream(stderr_fd);
-                        }
+        processReaperExecutor.execute(new Runnable() {
+            public void run() {
+                int exitcode = waitForProcessExit(pid);
+                UNIXProcess.this.processExited(exitcode);
+            }});
+    }
 
-                        return null; }});
-                        gate.exit(); /* exit from constructor */
-                        int res = waitForProcessExit(pid);
-                        synchronized (UNIXProcess.this) {
-                            hasExited = true;
-                            exitcode = res;
-                            UNIXProcess.this.notifyAll();
-                        }
-                    }
-                };
-                t.setDaemon(true);
-                t.start();
-                return null; }});
-        gate.waitForExit();
-        IOException e = gate.getException();
-        if (e != null)
-            throw new IOException(e.toString());
+    synchronized void processExited(int exitcode) {
+        if (stdout instanceof ProcessPipeInputStream)
+            ((ProcessPipeInputStream) stdout).processExited();
+
+        if (stderr instanceof ProcessPipeInputStream)
+            ((ProcessPipeInputStream) stderr).processExited();
+
+        if (stdin instanceof ProcessPipeOutputStream)
+            ((ProcessPipeOutputStream) stdin).processExited();
+
+        this.exitcode = exitcode;
+        hasExited = true;
+        notifyAll();
     }
 
     public OutputStream getOutputStream() {
-        return stdin_stream;
+        return stdin;
     }
 
     public InputStream getInputStream() {
-        return stdout_stream;
+        return stdout;
     }
 
     public InputStream getErrorStream() {
-        return stderr_stream;
+        return stderr;
     }
 
     public synchronized int waitFor() throws InterruptedException {
@@ -228,13 +226,9 @@
             if (!hasExited)
                 destroyProcess(pid);
         }
-        try {
-            stdin_stream.close();
-            stdout_stream.close();
-            stderr_stream.close();
-        } catch (IOException e) {
-            // ignore
-        }
+        try { stdin.close();  } catch (IOException ignored) {}
+        try { stdout.close(); } catch (IOException ignored) {}
+        try { stderr.close(); } catch (IOException ignored) {}
     }
 
     /* This routine initializes JNI field offsets for the class */
@@ -243,4 +237,77 @@
     static {
         initIDs();
     }
+
+    /**
+     * A buffered input stream for a subprocess pipe file descriptor
+     * that allows the underlying file descriptor to be reclaimed when
+     * the process exits, via the processExited hook.
+     *
+     * This is tricky because we do not want the user-level InputStream to be
+     * closed until the user invokes close(), and we need to continue to be
+     * able to read any buffered data lingering in the OS pipe buffer.
+     */
+    static class ProcessPipeInputStream extends BufferedInputStream {
+        ProcessPipeInputStream(int fd) {
+            super(new FileInputStream(newFileDescriptor(fd)));
+        }
+
+        private static byte[] drainInputStream(InputStream in)
+                throws IOException {
+            if (in == null) return null;
+            int n = 0;
+            int j;
+            byte[] a = null;
+            while ((j = in.available()) > 0) {
+                a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
+                n += in.read(a, n, j);
+            }
+            return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
+        }
+
+        /** Called by the process reaper thread when the process exits. */
+        synchronized void processExited() {
+            // Most BufferedInputStream methods are synchronized, but close()
+            // is not, and so we have to handle concurrent racing close().
+            try {
+                InputStream in = this.in;
+                if (in != null) {
+                    byte[] stragglers = drainInputStream(in);
+                    in.close();
+                    this.in = (stragglers == null) ?
+                        ProcessBuilder.NullInputStream.INSTANCE :
+                        new ByteArrayInputStream(stragglers);
+                    if (buf == null) // asynchronous close()?
+                        this.in = null;
+                }
+            } catch (IOException ignored) {
+                // probably an asynchronous close().
+            }
+        }
+    }
+
+    /**
+     * A buffered output stream for a subprocess pipe file descriptor
+     * that allows the underlying file descriptor to be reclaimed when
+     * the process exits, via the processExited hook.
+     */
+    static class ProcessPipeOutputStream extends BufferedOutputStream {
+        ProcessPipeOutputStream(int fd) {
+            super(new FileOutputStream(newFileDescriptor(fd)));
+        }
+
+        /** Called by the process reaper thread when the process exits. */
+        synchronized void processExited() {
+            OutputStream out = this.out;
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (IOException ignored) {
+                    // We know of no reason to get an IOException, but if
+                    // we do, there's nothing else to do but carry on.
+                }
+                this.out = ProcessBuilder.NullOutputStream.INSTANCE;
+            }
+        }
+    }
 }
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris	Wed Jul 05 17:16:45 2017 +0200
@@ -86,7 +86,7 @@
         java.security.AccessController.doPrivileged(
         new java.security.PrivilegedAction<Void>() { public Void run() {
             if (std_fds[0] == -1)
-                stdin_stream = new ProcessBuilder.NullOutputStream();
+                stdin_stream = ProcessBuilder.NullOutputStream.INSTANCE;
             else {
                 FileDescriptor stdin_fd = new FileDescriptor();
                 fdAccess.set(stdin_fd, std_fds[0]);
@@ -95,7 +95,7 @@
             }
 
             if (std_fds[1] == -1)
-                stdout_stream = new ProcessBuilder.NullInputStream();
+                stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
             else {
                 FileDescriptor stdout_fd = new FileDescriptor();
                 fdAccess.set(stdout_fd, std_fds[1]);
@@ -104,7 +104,7 @@
             }
 
             if (std_fds[2] == -1)
-                stderr_stream = new ProcessBuilder.NullInputStream();
+                stderr_stream = ProcessBuilder.NullInputStream.INSTANCE;
             else {
                 FileDescriptor stderr_fd = new FileDescriptor();
                 fdAccess.set(stderr_fd, std_fds[2]);
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java	Wed Jul 05 17:16:45 2017 +0200
@@ -275,7 +275,7 @@
         Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(),
                                                           XToolkit.getDefaultRootWindow(),
                                                           new Point(0, 0));
-        return absoluteLoc.x;
+        return absoluteLoc != null ? absoluteLoc.x : 0;
     }
 
     public int getAbsoluteY()
@@ -283,7 +283,7 @@
         Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(),
                                                           XToolkit.getDefaultRootWindow(),
                                                           new Point(0, 0));
-        return absoluteLoc.y;
+        return absoluteLoc != null ? absoluteLoc.y : 0;
     }
 
     public int getWidth() {
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, 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
@@ -849,7 +849,7 @@
                     // if _NET_WM_STRUT_PARTIAL is present, we should use its values to detect
                     // if the struts area intersects with screenBounds, however some window
                     // managers don't set this hint correctly, so we just get intersection with windowBounds
-                    if (windowBounds.intersects(screenBounds))
+                    if (windowBounds != null && windowBounds.intersects(screenBounds))
                     {
                         insets.left = Math.max((int)Native.getLong(native_ptr, 0), insets.left);
                         insets.right = Math.max((int)Native.getLong(native_ptr, 1), insets.right);
@@ -1961,7 +1961,7 @@
     }
 
     static long reset_time_utc;
-    static final long WRAP_TIME_MILLIS = Integer.MAX_VALUE;
+    static final long WRAP_TIME_MILLIS = 0x00000000FFFFFFFFL;
 
     /*
      * This function converts between the X server time (number of milliseconds
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,5 @@
+# Jules Rendering Engine module
+sun.java2d.jules.JulesRenderingEngine
+
+#  Pisces Rendering Engine module
+sun.java2d.pisces.PiscesRenderingEngine
--- a/jdk/src/solaris/classes/sun/nio/cs/ext/COMPOUND_TEXT_Encoder.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/sun/nio/cs/ext/COMPOUND_TEXT_Encoder.java	Wed Jul 05 17:16:45 2017 +0200
@@ -43,8 +43,8 @@
      * cannot be used for actual encoding because they are shared across all
      * COMPOUND_TEXT encoders and may be stateful.
      */
-    private static final Map encodingToEncoderMap =
-        Collections.synchronizedMap(new HashMap(21, 1.0f));
+    private static final Map<String,CharsetEncoder> encodingToEncoderMap =
+      Collections.synchronizedMap(new HashMap<String,CharsetEncoder>(21, 1.0f));
     private static final CharsetEncoder latin1Encoder;
     private static final CharsetEncoder defaultEncoder;
     private static final boolean defaultEncodingSupported;
@@ -221,7 +221,7 @@
             out.put((byte)0x1B);
             out.put((byte)0x25);
             out.put((byte)0x2F);
-            out.put((byte)nonStandardBytes[3]);
+            out.put(nonStandardBytes[3]);
 
             int toWrite = Math.min(numBytes - nonStandardBytesOff,
                                    (1 << 14) - 1 - nonStandardEncodingLen);
@@ -313,12 +313,9 @@
         }
 
         // 4. Brute force search of all supported encodings.
-        for (Iterator iter = CompoundTextSupport.getEncodings().iterator();
-             iter.hasNext();)
+        for (String encoding : CompoundTextSupport.getEncodings())
         {
-            String encoding = (String)iter.next();
-            CharsetEncoder enc =
-                (CharsetEncoder)encodingToEncoderMap.get(encoding);
+            CharsetEncoder enc = encodingToEncoderMap.get(encoding);
             if (enc == null) {
                 enc = CompoundTextSupport.getEncoder(encoding);
                 if (enc == null) {
--- a/jdk/src/solaris/classes/sun/nio/cs/ext/CompoundTextSupport.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/sun/nio/cs/ext/CompoundTextSupport.java	Wed Jul 05 17:16:45 2017 +0200
@@ -130,13 +130,13 @@
     /**
      * Maps a GL or GR escape sequence to an encoding.
      */
-    private static final Map sequenceToEncodingMap;
+    private static final Map<ControlSequence, String> sequenceToEncodingMap;
 
     /**
      * Indicates whether a particular encoding wants the high bit turned on
      * or off.
      */
-    private static final Map highBitsMap;
+    private static final Map<ControlSequence, Boolean> highBitsMap;
 
     /**
      * Maps an encoding to an escape sequence. Rather than manage two
@@ -144,18 +144,21 @@
      * modify both GL and GR if necessary. This makes the output slightly less
      * efficient, but our code much simpler.
      */
-    private static final Map encodingToSequenceMap;
+    private static final Map<String, ControlSequence> encodingToSequenceMap;
 
     /**
      * The keys of 'encodingToSequenceMap', sorted in preferential order.
      */
-    private static final List encodings;
+    private static final List<String> encodings;
 
     static {
-        HashMap tSequenceToEncodingMap = new HashMap(33, 1.0f);
-        HashMap tHighBitsMap = new HashMap(31, 1.0f);
-        HashMap tEncodingToSequenceMap = new HashMap(21, 1.0f);
-        ArrayList tEncodings = new ArrayList(21);
+        HashMap<ControlSequence, String> tSequenceToEncodingMap =
+            new HashMap<>(33, 1.0f);
+        HashMap<ControlSequence, Boolean> tHighBitsMap =
+            new HashMap<>(31, 1.0f);
+        HashMap<String, ControlSequence> tEncodingToSequenceMap =
+            new HashMap<>(21, 1.0f);
+        ArrayList<String> tEncodings = new ArrayList<>(21);
 
         if (!(isEncodingSupported("US-ASCII") &&
               isEncodingSupported("ISO-8859-1")))
@@ -457,13 +460,12 @@
         return getNonStandardDecoder(escSequence, null);
     }
     static boolean getHighBit(byte[] escSequence) {
-        Boolean bool = (Boolean)highBitsMap.get
-            (new ControlSequence(escSequence));
+        Boolean bool = highBitsMap.get(new ControlSequence(escSequence));
         return (bool == Boolean.TRUE);
     }
     static CharsetDecoder getNonStandardDecoder(byte[] escSequence,
                                                        byte[] encoding) {
-        return getDecoder((String)sequenceToEncodingMap.get
+        return getDecoder(sequenceToEncodingMap.get
             (new ControlSequence(escSequence, encoding)));
     }
     static CharsetDecoder getDecoder(String enc) {
@@ -474,7 +476,7 @@
         try {
             cs = Charset.forName(enc);
         } catch (IllegalArgumentException e) {
-            Class cls;
+            Class<?> cls;
             try {
                 cls = Class.forName("sun.awt.motif." + enc);
             } catch (ClassNotFoundException ee) {
@@ -497,22 +499,20 @@
 
     // For Encoder
     static byte[] getEscapeSequence(String encoding) {
-        ControlSequence seq = (ControlSequence)
-            encodingToSequenceMap.get(encoding);
+        ControlSequence seq = encodingToSequenceMap.get(encoding);
         if (seq != null) {
             return seq.escSequence;
         }
         return null;
     }
     static byte[] getEncoding(String encoding) {
-        ControlSequence seq = (ControlSequence)
-            encodingToSequenceMap.get(encoding);
+        ControlSequence seq = encodingToSequenceMap.get(encoding);
         if (seq != null) {
             return seq.encoding;
         }
         return null;
     }
-    static List getEncodings() {
+    static List<String> getEncodings() {
         return encodings;
     }
     static CharsetEncoder getEncoder(String enc) {
@@ -523,7 +523,7 @@
         try {
             cs = Charset.forName(enc);
         } catch (IllegalArgumentException e) {
-            Class cls;
+            Class<?> cls;
             try {
                 cls = Class.forName("sun.awt.motif." + enc);
             } catch (ClassNotFoundException ee) {
--- a/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,6 +37,8 @@
  * Linux implementation of HotSpotVirtualMachine
  */
 public class LinuxVirtualMachine extends HotSpotVirtualMachine {
+    // temp directory for socket file
+    private static final String tmpdir = System.getProperty("java.io.tmpdir");
 
     // Indicates if this machine uses the old LinuxThreads
     static boolean isLinuxThreads;
@@ -260,7 +262,7 @@
 
     // Return the socket file for the given process.
     // Checks working directory of process for .java_pid<pid>. If not
-    // found it looks in /tmp.
+    // found it looks in temp directory.
     private String findSocketFile(int pid) {
         // First check for a .java_pid<pid> file in the working directory
         // of the target process
@@ -268,20 +270,17 @@
         String path = "/proc/" + pid + "/cwd/" + fn;
         File f = new File(path);
         if (!f.exists()) {
-            // Not found, so try /tmp
-            path = "/tmp/" + fn;
-            f = new File(path);
-            if (!f.exists()) {
-                return null;            // not found
-            }
+            // Not found, so try temp directory
+            f = new File(tmpdir, fn);
+            path = f.exists() ? f.getPath() : null;
         }
         return path;
     }
 
     // On Solaris/Linux a simple handshake is used to start the attach mechanism
     // if not already started. The client creates a .attach_pid<pid> file in the
-    // target VM's working directory (or /tmp), and the SIGQUIT handler checks
-    // for the file.
+    // target VM's working directory (or temp directory), and the SIGQUIT handler
+    // checks for the file.
     private File createAttachFile(int pid) throws IOException {
         String fn = ".attach_pid" + pid;
         String path = "/proc/" + pid + "/cwd/" + fn;
@@ -289,8 +288,7 @@
         try {
             f.createNewFile();
         } catch (IOException x) {
-            path = "/tmp/" + fn;
-            f = new File(path);
+            f = new File(tmpdir, fn);
             f.createNewFile();
         }
         return f;
--- a/jdk/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,6 +38,11 @@
  * Solaris implementation of HotSpotVirtualMachine.
  */
 public class SolarisVirtualMachine extends HotSpotVirtualMachine {
+    // Use /tmp instead of /var/tmp on Solaris as /tmp is the default used by
+    // HotSpot when the property is not set on the command line.
+    private static final String tmpdir1 = System.getProperty("java.io.tmpdir");
+    private static final String tmpdir =
+        (tmpdir1.equals("/var/tmp") || tmpdir1.equals("/var/tmp/")) ? "/tmp" : tmpdir1;
 
     // door descriptor;
     private int fd = -1;
@@ -187,7 +192,7 @@
     }
 
     // The door is attached to .java_pid<pid> in the target VM's working
-    // directory or /tmp.
+    // directory or temporary directory.
     private int openDoor(int pid) throws IOException {
         // First check for a .java_pid<pid> file in the working directory
         // of the target process
@@ -196,7 +201,7 @@
         try {
             fd = open(path);
         } catch (FileNotFoundException fnf) {
-            path = "/tmp/" + fn;
+            path = tmpdir + "/" + fn;
             fd = open(path);
         }
 
@@ -213,8 +218,8 @@
 
     // On Solaris/Linux a simple handshake is used to start the attach mechanism
     // if not already started. The client creates a .attach_pid<pid> file in the
-    // target VM's working directory (or /tmp), and the SIGQUIT handler checks
-    // for the file.
+    // target VM's working directory (or temporary directory), and the SIGQUIT
+    // handler checks for the file.
     private File createAttachFile(int pid) throws IOException {
         String fn = ".attach_pid" + pid;
         String path = "/proc/" + pid + "/cwd/" + fn;
@@ -222,8 +227,7 @@
         try {
             f.createNewFile();
         } catch (IOException x) {
-            path = "/tmp/" + fn;
-            f = new File(path);
+            f = new File(tmpdir, fn);
             f.createNewFile();
         }
         return f;
--- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Wed Jul 05 17:16:45 2017 +0200
@@ -52,11 +52,15 @@
 {
     if (dialog != NULL)
     {
+        fp_gdk_threads_enter();
+
         fp_gtk_widget_hide (dialog);
         fp_gtk_widget_destroy (dialog);
 
         fp_gtk_main_quit ();
         dialog = NULL;
+
+        fp_gdk_threads_leave();
     }
 }
 
@@ -162,7 +166,6 @@
         (*env)->GetJavaVM(env, &jvm);
     }
 
-    fp_gdk_threads_init();
     fp_gdk_threads_enter();
 
     const char *title = (*env)->GetStringUTFChars(env, jtitle, 0);
--- a/jdk/src/windows/classes/java/lang/ProcessImpl.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/windows/classes/java/lang/ProcessImpl.java	Wed Jul 05 17:16:45 2017 +0200
@@ -159,7 +159,7 @@
         new java.security.PrivilegedAction<Void>() {
         public Void run() {
             if (stdHandles[0] == -1L)
-                stdin_stream = new ProcessBuilder.NullOutputStream();
+                stdin_stream = ProcessBuilder.NullOutputStream.INSTANCE;
             else {
                 FileDescriptor stdin_fd = new FileDescriptor();
                 fdAccess.setHandle(stdin_fd, stdHandles[0]);
@@ -168,7 +168,7 @@
             }
 
             if (stdHandles[1] == -1L)
-                stdout_stream = new ProcessBuilder.NullInputStream();
+                stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
             else {
                 FileDescriptor stdout_fd = new FileDescriptor();
                 fdAccess.setHandle(stdout_fd, stdHandles[1]);
@@ -177,7 +177,7 @@
             }
 
             if (stdHandles[2] == -1L)
-                stderr_stream = new ProcessBuilder.NullInputStream();
+                stderr_stream = ProcessBuilder.NullInputStream.INSTANCE;
             else {
                 FileDescriptor stderr_fd = new FileDescriptor();
                 fdAccess.setHandle(stderr_fd, stdHandles[2]);
--- a/jdk/src/windows/native/sun/font/fontpath.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/windows/native/sun/font/fontpath.c	Wed Jul 05 17:16:45 2017 +0200
@@ -154,7 +154,7 @@
     fullname = JNU_NewStringPlatform(env, lpelfe->elfFullName);
     fullnameLC = (*env)->CallObjectMethod(env, fullname,
                                           fmi->toLowerCaseMID, fmi->locale);
-    (*env)->CallObjectMethod(env, fmi->list, fmi->addMID, fullname);
+    (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
     (*env)->CallObjectMethod(env, fmi->fontToFamilyMap,
                              fmi->putMID, fullnameLC, fmi->family);
     return 1;
@@ -238,7 +238,7 @@
                                  wcslen((LPWSTR)lpelfe->elfFullName));
     fullnameLC = (*env)->CallObjectMethod(env, fullname,
                                           fmi->toLowerCaseMID, fmi->locale);
-    (*env)->CallObjectMethod(env, fmi->list, fmi->addMID, fullname);
+    (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
     (*env)->CallObjectMethod(env, fmi->fontToFamilyMap,
                              fmi->putMID, fullnameLC, fmi->family);
     return 1;
--- a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c	Wed Jul 05 17:16:45 2017 +0200
@@ -120,6 +120,12 @@
     rv = connect((SOCKET)fd, (struct sockaddr *)&sa, sa_len);
     if (rv == SOCKET_ERROR) {
         handleSocketError(env, WSAGetLastError());
+    } else {
+        /* Disable WSAECONNRESET errors as socket is no longer connected */
+        BOOL enable = FALSE;
+        DWORD bytesReturned = 0;
+        WSAIoctl((SOCKET)fd, SIO_UDP_CONNRESET, &enable, sizeof(enable),
+                 NULL, 0, &bytesReturned, NULL, NULL);
     }
 }
 
--- a/jdk/src/windows/native/sun/nio/ch/Net.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/Net.c	Wed Jul 05 17:16:45 2017 +0200
@@ -67,6 +67,14 @@
 #define COPY_INET6_ADDRESS(env, source, target) \
     (*env)->GetByteArrayRegion(env, source, 0, 16, target)
 
+/**
+ * Enable or disable receipt of WSAECONNRESET errors.
+ */
+static void setConnectionReset(SOCKET s, BOOL enable) {
+    DWORD bytesReturned = 0;
+    WSAIoctl(s, SIO_UDP_CONNRESET, &enable, sizeof(enable),
+             NULL, 0, &bytesReturned, NULL, NULL);
+}
 
 
 JNIEXPORT void JNICALL
@@ -109,6 +117,12 @@
             setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
                        (const char *)&opt, sizeof(opt));
         }
+
+        /* Disable WSAECONNRESET errors for initially unconnected UDP sockets */
+        if (!stream) {
+            setConnectionReset(s, FALSE);
+        }
+
     } else {
         NET_ThrowNew(env, WSAGetLastError(), "socket");
     }
@@ -149,12 +163,13 @@
     SOCKETADDRESS sa;
     int rv;
     int sa_len;
+    SOCKET s = (SOCKET)fdval(env, fdo);
 
     if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) {
         return IOS_THROWN;
     }
 
-    rv = connect(fdval(env, fdo), (struct sockaddr *)&sa, sa_len);
+    rv = connect(s, (struct sockaddr *)&sa, sa_len);
     if (rv != 0) {
         int err = WSAGetLastError();
         if (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK) {
@@ -162,6 +177,13 @@
         }
         NET_ThrowNew(env, err, "connect");
         return IOS_THROWN;
+    } else {
+        /* Enable WSAECONNRESET errors when a UDP socket is connected */
+        int type = 0, optlen = sizeof(type);
+        rv = getsockopt(s, SOL_SOCKET, SO_TYPE, (char*)&type, &optlen);
+        if (rv == 0 && type == SOCK_DGRAM) {
+            setConnectionReset(s, TRUE);
+        }
     }
     return 1;
 }
--- a/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c	Wed Jul 05 17:16:45 2017 +0200
@@ -50,6 +50,10 @@
     jint fd = fdval(env, fdo);
     WSABUF buf;
 
+    /* limit size */
+    if (len > MAX_BUFFER_SIZE)
+        len = MAX_BUFFER_SIZE;
+
     /* destination buffer and size */
     buf.buf = (char *)address;
     buf.len = (u_long)len;
@@ -86,6 +90,7 @@
     jint fd = fdval(env, fdo);
     struct iovec *iovp = (struct iovec *)address;
     WSABUF *bufs = malloc(len * sizeof(WSABUF));
+    jint rem = MAX_BUFFER_SIZE;
 
     if (bufs == 0) {
         JNU_ThrowOutOfMemoryError(env, 0);
@@ -98,8 +103,16 @@
 
     /* copy iovec into WSABUF */
     for(i=0; i<len; i++) {
+        jint iov_len = iovp[i].iov_len;
+        if (iov_len > rem)
+            iov_len = rem;
         bufs[i].buf = (char *)iovp[i].iov_base;
-        bufs[i].len = (u_long)iovp[i].iov_len;
+        bufs[i].len = (u_long)iov_len;
+        rem -= iov_len;
+        if (rem == 0) {
+            len = i+1;
+            break;
+        }
     }
 
     /* read into the buffers */
@@ -136,6 +149,10 @@
     jint fd = fdval(env, fdo);
     WSABUF buf;
 
+    /* limit size */
+    if (len > MAX_BUFFER_SIZE)
+        len = MAX_BUFFER_SIZE;
+
     /* copy iovec into WSABUF */
     buf.buf = (char *)address;
     buf.len = (u_long)len;
@@ -171,6 +188,7 @@
     jint fd = fdval(env, fdo);
     struct iovec *iovp = (struct iovec *)address;
     WSABUF *bufs = malloc(len * sizeof(WSABUF));
+    jint rem = MAX_BUFFER_SIZE;
 
     if (bufs == 0) {
         JNU_ThrowOutOfMemoryError(env, 0);
@@ -183,8 +201,16 @@
 
     /* copy iovec into WSABUF */
     for(i=0; i<len; i++) {
+        jint iov_len = iovp[i].iov_len;
+        if (iov_len > rem)
+            iov_len = rem;
         bufs[i].buf = (char *)iovp[i].iov_base;
-        bufs[i].len = (u_long)iovp[i].iov_len;
+        bufs[i].len = (u_long)iov_len;
+        rem -= iov_len;
+        if (rem == 0) {
+            len = i+1;
+            break;
+        }
     }
 
     /* read into the buffers */
--- a/jdk/src/windows/native/sun/nio/ch/nio_util.h	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/nio_util.h	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,14 @@
 
 #include "jni.h"
 
+/**
+ * The maximum buffer size for WSASend/WSARecv. Microsoft recommendation for
+ * blocking operations is to use buffers no larger than 64k. We need the
+ * maximum to be less than 128k to support asynchronous close on Windows
+ * Server 2003 and newer editions of Windows.
+ */
+#define MAX_BUFFER_SIZE             ((128*1024)-1)
+
 jint fdval(JNIEnv *env, jobject fdo);
 jlong handleval(JNIEnv *env, jobject fdo);
 jboolean isNT();
--- a/jdk/test/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -307,7 +307,7 @@
     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
-    $(ECHO) "TEST STATS: run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
+    $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
       >> $(STATS_TXT); \
   else \
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
@@ -326,7 +326,7 @@
 # Prep for output
 prep: clean
 	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
-	@$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`
+	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
 
 # Cleanup
 clean:
@@ -376,7 +376,7 @@
 $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
 	@$(RM) $@ $@.temp1 $@.temp2
 	@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
-	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)'   ) ;\
+	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)'          ) ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)'  ) ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\
@@ -562,7 +562,7 @@
 JDK_ALL_TARGETS += jdk_tools2
 jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
 	$(call SharedLibraryPermissions,tools/launcher)
-	$(call RunOthervmBatch)
+	$(call RunSamevmBatch)
 
 # All tools tests
 jdk_tools: jdk_tools1 jdk_tools2
--- a/jdk/test/ProblemList.txt	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 17:16:45 2017 +0200
@@ -174,10 +174,6 @@
 java/beans/XMLEncoder/Test4625418.java				solaris-sparc
 
 # Problems with samevm and setting security manager (speculation partially)
-java/beans/Beans/Test4080522.java				generic-all
-java/beans/EventHandler/Test6277246.java			generic-all
-java/beans/EventHandler/Test6277266.java			generic-all
-java/beans/Introspector/Test6277246.java			generic-all
 java/beans/Introspector/4168475/Test4168475.java		generic-all
 java/beans/Introspector/4520754/Test4520754.java		generic-all
 java/beans/Introspector/6380849/TestBeanInfo.java		generic-all
@@ -191,229 +187,14 @@
 
 ############################################################################
 
-# jdk_io
-
-# Many of these tests have a tendency to leave input streams open, which
-#  will cause following tests to be failures when used in samevm mode.
-
-# Should be othervm, or corrected for samevm, fails with samevm:
-java/io/BufferedReader/BigMark.java			 	generic-all
-java/io/BufferedReader/ReadLineSync.java		 	generic-all
-
-# One of these is leaving "a.ser" file open, windows samevm
-java/io/Serializable/duplicateSerialFields/Setup.java		generic-all
-java/io/Serializable/duplicateSerialFields/Test.java		generic-all
-
-# One of these leaving foo.ser open, windows samevm problem
-java/io/Serializable/enum/constantSubclasses/Read.java		generic-all
-java/io/Serializable/enum/constantSubclasses/Write.java		generic-all
-java/io/Serializable/enum/missingConstant/Read.java		generic-all
-java/io/Serializable/enum/missingConstant/Write.java		generic-all
-
-# This is leaving subtest1.tmp open, windows samevm problem
-java/io/Serializable/oldTests/AnnotateClass.java		generic-all
-
-# One or more of these leave a piotest* file open, windows samevm
-java/io/Serializable/oldTests/ArrayFields.java			generic-all
-java/io/Serializable/oldTests/ArraysOfArrays.java		generic-all
-java/io/Serializable/oldTests/BinaryTree.java			generic-all
-java/io/Serializable/oldTests/CircularList.java			generic-all
-java/io/Serializable/oldTests/SerializeWithException.java	generic-all
-java/io/Serializable/oldTests/SimpleArrays.java			generic-all
-java/io/Serializable/oldTests/WritePrimitive.java		generic-all
-
-# Missing close on file 0.ser, windows samevm
-java/io/Serializable/enum/badResolve/Read.java			generic-all
-java/io/Serializable/enum/badResolve/Write.java			generic-all
-
-# One of these tests is leaving parents.ser open, windows samevm
-java/io/Serializable/parents/EvolvedClass.java			generic-all
-java/io/Serializable/parents/OriginalClass.java			generic-all
-
-# One of these tests is leaving file foo.ser and/or bar.ser open, windows samevm
-java/io/Serializable/fieldTypeString/Read.java			generic-all
-java/io/Serializable/fieldTypeString/Write.java			generic-all
-
-# One of these tests is leaving tmp.ser file open, windows samevm
-java/io/Serializable/ClassCastExceptionDetail/Read.java		generic-all
-java/io/Serializable/ClassCastExceptionDetail/Write.java	generic-all
-java/io/Serializable/GetField/Read.java				generic-all
-java/io/Serializable/GetField/Read2.java			generic-all
-java/io/Serializable/GetField/Write.java			generic-all
-java/io/Serializable/PutField/Read.java				generic-all
-java/io/Serializable/PutField/Read2.java			generic-all
-java/io/Serializable/PutField/Write.java			generic-all
-java/io/Serializable/PutField/Write2.java			generic-all
-java/io/Serializable/arraySuidConflict/Read.java		generic-all
-java/io/Serializable/arraySuidConflict/Write.java		generic-all
-java/io/Serializable/backRefCNFException/Read.java		generic-all
-java/io/Serializable/backRefCNFException/Write.java		generic-all
-java/io/Serializable/class/Test.java				generic-all
-java/io/Serializable/evolution/AddedExternField/ReadAddedField.java generic-all
-java/io/Serializable/evolution/AddedExternField/WriteAddedField.java generic-all
-java/io/Serializable/evolution/AddedExternField/run.sh		generic-all
-java/io/Serializable/evolution/AddedField/ReadAddedField.java	generic-all
-java/io/Serializable/evolution/AddedField/WriteAddedField.java	generic-all
-java/io/Serializable/evolution/AddedSuperClass/ReadAddedSuperClass.java	generic-all
-java/io/Serializable/evolution/AddedSuperClass/ReadAddedSuperClass2.java generic-all
-java/io/Serializable/evolution/AddedSuperClass/WriteAddedSuperClass.java generic-all
-java/io/Serializable/proxy/skipMissing/Read.java		generic-all
-java/io/Serializable/proxy/skipMissing/Write.java		generic-all
-java/io/Serializable/readObjectNoData/Read.java			generic-all
-java/io/Serializable/readObjectNoData/Write.java		generic-all
-java/io/Serializable/skipWriteObject/Read.java			generic-all
-java/io/Serializable/skipWriteObject/Write.java			generic-all
-java/io/Serializable/skippedObjCNFException/Read.java		generic-all
-java/io/Serializable/skippedObjCNFException/Write.java		generic-all
-java/io/Serializable/stopCustomDeserialization/Read.java	generic-all
-java/io/Serializable/stopCustomDeserialization/Write.java	generic-all
-java/io/Serializable/unresolvedClassDesc/Read.java		generic-all
-java/io/Serializable/unresolvedClassDesc/Write.java		generic-all
-java/io/Serializable/unshared/Read.java				generic-all
-java/io/Serializable/unshared/Write.java			generic-all
-java/io/Serializable/wrongReturnTypes/Read.java			generic-all
-java/io/Serializable/wrongReturnTypes/Write.java		generic-all
-
-# Windows samevm issues? triggers other tests to fail, missing close() on f.txt?
-java/io/DataInputStream/OpsAfterClose.java		 	generic-all
-
-# Windows 32bit samevm failure: RuntimeException: File.getFreeSpace() failed
-java/io/File/MaxPathLength.java					generic-all
-
-# Should be othervm, or corrected for samevm, fails with samevm:
-java/io/File/DeleteOnExit.java				 	generic-all
-java/io/File/DeleteOnExitLong.java			 	generic-all
-java/io/File/DeleteOnExitNPE.java			 	generic-all
-java/io/File/IsHidden.java				 	generic-all
-java/io/FileDescriptor/FileChannelFDTest.java		 	generic-all
-java/io/FileDescriptor/Finalize.java			 	generic-all
-java/io/FileInputStream/FinalizeShdCallClose.java	 	generic-all
-
-# Known to cause samevm issues on windows, other tests fail, missing close()?
-java/io/FileInputStream/OpsAfterClose.java		 	generic-all
-
-# Should be othervm, or corrected for samevm, fails with samevm:
-java/io/FileOutputStream/FinalizeShdCallClose.java	 	generic-all
-
-# Known to cause samevm issues on windows, other tests fail, missing close()?
-java/io/FileOutputStream/OpsAfterClose.java		 	generic-all
-
-# Windows samevm issues? triggers other tests to fail, missing close() on f.txt?
-java/io/InputStream/OpsAfterClose.java			 	generic-all
-
-# Missing close() on x.ReadBounds file? Windows samevm issues
-java/io/InputStream/ReadParams.java			 	generic-all
-
-# Known to cause samevm issues on windows, other tests fail, missing close()?
-java/io/InputStreamReader/GrowAfterEOF.java		 	generic-all
-
-# Should be othervm, or corrected for samevm, fails with samevm:
-java/io/ObjectInputStream/ResolveProxyClass.java	 	generic-all
-
-# Not doing a close() on x.ParameterCheck file? windows samevm cascade error
-java/io/RandomAccessFile/ParameterCheck.java                    generic-all
-
-# Not doing a close on x.ReadLine file? windows cascade samevm problems
-java/io/RandomAccessFile/ReadLine.java				generic-all
-
-# Not doing close on file input x.WriteByteChars, windows samevm problems
-java/io/RandomAccessFile/WriteBytesChars.java			generic-all
-
-# Not doing close on file input x.WriteUTF, windows samevm problems
-java/io/RandomAccessFile/WriteUTF.java                          generic-all
-
-# Possibly, not doing a close() on input.txt, windows samevm issues.
-java/io/RandomAccessFile/skipBytes/SkipBytes.java	 	generic-all
-java/io/readBytes/MemoryLeak.java			 	generic-all
-java/io/readBytes/ReadBytesBounds.java			 	generic-all 
-
-# Missing close on fields.ser, windows samevm
-java/io/Serializable/checkModifiers/CheckModifiers.java		generic-all
-
-# Should be othervm, or corrected for samevm, fails with samevm:
-java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java generic-all
-java/io/Serializable/proxy/Basic.java			 	generic-all
-
-# Possibly not doing a close() on input.txt, windows samevm issues.
-java/io/StreamTokenizer/Comment.java			 	generic-all
-
-############################################################################
-
 # jdk_lang
 
-# Some of these tests (like java/lang/management) may just need to be marked
-#   othervm, but that is partially speculation.
-
-# Samevm failure on OpenSolaris, security manager?
-java/lang/ClassLoader/UninitializedParent.java			generic-all
-
 # Times out on solaris 10 sparc
 java/lang/ClassLoader/Assert.java				generic-all
 
-# Fedora 9 X64, RuntimeException: MyThread expected to be blocked on lock, but got null
-java/lang/management/ThreadMXBean/ThreadStateTest.java 		generic-all
-
-# RuntimeException: Uptime of the JVM is more than 30 minutes (32 minutes).
-java/lang/management/RuntimeMXBean/UpTime.java			generic-all
-
 # Solaris sparc, samevm, java.lang.Exception: Read from closed pipe hangs
 java/lang/Runtime/exec/SleepyCat.java				generic-all
 
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/annotation/ParameterAnnotations.java			generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java	generic-all
-java/lang/ClassLoader/findSystemClass/Loader.java		generic-all
-
-# Fedora 9 32bit, -client, samevm, Error while cleaning up threads after test
-java/lang/management/ThreadMXBean/Locks.java			generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/management/ClassLoadingMXBean/LoadCounts.java		generic-all
-java/lang/management/ManagementFactory/MBeanServerMXBeanUnsupportedTest.java generic-all
-java/lang/management/ManagementFactory/MXBeanProxyTest.java	generic-all
-java/lang/management/ManagementFactory/ThreadMXBeanProxy.java	generic-all
-java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	generic-all
-java/lang/management/MemoryMXBean/GetMBeanInfo.java		generic-all
-java/lang/management/MemoryMXBean/LowMemoryTest.java		generic-all
-java/lang/management/MemoryMXBean/MemoryManagement.java		generic-all
-java/lang/management/MemoryMXBean/MemoryTest.java		generic-all
-java/lang/management/MemoryMXBean/Pending.java			generic-all
-
-# Problematic on all platforms (even as othervm)
-java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java 	generic-all
-
-# Causes jtreg exit samevm issues due to non-String object in system properties
-java/lang/management/RuntimeMXBean/GetSystemProperties.java 	generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/management/RuntimeMXBean/PropertiesTest.java		generic-all
-java/lang/management/ThreadMXBean/AllThreadIds.java		generic-all
-java/lang/management/ThreadMXBean/EnableTest.java		generic-all
-java/lang/management/ThreadMXBean/FindMonitorDeadlock.java	generic-all
-java/lang/management/ThreadMXBean/LockingThread.java		generic-all
-java/lang/management/ThreadMXBean/MonitorDeadlock.java		generic-all
-java/lang/management/ThreadMXBean/MyOwnSynchronizer.java	generic-all
-java/lang/management/ThreadMXBean/SharedSynchronizer.java	generic-all
-java/lang/management/ThreadMXBean/SynchronizerLockingThread.java generic-all
-java/lang/management/ThreadMXBean/ThreadCounts.java		generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/reflect/Proxy/Boxing.java				generic-all
-java/lang/reflect/Proxy/ClassRestrictions.java			generic-all
-java/lang/reflect/Proxy/returnTypes/Test.java			generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/lang/Runtime/exec/LotsOfOutput.java			generic-all
-java/lang/System/ExitFinalizersAndJIT.java			generic-all
-java/lang/System/finalization/FinThreads.java			generic-all
-java/lang/System/IgnoreNullSecurityManager.java			generic-all
-java/lang/Thread/GenerifyStackTraces.java			generic-all
-java/lang/Thread/StackTraces.java				generic-all
-java/lang/ThreadGroup/Daemon.java				generic-all
-java/lang/ThreadGroup/NullThreadName.java			generic-all
-
 # Times out on solaris sparc -server
 java/lang/ThreadLocal/MemoryLeak.java			 	solaris-all
 
@@ -427,18 +208,12 @@
 
 # jdk_management
 
+# Failing, bug was filed: 6959636
+javax/management/loading/LibraryLoader/LibraryLoaderTest.java	generic-all
+
 # Access denied messages on windows/mks, filed 6954450
 sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh	windows-all
 
-# Filed 6951284, fails on linux 64bit Fedora 9, peak thread count differences
-java/lang/management/ThreadMXBean/ResetPeakThreadCount.java	generic-all
-
-# Started failing on linux and solaris (filed 6950927)
-#   com.sun.tools.attach.AttachNotSupportedException:
-#     Unable to open socket file:
-#     target process not responding or HotSpot VM not loaded
-sun/management/jmxremote/bootstrap/JvmstatCountersTest.java	generic-all
-
 # Fails on linux: KO: StringMonitor notification missed or not emitted
 javax/management/monitor/NonComparableAttributeValueTest.java	generic-all
 
@@ -737,9 +512,6 @@
 # Suspect many of these tests auffer from using fixed ports, no concrete 
 #   evidence.
 
-# Failing on Solaris x86 and Linux x86, filed 6934585
-java/nio/channels/AsynchronousSocketChannel/Basic.java		generic-all
-
 # Occasionally Failing with java.lang.AssertionError on Windows X64
 #  at sun.nio.ch.PendingIoCache.clearPendingIoMap(PendingIoCache.java:144)
 #java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java	windows-all
@@ -751,26 +523,6 @@
 com/sun/nio/sctp/SctpChannel/Send.java				generic-all
 com/sun/nio/sctp/SctpChannel/Shutdown.java			generic-all
 
-# Fails on Windows 2000, Can't delete test directory .\x.SetLastModified.dir
-#    at SetLastModified.main(SetLastModified.java:107)
-java/io/File/SetLastModified.java                               generic-all
-
-# Fails on Solaris 10 x64, address already in use
-java/nio/channels/DatagramChannel/SRTest.java			generic-all
-
-# Fails on Solaris 10 x86, times out
-java/nio/channels/DatagramChannel/Sender.java			generic-all
-
-# Fails on Fedora 9 x86, address in use
-java/nio/channels/Selector/SelectWrite.java			generic-all
-
-# Fails on Fedora 9 32bit times out
-java/nio/channels/DatagramChannel/EmptyBuffer.java		generic-all
-
-# Fails on Windows 2000, ExceptionInInitializerError
-#   in WindowsAsynchronousServerSocketChannelImpl.java:316
-java/nio/channels/AsynchronousChannelGroup/Unbounded.java	generic-all
-
 # Fails on Windows 2000,  times out
 java/nio/channels/FileChannel/Transfer.java			generic-all
 
@@ -784,9 +536,6 @@
 # Triggers a hotspot crash on Fedora 9 32bit -server and Windows X64  samevm
 sun/nio/cs/TestUTF8.java					generic-all
 
-# Solaris sparc, socket timeout
-java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh generic-all
-
 # Runtime exception on windows X64, samevm mode
 java/nio/channels/Selector/WakeupNow.java			generic-all
 
@@ -809,14 +558,12 @@
 # Linux 64bit failures. too many files open
 java/nio/channels/Selector/HelperSlowToDie.java			generic-all
 
-# Timeouts etc. on Window
-java/nio/channels/AsyncCloseAndInterrupt.java		 	windows-all
-
-# Gets java.lang.ExceptionInInitializerError on windows: (Windows 2000 only?)
+# Gets java.lang.ExceptionInInitializerError on Windows 2000 (need XP or newer)
 java/nio/channels/AsynchronousChannelGroup/Basic.java	 	windows-5.0
 java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java 	windows-5.0
 java/nio/channels/AsynchronousChannelGroup/Identity.java 	windows-5.0
 java/nio/channels/AsynchronousChannelGroup/Restart.java 	windows-5.0
+java/nio/channels/AsynchronousChannelGroup/Unbounded.java	windows-5.0
 java/nio/channels/AsynchronousDatagramChannel/Basic.java 	windows-5.0
 java/nio/channels/AsynchronousFileChannel/Lock.java	 	windows-5.0
 java/nio/channels/AsynchronousServerSocketChannel/Basic.java 	windows-5.0
@@ -827,19 +574,10 @@
 java/nio/channels/AsynchronousSocketChannel/StressLoopback.java windows-5.0
 java/nio/channels/Channels/Basic2.java			 	windows-5.0
 
-# Solaris sparc timeout
-java/nio/channels/DatagramChannel/Connect.java		 	generic-all
-
-# Solaris i586 timeouts
-java/nio/channels/DatagramChannel/EmptyBuffer.java	 	solaris-all
-
 # Failed loopback connection? On windows 32bit? 
 #   Considered a stress test, can consume all resources.
 java/nio/channels/Selector/LotsOfChannels.java		 	generic-all
 
-# Solaris sparcv9, just fails with exception
-java/nio/channels/Selector/OpRead.java			 	solaris-sparc
-
 # Windows i586 client, crashed hotspot? Unpredictable
 #   Considered a stress test, can consume all resources.
 java/nio/channels/Selector/RegAfterPreClose.java	 	generic-all
@@ -854,18 +592,6 @@
 java/nio/channels/SocketChannel/ConnectState.java	 	windows-all
 java/nio/channels/SocketChannel/FinishConnect.java	 	windows-all
 
-# Need to be marked othervm, or changed to be samevm safe
-java/nio/channels/SocketChannel/OpenLeak.java			generic-all
-
-# Gets java.net.BindException alot (static port number?)
-java/nio/channels/SocketChannel/VectorIO.java		 	generic-all
-
-# Solaris i586 java.net.BindExceptions
-java/nio/channels/SocketChannel/VectorParams.java	 	solaris-all
-
-# Linux i586 address already in use, samevm issues
-java/nio/channels/SocketChannel/Write.java		 	generic-all
-
 # Fails on all platforms due to overlap of JDK jar file contents:
 sun/nio/cs/Test4200310.sh				 	generic-all
 
@@ -1142,97 +868,6 @@
 
 # jdk_tools
 
-# Filed bug 6951287, failed on Linux 64bit, sometimes?
-com/sun/jdi/PopAndInvokeTest.java				generic-all
-
-# Some of the tools tests kind of require "othervm" or if they don't will
-#  always be firing up another VM anyway due to the nature of tools testing.
-#  So most if not all tools tests are now being run with "othervm" mode.
-#  Some of these tools tests have a tendency to use fixed ports, bad idea.
-
-# Fails with -ea -esa on Solaris, Assertion error (Solaris specific test)
-com/sun/tracing/BasicFunctionality.java				generic-all
-
-# Fails on Fedora 9 32bit, jps output differs problem
-sun/tools/jstatd/jstatdDefaults.sh				generic-all
-
-# Fails on Linux Fedora 9 32bit, Could not read data for remote JVM 16133
-#       jstat output differs from expected output
-sun/tools/jstatd/jstatdExternalRegistry.sh			generic-all
-
-# Output of jps differs from expected output.
-#   Invalid argument count on solaris-sparc and x64
-sun/tools/jstatd/jstatdPort.sh					generic-all
-
-# othervm mode, Could not synchronize with target
-sun/tools/jps/jps-l_1.sh					generic-all
-sun/tools/jps/jps-l_2.sh					generic-all
-sun/tools/jps/jps-lm.sh						generic-all
-sun/tools/jps/jps-Vvml_2.sh					generic-all
-sun/tools/jps/jps-m_2.sh					generic-all
-
-# Fails on Solaris 10 sparcv9, shell exits with 1
-#  Turning off use of shared archive because of choice of garbage collector or large pages 
-#  Could not synchronize with target
-sun/tools/jps/jps-v_1.sh					generic-all
-
-# Fails on OpenSolaris "Could not synchronize with target"
-sun/tools/jps/jps-Defaults.sh					generic-all
-sun/tools/jps/jps-V_2.sh					generic-all
-sun/tools/jps/jps-Vm_2.sh					generic-all
-sun/tools/jps/jps-Vvm.sh					generic-all
-sun/tools/jps/jps-Vvml.sh					generic-all
-sun/tools/jps/jps-m.sh						generic-all
-
-# Server name error, port 2098 problem?
-sun/tools/jstatd/jstatdServerName.sh				generic-all
-
-# These tests fail on solaris sparc, all the time
-com/sun/servicetag/DeleteServiceTag.java			generic-all
-com/sun/servicetag/DuplicateNotFound.java			generic-all
-com/sun/servicetag/FindServiceTags.java				generic-all
-com/sun/servicetag/InstanceUrnCheck.java			generic-all
-com/sun/servicetag/InvalidRegistrationData.java			generic-all
-com/sun/servicetag/InvalidServiceTag.java			generic-all
-com/sun/servicetag/JavaServiceTagTest.java			generic-all
-com/sun/servicetag/JavaServiceTagTest1.java			generic-all
-com/sun/servicetag/NewRegistrationData.java			generic-all
-com/sun/servicetag/SystemRegistryTest.java			generic-all
-com/sun/servicetag/TestLoadFromXML.java				generic-all
-com/sun/servicetag/UpdateServiceTagTest.java			generic-all
-com/sun/servicetag/ValidRegistrationData.java			generic-all
-
-# Problems on windows, jmap.exe hangs?
-com/sun/tools/attach/BasicTests.sh				windows-all
-
-# Fails on Solaris 10 sparc, in othervm mode, throws unexpected exception
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java			generic-all
-
-# Unexpected Monitor Exception, solaris sparc -client
-sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh	generic-all
-
-# Problems on windows, jmap.exe hangs? (these run jmap)
-sun/tools/jmap/Basic.sh						windows-all
-
-# Invalid argument count on solaris-sparc and x64
-sun/tools/jstatd/jstatdDefaults.sh			 	solaris-all
-
-# Solaris sparcv9, jps output does not match, x64 different
-sun/tools/jstatd/jstatdExternalRegistry.sh		 	solaris-all
-
-# Solaris 10 sparc 32bit -client, java.lang.AssertionError: Some tests failed
-tools/jar/JarEntryTime.java					generic-all
-
-# Times out on sparc?
-tools/launcher/VersionCheck.java				generic-all
-
-# These tests fail on solaris sparc, all the time
-tools/jar/ChangeDir.java					generic-all
-
-# Cannot write jar
-#  Also, possible problems on windows, jmap.exe hangs? 
-tools/jar/index/MetaInf.java				 	windows-all
-
 ############################################################################
 
 # jdk_util
@@ -1241,12 +876,6 @@
 #   11 separate stacktraces created... file reuse problem?
 java/util/zip/ZipFile/ReadLongZipFileName.java			generic-all
 
-# Recent failure on all platforms
-sun/util/resources/TimeZone/Bug6317929.java			generic-all
-
-# Fails with -ea -esa on all platforms with Assertion error
-java/util/ResourceBundle/Test4300693.java			generic-all
-
 # Failing on all -client 32bit platforms starting with b77? See 6908348.
 java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java generic-all
 
@@ -1274,39 +903,7 @@
 java/util/Formatter/Constructors.java				generic-all
 
 # Need to be marked othervm, or changed to be samevm safe
-java/util/Locale/Bug4175998Test.java				generic-all
-java/util/Locale/Bug4184873Test.java				generic-all
-java/util/Locale/LocaleTest.java				generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/util/logging/GetGlobalTest.java				generic-all
-java/util/logging/LoggerSubclass.java				generic-all
-java/util/logging/LoggingDeadlock.java				generic-all
-java/util/logging/LoggingDeadlock2.java 			generic-all
-java/util/logging/LoggingMXBeanTest.java			generic-all
-java/util/logging/LoggingMXBeanTest2.java			generic-all
-java/util/logging/LoggingNIOChange.java 			generic-all
-java/util/logging/ParentLoggersTest.java			generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
-java/util/ResourceBundle/Bug4168625Test.java			generic-all
-java/util/ResourceBundle/Bug6359330.java			generic-all
-java/util/ResourceBundle/TestBug4179766.java			generic-all
-
-# Need to be marked othervm, or changed to be samevm safe
 java/util/WeakHashMap/GCDuringIteration.java			generic-all
 
-# Possible missing input stream close()? Causes samevm issues on windows
-java/util/zip/InfoZip.java				 	generic-all
-
-# Missing a close() on file Test0.zip? windows samevm cascade problem
-java/util/zip/ZipFile/Comment.java                              generic-all
-
-# Suspect missing close() on bad*.zip files, windows cascade errors with samevm
-java/util/zip/ZipFile/CorruptedZipFiles.java			generic-all
-
-# Should be samevm but causes problems with samevm, no details:
-java/util/zip/ZipFile/ManyEntries.java			 	generic-all
-
 ############################################################################
 
--- a/jdk/test/com/sun/jdi/PopAndInvokeTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/jdi/PopAndInvokeTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -24,6 +24,7 @@
 /**
  *  @test
  *  @bug 6517249
+ *  @ignore 6951287
  *  @summary JDWP: Cannot do an invokeMethod after a popFrames operation
  *
  *  @author jjh
--- a/jdk/test/com/sun/servicetag/FindServiceTags.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/servicetag/FindServiceTags.java	Wed Jul 05 17:16:45 2017 +0200
@@ -56,8 +56,17 @@
     private static int expectedUrnCount = 3;
 
     public static void main(String[] argv) throws Exception {
-        registry = Util.getSvcTagClientRegistry();
+        try {
+            registry = Util.getSvcTagClientRegistry();
+            runTest();
+        } finally {
+            // restore empty registry file
+            Util.emptyRegistryFile();
+        }
+        System.out.println("Test passed.");
+    }
 
+    public static void runTest() throws Exception {
         for (String filename : files) {
             File f = new File(servicetagDir, filename);
             ServiceTag svcTag = Util.newServiceTag(f);
@@ -95,7 +104,6 @@
                 tags.size());
         }
 
-        System.out.println("Test passed.");
     }
 
     private static void findServiceTags(String productUrn) throws Exception {
--- a/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java	Wed Jul 05 17:16:45 2017 +0200
@@ -31,7 +31,7 @@
  *          are both created correctly.
  * @author  Mandy Chung
  *
- * @run build JavaServiceTagTest1
+ * @run build JavaServiceTagTest1 SvcTagClient Util
  * @run main JavaServiceTagTest1
  */
 
@@ -46,6 +46,16 @@
     private static File svcTagFile;
     private static Registry registry;
     public static void main(String[] argv) throws Exception {
+        try {
+            registry = Util.getSvcTagClientRegistry();
+            runTest();
+        } finally {
+            // restore empty registry file
+            Util.emptyRegistryFile();
+        }
+    }
+
+    private static void runTest() throws Exception {
         // cleanup the registration.xml and servicetag file in the test directory
         System.setProperty("servicetag.dir.path", registrationDir);
         regFile = new File(registrationDir, "registration.xml");
@@ -54,8 +64,6 @@
         svcTagFile = new File(registrationDir, "servicetag");
         svcTagFile.delete();
 
-        registry = Util.getSvcTagClientRegistry();
-
         // verify that only one service tag is created
         ServiceTag st1 = testJavaServiceTag("Test1");
 
--- a/jdk/test/com/sun/servicetag/SystemRegistryTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/servicetag/SystemRegistryTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -50,8 +50,16 @@
 
     private static Registry registry;
     public static void main(String[] argv) throws Exception {
-        registry = Util.getSvcTagClientRegistry();
+        try {
+            registry = Util.getSvcTagClientRegistry();
+            runTest();
+        } finally {
+            // restore empty registry file
+            Util.emptyRegistryFile();
+        }
+    }
 
+    private static void runTest() throws Exception {
         for (String filename : files) {
             File f = new File(servicetagDir, filename);
             ServiceTag svcTag = Util.newServiceTag(f);
--- a/jdk/test/com/sun/servicetag/Util.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/servicetag/Util.java	Wed Jul 05 17:16:45 2017 +0200
@@ -219,25 +219,25 @@
     }
 
     private static Registry registry = null;
+    private static File registryFile = null;
     /**
      * Returns the Registry processed by SvcTagClient that simulates
      * stclient.
      */
     static synchronized Registry getSvcTagClientRegistry() throws IOException {
+        String regDir = System.getProperty("test.classes");
+        File f = new File(regDir, "registry.xml");
         if (registry != null) {
+            if (!f.equals(registryFile) && f.length() != 0) {
+                throw new AssertionError("Has to be empty registry.xml to run in samevm");
+            }
             return registry;
         }
 
         // System.setProperty("servicetag.verbose", "true");
         // enable the helper class
         System.setProperty("servicetag.sthelper.supported", "true");
-
-        // clean up registry.xml
-        String regDir = System.getProperty("test.classes");
-        File registryFile = new File(regDir, "registry.xml");
-        if (registryFile.exists()) {
-            registryFile.delete();
-        }
+        registryFile = f;
 
         String stclientCmd = Util.getSvcClientCommand(registryFile.getCanonicalPath());
         System.out.println("stclient cmd: " + stclientCmd);
@@ -247,4 +247,17 @@
         registry = Registry.getSystemRegistry();
         return registry;
     }
+
+    static void emptyRegistryFile() throws IOException {
+        if (registryFile.exists()) {
+            BufferedOutputStream out = new BufferedOutputStream(
+                new FileOutputStream(registryFile));
+            try {
+                RegistrationData data = new RegistrationData();
+                data.storeToXML(out);
+            } finally {
+                out.close();
+            }
+        }
+    }
 }
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -37,6 +37,21 @@
   exit 1
 fi
 
+# Windows 2000 is a problem here, so we skip it, see 6962615
+osrev=`uname -a`
+if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then
+  if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then
+     echo "Treating as a pass, not testing Windows 2000"
+     exit 0
+  fi
+fi
+if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
+  if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
+     echo "Treating as a pass, not testing Windows 2000"
+     exit 0
+  fi
+fi
+
 . ${TESTSRC}/CommonSetup.sh
 . ${TESTSRC}/ApplicationSetup.sh
 . ${TESTSRC}/AgentSetup.sh
--- a/jdk/test/com/sun/tracing/BasicFunctionality.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/com/sun/tracing/BasicFunctionality.java	Wed Jul 05 17:16:45 2017 +0200
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 6537506
+ * @ignore 6962535
  * @summary Basic unit test for tracing framework
  */
 
--- a/jdk/test/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -83,6 +83,12 @@
         if (fd == null) {
             throw new RuntimeException("fd is null (very unexpected thing :(");
         }
+        //Wait a little; some native dialog implementations may take a while
+        //to initialize and call the filter. See 6959787 for an example.
+        try {
+            Thread.sleep(5000);
+        } catch (Exception ex) {
+        }
         fd.dispose();
         if (!filter_was_called) {
             throw new RuntimeException("Filter was not called");
--- a/jdk/test/java/beans/Beans/Test4080522.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/beans/Beans/Test4080522.java	Wed Jul 05 17:16:45 2017 +0200
@@ -29,6 +29,7 @@
  *          Beans.setGuiAvailable
  *          Introspector.setBeanInfoSearchPath
  *          PropertyEditorManager.setEditorSearchPath
+ * @run main/othervm Test4080522
  * @author Graham Hamilton
  */
 
--- a/jdk/test/java/beans/EventHandler/Test6277246.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/beans/EventHandler/Test6277246.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,7 @@
  * @test
  * @bug 6277246
  * @summary Tests problem with java.beans use of reflection
+ * @run main/othervm Test6277246
  * @author Jeff Nisewanger
  */
 
--- a/jdk/test/java/beans/EventHandler/Test6277266.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/beans/EventHandler/Test6277266.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,7 @@
  * @test
  * @bug 6277266
  * @summary Tests access control issue in EventHandler
+ * @run main/othervm Test6277266
  * @author Jeff Nisewanger
  */
 
--- a/jdk/test/java/beans/Introspector/Test6277246.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/beans/Introspector/Test6277246.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,7 @@
  * @test
  * @bug 6277246
  * @summary Tests problem with java.beans use of reflection
+ * @run main/othervm Test6277246
  * @author Jeff Nisewanger
  */
 
--- a/jdk/test/java/io/BufferedReader/BigMark.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/BufferedReader/BigMark.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,8 @@
    @summary BufferedReader should throw an OutOfMemoryError when the
             read-ahead limit is very large
    @bug 6350733
+   @build BigMark
+   @run main/othervm BigMark
 */
 
 import java.io.*;
--- a/jdk/test/java/io/BufferedReader/ReadLineSync.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/BufferedReader/ReadLineSync.java	Wed Jul 05 17:16:45 2017 +0200
@@ -46,16 +46,20 @@
 
         BufferedReader reader = new BufferedReader(
                                 new FileReader(f));
-        int threadCount = 2;
+        try {
+            int threadCount = 2;
 
-        ExecutorService es = Executors.newFixedThreadPool(threadCount);
+            ExecutorService es = Executors.newFixedThreadPool(threadCount);
 
-        for (int i=0; i < threadCount; i++)
-            es.execute(new BufferedReaderConsumer(reader));
+            for (int i=0; i < threadCount; i++)
+                es.execute(new BufferedReaderConsumer(reader));
 
-        // Wait for the tasks to complete
-        es.shutdown();
-        while (!es.awaitTermination(60, TimeUnit.SECONDS));
+            // Wait for the tasks to complete
+            es.shutdown();
+            while (!es.awaitTermination(60, TimeUnit.SECONDS));
+        } finally {
+            reader.close();
+        }
     }
 
     static class BufferedReaderConsumer extends Thread {
--- a/jdk/test/java/io/DataInputStream/OpsAfterClose.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/DataInputStream/OpsAfterClose.java	Wed Jul 05 17:16:45 2017 +0200
@@ -244,13 +244,19 @@
         f.deleteOnExit();
 
         FileInputStream fis = new FileInputStream(f);
-
-        DataInputStream dis = new DataInputStream(
-                                new FileInputStream(f));
-        if (testDataInputStream(dis)) {
-            failed = true;
+        try {
+            DataInputStream dis = new DataInputStream(
+                                    new FileInputStream(f));
+            try {
+                if (testDataInputStream(dis)) {
+                    failed = true;
+                }
+            } finally {
+                dis.close();
+            }
+        } finally {
+            fis.close();
         }
-
     }
 
     private static boolean testDataInputStream(DataInputStream is)
--- a/jdk/test/java/io/DataInputStream/ReadFully.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/DataInputStream/ReadFully.java	Wed Jul 05 17:16:45 2017 +0200
@@ -43,6 +43,7 @@
         } catch (IndexOutOfBoundsException ie) {
             caughtException = true;
         } finally {
+            dis.close();
             if (!caughtException)
                 throw new RuntimeException("Test failed");
         }
--- a/jdk/test/java/io/File/DeleteOnExit.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/File/DeleteOnExit.java	Wed Jul 05 17:16:45 2017 +0200
@@ -48,7 +48,9 @@
 
     public static void main (String args[]) throws Exception{
         if (args.length == 0) {
-            Runtime.getRuntime().exec(java +  " DeleteOnExit -test").waitFor();
+            String cmd = java + " -classpath " + System.getProperty("test.classes")
+                + " DeleteOnExit -test";
+            Runtime.getRuntime().exec(cmd).waitFor();
             if (file1.exists() || file2.exists() || file3.exists() ||
                 dir.exists()   || file4.exists() || file5.exists() ||
                 file6.exists() || file7.exists())  {
--- a/jdk/test/java/io/File/DeleteOnExitNPE.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/File/DeleteOnExitNPE.java	Wed Jul 05 17:16:45 2017 +0200
@@ -45,7 +45,8 @@
 
     public static void runTest() throws Exception {
         String cmd = System.getProperty("java.home") + File.separator +
-                     "bin" + File.separator + "java";
+                     "bin" + File.separator + "java" +
+                     " -classpath " + System.getProperty("test.classes");
         Process process = Runtime.getRuntime().exec(cmd +  " DeleteOnExitNPE -test");
         BufferedReader isReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
         BufferedReader esReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
--- a/jdk/test/java/io/File/IsHidden.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/File/IsHidden.java	Wed Jul 05 17:16:45 2017 +0200
@@ -27,7 +27,7 @@
  */
 
 import java.io.*;
-
+import java.nio.file.attribute.DosFileAttributeView;
 
 public class IsHidden {
 
@@ -41,15 +41,20 @@
         System.err.println(path + " ==> " + x);
     }
 
+    private static void setHidden(File f, boolean value) throws IOException {
+        f.toPath().getFileAttributeView(DosFileAttributeView.class).setHidden(value);
+    }
+
     private static void testWin32() throws Exception {
         File f = new File(dir, "test");
         f.deleteOnExit();
         f.createNewFile();
-        String name = f.getCanonicalPath();
-        Process p = Runtime.getRuntime().exec("cmd.exe /c attrib +H " + name);
-        p.waitFor();
-        ck(name, true);
-
+        setHidden(f, true);
+        try {
+            ck(f.getPath(), true);
+        } finally {
+            setHidden(f, false);
+        }
         ck(".foo", false);
         ck("foo", false);
     }
--- a/jdk/test/java/io/FileInputStream/LeadingSlash.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/FileInputStream/LeadingSlash.java	Wed Jul 05 17:16:45 2017 +0200
@@ -36,8 +36,8 @@
             File file = null;
             try {
                 file = File.createTempFile("bug", "4487368");
-                new FileInputStream("\\" + file.getPath());
-                new FileOutputStream("\\" + file.getPath());
+                new FileInputStream("\\" + file.getPath()).close();
+                new FileOutputStream("\\" + file.getPath()).close();
             } finally {
                 if (file != null)
                     file.delete();
--- a/jdk/test/java/io/InputStream/OpsAfterClose.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/InputStream/OpsAfterClose.java	Wed Jul 05 17:16:45 2017 +0200
@@ -125,23 +125,35 @@
         f.deleteOnExit();
 
         FileInputStream fis = new FileInputStream(f);
-        if (testInputStream(fis)) {
-            failed = true;
-        }
-        if (testFileInputStream(fis)) {
-            failed = true;
+        try {
+            if (testInputStream(fis)) {
+                failed = true;
+            }
+            if (testFileInputStream(fis)) {
+                failed = true;
+            }
+        } finally {
+            fis.close();
         }
 
         BufferedInputStream bs =  new BufferedInputStream(
                                         new FileInputStream(f));
-        if (testInputStream(bs)) {
-            failed = true;
+        try {
+            if (testInputStream(bs)) {
+                failed = true;
+            }
+        } finally {
+            bs.close();
         }
 
         DataInputStream dis = new DataInputStream(
                                 new FileInputStream(f));
-        if (testInputStream(dis)) {
-            failed = true;
+        try {
+            if (testInputStream(dis)) {
+                failed = true;
+            }
+        } finally {
+            dis.close();
         }
 
         PushbackInputStream pbis = new PushbackInputStream(
--- a/jdk/test/java/io/InputStream/ReadParams.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/InputStream/ReadParams.java	Wed Jul 05 17:16:45 2017 +0200
@@ -137,6 +137,7 @@
         oos.writeInt(12345);
         oos.writeObject("Today");
         oos.writeObject(new Integer(32));
+        oos.close();
         ObjectInputStream ois = new ObjectInputStream(new FileInputStream(fn));
         doTest(ois);
         doTest1(ois);
--- a/jdk/test/java/io/InputStreamReader/GrowAfterEOF.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/InputStreamReader/GrowAfterEOF.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,29 +33,36 @@
     public static void main(String[] args) throws Exception {
         File input = new File(".", "TestEOFInput.txt");
         RandomAccessFile rf = new RandomAccessFile(input, "rw");
-        BufferedReader r = new BufferedReader
-            (new InputStreamReader(new FileInputStream(input)));
+        try {
+            BufferedReader r = new BufferedReader
+                (new InputStreamReader(new FileInputStream(input)));
+            try {
+                // write something
+                rf.writeBytes("a line");
 
-        // write something
-        rf.writeBytes("a line");
+                // read till the end of file
+                while (r.readLine() != null);
 
-        // read till the end of file
-        while (r.readLine() != null);
+                // append to the end of the file
+                rf.seek(rf.length());
+                rf.writeBytes("new line");
 
-        // append to the end of the file
-        rf.seek(rf.length());
-        rf.writeBytes("new line");
-
-        // now try to read again
-        boolean readMore = false;
-        while (r.readLine() != null) {
-            readMore = true;
-        }
-        if (!readMore) {
-            input.delete();
-            throw new Exception("Failed test: unable to read!");
-        } else {
-            input.delete();
+                // now try to read again
+                boolean readMore = false;
+                while (r.readLine() != null) {
+                    readMore = true;
+                }
+                if (!readMore) {
+                    input.delete();
+                    throw new Exception("Failed test: unable to read!");
+                } else {
+                    input.delete();
+                }
+            } finally {
+                r.close();
+            }
+        } finally {
+            rf.close();
         }
     }
 }
--- a/jdk/test/java/io/ObjectInputStream/ResolveProxyClass.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/ObjectInputStream/ResolveProxyClass.java	Wed Jul 05 17:16:45 2017 +0200
@@ -79,7 +79,7 @@
              * code, and it should be the first loader on the stack when
              * ObjectInputStream.resolveProxyClass gets executed.
              */
-            ClassLoader expectedLoader = ClassLoader.getSystemClassLoader();
+            ClassLoader expectedLoader = ResolveProxyClass.class.getClassLoader();
 
             TestObjectInputStream in = new TestObjectInputStream();
             Class proxyClass = in.resolveProxyClass(
--- a/jdk/test/java/io/RandomAccessFile/EOF.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/EOF.java	Wed Jul 05 17:16:45 2017 +0200
@@ -35,12 +35,16 @@
         int n;
         String dir = System.getProperty("test.src", ".");
         RandomAccessFile raf = new RandomAccessFile(new File(dir, "EOF.java"), "r");
-        for (;;) {
-            n = raf.read(buf, 0, buf.length);
-            if (n <= 0) break;
+        try {
+            for (;;) {
+                n = raf.read(buf, 0, buf.length);
+                if (n <= 0) break;
+            }
+            if (n != -1)
+                throw new RuntimeException("Expected -1 for EOF, got " + n);
+        } finally {
+            raf.close();
         }
-        if (n != -1)
-            throw new RuntimeException("Expected -1 for EOF, got " + n);
     }
 
 }
--- a/jdk/test/java/io/RandomAccessFile/ParameterCheck.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/ParameterCheck.java	Wed Jul 05 17:16:45 2017 +0200
@@ -44,6 +44,7 @@
 
     private static void doTest(String method) throws Exception {
         File fn = new File("x.ParameterCheck");
+        RandomAccessFile raf = null;
 
         try {
             byte b[] = new byte[32];
@@ -55,7 +56,7 @@
                 fout.write(i);
             }
             fout.close();
-            RandomAccessFile raf =  new RandomAccessFile(fn , "rw");
+            raf =  new RandomAccessFile(fn , "rw");
 
             System.err.println("-----------------------------" +
                                "-----------------------------");
@@ -125,6 +126,8 @@
             System.err.println("-----------------------------" +
                                "-----------------------------");
         } finally {
+            if (raf != null)
+                raf.close();
             fn.delete();
         }
 
--- a/jdk/test/java/io/RandomAccessFile/ReadLine.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/ReadLine.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,26 +33,30 @@
     public static void main(String args[]) throws Exception {
         File fn = new File("x.ReadLine");
         RandomAccessFile raf = new RandomAccessFile(fn,"rw");
-        String line;
-        int ctr = 1;
-        String expected;
+        try {
+            String line;
+            int ctr = 1;
+            String expected;
 
-        raf.writeBytes
-            ("ln1\rln2\r\nln3\nln4\rln5\r\nln6\n\rln8\r\rln10\n\nln12\r\r\nln14");
-        raf.seek(0);
+            raf.writeBytes
+                ("ln1\rln2\r\nln3\nln4\rln5\r\nln6\n\rln8\r\rln10\n\nln12\r\r\nln14");
+            raf.seek(0);
 
-        while ((line=raf.readLine()) != null) {
-            if ((ctr == 7) || (ctr == 9) ||
-                (ctr == 11) || (ctr == 13)) {
-                expected = "";
-            } else {
-                expected = "ln" + ctr;
+            while ((line=raf.readLine()) != null) {
+                if ((ctr == 7) || (ctr == 9) ||
+                    (ctr == 11) || (ctr == 13)) {
+                     expected = "";
+                } else {
+                    expected = "ln" + ctr;
+                }
+                if (!line.equals(expected)) {
+                    throw new Exception("Expected \"" + expected + "\"" +
+                                        ", read \"" + line + "\"");
+                }
+                ctr++;
             }
-            if (!line.equals(expected)) {
-                throw new Exception("Expected \"" + expected + "\"" +
-                                    ", read \"" + line + "\"");
-            }
-            ctr++;
+        } finally {
+            raf.close();
         }
         System.err.println("Successfully completed test!");
     }
--- a/jdk/test/java/io/RandomAccessFile/Seek.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/Seek.java	Wed Jul 05 17:16:45 2017 +0200
@@ -44,6 +44,8 @@
             throw new Exception
                 ("Should have thrown an IOException when seek offset is < 0");
         } catch (IOException e) {
+        } finally {
+            raf.close();
         }
     }
 }
--- a/jdk/test/java/io/RandomAccessFile/WriteBytesChars.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/WriteBytesChars.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,8 +37,8 @@
         byte[] b = new byte[80];
         File fn = new File("x.WriteBytesChars");
 
-        try{
-            RandomAccessFile raf = new RandomAccessFile(fn , "rw");;
+        RandomAccessFile raf = new RandomAccessFile(fn , "rw");;
+        try {
             for (int i = 0; i < 80; i++) {
                 buf[i] = 'a';
             }
@@ -71,6 +71,7 @@
                     RuntimeException("RandomAccessFile.writeChars, wrong result");
             }
         } finally {
+            raf.close();
             fn.delete();
         }
     }
--- a/jdk/test/java/io/RandomAccessFile/WriteUTF.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/WriteUTF.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,8 +42,8 @@
             s += s;
         System.err.println("String length " + s.length());
 
+        f = new RandomAccessFile(fn, "rw");
         try {
-            f = new RandomAccessFile(fn, "rw");
             try {
                 f.writeUTF(s);
             }
@@ -53,6 +53,7 @@
             throw new RuntimeException("UTFDataFormatException not thrown");
         }
         finally {
+            f.close();
             fn.delete();
         }
 
--- a/jdk/test/java/io/RandomAccessFile/skipBytes/SkipBytes.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/RandomAccessFile/skipBytes/SkipBytes.java	Wed Jul 05 17:16:45 2017 +0200
@@ -96,14 +96,18 @@
     public static void main(String[] args) throws Exception {
 
         RandomAccessFile raf = new RandomAccessFile("input.txt" , "rw");
-        int length = (int)raf.length();
+        try {
+            int length = (int)raf.length();
 
-        doTest(raf , 0 , 2*length);
-        doTest(raf , 0 , length);
-        doTest(raf , 0 , length/2);
-        doTest(raf , length/2 , -2);
-        doTest(raf , length , 0);
-        doTest(raf , 0 , -1);
+            doTest(raf , 0 , 2*length);
+            doTest(raf , 0 , length);
+            doTest(raf , 0 , length/2);
+            doTest(raf , length/2 , -2);
+            doTest(raf , length , 0);
+            doTest(raf , 0 , -1);
+        } finally{
+            raf.close();
+        }
 
     }
 
--- a/jdk/test/java/io/Reader/Skip.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Reader/Skip.java	Wed Jul 05 17:16:45 2017 +0200
@@ -35,12 +35,16 @@
         File f = new File(System.getProperty("test.src", "."),
                           "SkipInput.txt");
         FileReader fr = new FileReader(f);
-        long nchars = 8200;
-        long actual = fr.skip(nchars);
+        try {
+            long nchars = 8200;
+            long actual = fr.skip(nchars);
 
-        if (actual > nchars) {
-            throw new Exception
-                ("Should skip " + nchars + ", but skipped " +actual+" chars");
+            if (actual > nchars) {
+                throw new Exception
+                    ("Should skip " + nchars + ", but skipped " +actual+" chars");
+            }
+        } finally {
+            fr.close();
         }
     }
 }
--- a/jdk/test/java/io/Reader/SkipNegative.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Reader/SkipNegative.java	Wed Jul 05 17:16:45 2017 +0200
@@ -41,6 +41,8 @@
         } catch(IllegalArgumentException e){
             // Negative argument caught
             return;
+        } finally {
+            fr.close();
         }
         throw new Exception("Skip should not accept negative values");
     }
--- a/jdk/test/java/io/Serializable/ClassCastExceptionDetail/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/ClassCastExceptionDetail/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -40,9 +40,9 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
+        FileInputStream in = new FileInputStream("tmp.ser");
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
             oin.readObject();
             throw new Error("readObject should not succeed");
         } catch (ClassCastException e) {
@@ -57,6 +57,8 @@
             {
                 throw new Error("ClassNotFoundException message incomplete");
             }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java	Wed Jul 05 17:16:45 2017 +0200
@@ -26,6 +26,8 @@
  * @summary Verify that unauthorized ObjectOutputStream and ObjectInputStream
  *          cannot be constructed if they override security-sensitive non-final
  *          methods.
+ * @build AuditStreamSubclass
+ * @run main/othervm AuditStreamSubclass
  */
 import java.io.*;
 
--- a/jdk/test/java/io/Serializable/backRefCNFException/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/backRefCNFException/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,13 +38,17 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
-        oin.readObject();
+        FileInputStream in = new FileInputStream("tmp.ser");
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
             oin.readObject();
-            throw new Error("back reference read succeeded");
-        } catch (ClassNotFoundException ex) {
+            try {
+                oin.readObject();
+                throw new Error("back reference read succeeded");
+            } catch (ClassNotFoundException ex) {
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/checkModifiers/CheckModifiers.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/checkModifiers/CheckModifiers.java	Wed Jul 05 17:16:45 2017 +0200
@@ -213,33 +213,39 @@
 
 
         FileOutputStream fos = new FileOutputStream("fields.ser");
-        ObjectOutputStream oos = new ObjectOutputStream(fos);
-
-        System.out.println("Writing obj 1");
-        oos.writeObject(tc1);
-        System.out.println("Writing obj 2");
-        oos.writeObject(tc2);
-        System.out.println("Writing obj 3");
-        oos.writeObject(tc3);
-        System.out.println("Writing obj 4");
-        oos.writeObject(tc4);
+        try {
+            ObjectOutputStream oos = new ObjectOutputStream(fos);
+            System.out.println("Writing obj 1");
+            oos.writeObject(tc1);
+            System.out.println("Writing obj 2");
+            oos.writeObject(tc2);
+            System.out.println("Writing obj 3");
+            oos.writeObject(tc3);
+            System.out.println("Writing obj 4");
+            oos.writeObject(tc4);
+            oos.flush();
+        } finally {
+            fos.close();
+        }
 
         FileInputStream fis = new FileInputStream("fields.ser");
-        ObjectInputStream ois = new ObjectInputStream(fis);
-
-
-        System.out.println("Test modifiers for serialPeristentFields ");
-        System.out.println("---------------------------------------- ");
-        System.out.println("Declaration missing final modifier");
-        ois.readObject();
-        System.out.println();
-        System.out.println("Declaration with public instead of private access");
-        ois.readObject();
-        System.out.println();
-        System.out.println("Declaration with different type");
-        ois.readObject();
-        System.out.println();
-        System.out.println("Declaration as in specification");
-        ois.readObject();
+        try {
+            ObjectInputStream ois = new ObjectInputStream(fis);
+            System.out.println("Test modifiers for serialPeristentFields ");
+            System.out.println("---------------------------------------- ");
+            System.out.println("Declaration missing final modifier");
+            ois.readObject();
+            System.out.println();
+            System.out.println("Declaration with public instead of private access");
+            ois.readObject();
+            System.out.println();
+            System.out.println("Declaration with different type");
+            ois.readObject();
+            System.out.println();
+            System.out.println("Declaration as in specification");
+            ois.readObject();
+        } finally {
+            fis.close();
+        }
     }
 };
--- a/jdk/test/java/io/Serializable/classDescFlagConflict/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/classDescFlagConflict/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,10 +42,15 @@
              * descriptor.
              */
             File f = new File(System.getProperty("test.src", "."), "Foo.ser");
-            new ObjectInputStream(new FileInputStream(f)).readObject();
-            throw new Error(
-                "read succeeded for object whose class descriptor has " +
-                "both SC_SERIALIZABLE and SC_EXTERNALIZABLE flags set");
+            FileInputStream in = new FileInputStream(f);
+            try {
+                new ObjectInputStream(in).readObject();
+                throw new Error(
+                    "read succeeded for object whose class descriptor has " +
+                    "both SC_SERIALIZABLE and SC_EXTERNALIZABLE flags set");
+            } finally {
+                in.close();
+            }
         } catch (InvalidClassException e) {
         }
     }
--- a/jdk/test/java/io/Serializable/classDescHooks/ClassDescHooks.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/classDescHooks/ClassDescHooks.java	Wed Jul 05 17:16:45 2017 +0200
@@ -93,8 +93,12 @@
         bout = new ByteArrayOutputStream();
         foof = new File(System.getProperty("test.src", "."), "Foo.ser");
         fin = new FileInputStream(foof);
-        while (fin.available() > 0)
-            bout.write(fin.read());
+        try {
+            while (fin.available() > 0)
+                bout.write(fin.read());
+        } finally {
+            fin.close();
+        }
         byte[] buf1 = bout.toByteArray();
 
         bout = new ByteArrayOutputStream();
@@ -107,11 +111,16 @@
         if (! Arrays.equals(buf1, buf2))
             throw new Error("Incompatible stream format (write)");
 
+        Foo foocopy;
         fin = new FileInputStream(foof);
-        oin = new ObjectInputStream(fin);
-        Foo foocopy = (Foo) oin.readObject();
-        if (! foo.equals(foocopy))
-            throw new Error("Incompatible stream format (read)");
+        try {
+            oin = new ObjectInputStream(fin);
+            foocopy = (Foo) oin.readObject();
+            if (! foo.equals(foocopy))
+                throw new Error("Incompatible stream format (read)");
+        } finally {
+            fin.close();
+        }
 
         // make sure write hook not called when old protocol in use
         bout = new ByteArrayOutputStream();
--- a/jdk/test/java/io/Serializable/duplicateSerialFields/Test.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/duplicateSerialFields/Test.java	Wed Jul 05 17:16:45 2017 +0200
@@ -82,18 +82,26 @@
         } catch (InvalidClassException e) {
         }
 
+        FileInputStream in = new FileInputStream("a.ser");
         try {
-            new ObjectInputStream(new FileInputStream("a.ser")).readObject();
+            ObjectInputStream oin = new ObjectInputStream(in);
+            oin.readObject();
             throw new Error(
                 "read of A should fail with InvalidClassException");
         } catch (InvalidClassException e) {
+        } finally {
+            in.close();
         }
 
+        in = new FileInputStream("b.ser");
         try {
-            new ObjectInputStream(new FileInputStream("b.ser")).readObject();
+            ObjectInputStream oin = new ObjectInputStream(in);
+            oin.readObject();
             throw new Error(
                 "read of B should fail with InvalidClassException");
         } catch (InvalidClassException e) {
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/enum/badResolve/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/enum/badResolve/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -44,13 +44,15 @@
     }
 
     static void read(String filename) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream(filename));
+        FileInputStream in = new FileInputStream(filename);
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
             Object obj = oin.readObject();
             throw new Error("read of " + obj + " should not have succeeded");
         } catch (InvalidClassException e) {
             System.out.println("caught expected exception " + e);
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/enum/constantSubclasses/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/enum/constantSubclasses/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,13 +38,17 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("foo.ser"));
-        for (Foo f : Foo.values()) {
-            Object obj = oin.readObject();
-            if (obj != f) {
-                throw new Error("expected " + f + ", got " + obj);
+        FileInputStream in = new FileInputStream("foo.ser");
+        try {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            for (Foo f : Foo.values()) {
+                Object obj = oin.readObject();
+                if (obj != f) {
+                    throw new Error("expected " + f + ", got " + obj);
+                }
             }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/enum/missingConstant/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/enum/missingConstant/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,19 +33,23 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("foo.ser"));
-        for (Foo f : Foo.values()) {
-            Object obj = oin.readObject();
-            if (obj != f) {
-                throw new Error("expected " + f + ", got " + obj);
+        FileInputStream in = new FileInputStream("foo.ser");
+        try {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            for (Foo f : Foo.values()) {
+                Object obj = oin.readObject();
+                if (obj != f) {
+                    throw new Error("expected " + f + ", got " + obj);
+                }
             }
-        }
-        try {
-            Object obj = oin.readObject();
-            throw new Error("read of " + obj + " should not succeed");
-        } catch (InvalidObjectException e) {
-            System.out.println("caught expected exception: " + e);
+            try {
+                Object obj = oin.readObject();
+                throw new Error("read of " + obj + " should not succeed");
+            } catch (InvalidObjectException e) {
+                System.out.println("caught expected exception: " + e);
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/fieldTypeString/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/fieldTypeString/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -44,23 +44,30 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("foo.ser"));
-        Foo foo = (Foo) oin.readObject();
-        if (! foo.obj.equals("foo")) {
-            throw new Error();
-        }
+        FileInputStream in = new FileInputStream("foo.ser");
         try {
-            oin.readObject();
-            throw new Error();
-        } catch (ClassCastException ex) {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            Foo foo = (Foo) oin.readObject();
+            if (! foo.obj.equals("foo")) {
+                throw new Error();
+            }
+            try {
+                oin.readObject();
+                throw new Error();
+            } catch (ClassCastException ex) {
+            }
+        } finally {
+            in.close();
         }
 
-        oin = new ObjectInputStream(new FileInputStream("bar.ser"));
+        in = new FileInputStream("bar.ser");
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
             oin.readObject();
             throw new Error();
         } catch (InvalidClassException ex) {
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/illegalHandle/Test.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/illegalHandle/Test.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,21 +38,31 @@
          * serialized String object followed by an illegal handle
          */
         File f = new File(base, "negativeHandle.ser");
-        ObjectInputStream oin = new ObjectInputStream(new FileInputStream(f));
-        oin.readObject();
+        FileInputStream in = new FileInputStream(f);
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
             oin.readObject();
-            throw new Error("negative handle read should not succeed");
-        } catch (StreamCorruptedException ex) {
+            try {
+                oin.readObject();
+                throw new Error("negative handle read should not succeed");
+            } catch (StreamCorruptedException ex) {
+            }
+        } finally {
+            in.close();
         }
 
         f = new File(base, "tooHighHandle.ser");
-        oin = new ObjectInputStream(new FileInputStream(f));
-        oin.readObject();
+        in = new FileInputStream(f);
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
             oin.readObject();
-            throw new Error("too-high handle read should not succeed");
-        } catch (StreamCorruptedException ex) {
+            try {
+                oin.readObject();
+                throw new Error("too-high handle read should not succeed");
+            } catch (StreamCorruptedException ex) {
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/longString/LongString.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/longString/LongString.java	Wed Jul 05 17:16:45 2017 +0200
@@ -68,17 +68,25 @@
         mesgf = new File(System.getProperty("test.src", "."), "mesg.ser");
         fin = new FileInputStream(mesgf);
         bout = new ByteArrayOutputStream();
-        while (fin.available() > 0)
-            bout.write(fin.read());
+        try {
+            while (fin.available() > 0)
+                bout.write(fin.read());
+        } finally {
+            fin.close();
+        }
         byte[] buf2 = bout.toByteArray();
 
         if (! Arrays.equals(buf1, buf2))
             throw new Error("incompatible string format (write)");
 
         fin = new FileInputStream(mesgf);
-        oin = new ObjectInputStream(fin);
-        String mesgcopy = (String) oin.readObject();
-        if (! mesg.equals(mesgcopy))
-            throw new Error("incompatible string format (read)");
+        try {
+            oin = new ObjectInputStream(fin);
+            String mesgcopy = (String) oin.readObject();
+            if (! mesg.equals(mesgcopy))
+                throw new Error("incompatible string format (read)");
+        } finally {
+            fin.close();
+        }
     }
 }
--- a/jdk/test/java/io/Serializable/oldTests/AnnotateClass.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/AnnotateClass.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,36 +37,43 @@
                            "methods \n");
         try {
             FileOutputStream ostream = new FileOutputStream("subtest1.tmp");
-            TestOutputStream p = new TestOutputStream(ostream);
-
-            p.writeObject(System.out);
-            p.writeObject(System.err);
-            p.writeObject(new PrintStream(ostream));
-            p.flush();
-            ostream.close();
+            try {
+                TestOutputStream p = new TestOutputStream(ostream);
+                p.writeObject(System.out);
+                p.writeObject(System.err);
+                p.writeObject(new PrintStream(ostream));
+                p.flush();
+            } finally {
+                ostream.close();
+            }
 
             FileInputStream istream = new FileInputStream("subtest1.tmp");
-            TestInputStream q = new TestInputStream(istream);
+            try {
+                TestInputStream q = new TestInputStream(istream);
 
-            PrintStream out = (PrintStream)q.readObject();
-            PrintStream err = (PrintStream)q.readObject();
-            Object other = q.readObject();
-            if (out != System.out) {
-                System.err.println(
-                    "\nTEST FAILED: System.out not read correctly");
-                throw new Error();
+                PrintStream out = (PrintStream)q.readObject();
+                PrintStream err = (PrintStream)q.readObject();
+                Object other = q.readObject();
+                if (out != System.out) {
+                    System.err.println(
+                        "\nTEST FAILED: System.out not read correctly");
+                    throw new Error();
+                }
+                if (err != System.err) {
+                    System.err.println(
+                        "\nTEST FAILED: System.err not read correctly");
+                    throw new Error();
+                }
+                if (other != null) {
+                    System.err.println(
+                        "\nTEST FAILED: Non-system PrintStream should have " +
+                        "been written/read as null");
+                    throw new Error();
+                }
+            } finally {
+                istream.close();
             }
-            if (err != System.err) {
-                System.err.println(
-                    "\nTEST FAILED: System.err not read correctly");
-                throw new Error();
-            }
-            if (other != null) {
-                System.err.println(
-                    "\nTEST FAILED: Non-system PrintStream should have " +
-                    "been written/read as null");
-                throw new Error();
-            }
+
             System.err.println("\nTEST PASSED");
         } catch (Exception e) {
             System.err.print("TEST FAILED: ");
--- a/jdk/test/java/io/Serializable/oldTests/ArrayFields.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/ArrayFields.java	Wed Jul 05 17:16:45 2017 +0200
@@ -35,20 +35,22 @@
 
 public class ArrayFields {
 
-   public static void main (String argv[]) {
+   public static void main (String argv[]) throws IOException {
        System.err.println("\nRegression test for testing of " +
            "serialization/deserialization of objects with " +
            "fields of array type\n");
 
+       FileOutputStream ostream = null;
+       FileInputStream istream = null;
        try {
-           FileOutputStream ostream = new FileOutputStream("piotest4.tmp");
+           ostream = new FileOutputStream("piotest4.tmp");
            ObjectOutputStream p = new ObjectOutputStream(ostream);
 
            ArrayTest array = new ArrayTest();
            p.writeObject(array);
            p.flush();
 
-           FileInputStream istream = new FileInputStream("piotest4.tmp");
+           istream = new FileInputStream("piotest4.tmp");
            ObjectInputStream q = new ObjectInputStream(istream);
 
            Object obj = null;
@@ -73,6 +75,9 @@
            System.err.print("TEST FAILED: ");
            e.printStackTrace();
            throw new Error();
+       } finally {
+           if (istream != null) istream.close();
+           if (ostream != null) ostream.close();
        }
    }
 }
--- a/jdk/test/java/io/Serializable/oldTests/ArraysOfArrays.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/ArraysOfArrays.java	Wed Jul 05 17:16:45 2017 +0200
@@ -31,14 +31,15 @@
 import java.io.*;
 
 public class ArraysOfArrays {
-    public static void main (String argv[]) {
+    public static void main (String argv[]) throws IOException {
         System.err.println("\nRegression test for testing of " +
             "serialization/deserialization of objects as " +
             "arrays of arrays \n");
 
         FileInputStream istream = null;
+        FileOutputStream ostream = null;
         try {
-            FileOutputStream ostream = new FileOutputStream("piotest5.tmp");
+            ostream = new FileOutputStream("piotest5.tmp");
             ObjectOutputStream p = new ObjectOutputStream(ostream);
 
             byte b[][] = {{ 0, 1}, {2,3}};
@@ -207,6 +208,9 @@
                 throw new Error();
             }
             throw new Error();
+        } finally {
+            if (istream != null) istream.close();
+            if (ostream != null) ostream.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/oldTests/BinaryTree.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/BinaryTree.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,28 +37,34 @@
             "with BinaryTree types \n");
 
         try {
+            BinaryTreeTest base = new BinaryTreeTest(2);
             FileOutputStream ostream = new FileOutputStream("piotest3.tmp");
-            ObjectOutputStream p = new ObjectOutputStream(ostream);
-
-            BinaryTreeTest base = new BinaryTreeTest(2);
-            p.writeObject(null);
-            p.writeObject(base);
-            p.flush();
-            ostream.close();
+            try {
+                ObjectOutputStream p = new ObjectOutputStream(ostream);
+                p.writeObject(null);
+                p.writeObject(base);
+                p.flush();
+            } finally {
+                ostream.close();
+            }
 
             FileInputStream istream = new FileInputStream("piotest3.tmp");
-            ObjectInputStream q = new ObjectInputStream(istream);
-
-            Object n = q.readObject();
-            if (n != null) {
-                System.err.println("\nnull read as " + n);
+            try {
+                ObjectInputStream q = new ObjectInputStream(istream);
+                Object n = q.readObject();
+                if (n != null) {
+                    System.err.println("\nnull read as " + n);
+                }
+                BinaryTreeTest nbase = (BinaryTreeTest)q.readObject();
+                if (!base.equals(nbase)) {
+                    System.err.println("\nTEST FAILED: BinaryTree read " +
+                        "incorrectly.");
+                    throw new Error();
+                }
+            } finally {
+                istream.close();
             }
-            BinaryTreeTest nbase = (BinaryTreeTest)q.readObject();
-            if (!base.equals(nbase)) {
-                System.err.println("\nTEST FAILED: BinaryTree read " +
-                    "incorrectly.");
-                throw new Error();
-            }
+
             System.err.println("\nTEST PASSED");
         } catch (Exception e) {
             System.err.print("TEST FAILED: ");
--- a/jdk/test/java/io/Serializable/oldTests/CircularList.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/CircularList.java	Wed Jul 05 17:16:45 2017 +0200
@@ -31,20 +31,22 @@
 import java.io.*;
 
 public class CircularList {
-   public static void main (String argv[]) {
+   public static void main (String argv[]) throws IOException {
        System.err.println("\nRegression test for testing of " +
             "serialization/deserialization of " +
             "objects with CirculalListType types \n");
 
+       FileInputStream istream = null;
+       FileOutputStream ostream = null;
        try {
-           FileOutputStream ostream = new FileOutputStream("piotest7.tmp");
+           ostream = new FileOutputStream("piotest7.tmp");
            ObjectOutputStream p = new ObjectOutputStream(ostream);
 
            CircularListTest.setup();
            p.writeObject(CircularListTest.list);
            p.flush();
 
-           FileInputStream istream = new FileInputStream("piotest7.tmp");
+           istream = new FileInputStream("piotest7.tmp");
            ObjectInputStream q = new ObjectInputStream(istream);
 
            CircularListTest cv = (CircularListTest)q.readObject();
@@ -58,6 +60,9 @@
            System.err.print("TEST FAILED: ");
            e.printStackTrace();
            throw new Error();
+        } finally {
+           if (istream != null) istream.close();
+           if (ostream != null) ostream.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/oldTests/SimpleArrays.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/SimpleArrays.java	Wed Jul 05 17:16:45 2017 +0200
@@ -35,13 +35,14 @@
 
 
 public class SimpleArrays {
-    public static void main (String argv[]) {
+    public static void main (String argv[]) throws IOException {
        System.err.println("\nRegression test for testing of " +
            "serialization/deserialization of objects with Arrays types\n");
 
        FileInputStream istream = null;
+       FileOutputStream ostream = null;
        try {
-           FileOutputStream ostream = new FileOutputStream("piotest2.tmp");
+           ostream = new FileOutputStream("piotest2.tmp");
            ObjectOutputStream p = new ObjectOutputStream(ostream);
 
             byte b[] = { 0, 1};
@@ -177,6 +178,9 @@
                throw new Error();
            }
            throw new Error();
+       } finally {
+           if (istream != null) istream.close();
+           if (ostream != null) ostream.close();
        }
     }
 }
--- a/jdk/test/java/io/Serializable/oldTests/WritePrimitive.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/oldTests/WritePrimitive.java	Wed Jul 05 17:16:45 2017 +0200
@@ -34,11 +34,12 @@
 import java.io.*;
 
 public class WritePrimitive {
-    public static void main (String argv[]) {
+    public static void main (String argv[]) throws IOException {
         System.err.println("\nRegression test for testing of " +
             "serialization/deserialization of primitives \n");
 
         FileInputStream istream = null;
+        FileOutputStream ostream = null;
         try {
             int i = 123456;
             byte b = 12;
@@ -51,7 +52,7 @@
             String string = "The String";
             PrimitivesTest prim = new PrimitivesTest();
 
-            FileOutputStream ostream = new FileOutputStream("piotest1.tmp");
+            ostream = new FileOutputStream("piotest1.tmp");
             ObjectOutputStream p = new ObjectOutputStream(ostream);
 
             p.writeInt(i);
@@ -154,6 +155,9 @@
                 throw new Error();
             }
             throw new Error();
+        } finally {
+            if (istream != null) istream.close();
+            if (ostream != null) ostream.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/packageAccess/Test.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/packageAccess/Test.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,7 +38,8 @@
 
     public static void main(String[] args) throws Exception {
         ClassLoader ldr =
-            new URLClassLoader(new URL[]{ new URL("file:foo.jar") });
+            new URLClassLoader(new URL[]{ new URL("file:foo.jar") },
+                               Test.class.getClassLoader());
         bcl = Class.forName("B", true, ldr);
         dcl = Class.forName("D", true, ldr);
 
--- a/jdk/test/java/io/Serializable/parents/EvolvedClass.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/parents/EvolvedClass.java	Wed Jul 05 17:16:45 2017 +0200
@@ -34,8 +34,12 @@
 
         // Deserialize in to new class object
         FileInputStream fi = new FileInputStream("parents.ser");
-        ObjectInputStream si = new ObjectInputStream(fi);
-        cnew = (ASubClass) si.readObject();
+        try {
+            ObjectInputStream si = new ObjectInputStream(fi);
+            cnew = (ASubClass) si.readObject();
+        } finally {
+            fi.close();
+        }
 
         System.out.println("Printing the deserialized class: ");
         System.out.println();
--- a/jdk/test/java/io/Serializable/parents/OriginalClass.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/parents/OriginalClass.java	Wed Jul 05 17:16:45 2017 +0200
@@ -43,9 +43,13 @@
 
         // Serialize the subclass
         FileOutputStream fo = new FileOutputStream("parents.ser");
-        ObjectOutputStream so = new ObjectOutputStream(fo);
-        so.writeObject(corg);
-        so.flush();
+        try {
+            ObjectOutputStream so = new ObjectOutputStream(fo);
+            so.writeObject(corg);
+            so.flush();
+        } finally {
+            fo.close();
+        }
 
         System.out.println("Printing the serialized class: ");
         System.out.println();
--- a/jdk/test/java/io/Serializable/proxy/Basic.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/proxy/Basic.java	Wed Jul 05 17:16:45 2017 +0200
@@ -81,7 +81,7 @@
 
 public class Basic {
     public static void main(String[] args) throws Exception {
-        ClassLoader loader = ClassLoader.getSystemClassLoader();
+        ClassLoader loader = Basic.class.getClassLoader();
         Class[] interfaces = new Class[] { Foo.class, Bar.class };
         Random rand = new Random();
         int foo = rand.nextInt();
--- a/jdk/test/java/io/Serializable/proxy/skipMissing/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/proxy/skipMissing/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -49,20 +49,24 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin = new ObjectInputStream(
-            new FileInputStream("tmp.ser"));
-        A a = (A) oin.readObject();
-        if (! (a.a.equals("a") && a.z.equals("z"))) {
-            throw new Error("A fields corrupted");
-        }
-        B b = (B) oin.readObject();
-        if (! b.s.equals("s")) {
-            throw new Error("B fields corrupted");
-        }
+        FileInputStream in = new FileInputStream("tmp.ser");
         try {
-            oin.readObject();
-            throw new Error("proxy read should not succeed");
-        } catch (ClassNotFoundException ex) {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            A a = (A) oin.readObject();
+            if (! (a.a.equals("a") && a.z.equals("z"))) {
+                throw new Error("A fields corrupted");
+            }
+            B b = (B) oin.readObject();
+            if (! b.s.equals("s")) {
+                throw new Error("B fields corrupted");
+            }
+            try {
+                oin.readObject();
+                throw new Error("proxy read should not succeed");
+            } catch (ClassNotFoundException ex) {
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/proxy/skipMissing/Write.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/proxy/skipMissing/Write.java	Wed Jul 05 17:16:45 2017 +0200
@@ -64,7 +64,7 @@
 public class Write {
     public static void main(String[] args) throws Exception {
         Object proxy = Proxy.newProxyInstance(
-            ClassLoader.getSystemClassLoader(),
+            Write.class.getClassLoader(),
             new Class[] { I.class }, new Handler());
         ObjectOutputStream oout = new ObjectOutputStream(
             new FileOutputStream("tmp.ser"));
--- a/jdk/test/java/io/Serializable/readObjectNoData/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/readObjectNoData/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -95,14 +95,18 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
-        F f = (F) oin.readObject();
-        if (f.aCalled || f.bCalled || f.dCalled || f.eCalled) {
-            throw new Error("readObjectNoData invoked erroneously");
-        }
-        if (! f.cCalled) {
-            throw new Error("readObjectNoData not invoked");
+        FileInputStream in = new FileInputStream("tmp.ser");
+        try {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            F f = (F) oin.readObject();
+            if (f.aCalled || f.bCalled || f.dCalled || f.eCalled) {
+                throw new Error("readObjectNoData invoked erroneously");
+            }
+            if (! f.cCalled) {
+                throw new Error("readObjectNoData not invoked");
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/skipWriteObject/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/skipWriteObject/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,9 +38,13 @@
     public static void main(String[] args) throws Exception {
         ObjectInputStream oin =
             new ObjectInputStream(new FileInputStream("tmp.ser"));
-        Object[] array = (Object[]) oin.readObject();
-        if (! (array[0].equals("before") && array[2].equals("after"))) {
-            throw new Error();
+        try {
+            Object[] array = (Object[]) oin.readObject();
+            if (! (array[0].equals("before") && array[2].equals("after"))) {
+                throw new Error();
+            }
+        } finally {
+            oin.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/skippedObjCNFException/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/skippedObjCNFException/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -44,8 +44,12 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
-        oin.readObject();
+        FileInputStream in = new FileInputStream("tmp.ser");
+        try {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            oin.readObject();
+        } finally {
+            in.close();
+        }
     }
 }
--- a/jdk/test/java/io/Serializable/stopCustomDeserialization/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/stopCustomDeserialization/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -53,16 +53,20 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
+        FileInputStream in = new FileInputStream("tmp.ser");
         try {
-            oin.readObject();
-            throw new Error("readObject should not succeed");
-        } catch (ClassNotFoundException e) {
-            // expected
-        }
-        if (!oin.readObject().equals("after")) {
-            throw new Error("subsequent object corrupted");
+            ObjectInputStream oin = new ObjectInputStream(in);
+            try {
+                oin.readObject();
+                throw new Error("readObject should not succeed");
+            } catch (ClassNotFoundException e) {
+                // expected
+            }
+            if (!oin.readObject().equals("after")) {
+                throw new Error("subsequent object corrupted");
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/unresolvedClassDesc/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/unresolvedClassDesc/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -32,19 +32,23 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
-        oin.readObject();
-        oin.readObject();
+        FileInputStream in = new FileInputStream("tmp.ser");
         try {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            oin.readObject();
             oin.readObject();
-            throw new Error("read of Foo instance succeeded");
-        } catch (ClassNotFoundException ex) {
-        }
-        try {
-            oin.readObject();
-            throw new Error("indirect read of Foo instance succeeded");
-        } catch (ClassNotFoundException ex) {
+            try {
+                oin.readObject();
+                throw new Error("read of Foo instance succeeded");
+            } catch (ClassNotFoundException ex) {
+            }
+            try {
+                oin.readObject();
+                throw new Error("indirect read of Foo instance succeeded");
+            } catch (ClassNotFoundException ex) {
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/unshared/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/unshared/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -80,20 +80,30 @@
         }
 
         // read in objects written by Write.main()
-        oin = new ObjectInputStream(new FileInputStream("tmp.ser"));
-        oin.readObject();
+        FileInputStream in = new FileInputStream("tmp.ser");
         try {
+            oin = new ObjectInputStream(in);
             oin.readObject();
-            throw new Error();
-        } catch (ObjectStreamException ex) {
+            try {
+                oin.readObject();
+                throw new Error();
+            } catch (ObjectStreamException ex) {
+            }
+        } finally {
+            in.close();
         }
 
-        oin = new ObjectInputStream(new FileInputStream("tmp.ser"));
-        oin.readObject();
+        in = new FileInputStream("tmp.ser");
         try {
-            oin.readUnshared();
-            throw new Error();
-        } catch (ObjectStreamException ex) {
+            oin = new ObjectInputStream(in);
+            oin.readObject();
+            try {
+                oin.readUnshared();
+                throw new Error();
+            } catch (ObjectStreamException ex) {
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/Serializable/wrongReturnTypes/Read.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/Serializable/wrongReturnTypes/Read.java	Wed Jul 05 17:16:45 2017 +0200
@@ -62,15 +62,19 @@
 
 public class Read {
     public static void main(String[] args) throws Exception {
-        ObjectInputStream oin =
-            new ObjectInputStream(new FileInputStream("tmp.ser"));
-        B b = (B) oin.readObject();
-        if (A.readObjectNoDataCalled) {
-            throw new Error("readObjectNoData with wrong return type called");
-        } else if (B.readObjectCalled) {
-            throw new Error("readObject with wrong return type called");
-        } else if (B.readResolveCalled) {
-            throw new Error("readResolve with wrong return type called");
+        FileInputStream in = new FileInputStream("tmp.ser");
+        try {
+            ObjectInputStream oin = new ObjectInputStream(in);
+            B b = (B) oin.readObject();
+            if (A.readObjectNoDataCalled) {
+                throw new Error("readObjectNoData with wrong return type called");
+            } else if (B.readObjectCalled) {
+                throw new Error("readObject with wrong return type called");
+            } else if (B.readResolveCalled) {
+                throw new Error("readResolve with wrong return type called");
+            }
+        } finally {
+            in.close();
         }
     }
 }
--- a/jdk/test/java/io/StreamTokenizer/Comment.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/StreamTokenizer/Comment.java	Wed Jul 05 17:16:45 2017 +0200
@@ -41,40 +41,45 @@
         int slashStarComment = 4;
 
         for (int i = 0; i < 8 ; i++) {
-            StreamTokenizer st = new StreamTokenizer(new FileReader(f));
-
-            /* decide the state of this run */
-            boolean slashCommentFlag = ((i & slashIsCommentStart) != 0);
-            boolean slashSlashCommentFlag = ((i & slashSlashComment) != 0);
-            boolean slashStarCommentFlag = ((i & slashStarComment) != 0);
+            FileReader reader = new FileReader(f);
+            try {
+                StreamTokenizer st = new StreamTokenizer(reader);
 
-            /* set the initial state of the tokenizer */
-            if (!slashCommentFlag) {
-                st.ordinaryChar('/');
-            }
-            st.slashSlashComments(slashSlashCommentFlag);
-            st.slashStarComments(slashStarCommentFlag);
+                /* decide the state of this run */
+                boolean slashCommentFlag = ((i & slashIsCommentStart) != 0);
+                boolean slashSlashCommentFlag = ((i & slashSlashComment) != 0);
+                boolean slashStarCommentFlag = ((i & slashStarComment) != 0);
+
+                /* set the initial state of the tokenizer */
+                if (!slashCommentFlag) {
+                    st.ordinaryChar('/');
+                }
+                st.slashSlashComments(slashSlashCommentFlag);
+                st.slashStarComments(slashStarCommentFlag);
 
-            /* now go throgh the input file */
-            while(st.nextToken() != StreamTokenizer.TT_EOF)
-            {
-                String token = st.sval;
-                if (token == null) {
-                    continue;
-                } else {
-                    if ((token.compareTo("Error1") == 0) && slashStarCommentFlag) {
-                        throw new Exception("Failed to pass one line C comments!");
-                    }
-                    if ((token.compareTo("Error2") == 0) && slashStarCommentFlag) {
-                        throw new Exception("Failed to pass multi line C comments!");
-                    }
-                    if ((token.compareTo("Error3") == 0) && slashSlashCommentFlag) {
-                        throw new Exception("Failed to pass C++ comments!");
-                    }
-                    if ((token.compareTo("Error4") == 0) && slashCommentFlag) {
-                        throw new Exception("Failed to pass / comments!");
+                /* now go throgh the input file */
+                while(st.nextToken() != StreamTokenizer.TT_EOF)
+                {
+                    String token = st.sval;
+                    if (token == null) {
+                        continue;
+                    } else {
+                        if ((token.compareTo("Error1") == 0) && slashStarCommentFlag) {
+                            throw new Exception("Failed to pass one line C comments!");
+                        }
+                        if ((token.compareTo("Error2") == 0) && slashStarCommentFlag) {
+                            throw new Exception("Failed to pass multi line C comments!");
+                        }
+                        if ((token.compareTo("Error3") == 0) && slashSlashCommentFlag) {
+                            throw new Exception("Failed to pass C++ comments!");
+                        }
+                        if ((token.compareTo("Error4") == 0) && slashCommentFlag) {
+                            throw new Exception("Failed to pass / comments!");
+                        }
                     }
                 }
+            } finally {
+                reader.close();
             }
         }
     }
--- a/jdk/test/java/io/readBytes/ReadBytesBounds.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/io/readBytes/ReadBytesBounds.java	Wed Jul 05 17:16:45 2017 +0200
@@ -57,24 +57,28 @@
     }
 
     public static void main(String argv[]) throws Throwable {
-        byte b[] = new byte[32];
-        testRead(-1, -1, false);
-        testRead(-1,  0, false);
-        testRead( 0, -1, false);
-        testRead( 0, 33, false);
-        testRead(33,  0, false);
-        testRead(33,  4, false);
-        testRead( 0, 32, true);
-        testRead(32,  0, true);
-        testRead(32,  4, false);
-        testRead( 4, 16, true);
-        testRead( 1, 31, true);
-        testRead( 0,  0, true);
-        testRead(31,  Integer.MAX_VALUE, false);
-        testRead( 0,  Integer.MAX_VALUE, false);
-        testRead(-1,  Integer.MAX_VALUE, false);
-        testRead(-4,  Integer.MIN_VALUE, false);
-        testRead( 0,  Integer.MIN_VALUE, false);
+        try {
+            testRead(-1, -1, false);
+            testRead(-1,  0, false);
+            testRead( 0, -1, false);
+            testRead( 0, 33, false);
+            testRead(33,  0, false);
+            testRead(33,  4, false);
+            testRead( 0, 32, true);
+            testRead(32,  0, true);
+            testRead(32,  4, false);
+            testRead( 4, 16, true);
+            testRead( 1, 31, true);
+            testRead( 0,  0, true);
+            testRead(31,  Integer.MAX_VALUE, false);
+            testRead( 0,  Integer.MAX_VALUE, false);
+            testRead(-1,  Integer.MAX_VALUE, false);
+            testRead(-4,  Integer.MIN_VALUE, false);
+            testRead( 0,  Integer.MIN_VALUE, false);
+        } finally {
+            fis.close();
+            raf.close();
+        }
     }
 
     static void testRead(int off, int len, boolean expected) throws Throwable {
--- a/jdk/test/java/lang/ClassLoader/UninitializedParent.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/ClassLoader/UninitializedParent.java	Wed Jul 05 17:16:45 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 6636650
  * @summary Uninitialized class loaders should not be a parent of other
  *          class loaders.
+ * @run main/othervm UninitializedParent
  */
 
 
--- a/jdk/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java	Wed Jul 05 17:16:45 2017 +0200
@@ -38,14 +38,17 @@
 public class DefineClassByteBuffer {
 
     static void test(ClassLoader cl) throws Exception {
-        Class c = Class.forName("TestClass", true, cl);
+        Class<?> c = Class.forName("TestClass", true, cl);
         if (!"TestClass".equals(c.getName())) {
             throw new RuntimeException("Got wrong class: " + c);
         }
+        if (c.getClassLoader() != cl) {
+            throw new RuntimeException("TestClass defined by wrong classloader: " + c.getClassLoader());
+        }
     }
 
     public static void main(String arg[]) throws Exception {
-        ClassLoader[] cls = new ClassLoader[DummyClassLoader.MAX_TYPE];
+        DummyClassLoader[] cls = new DummyClassLoader[DummyClassLoader.MAX_TYPE];
         for (int i = 0; i < cls.length; i++) {
             cls[i] = new DummyClassLoader(i);
         }
@@ -53,7 +56,7 @@
         /* Create several instances of the class using different classloaders,
            which are using different types of ByteBuffer. */
         for (int i = 0; i < cls.length; i++) {
-          test(cls[i]);
+            test(cls[i]);
         }
     }
 
@@ -100,12 +103,13 @@
                buffers. */
             buffers[MAPPED_BUFFER] = readClassFile(CLASS_NAME + ".class");
             byte[] array = new byte[buffers[MAPPED_BUFFER].limit()];
+            buffers[MAPPED_BUFFER].get(array).flip();
 
             buffers[DIRECT_BUFFER] = ByteBuffer.allocateDirect(array.length);
-            buffers[DIRECT_BUFFER].put(array);
+            buffers[DIRECT_BUFFER].put(array).flip();
 
             buffers[ARRAY_BUFFER] = ByteBuffer.allocate(array.length);
-            buffers[ARRAY_BUFFER].put(array);
+            buffers[ARRAY_BUFFER].put(array).flip();
 
             buffers[WRAPPED_BUFFER] = ByteBuffer.wrap(array);
 
@@ -118,9 +122,30 @@
             buffers[DUP_DIRECT_BUFFER] = buffers[DIRECT_BUFFER].duplicate();
         }
 
-         public Class findClass(String name) {
-             return defineClass(name, buffers[loaderType], null);
-         }
+        protected Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException
+        {
+            Class<?> c;
+            if (!"TestClass".equals(name)) {
+                c = super.loadClass(name, resolve);
+            } else {
+                // should not delegate to the system class loader
+                c = findClass(name);
+                if (resolve) {
+                    resolveClass(c);
+                }
+            }
+            return c;
+        }
+
+        protected Class<?> findClass(String name)
+            throws ClassNotFoundException
+        {
+            if (!"TestClass".equals(name)) {
+                throw new ClassNotFoundException("Unexpected class: " + name);
+            }
+            return defineClass(name, buffers[loaderType], null);
+        }
     } /* DummyClassLoader */
 
 } /* DefineClassByteBuffer */
--- a/jdk/test/java/lang/ClassLoader/findSystemClass/Loader.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/ClassLoader/findSystemClass/Loader.java	Wed Jul 05 17:16:45 2017 +0200
@@ -21,10 +21,16 @@
  * questions.
  */
 
+/*
+ * This test runs in othervm mode as it tests ClassLoader.findSystemClass
+ * and getSystemResource methods.
+ */
+
 /* @test
    @bug 4147599 4478150
    @summary In 1.2beta4-I ClassLoader loaded classes can not link
             against application classes.
+   @run main/othervm Loader
 */
 
 /*
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,6 +37,7 @@
 
 import java.io.*;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
 import java.security.*;
 import java.util.regex.Pattern;
 import static java.lang.System.getenv;
@@ -252,9 +253,9 @@
         return sb.toString();
     }
 
-    static void print4095(OutputStream s) throws Throwable {
+    static void print4095(OutputStream s, byte b) throws Throwable {
         byte[] bytes = new byte[4095];
-        Arrays.fill(bytes, (byte) '!');
+        Arrays.fill(bytes, b);
         s.write(bytes);         // Might hang!
     }
 
@@ -273,7 +274,9 @@
     public static class JavaChild {
         public static void main(String args[]) throws Throwable {
             String action = args[0];
-            if (action.equals("testIO")) {
+            if (action.equals("sleep")) {
+                Thread.sleep(10 * 60 * 1000L);
+            } else if (action.equals("testIO")) {
                 String expected = "standard input";
                 char[] buf = new char[expected.length()+1];
                 int n = new InputStreamReader(System.in).read(buf,0,buf.length);
@@ -315,7 +318,8 @@
                 printUTF8(new File(System.getProperty("user.dir"))
                           .getCanonicalPath());
             } else if (action.equals("print4095")) {
-                print4095(System.out);
+                print4095(System.out, (byte) '!');
+                print4095(System.err, (byte) 'E');
                 System.exit(5);
             } else if (action.equals("OutErr")) {
                 // You might think the system streams would be
@@ -1717,16 +1721,107 @@
         } catch (Throwable t) { unexpected(t); }
 
         //----------------------------------------------------------------
-        // This would deadlock, if not for the fact that
+        // Attempt to write 4095 bytes to the pipe buffer without a
+        // reader to drain it would deadlock, if not for the fact that
         // interprocess pipe buffers are at least 4096 bytes.
+        //
+        // Also, check that available reports all the bytes expected
+        // in the pipe buffer, and that I/O operations do the expected
+        // things.
         //----------------------------------------------------------------
         try {
             List<String> childArgs = new ArrayList<String>(javaChildArgs);
             childArgs.add("print4095");
-            Process p = new ProcessBuilder(childArgs).start();
-            print4095(p.getOutputStream()); // Might hang!
-            p.waitFor();                    // Might hang!
+            final int SIZE = 4095;
+            final Process p = new ProcessBuilder(childArgs).start();
+            print4095(p.getOutputStream(), (byte) '!'); // Might hang!
+            p.waitFor();                                // Might hang!
+            equal(SIZE, p.getInputStream().available());
+            equal(SIZE, p.getErrorStream().available());
+            THROWS(IOException.class,
+                   new Fun(){void f() throws IOException {
+                       p.getOutputStream().write((byte) '!');
+                       p.getOutputStream().flush();
+                       }});
+
+            final byte[] bytes = new byte[SIZE + 1];
+            equal(SIZE, p.getInputStream().read(bytes));
+            for (int i = 0; i < SIZE; i++)
+                equal((byte) '!', bytes[i]);
+            equal((byte) 0, bytes[SIZE]);
+
+            equal(SIZE, p.getErrorStream().read(bytes));
+            for (int i = 0; i < SIZE; i++)
+                equal((byte) 'E', bytes[i]);
+            equal((byte) 0, bytes[SIZE]);
+
+            equal(0, p.getInputStream().available());
+            equal(0, p.getErrorStream().available());
+            equal(-1, p.getErrorStream().read());
+            equal(-1, p.getInputStream().read());
+
             equal(p.exitValue(), 5);
+
+            p.getInputStream().close();
+            p.getErrorStream().close();
+            p.getOutputStream().close();
+
+            InputStream[] streams = { p.getInputStream(), p.getErrorStream() };
+            for (final InputStream in : streams) {
+                Fun[] ops = {
+                    new Fun(){void f() throws IOException {
+                        in.read(); }},
+                    new Fun(){void f() throws IOException {
+                        in.read(bytes); }},
+                    new Fun(){void f() throws IOException {
+                        in.available(); }}
+                };
+                for (Fun op : ops) {
+                    try {
+                        op.f();
+                        fail();
+                    } catch (IOException expected) {
+                        check(expected.getMessage()
+                              .matches("[Ss]tream [Cc]losed"));
+                    }
+                }
+            }
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
+        // Check that reads which are pending when Process.destroy is
+        // called, get EOF, not IOException("Stream closed").
+        //----------------------------------------------------------------
+        try {
+            final int cases = 4;
+            for (int i = 0; i < cases; i++) {
+                final int action = i;
+                List<String> childArgs = new ArrayList<String>(javaChildArgs);
+                childArgs.add("sleep");
+                final byte[] bytes = new byte[10];
+                final Process p = new ProcessBuilder(childArgs).start();
+                final CountDownLatch latch = new CountDownLatch(1);
+                final Thread thread = new Thread() {
+                    public void run() {
+                        try {
+                            latch.countDown();
+                            int r;
+                            switch (action) {
+                            case 0: r = p.getInputStream().read(); break;
+                            case 1: r = p.getErrorStream().read(); break;
+                            case 2: r = p.getInputStream().read(bytes); break;
+                            case 3: r = p.getErrorStream().read(bytes); break;
+                            default: throw new Error();
+                            }
+                            equal(-1, r);
+                        } catch (Throwable t) { unexpected(t); }}};
+
+                thread.start();
+                latch.await();
+                Thread.sleep(10);
+                p.destroy();
+                thread.join();
+            }
         } catch (Throwable t) { unexpected(t); }
 
         //----------------------------------------------------------------
@@ -1741,7 +1836,6 @@
         } catch (IOException e) {
             new File("./emptyCommand").delete();
             String m = e.getMessage();
-            //e.printStackTrace();
             if (EnglishUnix.is() &&
                 ! matches(m, "Permission denied"))
                 unexpected(e);
--- a/jdk/test/java/lang/System/ExitFinalizersAndJIT.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/System/ExitFinalizersAndJIT.java	Wed Jul 05 17:16:45 2017 +0200
@@ -26,6 +26,7 @@
    @summary runFinalizersOnExit(true) causes JIT to be unloaded and
             crashes the VM.  Interim fix for 1.2 beta4 -- don't unload
             native libraries loaded by system classes.
+   @run main/othervm ExitFinalizersAndJIT
 */
 
 public class ExitFinalizersAndJIT {
--- a/jdk/test/java/lang/System/IgnoreNullSecurityManager.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/System/IgnoreNullSecurityManager.java	Wed Jul 05 17:16:45 2017 +0200
@@ -26,6 +26,7 @@
  * @bug 4213876
  * @summary Make sure "null" security manager is ignored, as specified in the
  * javadocs
+ * @run main/othervm IgnoreNullSecurityManager
  */
 
 public class IgnoreNullSecurityManager {
--- a/jdk/test/java/lang/Thread/GenerifyStackTraces.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/Thread/GenerifyStackTraces.java	Wed Jul 05 17:16:45 2017 +0200
@@ -155,7 +155,7 @@
             printStack(t, stack);
         }
         int frame = stack.length - 1;
-        for (int i = 0; i < depth; i++) {
+        for (int i = 0; i < depth && frame >= 0; i++) {
             if (! stack[frame].getMethodName().equals(methodNames[i])) {
                 throw new RuntimeException("Expected " + methodNames[i] +
                                            " in frame " + frame + " but got " +
--- a/jdk/test/java/lang/Thread/StackTraces.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/Thread/StackTraces.java	Wed Jul 05 17:16:45 2017 +0200
@@ -159,7 +159,7 @@
             printStack(t, stack);
         }
         int frame = stack.length - 1;
-        for (int i = 0; i < depth; i++) {
+        for (int i = 0; i < depth && frame >= 0; i++) {
             if (! stack[frame].getMethodName().equals(methodNames[i])) {
                 throw new RuntimeException("Expected " + methodNames[i] +
                                            " in frame " + frame + " but got " +
--- a/jdk/test/java/lang/annotation/ParameterAnnotations.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/annotation/ParameterAnnotations.java	Wed Jul 05 17:16:45 2017 +0200
@@ -27,6 +27,7 @@
  * @summary Check properties of Annotations returned from
  * getParameterAnnotations, including freedom from security
  * exceptions.
+ * @run main/othervm ParameterAnnotations
  * @author Martin Buchholz
  */
 
--- a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java	Wed Jul 05 17:16:45 2017 +0200
@@ -118,9 +118,21 @@
 }
 class Slave {}
 
-class LeftHand extends ClassLoader {}
-class RightHand extends ClassLoader {}
+class LeftHand extends ClassLoader {
+    public LeftHand() {
+        super(LeftHand.class.getClassLoader());
+    }
+}
+class RightHand extends ClassLoader {
+    public RightHand() {
+        super(RightHand.class.getClassLoader());
+    }
+}
 class Body {}
 
-class LoaderForTwoInstances extends ClassLoader {}
+class LoaderForTwoInstances extends ClassLoader {
+    public LoaderForTwoInstances() {
+        super(LoaderForTwoInstances.class.getClassLoader());
+    }
+}
 class TheSameClass {}
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,7 @@
  * @test
  * @bug     5024531
  * @summary Basic Test for ManagementFactory.newPlatformMXBean().
+ * @run main/othervm MXBeanProxyTest
  * @author  Mandy Chung
  */
 import javax.management.*;
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Wed Jul 05 17:16:45 2017 +0200
@@ -41,9 +41,9 @@
 
 public class CollectionUsageThreshold {
     private static MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
-    private static List pools = ManagementFactory.getMemoryPoolMXBeans();
-    private static List managers = ManagementFactory.getMemoryManagerMXBeans();
-    private static Map result = new HashMap();
+    private static List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
+    private static List<MemoryManagerMXBean> managers = ManagementFactory.getMemoryManagerMXBeans();
+    private static Map<String, PoolRecord> result = new HashMap<>();
     private static boolean trace = false;
     private static boolean testFailed = false;
     private static final int EXPECTED_NUM_POOLS = 2;
@@ -119,8 +119,7 @@
         }
 
         // Find the Old generation which supports low memory detection
-        for (ListIterator iter = pools.listIterator(); iter.hasNext(); ) {
-            MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
+        for (MemoryPoolMXBean p : pools) {
             MemoryUsage u = p.getUsage();
             if (p.isUsageThresholdSupported() && p.isCollectionUsageThresholdSupported()) {
                 PoolRecord pr = new PoolRecord(p);
@@ -134,25 +133,30 @@
             throw new RuntimeException("Unexpected number of selected pools");
         }
 
-        checker = new Checker("Checker thread");
-        checker.setDaemon(true);
-        checker.start();
+        try {
+            checker = new Checker("Checker thread");
+            checker.setDaemon(true);
+            checker.start();
+
+            for (PoolRecord pr : result.values()) {
+                pr.getPool().setCollectionUsageThreshold(THRESHOLD);
+                System.out.println("Collection usage threshold of " +
+                    pr.getPool().getName() + " set to " + THRESHOLD);
+            }
 
-        for (Iterator iter = result.values().iterator(); iter.hasNext();) {
-            PoolRecord pr = (PoolRecord) iter.next();
-            pr.getPool().setCollectionUsageThreshold(THRESHOLD);
-            System.out.println("Collection usage threshold of " +
-                pr.getPool().getName() + " set to " + THRESHOLD);
-        }
+            SensorListener listener = new SensorListener();
+            NotificationEmitter emitter = (NotificationEmitter) mm;
+            emitter.addNotificationListener(listener, null, null);
 
-        SensorListener listener = new SensorListener();
-        NotificationEmitter emitter = (NotificationEmitter) mm;
-        emitter.addNotificationListener(listener, null, null);
-
-        mm.setVerbose(true);
-        for (int i = 0; i < NUM_GCS; i++) {
-            invokeGC();
-            checker.waitForCheckResult();
+            for (int i = 0; i < NUM_GCS; i++) {
+                invokeGC();
+                checker.waitForCheckResult();
+            }
+        } finally {
+            // restore the default
+            for (PoolRecord pr : result.values()) {
+                pr.getPool().setCollectionUsageThreshold(0);
+            }
         }
 
         if (testFailed)
@@ -168,8 +172,7 @@
         mm.gc();
 
         if (trace) {
-            for (Iterator iter = result.values().iterator(); iter.hasNext();) {
-                PoolRecord pr = (PoolRecord) iter.next();
+            for (PoolRecord pr : result.values()) {
                 System.out.println("Usage after GC for: " + pr.getPool().getName());
                 MemoryUtil.printMemoryUsage(pr.getPool().getUsage());
             }
@@ -200,8 +203,7 @@
             }
         }
         private void checkResult() {
-            for (Iterator iter = result.values().iterator(); iter.hasNext();) {
-                PoolRecord pr = (PoolRecord) iter.next();
+            for (PoolRecord pr : result.values()) {
                 if (pr.getListenerInvokedCount() != numGCs) {
                     throw new RuntimeException("Listeners invoked count = " +
                          pr.getListenerInvokedCount() + " expected to be " +
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -31,7 +31,7 @@
  * @author  Mandy Chung
  *
  * @build LowMemoryTest MemoryUtil
- * @run main/timeout=600 LowMemoryTest
+ * @run main/othervm/timeout=600 LowMemoryTest
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java	Wed Jul 05 17:16:45 2017 +0200
@@ -31,7 +31,7 @@
  * @author  Mandy Chung
  *
  * @build MemoryManagement MemoryUtil
- * @run main/timeout=600 MemoryManagement
+ * @run main/othervm/timeout=600 MemoryManagement
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryMXBean/Pending.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/MemoryMXBean/Pending.java	Wed Jul 05 17:16:45 2017 +0200
@@ -62,9 +62,21 @@
             trace = true;
         }
 
-        // Turn on verbose:gc to track GC
-        mbean.setVerbose(true);
+        try {
+            if (trace) {
+                // Turn on verbose:gc to track GC
+                mbean.setVerbose(true);
+            }
+            test();
+        } finally {
+            if (trace) {
+                mbean.setVerbose(false);
+            }
+        }
+        System.out.println("Test passed.");
+    }
 
+    private static void test() throws Exception {
         // Clean the memory and remove all objects that are pending
         // finalization
         System.gc();
@@ -130,7 +142,6 @@
                                      + " end = " + snapshot);
         }
 
-        System.out.println("Test passed.");
     }
 
     private static void checkFinalizerCount(int expectedTotal, int curFinalized)
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Wed Jul 05 17:16:45 2017 +0200
@@ -28,7 +28,7 @@
  * @author  Mandy Chung
  *
  * @build ResetPeakMemoryUsage MemoryUtil
- * @run main ResetPeakMemoryUsage
+ * @run main/othervm ResetPeakMemoryUsage
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,11 +37,23 @@
 public class ThresholdTest {
     public static void main(String args[]) throws Exception {
         List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
-        for (MemoryPoolMXBean p : pools) {
-            // verify if isUsageThresholdExceeded() returns correct value
-            checkUsageThreshold(p);
-            // verify if isCollectionUsageThresholdExceeded() returns correct value
-            checkCollectionUsageThreshold(p);
+        try {
+            for (MemoryPoolMXBean p : pools) {
+                // verify if isUsageThresholdExceeded() returns correct value
+                checkUsageThreshold(p);
+                // verify if isCollectionUsageThresholdExceeded() returns correct value
+                checkCollectionUsageThreshold(p);
+            }
+        } finally {
+            // restore the default
+            for (MemoryPoolMXBean p : pools) {
+                if (p.isUsageThresholdSupported()) {
+                    p.setUsageThreshold(0);
+                }
+                if (p.isCollectionUsageThresholdSupported()) {
+                    p.setCollectionUsageThreshold(0);
+                }
+            }
         }
 
         System.out.println("Test passed.");
--- a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,13 +37,18 @@
         = ManagementFactory.getRuntimeMXBean();
 
     public static void main(String argv[]) throws Exception {
+        long jvmStartTime = metrics.getStartTime();
         long systemStartOuter = System.currentTimeMillis();
         long metricsStart = metrics.getUptime();
         long systemStartInner = System.currentTimeMillis();
 
+        // This JVM might have been running for some time if this test runs
+        // in samevm mode.  The sanity check should apply to the test uptime.
+        long testUptime = metricsStart - (systemStartOuter - jvmStartTime);
+
         // If uptime is more than 30 minutes then it looks like a bug in
         // the method
-        if (metricsStart > TIMEOUT * 60 * 1000)
+        if (testUptime > TIMEOUT * 60 * 1000)
             throw new RuntimeException("Uptime of the JVM is more than 30 "
                                      + "minutes ("
                                      + (metricsStart / 60 / 1000)
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java	Wed Jul 05 17:16:45 2017 +0200
@@ -28,7 +28,7 @@
  * @author  Alexei Guibadoulline and Mandy Chung
  *
  * @run build Barrier
- * @run main AllThreadIds
+ * @run main/othervm AllThreadIds
  */
 
 import java.lang.management.*;
@@ -70,6 +70,12 @@
         }
     }
 
+    private static void fail(String msg) {
+        trace = true;
+        printThreadList();
+        throw new RuntimeException(msg);
+    }
+
     private static void checkThreadCount(int numNewThreads,
                                          int numTerminatedThreads)
         throws Exception {
@@ -82,27 +88,27 @@
 
         if ((curLiveThreadCount - prevLiveThreadCount) !=
             (numNewThreads - numTerminatedThreads)) {
-            throw new RuntimeException("Unexpected number of live threads: " +
-                " Prev Total = " + prevTotalThreadCount +
-                " Current Total = " + curTotalThreadCount +
+            fail("Unexpected number of live threads: " +
+                " Prev live = " + prevLiveThreadCount +
+                " Current live = " + curLiveThreadCount +
                 " Threads added = " + numNewThreads +
                 " Threads terminated = " + numTerminatedThreads);
         }
         if (curPeakThreadCount - prevPeakThreadCount != numNewThreads) {
-            throw new RuntimeException("Unexpected number of peak threads: " +
-                " Prev Total = " + prevTotalThreadCount +
-                " Current Total = " + curTotalThreadCount +
+            fail("Unexpected number of peak threads: " +
+                " Prev peak = " + prevPeakThreadCount +
+                " Current peak = " + curPeakThreadCount +
                 " Threads added = " + numNewThreads);
         }
         if (curTotalThreadCount - prevTotalThreadCount != numNewThreads) {
-            throw new RuntimeException("Unexpected number of total threads: " +
+            fail("Unexpected number of total threads: " +
                 " Prev Total = " + prevTotalThreadCount +
                 " Current Total = " + curTotalThreadCount +
                 " Threads added = " + numNewThreads);
         }
         long[] list = mbean.getAllThreadIds();
         if (list.length != curLiveThreadCount) {
-            throw new RuntimeException("Array length returned by " +
+            fail("Array length returned by " +
                 "getAllThreadIds() = " + list.length +
                 " not matched count = " + curLiveThreadCount);
         }
--- a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -36,8 +36,18 @@
     private static ThreadMXBean tm = ManagementFactory.getThreadMXBean();
 
     public static void main(String args[]) throws Exception {
-        testThreadContentionMonitoring();
-        testThreadCpuMonitoring();
+        try {
+            testThreadContentionMonitoring();
+            testThreadCpuMonitoring();
+        } finally {
+            // restore the default
+            if (tm.isThreadContentionMonitoringSupported()) {
+                tm.setThreadContentionMonitoringEnabled(false);
+            }
+            if (tm.isThreadCpuTimeSupported()) {
+                tm.setThreadCpuTimeEnabled(false);
+            }
+        }
 
         System.out.println("Test passed.");
     }
--- a/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -119,8 +119,19 @@
     }
 
     public static void main(String args[]) throws Exception {
-        testThreadContentionMonitoring();
-        testThreadCpuTime();
+        try {
+            testThreadContentionMonitoring();
+            testThreadCpuTime();
+        } finally {
+            // restore the default
+            if (tm.isThreadContentionMonitoringSupported()) {
+                tm.setThreadContentionMonitoringEnabled(false);
+            }
+            if (tm.isThreadCpuTimeSupported()) {
+                tm.setThreadCpuTimeEnabled(false);
+            }
+        }
+
 
         System.out.println("Test passed.");
     }
--- a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,7 +33,7 @@
  * @build MonitorDeadlock
  * @build SynchronizerDeadlock
  * @build ThreadDump
- * @run main FindDeadlocks
+ * @run main/othervm FindDeadlocks
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java	Wed Jul 05 17:16:45 2017 +0200
@@ -30,7 +30,7 @@
  *
  * @build MonitorDeadlock
  * @build ThreadDump
- * @run main FindMonitorDeadlock
+ * @run main/othervm FindMonitorDeadlock
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Wed Jul 05 17:16:45 2017 +0200
@@ -29,7 +29,7 @@
  * @author  Mandy Chung
  *
  * @build ThreadExecutionSynchronizer
- * @run main Locks
+ * @run main/othervm Locks
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/reflect/Proxy/Boxing.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/reflect/Proxy/Boxing.java	Wed Jul 05 17:16:45 2017 +0200
@@ -71,8 +71,8 @@
         Random random = new Random(42); // ensure consistent test domain
 
         Test proxy = (Test) Proxy.newProxyInstance(
-            ClassLoader.getSystemClassLoader(),
-            new Class[] { Test.class },
+            Test.class.getClassLoader(),
+            new Class<?>[] { Test.class },
             new TestHandler());
 
         for (int rep = 0; rep < REPS; rep++) {
--- a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java	Wed Jul 05 17:16:45 2017 +0200
@@ -54,16 +54,16 @@
             "\nTest of restrictions on parameters to Proxy.getProxyClass\n");
 
         try {
-            ClassLoader loader = ClassLoader.getSystemClassLoader();
-            Class[] interfaces;
-            Class proxyClass;
+            ClassLoader loader = ClassRestrictions.class.getClassLoader();
+            Class<?>[] interfaces;
+            Class<?> proxyClass;
 
             /*
              * All of the Class objects in the interfaces array must represent
              * interfaces, not classes or primitive types.
              */
             try {
-                interfaces = new Class[] { Object.class };
+                interfaces = new Class<?>[] { Object.class };
                 proxyClass = Proxy.getProxyClass(loader, interfaces);
                 throw new RuntimeException(
                     "proxy class created with java.lang.Object as interface");
@@ -73,7 +73,7 @@
                 // assume exception is for intended failure
             }
             try {
-                interfaces = new Class[] { Integer.TYPE };
+                interfaces = new Class<?>[] { Integer.TYPE };
                 proxyClass = Proxy.getProxyClass(loader, interfaces);
                 throw new RuntimeException(
                     "proxy class created with int.class as interface");
@@ -88,7 +88,7 @@
              * Class objects.
              */
             try {
-                interfaces = new Class[] { Bar.class, Bar.class };
+                interfaces = new Class<?>[] { Bar.class, Bar.class };
                 proxyClass = Proxy.getProxyClass(loader, interfaces);
                 throw new RuntimeException(
                     "proxy class created with repeated interfaces");
@@ -107,7 +107,7 @@
             Class altBarClass;
             altBarClass = Class.forName(Bar.class.getName(), false, altLoader);
             try {
-                interfaces = new Class[] { altBarClass };
+                interfaces = new Class<?>[] { altBarClass };
                 proxyClass = Proxy.getProxyClass(loader, interfaces);
                 throw new RuntimeException(
                     "proxy class created with interface " +
@@ -121,8 +121,8 @@
             /*
              * All non-public interfaces must be in the same package.
              */
-            Class nonPublic1 = Bashful.class;
-            Class nonPublic2 = null;
+            Class<?> nonPublic1 = Bashful.class;
+            Class<?> nonPublic2 = null;
             String[] nonPublicInterfaces = new String[] {
                 "java.awt.Conditional",
                 "java.util.zip.ZipConstants",
@@ -147,7 +147,7 @@
                     "no second non-public interface found for test");
             }
             try {
-                interfaces = new Class[] { nonPublic1, nonPublic2 };
+                interfaces = new Class<?>[] { nonPublic1, nonPublic2 };
                 proxyClass = Proxy.getProxyClass(loader, interfaces);
                 throw new RuntimeException(
                     "proxy class created with two non-public interfaces " +
@@ -163,7 +163,7 @@
              * parameter signature but different return type.
              */
             try {
-                interfaces = new Class[] { Bar.class, Baz.class };
+                interfaces = new Class<?>[] { Bar.class, Baz.class };
                 proxyClass = Proxy.getProxyClass(loader, interfaces);
                 throw new RuntimeException(
                     "proxy class created with conflicting methods");
--- a/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,7 +42,7 @@
 
     // additional test cases may be added to both of these lists:
 
-    private static final Class[][] GOOD = {
+    private static final Class<?>[][] GOOD = {
         { Collection.class },
         { Iterable.class, Collection.class },
         { Iterable.class, Collection.class, List.class },
@@ -51,7 +51,7 @@
           GetArray.class }
     };
 
-    private static final Class[][] BAD = {
+    private static final Class<?>[][] BAD = {
         { Runnable.class, PrivilegedAction.class },
         { GetSerializable.class, GetCloneable.class },
         { GetObject.class, GetSerializable.class, GetCloneable.class }
@@ -60,12 +60,12 @@
     public static void main(String[] args) throws Exception {
         System.err.println("\nRegression test for bug 4838310\n");
 
-        ClassLoader loader = ClassLoader.getSystemClassLoader();
+        ClassLoader loader = Test.class.getClassLoader();
 
         System.err.println("Testing GOOD combinations:");
 
         for (int i = 0; i < GOOD.length; i++) {
-            Class[] interfaces = GOOD[i];
+            Class<?>[] interfaces = GOOD[i];
             System.err.println(Arrays.asList(interfaces));
             Proxy.getProxyClass(loader, interfaces);
             System.err.println("--- OK.");
@@ -74,7 +74,7 @@
         System.err.println("Testing BAD combinations:");
 
         for (int i = 0; i < BAD.length; i++) {
-            Class[] interfaces = BAD[i];
+            Class<?>[] interfaces = BAD[i];
             System.err.println(Arrays.asList(interfaces));
             try {
                 Proxy.getProxyClass(loader, interfaces);
Binary file jdk/test/java/net/ResponseCache/file1.cache has changed
--- a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java	Wed Jul 05 17:16:45 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4460583 4470470 4840199 6419424 6710579 6596323 6824135
+ * @bug 4460583 4470470 4840199 6419424 6710579 6596323 6824135 6395224
  * @summary Comprehensive test of asynchronous closing and interruption
  * @author Mark Reinhold
  */
@@ -88,6 +88,9 @@
     }
 
     private static void pumpRefuser(String msg) throws IOException {
+        // Can't reliably saturate connection backlog on Windows Server editions
+        assert !TestUtil.onWindows();
+
         log.print(msg);
         int n = refuserClients.size();
 
@@ -203,9 +206,9 @@
         = new ChannelFactory("DatagramChannel") {
                 InterruptibleChannel create() throws IOException {
                     DatagramChannel dc = DatagramChannel.open();
-                    dc.socket().bind(wildcardAddress);
-                    InetAddress ia = InetAddress.getByName("127.0.0.1");
-                    dc.connect(new InetSocketAddress(ia, 80));
+                    InetAddress lb = InetAddress.getByName("127.0.0.1");
+                    dc.bind(new InetSocketAddress(lb, 0));
+                    dc.connect(new InetSocketAddress(lb, 80));
                     return dc;
                 }
             };
@@ -636,7 +639,8 @@
 
         wildcardAddress = new InetSocketAddress(InetAddress.getLocalHost(), 0);
         initAcceptor();
-        initRefuser();
+        if (!TestUtil.onWindows())
+            initRefuser();
         initPipes();
         initFile();
 
@@ -658,8 +662,15 @@
         // unclear under what conditions mmap(2) will actually block.
 
         test(connectedSocketChannelFactory);
-        test(socketChannelFactory, CONNECT);
-        test(socketChannelFactory, FINISH_CONNECT);
+
+        if (TestUtil.onWindows()) {
+            log.println("WARNING Cannot reliably test connect/finishConnect"
+                + " operations on Windows");
+        } else {
+            test(socketChannelFactory, CONNECT);
+            test(socketChannelFactory, FINISH_CONNECT);
+        }
+
         test(serverSocketChannelFactory, ACCEPT);
         test(datagramChannelFactory);
         test(pipeSourceChannelFactory);
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Wed Jul 05 17:16:45 2017 +0200
@@ -196,18 +196,16 @@
 
         System.out.println("-- connect to non-existent host --");
 
-        // test failure
-        InetAddress badHost = InetAddress.getByName("1.2.3.4");
-        if (!badHost.isReachable(10*1000)) {
-
-            ch = AsynchronousSocketChannel.open();
-            try {
-                ch.connect(new InetSocketAddress(badHost, 9876)).get();
-                throw new RuntimeException("Connection should not be established");
-            } catch (ExecutionException x) {
-            }
+        // test that failure to connect closes the channel
+        ch = AsynchronousSocketChannel.open();
+        try {
+            ch.connect(genSocketAddress()).get();
+        } catch (ExecutionException x) {
+            // failed to establish connection
             if (ch.isOpen())
                 throw new RuntimeException("Channel should be closed");
+        } finally {
+            ch.close();
         }
 
         server.close();
@@ -219,27 +217,22 @@
         AsynchronousSocketChannel ch;
 
         // asynchronous close while connecting
-        InetAddress rh = InetAddress.getByName("1.2.3.4");
-        if (!rh.isReachable(3000)) {
-            InetSocketAddress isa = new InetSocketAddress(rh, 1234);
+        ch = AsynchronousSocketChannel.open();
+        Future<Void> connectResult = ch.connect(genSocketAddress());
 
-            ch = AsynchronousSocketChannel.open();
-            Future<Void> result = ch.connect(isa);
-
-            // give time to initiate the connect (SYN)
-            Thread.sleep(50);
+        // give time to initiate the connect (SYN)
+        Thread.sleep(50);
 
-            // close
-            ch.close();
+        // close
+        ch.close();
 
-            // check that AsynchronousCloseException is thrown
-            try {
-                result.get();
-                throw new RuntimeException("Should not connect");
-            } catch (ExecutionException x) {
-                if (!(x.getCause() instanceof AsynchronousCloseException))
-                    throw new RuntimeException(x);
-            }
+        // check that exception is thrown in timely manner
+        try {
+            connectResult.get(5, TimeUnit.SECONDS);
+        } catch (TimeoutException x) {
+            throw new RuntimeException("AsynchronousCloseException not thrown");
+        } catch (ExecutionException x) {
+            // expected
         }
 
         System.out.println("-- asynchronous close when reading --");
@@ -785,30 +778,47 @@
         ch.close();
     }
 
-   // returns ByteBuffer with random bytes
-   static ByteBuffer genBuffer() {
-       int size = 1024 + rand.nextInt(16000);
-       byte[] buf = new byte[size];
-       rand.nextBytes(buf);
-       boolean useDirect = rand.nextBoolean();
-       if (useDirect) {
-           ByteBuffer bb = ByteBuffer.allocateDirect(buf.length);
-           bb.put(buf);
-           bb.flip();
-           return bb;
-       } else {
-           return ByteBuffer.wrap(buf);
-       }
-   }
+    // returns ByteBuffer with random bytes
+    static ByteBuffer genBuffer() {
+        int size = 1024 + rand.nextInt(16000);
+        byte[] buf = new byte[size];
+        rand.nextBytes(buf);
+        boolean useDirect = rand.nextBoolean();
+        if (useDirect) {
+            ByteBuffer bb = ByteBuffer.allocateDirect(buf.length);
+            bb.put(buf);
+            bb.flip();
+            return bb;
+        } else {
+            return ByteBuffer.wrap(buf);
+        }
+    }
 
-   // return ByteBuffer[] with random bytes
-   static ByteBuffer[] genBuffers(int max) {
-       int len = 1;
-       if (max > 1)
-           len += rand.nextInt(max);
-       ByteBuffer[] bufs = new ByteBuffer[len];
-       for (int i=0; i<len; i++)
-           bufs[i] = genBuffer();
-       return bufs;
-   }
+    // return ByteBuffer[] with random bytes
+    static ByteBuffer[] genBuffers(int max) {
+        int len = 1;
+        if (max > 1)
+            len += rand.nextInt(max);
+        ByteBuffer[] bufs = new ByteBuffer[len];
+        for (int i=0; i<len; i++)
+            bufs[i] = genBuffer();
+        return bufs;
+    }
+
+    // return random SocketAddress
+    static SocketAddress genSocketAddress() {
+        StringBuilder sb = new StringBuilder("10.");
+        sb.append(rand.nextInt(256));
+        sb.append('.');
+        sb.append(rand.nextInt(256));
+        sb.append('.');
+        sb.append(rand.nextInt(256));
+        InetAddress rh;
+        try {
+            rh = InetAddress.getByName(sb.toString());
+        } catch (UnknownHostException x) {
+            throw new InternalError("Should not happen");
+        }
+        return new InetSocketAddress(rh, rand.nextInt(65535)+1);
+    }
 }
--- a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java	Wed Jul 05 17:16:45 2017 +0200
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @bug 4313882 4981129
  * @summary Unit test for datagram-socket-channel adaptors
  * @library ..
  */
@@ -93,6 +94,11 @@
             if (ip.getData()[ip.getOffset() + i]
                 != op.getData()[op.getOffset() + i])
                 throw new Exception("Incorrect data received");
+
+        if (!(ip.getSocketAddress().equals(dst))) {
+            throw new Exception("Incorrect sender address, expected: " + dst
+                + " actual: " + ip.getSocketAddress());
+        }
     }
 
     static void test(InetSocketAddress dst,
--- a/jdk/test/java/nio/channels/DatagramChannel/Connect.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/Connect.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,15 +42,15 @@
     }
 
     static void test() throws Exception {
-        invoke(new Actor(), new Reactor());
+        Reactor r = new Reactor();
+        Actor a = new Actor(r.port());
+        invoke(a, r);
     }
 
     static void invoke(Sprintable reader, Sprintable writer) throws Exception {
 
         Thread writerThread = new Thread(writer);
         writerThread.start();
-        while (!writer.ready())
-            Thread.sleep(50);
 
         Thread readerThread = new Thread(reader);
         readerThread.start();
@@ -64,34 +64,31 @@
 
     public interface Sprintable extends Runnable {
         public void throwException() throws Exception;
-        public boolean ready();
     }
 
     public static class Actor implements Sprintable {
+        final int port;
         Exception e = null;
 
+        Actor(int port) {
+            this.port = port;
+        }
+
         public void throwException() throws Exception {
             if (e != null)
                 throw e;
         }
 
-        private volatile boolean ready = false;
-
-        public boolean ready() {
-            return ready;
-        }
-
         public void run() {
             try {
                 DatagramChannel dc = DatagramChannel.open();
-                ready = true;
 
                 // Send a message
                 ByteBuffer bb = ByteBuffer.allocateDirect(256);
                 bb.put("hello".getBytes());
                 bb.flip();
                 InetAddress address = InetAddress.getLocalHost();
-                InetSocketAddress isa = new InetSocketAddress(address, 8888);
+                InetSocketAddress isa = new InetSocketAddress(address, port);
                 dc.connect(isa);
                 dc.write(bb);
 
@@ -123,26 +120,26 @@
     }
 
     public static class Reactor implements Sprintable {
+        final DatagramChannel dc;
         Exception e = null;
 
+        Reactor() throws IOException {
+            dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        }
+
+        int port() {
+            return dc.socket().getLocalPort();
+        }
+
         public void throwException() throws Exception {
             if (e != null)
                 throw e;
         }
 
-        private volatile boolean ready = false;
-
-        public boolean ready() {
-            return ready;
-        }
-
         public void run() {
             try {
                 // Listen for a message
-                DatagramChannel dc = DatagramChannel.open();
-                dc.socket().bind(new InetSocketAddress(8888));
                 ByteBuffer bb = ByteBuffer.allocateDirect(100);
-                ready = true;
                 SocketAddress sa = dc.receive(bb);
                 bb.flip();
                 CharBuffer cb = Charset.forName("US-ASCII").
--- a/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,18 +42,16 @@
     }
 
     static void test() throws Exception {
-        Sprintable server = new Server();
+        Server server = new Server();
         Thread serverThread = new Thread(server);
         serverThread.start();
-        while (!server.ready())
-            Thread.sleep(50);
         DatagramChannel dc = DatagramChannel.open();
         ByteBuffer bb = ByteBuffer.allocateDirect(12);
         bb.order(ByteOrder.BIG_ENDIAN);
         bb.putInt(1).putLong(1);
         bb.flip();
         InetAddress address = InetAddress.getLocalHost();
-        InetSocketAddress isa = new InetSocketAddress(address, 8888);
+        InetSocketAddress isa = new InetSocketAddress(address, server.port());
         dc.connect(isa);
         dc.write(bb);
         bb.rewind();
@@ -65,24 +63,23 @@
         server.throwException();
     }
 
-    public interface Sprintable extends Runnable {
-        public void throwException() throws Exception;
-        public boolean ready();
-    }
+    public static class Server implements Runnable {
+        final DatagramChannel dc;
+        Exception e = null;
 
-    public static class Server implements Sprintable {
-        Exception e = null;
-        private volatile boolean ready = false;
+        Server() throws IOException {
+            this.dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        }
 
-        public void throwException() throws Exception {
+        int port() {
+            return dc.socket().getLocalPort();
+        }
+
+        void throwException() throws Exception {
             if (e != null)
                 throw e;
         }
 
-        public boolean ready() {
-            return ready;
-        }
-
         void showBuffer(String s, ByteBuffer bb) {
             log.println(s);
             bb.rewind();
@@ -97,9 +94,6 @@
             SocketAddress sa = null;
             int numberReceived = 0;
             try {
-                DatagramChannel dc = DatagramChannel.open();
-                dc.socket().bind(new InetSocketAddress(8888));
-                ready = true;
                 ByteBuffer bb = ByteBuffer.allocateDirect(12);
                 bb.clear();
                 // Only one clear. The buffer will be full after
--- a/jdk/test/java/nio/channels/DatagramChannel/NoSender.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/NoSender.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,7 +33,7 @@
 public class NoSender {
     public static void main(String argv[]) throws Exception {
         DatagramChannel dc = DatagramChannel.open();
-        dc.socket().bind(new InetSocketAddress(5441));
+        dc.socket().bind(new InetSocketAddress(0));
         dc.configureBlocking(false);
         ByteBuffer buf1 = ByteBuffer.allocateDirect(256);
         SocketAddress sa1 = dc.receive(buf1);
--- a/jdk/test/java/nio/channels/DatagramChannel/SRTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/SRTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,16 +42,23 @@
     }
 
     static void test() throws Exception {
-        invoke(new ClassicReader(), new ClassicWriter());
+        ClassicReader classicReader;
+        NioReader nioReader;
+
+        classicReader = new ClassicReader();
+        invoke(classicReader, new ClassicWriter(classicReader.port()));
         log.println("Classic RW: OK");
 
-        invoke(new ClassicReader(), new NioWriter());
+        classicReader = new ClassicReader();
+        invoke(classicReader, new NioWriter(classicReader.port()));
         log.println("Classic R, Nio W: OK");
 
-        invoke(new NioReader(), new ClassicWriter());
+        nioReader = new NioReader();
+        invoke(nioReader, new ClassicWriter(nioReader.port()));
         log.println("Classic W, Nio R: OK");
 
-        invoke(new NioReader(), new NioWriter());
+        nioReader = new NioReader();
+        invoke(nioReader, new NioWriter(nioReader.port()));
         log.println("Nio RW: OK");
     }
 
@@ -75,8 +82,13 @@
     }
 
     public static class ClassicWriter implements Sprintable {
+        final int port;
         Exception e = null;
 
+        ClassicWriter(int port) {
+            this.port = port;
+        }
+
         public void throwException() throws Exception {
             if (e != null)
                 throw e;
@@ -89,7 +101,7 @@
                 byte[] data = dataString.getBytes();
                 InetAddress address = InetAddress.getLocalHost();
                 DatagramPacket dp = new DatagramPacket(data, data.length,
-                                                       address, 8888);
+                                                       address, port);
                 ds.send(dp);
                 Thread.sleep(50);
                 ds.send(dp);
@@ -100,8 +112,13 @@
     }
 
     public static class NioWriter implements Sprintable {
+        final int port;
         Exception e = null;
 
+        NioWriter(int port) {
+            this.port = port;
+        }
+
         public void throwException() throws Exception {
             if (e != null)
                 throw e;
@@ -114,7 +131,7 @@
                 bb.put("hello".getBytes());
                 bb.flip();
                 InetAddress address = InetAddress.getLocalHost();
-                InetSocketAddress isa = new InetSocketAddress(address, 8888);
+                InetSocketAddress isa = new InetSocketAddress(address, port);
                 dc.send(bb, isa);
                 Thread.sleep(50);
                 dc.send(bb, isa);
@@ -125,8 +142,17 @@
     }
 
     public static class ClassicReader implements Sprintable {
+        final DatagramSocket ds;
         Exception e = null;
 
+        ClassicReader() throws IOException {
+            this.ds = new DatagramSocket();
+        }
+
+        int port() {
+            return ds.getLocalPort();
+        }
+
         public void throwException() throws Exception {
             if (e != null)
                 throw e;
@@ -136,7 +162,6 @@
             try {
                 byte[] buf = new byte[256];
                 DatagramPacket dp = new DatagramPacket(buf, buf.length);
-                DatagramSocket ds = new DatagramSocket(8888);
                 ds.receive(dp);
                 String received = new String(dp.getData());
                 log.println(received);
@@ -148,8 +173,17 @@
     }
 
     public static class NioReader implements Sprintable {
+        final DatagramChannel dc;
         Exception e = null;
 
+        NioReader() throws IOException {
+            this.dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        }
+
+        int port() {
+            return dc.socket().getLocalPort();
+        }
+
         public void throwException() throws Exception {
             if (e != null)
                 throw e;
@@ -157,8 +191,6 @@
 
         public void run() {
             try {
-                DatagramChannel dc = DatagramChannel.open();
-                dc.socket().bind(new InetSocketAddress(8888));
                 ByteBuffer bb = ByteBuffer.allocateDirect(100);
                 SocketAddress sa = dc.receive(bb);
                 bb.flip();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2010, 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 6935563
+ * @summary Test that Selector does not select an unconnected DatagramChannel when
+ *    ICMP port unreachable received
+ */
+
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.net.*;
+import java.io.IOException;
+
+public class SelectWhenRefused {
+
+    public static void main(String[] args) throws IOException {
+        DatagramChannel dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        int port = dc.socket().getLocalPort();
+        dc.close();
+
+        // datagram sent to this address should be refused
+        SocketAddress refuser = new InetSocketAddress(InetAddress.getLocalHost(), port);
+
+        dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        try {
+            dc.configureBlocking(false);
+            Selector sel = Selector.open();
+            dc.register(sel, SelectionKey.OP_READ);
+
+            /* Test 1: not connected so ICMP port unreachable should not be received */
+            sendDatagram(dc, refuser);
+            int n = sel.select(2000);
+            if (n > 0) {
+                throw new RuntimeException("Unexpected wakeup");
+            }
+
+            /* Test 2: connected so ICMP port unreachable may be received */
+            dc.connect(refuser);
+            try {
+                sendDatagram(dc, refuser);
+                n = sel.select(2000);
+                if (n > 0) {
+                    sel.selectedKeys().clear();
+                    try {
+                        n = dc.read(ByteBuffer.allocate(100));
+                        throw new RuntimeException("Unexpected datagram received");
+                    } catch (PortUnreachableException pue) {
+                        // expected
+                    }
+                }
+            } finally {
+                dc.disconnect();
+            }
+
+            /* Test 3: not connected so ICMP port unreachable should not be received */
+            sendDatagram(dc, refuser);
+            n = sel.select(2000);
+            if (n > 0) {
+                throw new RuntimeException("Unexpected wakeup after disconnect");
+            }
+
+        } finally {
+            dc.close();
+        }
+    }
+
+    static void sendDatagram(DatagramChannel dc, SocketAddress remote)
+        throws IOException
+    {
+        ByteBuffer bb = ByteBuffer.wrap("Greetings!".getBytes());
+        dc.send(bb, remote);
+    }
+}
--- a/jdk/test/java/nio/channels/DatagramChannel/Sender.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/Sender.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,13 +42,11 @@
     }
 
     static void test() throws Exception {
-        Sprintable server = new Server();
-        Sprintable client = new Client();
+        Server server = new Server();
+        Client client = new Client(server.port());
 
         Thread serverThread = new Thread(server);
         serverThread.start();
-        while (!server.ready())
-            Thread.sleep(50);
 
         Thread clientThread = new Thread(client);
         clientThread.start();
@@ -60,23 +58,17 @@
         client.throwException();
     }
 
-    public interface Sprintable extends Runnable {
-        public void throwException() throws Exception;
-        public boolean ready();
-    }
-
-    public static class Client implements Sprintable {
+    public static class Client implements Runnable {
+        final int port;
         Exception e = null;
 
-        public void throwException() throws Exception {
-            if (e != null)
-                throw e;
+        Client(int port) {
+            this.port = port;
         }
 
-        private volatile boolean ready = false;
-
-        public boolean ready() {
-            return ready;
+        void throwException() throws Exception {
+            if (e != null)
+                throw e;
         }
 
         public void run() {
@@ -87,7 +79,7 @@
                 bb.putInt(1).putLong(1);
                 bb.flip();
                 InetAddress address = InetAddress.getLocalHost();
-                InetSocketAddress isa = new InetSocketAddress(address, 8888);
+                InetSocketAddress isa = new InetSocketAddress(address, port);
                 dc.connect(isa);
                 dc.write(bb);
             } catch (Exception ex) {
@@ -96,19 +88,23 @@
         }
     }
 
-    public static class Server implements Sprintable {
+    public static class Server implements Runnable {
+        final DatagramChannel dc;
         Exception e = null;
-        private volatile boolean ready = false;
+
+        Server() throws IOException {
+            dc = DatagramChannel.open().bind(new InetSocketAddress(0));
+        }
 
-        public void throwException() throws Exception {
+        int port() {
+            return dc.socket().getLocalPort();
+        }
+
+        void throwException() throws Exception {
             if (e != null)
                 throw e;
         }
 
-        public boolean ready() {
-            return ready;
-        }
-
         void showBuffer(String s, ByteBuffer bb) {
             log.println(s);
             bb.rewind();
@@ -123,13 +119,10 @@
             SocketAddress sa = null;
 
             try {
-                DatagramChannel dc = DatagramChannel.open();
-                dc.socket().bind(new InetSocketAddress(8888));
-                dc.configureBlocking(false);
-                ready = true;
                 ByteBuffer bb = ByteBuffer.allocateDirect(12);
                 bb.clear();
                 // Get the one valid datagram
+                dc.configureBlocking(false);
                 while (sa == null)
                     sa = dc.receive(bb);
                 sa = null;
--- a/jdk/test/java/nio/channels/Selector/ByteServer.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/ByteServer.java	Wed Jul 05 17:16:45 2017 +0200
@@ -33,7 +33,6 @@
 
 public class ByteServer {
 
-    public static final int PORT = 31415;
     public static final String LOCALHOST = "localhost";
     private int bytecount;
     private Socket  socket;
@@ -43,7 +42,11 @@
 
     public ByteServer(int bytecount) throws Exception{
         this.bytecount = bytecount;
-        serversocket = new ServerSocket(PORT);
+        serversocket = new ServerSocket(0);
+    }
+
+    public int port() {
+        return serversocket.getLocalPort();
     }
 
     public void start() {
--- a/jdk/test/java/nio/channels/Selector/CloseThenRegister.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/CloseThenRegister.java	Wed Jul 05 17:16:45 2017 +0200
@@ -32,17 +32,19 @@
 public class CloseThenRegister {
 
     public static void main (String [] args) throws Exception {
+        Selector sel = Selector.open();
+        sel.close();
+        ServerSocketChannel ssc = ServerSocketChannel.open();
         try {
-            Selector s = Selector.open();
-            s.close();
-            ServerSocketChannel c = ServerSocketChannel.open();
-            c.socket().bind(new InetSocketAddress(40000));
-            c.configureBlocking(false);
-            c.register(s, SelectionKey.OP_ACCEPT);
+            ssc.bind(new InetSocketAddress(0));
+            ssc.configureBlocking(false);
+            ssc.register(sel, SelectionKey.OP_ACCEPT);
+            throw new RuntimeException("register after close does not cause CSE!");
         } catch (ClosedSelectorException cse) {
-            return;
+            // expected
+        } finally {
+            ssc.close();
         }
-        throw new RuntimeException("register after close does not cause CSE!");
     }
 
 }
--- a/jdk/test/java/nio/channels/Selector/OpRead.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/OpRead.java	Wed Jul 05 17:16:45 2017 +0200
@@ -24,59 +24,63 @@
 /* @test
  * @bug 4755720
  * @summary Test if OP_READ is detected with OP_WRITE in interestOps
- * @library ..
  */
 
 import java.net.*;
-import java.io.*;
 import java.nio.*;
 import java.nio.channels.*;
-import java.nio.channels.spi.SelectorProvider;
 import java.util.*;
 
 public class OpRead {
 
-    static final int DAYTIME_PORT = 13;
-    static final String DAYTIME_HOST = TestUtil.HOST;
+    static void test() throws Exception {
+        ServerSocketChannel ssc = null;
+        SocketChannel sc = null;
+        SocketChannel peer = null;
+        try {
+            ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0));
 
-    static void test() throws Exception {
-        InetSocketAddress isa
-            = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST),
-                                    DAYTIME_PORT);
-        SocketChannel sc = SocketChannel.open();
+            // loopback connection
+            InetAddress lh = InetAddress.getLocalHost();
+            sc = SocketChannel.open(new InetSocketAddress(lh, ssc.socket().getLocalPort()));
+            peer = ssc.accept();
 
-        sc.connect(isa);
-
-        sc.configureBlocking(false);
+            // peer sends message so that "sc" will be readable
+            int n = peer.write(ByteBuffer.wrap("Hello".getBytes()));
+            assert n > 0;
 
-        Selector selector = SelectorProvider.provider().openSelector();
-        SelectionKey key = sc.register(selector, SelectionKey.OP_READ |
-            SelectionKey.OP_WRITE);
+            sc.configureBlocking(false);
 
-        boolean done = false;
-        int failCount = 0;
-        while (!done) {
-            if (selector.select() > 0) {
-                Set keys = selector.selectedKeys();
-                Iterator iterator = keys.iterator();
-                while (iterator.hasNext()) {
-                    key = (SelectionKey)iterator.next();
-                    iterator.remove();
-                    if (key.isWritable()) {
-                        failCount++;
-                        if (failCount > 10)
-                            throw new RuntimeException("Test failed");
-                        Thread.sleep(100);
-                    }
-                    if (key.isReadable()) {
-                        done = true;
+            Selector selector = Selector.open();
+            SelectionKey key = sc.register(selector, SelectionKey.OP_READ |
+                SelectionKey.OP_WRITE);
+
+            boolean done = false;
+            int failCount = 0;
+            while (!done) {
+                if (selector.select() > 0) {
+                    Set<SelectionKey> keys = selector.selectedKeys();
+                    Iterator<SelectionKey> iterator = keys.iterator();
+                    while (iterator.hasNext()) {
+                        key = iterator.next();
+                        iterator.remove();
+                        if (key.isWritable()) {
+                            failCount++;
+                            if (failCount > 10)
+                                throw new RuntimeException("Test failed");
+                            Thread.sleep(250);
+                        }
+                        if (key.isReadable()) {
+                            done = true;
+                        }
                     }
                 }
             }
+        } finally {
+            if (peer != null) peer.close();
+            if (sc != null) sc.close();
+            if (ssc != null) ssc.close();
         }
-
-
-        sc.close();
     }
 
     public static void main(String[] args) throws Exception {
--- a/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,7 +37,7 @@
         ByteServer server = new ByteServer(0); // server: accept connection and do nothing
         server.start();
         InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), ByteServer.PORT);
+                InetAddress.getByName(ByteServer.LOCALHOST), server.port());
         Selector sel = Selector.open();
         SocketChannel sc = SocketChannel.open();
         sc.connect(isa);
--- a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,14 +37,14 @@
     final static int TIMEOUT = 1000;
 
     public static void main(String[] argv) throws Exception {
+        InetAddress lh = InetAddress.getByName(ByteServer.LOCALHOST);
+
         // server: accept connection and write one byte
         ByteServer server = new ByteServer(1);
         server.start();
-        InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), ByteServer.PORT);
         Selector sel = Selector.open();
         SocketChannel sc = SocketChannel.open();
-        sc.connect(isa);
+        sc.connect(new InetSocketAddress(lh, server.port()));
         sc.read(ByteBuffer.allocate(1));
         sc.configureBlocking(false);
         sc.register(sel, SelectionKey.OP_READ);
@@ -61,7 +61,7 @@
         server = new ByteServer(2);
         server.start();
         sc = SocketChannel.open();
-        sc.connect(isa);
+        sc.connect(new InetSocketAddress(lh, server.port()));
         sc.configureBlocking(false);
         sel = Selector.open();
         sc.register(sel, SelectionKey.OP_READ);
--- a/jdk/test/java/nio/channels/Selector/SelectWrite.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/SelectWrite.java	Wed Jul 05 17:16:45 2017 +0200
@@ -39,7 +39,7 @@
         // server: accept connection and do nothing
         server.start();
         InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), ByteServer.PORT);
+                InetAddress.getByName(ByteServer.LOCALHOST), server.port());
         Selector sel = Selector.open();
         SocketChannel sc = SocketChannel.open();
         sc.connect(isa);
--- a/jdk/test/java/nio/channels/SocketChannel/BigReadWrite.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/BigReadWrite.java	Wed Jul 05 17:16:45 2017 +0200
@@ -32,7 +32,6 @@
 
 public class BigReadWrite {
 
-    static int port = 40170;
     static int testSize = 15;
 
     public static void main(String[] args) throws Exception {
--- a/jdk/test/java/nio/channels/SocketChannel/OpenLeak.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/OpenLeak.java	Wed Jul 05 17:16:45 2017 +0200
@@ -25,6 +25,8 @@
  * @bug 6548464
  * @summary SocketChannel.open(SocketAddress) leaks file descriptor if
  *     connection cannot be established
+ * @build OpenLeak
+ * @run main/othervm OpenLeak
  */
 
 import java.net.InetAddress;
--- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java	Wed Jul 05 17:16:45 2017 +0200
@@ -36,8 +36,6 @@
 
 public class VectorIO {
 
-    static int port = 40170;
-
     static Random generator = new Random();
 
     static int testSize;
@@ -55,20 +53,12 @@
         System.err.println("Length " + testSize);
         Server sv = new Server(testSize);
         sv.start();
-        do {
-            try {
-                Thread.currentThread().sleep(200);
-            } catch (InterruptedException x) {
-                if (sv.finish(8000) == 0)
-                    throw new Exception("Failed: Error in server thread");
-            }
-        } while (!sv.ready);
-        bufferTest();
+        bufferTest(sv.port());
         if (sv.finish(8000) == 0)
             throw new Exception("Failed: Length = " + testSize);
     }
 
-    static void bufferTest() throws Exception {
+    static void bufferTest(int port) throws Exception {
         ByteBuffer[] bufs = new ByteBuffer[testSize];
         for(int i=0; i<testSize; i++) {
             String source = "buffer" + i;
@@ -105,17 +95,19 @@
     static class Server
         extends TestThread
     {
-        static int port = 40170;
-
         static Random generator = new Random();
 
-        int testSize;
+        final int testSize;
+        final ServerSocketChannel ssc;
 
-        volatile boolean ready = false;
-
-        Server(int testSize) {
+        Server(int testSize) throws IOException {
             super("Server " + testSize);
             this.testSize = testSize;
+            this.ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0));
+        }
+
+        int port() {
+            return ssc.socket().getLocalPort();
         }
 
         void go() throws Exception {
@@ -133,16 +125,11 @@
             }
 
             // Get a connection from client
-            ServerSocketChannel ssc = ServerSocketChannel.open();
             SocketChannel sc = null;
 
             try {
 
                 ssc.configureBlocking(false);
-                InetAddress lh = InetAddress.getLocalHost();
-                InetSocketAddress isa = new InetSocketAddress(lh, port);
-                ssc.socket().bind(isa);
-                ready = true;
 
                 for (;;) {
                     sc = ssc.accept();
--- a/jdk/test/java/nio/channels/SocketChannel/Write.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/Write.java	Wed Jul 05 17:16:45 2017 +0200
@@ -37,8 +37,6 @@
 
 public class Write {
 
-    static int port = 40170;
-
     static Random generator = new Random();
 
     static int testSize = 15;
@@ -46,20 +44,12 @@
     public static void main(String[] args) throws Exception {
         WriteServer sv = new WriteServer();
         sv.start();
-        do {
-            try {
-                Thread.currentThread().sleep(200);
-            } catch (InterruptedException x) {
-                if (sv.finish(8000) == 0)
-                    throw new Exception("Failed: Error in server thread");
-            }
-        } while (!sv.ready);
-        bufferTest();
+        bufferTest(sv.port());
         if (sv.finish(8000) == 0)
             throw new Exception("Failed" );
     }
 
-    static void bufferTest() throws Exception {
+    static void bufferTest(int port) throws Exception {
         ByteBuffer[] bufs = new ByteBuffer[testSize];
         for(int i=0; i<testSize; i++) {
             String source =
@@ -94,14 +84,18 @@
 
 class WriteServer extends TestThread {
 
-    static int port = 40170;
-
     static Random generator = new Random();
 
-    volatile boolean ready = false;
+
+    final ServerSocketChannel ssc;
 
-    WriteServer() {
+    WriteServer() throws IOException {
         super("WriteServer");
+        this.ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0));
+    }
+
+    int port() {
+        return ssc.socket().getLocalPort();
     }
 
     void go() throws Exception {
@@ -112,15 +106,10 @@
         ByteBuffer buf = ByteBuffer.allocateDirect(5);
 
         // Get a connection from client
-        ServerSocketChannel ssc = ServerSocketChannel.open();
         SocketChannel sc = null;
 
         try {
             ssc.configureBlocking(false);
-            InetAddress lh = InetAddress.getLocalHost();
-            InetSocketAddress isa = new InetSocketAddress(lh, port);
-            ssc.socket().bind(isa);
-            ready = true;
 
             for (;;) {
                 sc = ssc.accept();
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -141,7 +141,7 @@
         // and receive the echo
         byte b[] = new byte[msg.length() + 100];
         DatagramPacket pkt2 = new DatagramPacket(b, b.length);
-        dc.socket().setSoTimeout(2000);
+        dc.socket().setSoTimeout(5000);
         dc.socket().receive(pkt2);
 
         if (pkt2.getLength() != msg.length()) {
Binary file jdk/test/java/util/Locale/Bug4184873_he has changed
Binary file jdk/test/java/util/Locale/Bug4184873_id has changed
Binary file jdk/test/java/util/Locale/Bug4184873_yi has changed
--- a/jdk/test/java/util/ResourceBundle/Bug4168625Test.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/ResourceBundle/Bug4168625Test.java	Wed Jul 05 17:16:45 2017 +0200
@@ -427,9 +427,11 @@
         private boolean network = false;
 
         public SimpleLoader() {
+            super(SimpleLoader.class.getClassLoader());
             this.network = false;
         }
         public SimpleLoader(boolean simulateNetworkLoad) {
+            super(SimpleLoader.class.getClassLoader());
             this.network = simulateNetworkLoad;
         }
         public Class loadClass(final String className, final boolean resolveIt)
@@ -444,7 +446,7 @@
                         } catch (java.lang.InterruptedException e) {
                         }
                     }
-                    result = super.findSystemClass(className);
+                    result = getParent().loadClass(className);
                     if ((result != null) && resolveIt) {
                         resolveClass(result);
                     }
@@ -460,11 +462,13 @@
         private String[] classesToWaitFor;
 
         public Loader() {
+            super(Loader.class.getClassLoader());
             classesToLoad = new String[0];
             classesToWaitFor = new String[0];
         }
 
         public Loader(final String[] classesToLoadIn, final String[] classesToWaitForIn) {
+            super(Loader.class.getClassLoader());
             classesToLoad = classesToLoadIn;
             classesToWaitFor = classesToWaitForIn;
         }
@@ -540,10 +544,12 @@
         }
 
         /**
-         * Delegate loading to the system loader
+         * Delegate loading to its parent class loader that loads the test classes.
+         * In othervm mode, the parent class loader is the system class loader;
+         * in samevm mode, the parent class loader is the jtreg URLClassLoader.
          */
         private Class loadFromSystem(String className) throws ClassNotFoundException {
-            return super.findSystemClass(className);
+            return getParent().loadClass(className);
         }
 
         public void logClasses(String title) {
--- a/jdk/test/java/util/ResourceBundle/Bug6359330.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/ResourceBundle/Bug6359330.java	Wed Jul 05 17:16:45 2017 +0200
@@ -26,6 +26,7 @@
  * @summary Make sure that getBundle doesn't cause a security error
  * with a security manager when instantialing RBClassLoader (internal
  * classloader).
+ * @run main/othervm Bug6359330
  */
 
 import javax.xml.parsers.SAXParser;
--- a/jdk/test/java/util/ResourceBundle/Test4300693.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/ResourceBundle/Test4300693.java	Wed Jul 05 17:16:45 2017 +0200
@@ -22,6 +22,7 @@
  */
 /*
     @test
+    @ignore 6876961
     @summary test that ResourceBundle.getBundle can be called recursively
     @build  Test4300693RB
     @run main Test4300693
--- a/jdk/test/java/util/ResourceBundle/TestBug4179766.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/ResourceBundle/TestBug4179766.java	Wed Jul 05 17:16:45 2017 +0200
@@ -209,6 +209,7 @@
          * Create a new loader
          */
         public Loader(boolean sameHash) {
+            super(Loader.class.getClassLoader());
             if (sameHash) {
                 thisHashCode = SAME_HASH_CODE;
             } else {
@@ -287,7 +288,7 @@
          */
         private Class loadFromSystem(String className) throws ClassNotFoundException {
             try {
-                Class result = super.findSystemClass(className);
+                Class result = getParent().loadClass(className);
                 printInfo("        ***Returning system class: "+className, result);
                 return result;
             } catch (ClassNotFoundException e) {
--- a/jdk/test/java/util/logging/ParentLoggersTest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/logging/ParentLoggersTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -40,7 +40,19 @@
     static final String LOGGER_NAME_1   = PARENT_NAME_1 + ".myLogger";
     static final String LOGGER_NAME_2   = PARENT_NAME_2 + ".myBar.myLogger";
 
+    static final List<String> initialLoggerNames = new ArrayList<String>();
     public static void main(String args[]) throws Exception {
+        // cache the initial set of loggers before this test begins
+        // to add any loggers
+        Enumeration<String> e = logMgr.getLoggerNames();
+        List<String> defaultLoggers = getDefaultLoggerNames();
+        while (e.hasMoreElements()) {
+            String logger = e.nextElement();
+            if (!defaultLoggers.contains(logger)) {
+                initialLoggerNames.add(logger);
+            }
+        };
+
         String tstSrc = System.getProperty(TST_SRC_PROP);
         File   fname  = new File(tstSrc, LM_PROP_FNAME);
         String prop   = fname.getCanonicalPath();
@@ -56,12 +68,12 @@
         }
     }
 
-    public static Vector getDefaultLoggerNames() {
-        Vector expectedLoggerNames = new Vector(0);
+    public static List<String> getDefaultLoggerNames() {
+        List<String> expectedLoggerNames = new ArrayList<String>();
 
         // LogManager always creates two loggers:
-        expectedLoggerNames.addElement("");       // root   logger: ""
-        expectedLoggerNames.addElement("global"); // global logger: "global"
+        expectedLoggerNames.add("");       // root   logger: ""
+        expectedLoggerNames.add("global"); // global logger: "global"
         return expectedLoggerNames;
     }
 
@@ -71,7 +83,7 @@
      */
     public static boolean checkLoggers() {
         String failMsg = "# checkLoggers: getLoggerNames() returned unexpected loggers";
-        Vector expectedLoggerNames = getDefaultLoggerNames();
+        Vector<String> expectedLoggerNames = new Vector<String>(getDefaultLoggerNames());
 
         // Create the logger LOGGER_NAME_1
         Logger logger1 = Logger.getLogger(LOGGER_NAME_1);
@@ -83,18 +95,23 @@
         expectedLoggerNames.addElement(PARENT_NAME_2);
         expectedLoggerNames.addElement(LOGGER_NAME_2);
 
-        Enumeration returnedLoggersEnum = logMgr.getLoggerNames();
-        Vector      returnedLoggerNames = new Vector(0);
+        Enumeration<String> returnedLoggersEnum = logMgr.getLoggerNames();
+        Vector<String>      returnedLoggerNames = new Vector<String>(0);
         while (returnedLoggersEnum.hasMoreElements()) {
-            returnedLoggerNames.addElement(returnedLoggersEnum.nextElement());
+           String logger = returnedLoggersEnum.nextElement();
+            if (!initialLoggerNames.contains(logger)) {
+                // filter out the loggers that have been added before this test runs
+                returnedLoggerNames.addElement(logger);
+            }
+
         };
 
         return checkNames(expectedLoggerNames, returnedLoggerNames, failMsg);
     }
 
     // Returns boolean values: PASSED or FAILED
-    private static boolean checkNames(Vector expNames,
-                                      Vector retNames,
+    private static boolean checkNames(Vector<String> expNames,
+                                      Vector<String> retNames,
                                       String failMsg) {
         boolean status = PASSED;
 
@@ -123,8 +140,8 @@
         return status;
     }
 
-    private static void printFailMsg(Vector expNames,
-                                     Vector retNames,
+    private static void printFailMsg(Vector<String> expNames,
+                                     Vector<String> retNames,
                                      String failMsg) {
         out.println();
         out.println(failMsg);
--- a/jdk/test/java/util/zip/InfoZip.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/zip/InfoZip.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, 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
@@ -103,19 +103,25 @@
         os.close();
 
         ZipFile zf = new ZipFile(f);
-        Enumeration<? extends ZipEntry> entries = zf.entries();
-        ZipEntry ze = entries.nextElement();
-        check(! entries.hasMoreElements());
-        checkZipEntry(ze, contents(zf, ze));
-        zf.close();
+        ZipEntry ze = null;
+        try {
+            Enumeration<? extends ZipEntry> entries = zf.entries();
+            ze = entries.nextElement();
+            check(! entries.hasMoreElements());
+            checkZipEntry(ze, contents(zf, ze));
+        } finally {
+            zf.close();
+        }
 
         ZipInputStream is = new ZipInputStream(new FileInputStream(f));
-        ze = is.getNextEntry();
-        checkZipEntry(ze, contents(is));
-        check(is.getNextEntry() == null);
-
+        try {
+            ze = is.getNextEntry();
+            checkZipEntry(ze, contents(is));
+            check(is.getNextEntry() == null);
+        } finally {
+            is.close();
+        }
         f.delete();
-
         System.out.printf("passed = %d, failed = %d%n", passed, failed);
         if (failed > 0) throw new Exception("Some tests failed");
     }
--- a/jdk/test/java/util/zip/ZipFile/Comment.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/zip/ZipFile/Comment.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -58,13 +58,16 @@
         throws IOException
     {
         ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(name));
-        zos.setComment(comment);
-        ZipEntry ze = new ZipEntry(entryName);
-        ze.setMethod(ZipEntry.DEFLATED);
-        zos.putNextEntry(ze);
-        new DataOutputStream(zos).writeUTF(entryContents);
-        zos.closeEntry();
-        zos.close();
+        try {
+            zos.setComment(comment);
+            ZipEntry ze = new ZipEntry(entryName);
+            ze.setMethod(ZipEntry.DEFLATED);
+            zos.putNextEntry(ze);
+            new DataOutputStream(zos).writeUTF(entryContents);
+            zos.closeEntry();
+        } finally {
+            zos.close();
+        }
     }
 
     private static void verifyZipFile(String name, String comment)
@@ -91,6 +94,8 @@
         file.seek(file.length() - comment.length());
         byte [] bytes = new byte [comment.length()];
         file.readFully(bytes);
+        zipFile.close();
+        file.close();
         if (! comment.equals(new String(bytes, "UTF8")))
             throw new Exception("Zip file comment corrupted");
     }
--- a/jdk/test/java/util/zip/ZipFile/CorruptedZipFiles.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/zip/ZipFile/CorruptedZipFiles.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, 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
@@ -47,13 +47,14 @@
     }
 
     public static void main(String[] args) throws Exception {
-        ZipOutputStream zos = new ZipOutputStream(
-            new FileOutputStream("x.zip"));
-        ZipEntry e = new ZipEntry("x");
-        zos.putNextEntry(e);
-        zos.write((int)'x');
-        zos.close();
-        zos = null;
+        ZipOutputStream zos = new ZipOutputStream(new FileOutputStream("x.zip"));
+        try {
+            ZipEntry e = new ZipEntry("x");
+            zos.putNextEntry(e);
+            zos.write((int)'x');
+        } finally {
+            zos.close();
+        }
 
         int len = (int)(new File("x.zip").length());
         byte[] good = new byte[len];
@@ -153,12 +154,15 @@
             fos.write(data);
             fos.close();
             ZipFile zf = new ZipFile(zipName);
-            if (getInputStream) {
-                InputStream is = zf.getInputStream(new ZipEntry("x"));
-                is.read();
+            try {
+                if (getInputStream) {
+                    InputStream is = zf.getInputStream(new ZipEntry("x"));
+                    is.read();
+                }
+            } finally {
+                zf.close();
             }
             fail("Failed to throw expected ZipException");
-            zf.close();
         } catch (ZipException e) {
             if (e.getMessage().matches(msgPattern))
                 passed++;
--- a/jdk/test/java/util/zip/ZipFile/ManyEntries.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/java/util/zip/ZipFile/ManyEntries.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,52 +55,58 @@
         File zipFile = new File(++uniquifier + ".zip");
         try {
             zipFile.delete();
-            ZipOutputStream zos =
-                new ZipOutputStream(
-                    new BufferedOutputStream(
-                        new FileOutputStream(zipFile)));
-            for (int i = 0; i < N; i++) {
-                ZipEntry e = new ZipEntry("DIR/"+i);
-                e.setMethod(method);
-                e.setTime(time);
-                if (method == ZipEntry.STORED) {
-                    e.setSize(1);
-                    crc32.reset();
-                    crc32.update((byte)i);
-                    e.setCrc(crc32.getValue());
-                } else {
-                    e.setSize(0);
-                    e.setCrc(0);
+            ZipOutputStream zos = new ZipOutputStream(
+                new BufferedOutputStream(
+                    new FileOutputStream(zipFile)));
+            try {
+                for (int i = 0; i < N; i++) {
+                    ZipEntry e = new ZipEntry("DIR/"+i);
+                    e.setMethod(method);
+                    e.setTime(time);
+                    if (method == ZipEntry.STORED) {
+                        e.setSize(1);
+                        crc32.reset();
+                        crc32.update((byte)i);
+                        e.setCrc(crc32.getValue());
+                    } else {
+                        e.setSize(0);
+                        e.setCrc(0);
+                    }
+                    zos.putNextEntry(e);
+                    zos.write(i);
                 }
-                zos.putNextEntry(e);
-                zos.write(i);
+            } finally {
+                zos.close();
+                zos = null;
             }
-            zos.close();
-            zos = null;
 
-            ZipFile zip = new ZipFile(zipFile);
-            if (! (zip.size() == N))
-                throw new Exception("Bad ZipFile size: " + zip.size());
-            Enumeration entries = zip.entries();
+            ZipFile zip = zip = new ZipFile(zipFile);
+            try {
+                if (! (zip.size() == N))
+                    throw new Exception("Bad ZipFile size: " + zip.size());
+                Enumeration entries = zip.entries();
 
-            for (int i = 0; i < N; i++) {
-                if (i % 1000 == 0) {System.gc(); System.runFinalization();}
-                if (! (entries.hasMoreElements()))
-                    throw new Exception("only " + i + " elements");
-                ZipEntry e = (ZipEntry)entries.nextElement();
-                if (! (e.getSize() == 1))
-                    throw new Exception("bad size: " + e.getSize());
-                if (! (e.getName().equals("DIR/" + i)))
-                    throw new Exception("bad name: " + i);
-                if (! (e.getMethod() == method))
-                    throw new Exception("getMethod="+e.getMethod()+", method=" + method);
-                if (! (e.getTime() == time))
-                    throw new Exception("getTime="+e.getTime()+", time=" + time);
-                if (! (zip.getInputStream(e).read() == (i & 0xff)))
-                    throw new Exception("Bad file contents: " + i);
+                for (int i = 0; i < N; i++) {
+                    if (i % 1000 == 0) {System.gc(); System.runFinalization();}
+                    if (! (entries.hasMoreElements()))
+                        throw new Exception("only " + i + " elements");
+                    ZipEntry e = (ZipEntry)entries.nextElement();
+                    if (! (e.getSize() == 1))
+                        throw new Exception("bad size: " + e.getSize());
+                    if (! (e.getName().equals("DIR/" + i)))
+                        throw new Exception("bad name: " + i);
+                    if (! (e.getMethod() == method))
+                        throw new Exception("getMethod="+e.getMethod()+", method=" + method);
+                    if (! (e.getTime() == time))
+                        throw new Exception("getTime="+e.getTime()+", time=" + time);
+                    if (! (zip.getInputStream(e).read() == (i & 0xff)))
+                        throw new Exception("Bad file contents: " + i);
+                }
+                if (entries.hasMoreElements())
+                    throw new Exception("too many elements");
+            } finally {
+                zip.close();
             }
-            if (entries.hasMoreElements())
-                throw new Exception("too many elements");
         }
         finally {
             zipFile.delete();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/6788484/bug6788484.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6788484
+   @summary NPE in DefaultTableCellHeaderRenderer.getColumnSortOrder() with null table
+   @author Alexander Potochkin
+   @run main bug6788484
+*/
+import sun.swing.table.DefaultTableCellHeaderRenderer;
+
+import javax.swing.*;
+
+public class bug6788484 {
+
+    public static void main(String[] args) throws Exception {
+        DefaultTableCellHeaderRenderer.getColumnSortOrder(null, 0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/6771547/SynthTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010, 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 6771547
+ * @author Alexander Potochkin
+ * @summary SynthParser throws StringIndexOutOfBoundsException parsing custom ColorTypes
+ */
+
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.*;
+import java.io.InputStream;
+import java.awt.*;
+
+public class SynthTest {
+
+    public static void main(String[] args) throws Exception {
+        SynthLookAndFeel laf = new SynthLookAndFeel();
+        InputStream in = SynthTest.class.getResourceAsStream(
+                "synthconfig.xml");
+        laf.load(in, SynthTest.class);
+
+        UIManager.setLookAndFeel(laf);
+
+        if (!Color.RED.equals(new JButton().getForeground())) {
+            throw new RuntimeException("The wrong foreground color!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/6771547/synthconfig.xml	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,10 @@
+<synth>
+    <style id="button">
+        <font name="Verdana" size="16"/>
+        <state>
+            <color value="RED"
+                   type="javax.swing.plaf.synth.ColorType.FOREGROUND"/>
+        </state>
+    </style>
+    <bind style="button" type="region" key="button"/>
+</synth>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/SynthToolBarUI/6739756/bug6739756.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6739756
+ * @author Alexander Potochkin
+ * @summary JToolBar leaves space for non-visible items under Nimbus L&F
+ * @run main bug6739756
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+public class bug6739756 {
+
+    public static void main(String[] args) throws Exception {
+        try {
+           UIManager.setLookAndFeel(
+                   "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            return;
+        }
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JToolBar tb = new JToolBar();
+                Dimension preferredSize = tb.getPreferredSize();
+                JButton button = new JButton("Test");
+                button.setVisible(false);
+                tb.add(button);
+                if (!preferredSize.equals(tb.getPreferredSize())) {
+                    throw new RuntimeException("Toolbar's preferredSize is wrong");
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010, 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 6636983
+ * @summary test that composed text at the line starts is handled correctly
+ * @author Sergey Groznyh
+ * @run main bug6636983
+ */
+
+import sun.swing.SwingUtilities2;
+
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.text.html.HTMLDocument;
+import java.awt.*;
+import java.awt.event.InputMethodEvent;
+import java.awt.event.KeyEvent;
+import java.text.AttributedString;
+
+public class bug6636983 {
+    private Robot robot;
+
+    private final AttributedString Hiragana_A = new AttributedString("\u3042");
+
+    void sendInputMethodEvent() {
+        InputMethodEvent ime = new InputMethodEvent(
+                ep,
+                InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
+                Hiragana_A.getIterator(),
+                0,
+                null,
+                null);
+        ep.dispatchEvent(ime);
+    }
+
+    void checkComposedTextRun() {
+        HTMLDocument d = (HTMLDocument) ep.getDocument();
+        ElementIterator it = new ElementIterator(d.getDefaultRootElement());
+
+        while (true) {
+            Element e = it.next();
+            if (e == null) {
+                throw new RuntimeException("no composed text found");
+            }
+            AttributeSet a = e.getAttributes();
+            if (a.isDefined(StyleConstants.ComposedTextAttribute)) {
+                if (!AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute))) {
+                    throw new RuntimeException("AbstractDocument.ContentElementName.equals(a.getAttribute(StyleConstants.NameAttribute)) is false");
+                }
+
+                if (a.isDefined(SwingUtilities2.IMPLIED_CR)) {
+                    throw new RuntimeException("a.isDefined(SwingUtilities2.IMPLIED_CR) is true");
+                }
+
+                return;
+            }
+        }
+
+    }
+
+    JEditorPane ep;
+
+    void initAtParagraphStart() {
+        ep.setText("A<p>B");
+        hitKey(KeyEvent.VK_LEFT);
+    }
+
+    void sendAtParagraphStart() {
+        sendInputMethodEvent();
+    }
+
+    void checkAtParagraphStart() {
+        checkComposedTextRun();
+    }
+
+    void initAfterBRElement() {
+        ep.setText("A<br>B");
+        hitKey(KeyEvent.VK_LEFT);
+    }
+
+    void sendAtBRElement() {
+        sendInputMethodEvent();
+    }
+
+    void checkAtBrElement() {
+        checkComposedTextRun();
+    }
+
+    private void hitKey(int keycode) {
+        robot.keyPress(keycode);
+        robot.keyRelease(keycode);
+        robot.delay(550); // The magic number equals JRobot.DEFAULT_DELAY
+    }
+
+    private void run() throws Exception {
+        robot = new Robot();
+
+        ep = new JEditorPane();
+        ep.setContentType("text/html");
+        ep.setPreferredSize(new Dimension(100, 100));
+
+        JFrame frame = new JFrame("Test: " + getClass().getName());
+
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.add(ep);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Throwable {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                try {
+                    bug6636983 bug6636983 = new bug6636983();
+
+                    bug6636983.run();
+                    bug6636983.initAtParagraphStart();
+                    bug6636983.sendAtParagraphStart();
+                    bug6636983.checkAtParagraphStart();
+                    bug6636983.initAfterBRElement();
+                    bug6636983.sendAtBRElement();
+                    bug6636983.checkAtBrElement();
+
+                    System.out.println("OK");
+                } catch (Exception e) {
+                    throw new RuntimeException("The test failed", e);
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubBranchElement.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import javax.swing.text.*;
+
+class StubBranchElement implements Element {
+    Document document = new DefaultStyledDocument();
+    String context;
+    Element[] children = new StubLeafElement[3];
+
+    public StubBranchElement(String context) {
+        this.context = context;
+        int len = context.length() / 3;
+        for (int i = 0; i < 3; i++) {
+            children[i] = new StubLeafElement(
+                    context.substring(len * i, len * (i + 1)), this, len * i);
+        }
+        try {
+            document.insertString(0, context, new SimpleAttributeSet());
+        } catch (BadLocationException e) {
+        }
+    }
+
+    public Document getDocument() {
+        return document;
+    }
+
+    public Element getParentElement() {
+        return null;
+    }
+
+    public String getName() {
+        return "StubBranchElement";
+    }
+
+    public AttributeSet getAttributes() {
+        return new SimpleAttributeSet();
+    }
+
+    public int getStartOffset() {
+        return 0;
+    }
+
+    public int getEndOffset() {
+        return document.getLength();
+    }
+
+    public int getElementIndex(int offset) {
+        return offset / 3;
+    }
+
+    public int getElementCount() {
+        return 3;
+    }
+
+    public Element getElement(int index) {
+        return children[index];
+    }
+
+    public boolean isLeaf() {
+        return false;
+    }
+
+    public Element[] getChildren() {
+        return children;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubLeafElement.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import javax.swing.text.*;
+
+class StubLeafElement implements Element {
+    Document document = new DefaultStyledDocument();
+    String context;
+    Element parent;
+    int position;
+
+    public StubLeafElement(String context, Element parent, int position) {
+        this.context = context;
+        this.parent = parent;
+        this.position = position;
+        try {
+            document.insertString(0, context, new SimpleAttributeSet());
+        } catch (BadLocationException e) {
+        }
+    }
+
+    public Document getDocument() {
+        return document;
+    }
+
+    public Element getParentElement() {
+        return parent;
+    }
+
+    public String getName() {
+        return "StubLeafElement";
+    }
+
+    public AttributeSet getAttributes() {
+        return new SimpleAttributeSet();
+    }
+
+    public int getStartOffset() {
+        return position;
+    }
+
+    public int getEndOffset() {
+        return position + document.getLength();
+    }
+
+    public int getElementIndex(int offset) {
+        return 0;
+    }
+
+    public int getElementCount() {
+        return 0;
+    }
+
+    public Element getElement(int index) {
+        return this;
+    }
+
+    public boolean isLeaf() {
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/WrappedPlainView/6857057/bug6857057.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6857057
+ * @summary test that the JCK GlyphView2021 test doesn't fail
+ * @author Sergey Groznyh
+ * @run main bug6857057
+ */
+
+import javax.swing.*;
+import javax.swing.text.Element;
+import javax.swing.text.GlyphView;
+import javax.swing.text.View;
+
+public class bug6857057 {
+
+    bug6857057() {
+        Element elem = new StubBranchElement(" G L Y P H V");
+        GlyphView view = new GlyphView(elem);
+        float pos = elem.getStartOffset();
+        float len = elem.getEndOffset() - pos;
+        int res = view.getBreakWeight(View.X_AXIS, pos, len);
+        if (res != View.ExcellentBreakWeight) {
+            throw new RuntimeException("breakWeight != ExcellentBreakWeight");
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                new bug6857057();
+            }
+        });
+
+        System.out.println("OK");
+    }
+}
--- a/jdk/test/sun/jvmstat/testlibrary/utils.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/jvmstat/testlibrary/utils.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -189,3 +189,37 @@
         echo "Error sending term signal to ${kpid}!"
     fi
 }
+
+# check to see if a port is free
+checkPort() # port
+{
+    inuse=`netstat -a | egrep "\.$1"`
+    if [ "${inuse}" = "" ] ; then
+      echo "free"
+    else
+      echo "inuse"
+    fi
+}
+
+# Get a free port, where port+1 is also free, return 0 when giving up
+freePort()
+{
+  start=3000
+  while [ ${start} -lt 3030 ] ; do
+    port1=`expr ${start} '+' $$ '%' 1000`
+    port2=`expr ${port1} '+' 1`
+    if [ "`checkPort ${port1}`" = "inuse" \
+         -o "`checkPort ${port2}`" = "inuse" ] ; then
+      start=`expr ${start} '+' 1`
+    else
+      break
+    fi
+  done
+  if [ "`checkPort ${port1}`" = "inuse" \
+       -o "`checkPort ${port2}`" = "inuse" ] ; then
+    port1="0"
+  fi
+  echo "${port1}"
+}
+
+
--- a/jdk/test/sun/security/krb5/auto/Context.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/security/krb5/auto/Context.java	Wed Jul 05 17:16:45 2017 +0200
@@ -42,6 +42,7 @@
 import com.sun.security.jgss.ExtendedGSSContext;
 import com.sun.security.jgss.InquireType;
 import com.sun.security.jgss.AuthorizationDataEntry;
+import java.io.File;
 
 /**
  * Context of a JGSS subject, encapsulating Subject and GSSContext.
@@ -107,7 +108,8 @@
      * Logins with a username and a password, using Krb5LoginModule directly
      * @param storeKey true if key should be saved, used on acceptor side
      */
-    public static Context fromUserPass(String user, char[] pass, boolean storeKey) throws Exception {
+    public static Context fromUserPass(String user, char[] pass, boolean storeKey)
+            throws Exception {
         Context out = new Context();
         out.name = user;
         out.s = new Subject();
@@ -137,6 +139,33 @@
     }
 
     /**
+     * Logins with a username and a keytab, using Krb5LoginModule directly
+     * @param storeKey true if key should be saved, used on acceptor side
+     */
+    public static Context fromUserKtab(String user, String ktab, boolean storeKey)
+            throws Exception {
+        Context out = new Context();
+        out.name = user;
+        out.s = new Subject();
+        Krb5LoginModule krb5 = new Krb5LoginModule();
+        Map<String, String> map = new HashMap<String, String>();
+
+        map.put("doNotPrompt", "true");
+        map.put("useTicketCache", "false");
+        map.put("useKeyTab", "true");
+        map.put("keyTab", ktab);
+        map.put("principal", user);
+        if (storeKey) {
+            map.put("storeKey", "true");
+        }
+
+        krb5.initialize(out.s, null, null, map);
+        krb5.login();
+        krb5.commit();
+        return out;
+    }
+
+    /**
      * Starts as a client
      * @param target communication peer
      * @param mech GSS mech
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Wed Jul 05 17:16:45 2017 +0200
@@ -35,6 +35,7 @@
 import sun.security.krb5.*;
 import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.ccache.CredentialsCache;
+import sun.security.krb5.internal.crypto.EType;
 import sun.security.krb5.internal.crypto.KeyUsage;
 import sun.security.krb5.internal.ktab.KeyTab;
 import sun.security.util.DerInputStream;
@@ -153,6 +154,14 @@
          * Whether pre-authentication is required. Default Boolean.TRUE
          */
         PREAUTH_REQUIRED,
+        /**
+         * Only issue TGT in RC4
+         */
+        ONLY_RC4_TGT,
+        /**
+         * Only use RC4 in preauth, enc-type still using eTypes[0]
+         */
+        ONLY_RC4_PREAUTH,
     };
 
     static {
@@ -743,13 +752,25 @@
             Field f = KDCReqBody.class.getDeclaredField("eType");
             f.setAccessible(true);
             eTypes = (int[])f.get(body);
-            if (eTypes.length < 2) {
-                throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
-            }
             int eType = eTypes[0];
 
             EncryptionKey ckey = keyForUser(body.cname, eType, false);
             EncryptionKey skey = keyForUser(body.sname, eType, true);
+
+            if (options.containsKey(KDC.Option.ONLY_RC4_TGT)) {
+                int tgtEType = EncryptedData.ETYPE_ARCFOUR_HMAC;
+                boolean found = false;
+                for (int i=0; i<eTypes.length; i++) {
+                    if (eTypes[i] == tgtEType) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
+                }
+                skey = keyForUser(body.sname, tgtEType, true);
+            }
             if (ckey == null) {
                 throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
             }
@@ -799,7 +820,8 @@
                     Constructor<EncryptedData> ctor = EncryptedData.class.getDeclaredConstructor(DerValue.class);
                     ctor.setAccessible(true);
                     EncryptedData data = ctor.newInstance(new DerValue(pas[0].getValue()));
-                    data.decrypt(ckey, KeyUsage.KU_PA_ENC_TS);
+                    EncryptionKey pakey = keyForUser(body.cname, data.getEType(), false);
+                    data.decrypt(pakey, KeyUsage.KU_PA_ENC_TS);
                 } catch (Exception e) {
                     throw new KrbException(Krb5.KDC_ERR_PREAUTH_FAILED);
                 }
@@ -887,7 +909,11 @@
                         ke.returnCode() == Krb5.KDC_ERR_PREAUTH_FAILED) {
                     PAData pa;
 
-                    ETypeInfo2 ei2 = new ETypeInfo2(eTypes[0], null, null);
+                    int epa = eTypes[0];
+                    if (options.containsKey(KDC.Option.ONLY_RC4_PREAUTH)) {
+                        epa = EncryptedData.ETYPE_ARCFOUR_HMAC;
+                    }
+                    ETypeInfo2 ei2 = new ETypeInfo2(epa, null, null);
                     DerOutputStream eid = new DerOutputStream();
                     eid.write(DerValue.tag_Sequence, ei2.asn1Encode());
 
@@ -906,7 +932,7 @@
                         }
                     }
                     if (allOld) {
-                        ETypeInfo ei = new ETypeInfo(eTypes[0], null);
+                        ETypeInfo ei = new ETypeInfo(epa, null);
                         eid = new DerOutputStream();
                         eid.write(DerValue.tag_Sequence, ei.asn1Encode());
                         pa = new PAData(Krb5.PA_ETYPE_INFO, eid.toByteArray());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/W83.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2010, 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 6932525 6951366 6959292
+ * @summary kerberos login failure on win2008 with AD set to win2000 compat mode
+ * and cannot login if session key and preauth does not use the same etype
+ */
+import com.sun.security.auth.module.Krb5LoginModule;
+import java.io.File;
+import sun.security.krb5.Config;
+import sun.security.krb5.EncryptedData;
+import sun.security.krb5.PrincipalName;
+import sun.security.krb5.internal.crypto.EType;
+import sun.security.krb5.internal.ktab.KeyTab;
+
+public class W83 {
+    public static void main(String[] args) throws Exception {
+
+        W83 x = new W83();
+
+        // Cannot use OneKDC. kinit command cannot resolve
+        // hostname kdc.rabbit.hole
+        KDC kdc = new KDC(OneKDC.REALM, "127.0.0.1", 0, true);
+        kdc.addPrincipal(OneKDC.USER, OneKDC.PASS);
+        kdc.addPrincipalRandKey("krbtgt/" + OneKDC.REALM);
+        KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
+        System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
+        Config.refresh();
+
+        kdc.writeKtab(OneKDC.KTAB);
+        new File(OneKDC.KRB5_CONF).deleteOnExit();
+        new File(OneKDC.KTAB).deleteOnExit();
+
+        KeyTab ktab = KeyTab.getInstance(OneKDC.KTAB);
+        for (int etype: EType.getBuiltInDefaults()) {
+            if (etype != EncryptedData.ETYPE_ARCFOUR_HMAC) {
+                ktab.deleteEntry(new PrincipalName(OneKDC.USER), etype);
+            }
+        }
+        ktab.save();
+
+        // For 6932525 and 6951366, make sure the etypes sent in 2nd AS-REQ
+        // is not restricted to that of preauth
+        kdc.setOption(KDC.Option.ONLY_RC4_TGT, true);
+        x.go();
+
+        // For 6959292, make sure that when etype for enc-part in 2nd AS-REQ
+        // is different from that of preauth, client can still decrypt it
+        kdc.setOption(KDC.Option.ONLY_RC4_PREAUTH, true);
+        x.go();
+    }
+
+    void go() throws Exception {
+        Krb5LoginModule krb5 = new Krb5LoginModule();
+        StringBuffer error = new StringBuffer();
+        try {
+            Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        } catch (Exception e) {
+            error.append("Krb5LoginModule password login error\n");
+        }
+        try {
+            Context.fromUserKtab(OneKDC.USER, OneKDC.KTAB, false);
+        } catch (Exception e) {
+            error.append("Krb5LoginModule keytab login error\n");
+        }
+        try {
+            Class.forName("sun.security.krb5.internal.tools.Kinit");
+            String cmd = System.getProperty("java.home") +
+                    System.getProperty("file.separator") +
+                    "bin" +
+                    System.getProperty("file.separator") +
+                    "kinit";
+
+            int p = execute(
+                cmd,
+                "-J-Djava.security.krb5.conf=" + OneKDC.KRB5_CONF,
+                "-c", "cache1",
+                OneKDC.USER,
+                new String(OneKDC.PASS));
+            if (p != 0) {
+                error.append("kinit password login error\n");
+            }
+            p = execute(
+                cmd,
+                "-J-Djava.security.krb5.conf=" + OneKDC.KRB5_CONF,
+                "-c", "cache2",
+                "-k", "-t", OneKDC.KTAB,
+                OneKDC.USER);
+            if (p != 0) {
+                error.append("kinit keytab login error\n");
+            }
+        } catch (ClassNotFoundException cnfe) {
+            System.out.println("No kinit, test ignored.");
+            // Ignore, not on windows
+        }
+        if (error.length() != 0) {
+            throw new Exception(error.toString());
+        }
+    }
+
+    private static int execute(String... args) throws Exception {
+        for (String arg: args) {
+            System.out.printf("%s ", arg);
+        }
+        System.out.println();
+        Process p = Runtime.getRuntime().exec(args);
+        return p.waitFor();
+    }
+}
--- a/jdk/test/sun/security/validator/CertReplace.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/security/validator/CertReplace.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright (c) 2010, 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
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  */
 
 /*
@@ -37,25 +37,28 @@
 
 public class CertReplace {
 
-    private final static String cacerts = "certreplace.jks";
-    private final static String certs = "certreplace.certs";
-
+    /**
+     * @param args {cacerts keystore, cert chain}
+     */
     public static void main(String[] args) throws Exception {
 
         KeyStore ks = KeyStore.getInstance("JKS");
-        ks.load(new FileInputStream(cacerts), "changeit".toCharArray());
+        ks.load(new FileInputStream(args[0]), "changeit".toCharArray());
         Validator v = Validator.getInstance
             (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks);
-        X509Certificate[] chain = createPath();
-        System.out.println(Arrays.toString(v.validate(chain)));
-
+        X509Certificate[] chain = createPath(args[1]);
+        System.out.println("Chain: ");
+        for (X509Certificate c: v.validate(chain)) {
+            System.out.println("   " + c.getSubjectX500Principal() +
+                    " issued by " + c.getIssuerX500Principal());
+        }
     }
 
-    public static X509Certificate[] createPath() throws Exception {
+    public static X509Certificate[] createPath(String chain) throws Exception {
         CertificateFactory cf = CertificateFactory.getInstance("X.509");
         List list = new ArrayList();
         for (Certificate c: cf.generateCertificates(
-                new FileInputStream(certs))) {
+                new FileInputStream(chain))) {
             list.add((X509Certificate)c);
         }
         return (X509Certificate[]) list.toArray(new X509Certificate[0]);
--- a/jdk/test/sun/security/validator/certreplace.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/security/validator/certreplace.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright (c) 2010, 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
@@ -16,9 +16,9 @@
 # 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
+# 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
@@ -82,4 +82,4 @@
 # 5. Build and run test
 
 $JAVAC -d . ${TESTSRC}${FS}CertReplace.java
-$JAVA CertReplace
+$JAVA CertReplace certreplace.jks certreplace.certs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/validator/samedn.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,82 @@
+#
+# Copyright (c) 2010, 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 6958869
+# @summary regression: PKIXValidator fails when multiple trust anchors
+# have same dn
+#
+
+if [ "${TESTSRC}" = "" ] ; then
+  TESTSRC="."
+fi
+if [ "${TESTJAVA}" = "" ] ; then
+  JAVAC_CMD=`which javac`
+  TESTJAVA=`dirname $JAVAC_CMD`/..
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  Windows_* )
+    FS="\\"
+    ;;
+  * )
+    FS="/"
+    ;;
+esac
+
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit \
+    -keypass changeit -keystore samedn.jks"
+JAVAC=$TESTJAVA${FS}bin${FS}javac
+JAVA=$TESTJAVA${FS}bin${FS}java
+
+rm -rf samedn.jks 2> /dev/null
+
+# 1. Generate 3 aliases in a keystore: ca1, ca2, user. The CAs' startdate
+# is set to one year ago so that they are expired now
+
+$KT -genkeypair -alias ca1 -dname CN=CA -keyalg rsa -sigalg md5withrsa -ext bc -startdate -1y
+$KT -genkeypair -alias ca2 -dname CN=CA -keyalg rsa -sigalg sha1withrsa -ext bc -startdate -1y
+$KT -genkeypair -alias user -dname CN=User -keyalg rsa
+
+# 2. Signing: ca -> user
+
+$KT -certreq -alias user | $KT -gencert -rfc -alias ca1 > samedn1.certs
+$KT -certreq -alias user | $KT -gencert -rfc -alias ca2 > samedn2.certs
+
+# 3. Append the ca file
+
+$KT -export -rfc -alias ca1 >> samedn1.certs
+$KT -export -rfc -alias ca2 >> samedn2.certs
+
+# 4. Remove user for cacerts
+
+$KT -delete -alias user
+
+# 5. Build and run test. Make sure the CA certs are ignored for validity check.
+# Check both, one of them might be dropped out of map in old codes.
+
+$JAVAC -d . ${TESTSRC}${FS}CertReplace.java
+$JAVA CertReplace samedn.jks samedn1.certs || exit 1
+$JAVA CertReplace samedn.jks samedn2.certs || exit 2
--- a/jdk/test/sun/tools/jps/jps-Vvml_2.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jps/jps-Vvml_2.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -51,3 +51,9 @@
 SLEEPER_PID=$!
 
 ${JPS} -J-XX:Flags=${TESTSRC}/vmflags -Vvml | awk -f ${TESTSRC}/jps-Vvml_Output2.awk
+RC=$?
+
+cleanup
+
+exit ${RC}
+
--- a/jdk/test/sun/tools/jps/jps-m_2.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jps/jps-m_2.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -50,3 +50,9 @@
 SLEEPER_PID=$!
 
 ${JPS} -m | awk -f ${TESTSRC}/jps-m_Output2.awk
+RC=$?
+
+cleanup
+
+exit ${RC}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstat/classloadOutput1.awk	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,31 @@
+#
+# matching the following output specified as a pattern that verifies
+# that the numerical values conform to a specific pattern, rather than
+# specific values.
+#
+# Loaded       Time Inited       Time Shared  Kbytes   LoadTime SysClass  Kbytes   LoadTime     Lookup      Parse Linked       Time Verified       Time AppClass  Kbytes      AppCL DefineClass       Time FindClass       Time Delegation URLCL Read
+#    956      0.115    777      0.032      0     0.0      0.000      956  3437.5      0.085      0.013      0.045    918      0.032      917      0.011       13     1.0      0.003           1      0.000         1      0.004      0.005      0.000
+#
+
+BEGIN	{
+	    headerlines=0; datalines=0; totallines=0
+	}
+
+/^Loaded       Time Inited       Time Shared  Kbytes   LoadTime SysClass  Kbytes   LoadTime     Lookup      Parse Linked       Time Verified       Time AppClass  Kbytes      AppCL DefineClass       Time FindClass       Time Delegation URLCL Read$/ {
+	    headerlines++;
+	}
+
+/^[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9][ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9][ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9][ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+	    datalines++;
+	}
+
+	{ totallines++; print $0 }
+
+END	{
+	    if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
+	        exit 0
+	    }
+	    else {
+	        exit 1
+	    }
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstat/jstatClassloadOutput1.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2010, 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 6959965 
+# @run shell jstatClassloadOutput1.sh
+# @summary Test that output of 'jstat -classload 0' has expected line counts
+
+. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
+
+setup
+verify_os
+
+JSTAT="${TESTJAVA}/bin/jstat"
+
+${JSTAT} -classload -J-Djstat.showUnsupported=true 0 2>&1 | awk -f ${TESTSRC}/classloadOutput1.awk
--- a/jdk/test/sun/tools/jstat/jstatOptions1.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jstat/jstatOptions1.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -32,7 +32,9 @@
 
 JSTAT="${TESTJAVA}/bin/jstat"
 
-rm -f jstat.out 2>/dev/null
-${JSTAT} -options > jstat.out 2>&1
+rm -f jstat.out1 jstat.out2 2>/dev/null
+${JSTAT} -options > jstat.out1 2>&1
+${JSTAT} -options -J-Djstat.showUnsupported=true > jstat.out2 2>&1
 
-diff -w jstat.out ${TESTSRC}/options1.out
+diff -w jstat.out1 ${TESTSRC}/options1.out
+diff -w jstat.out2 ${TESTSRC}/options2.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstat/options2.out	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,13 @@
+-class
+-classload
+-compiler
+-gc
+-gccapacity
+-gccause
+-gcnew
+-gcnewcapacity
+-gcold
+-gcoldcapacity
+-gcpermcapacity
+-gcutil
+-printcompilation
--- a/jdk/test/sun/tools/jstatd/jstatdDefaults.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdDefaults.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -56,12 +56,11 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1`
-
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -75,4 +74,6 @@
     RC=1
 fi
 
+cleanup
+
 exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -44,7 +44,11 @@
 JSTAT="${TESTJAVA}/bin/jstat"
 
 HOSTNAME=`uname -n`
-PORT=2099
+PORT=`freePort`
+if [ "${PORT}" = "0" ] ; then
+  echo "Cannot get free port"
+  exit 1
+fi
 
 RMIREGISTRY_OUT="rmiregistry_$$.out"
 JSTATD_OUT="jstatd_$$.out"
@@ -69,12 +73,7 @@
     exit 1
 fi
 
-# get the process id for the target app (jstatd). note, don't rely
-# on JSTATD_PID as mks interposes a shell when starting a process in
-# the background
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1`
-
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
--- a/jdk/test/sun/tools/jstatd/jstatdPort.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdPort.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -42,7 +42,11 @@
 JSTAT="${TESTJAVA}/bin/jstat"
 
 HOSTNAME=`uname -n`
-PORT=2099
+PORT=`freePort`
+if [ "${PORT}" = "0" ] ; then
+  echo "Cannot get free port"
+  exit 1
+fi
 
 JSTATD_OUT="jstatd_$$.out"
 
@@ -57,12 +61,11 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1`
-
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -76,4 +79,6 @@
     RC=1
 fi
 
+cleanup
+
 exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdServerName.sh	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdServerName.sh	Wed Jul 05 17:16:45 2017 +0200
@@ -43,8 +43,12 @@
 JSTAT="${TESTJAVA}/bin/jstat"
 
 HOSTNAME=`uname -n`
-PORT_1=2098
-PORT_2=2099
+PORT_1=`freePort`
+if [ "${PORT_1}" = "0" ] ; then
+  echo "ERROR: No free port"
+  exit 1
+fi
+PORT_2=`expr ${PORT_1} '+' 1`
 SERVERNAME="SecondJstatdServer"
 
 JSTATD_1_OUT="jstatd_$$_1.out"
@@ -68,6 +72,7 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
@@ -77,13 +82,12 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1 | head -1`
-
-echo "running: ${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_1} 250 5"
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+echo "running: ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5"
+${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -91,8 +95,8 @@
     echo "jstat output differs from expected output"
 fi
 
-echo "running: ${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+echo "running: ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
+${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -112,4 +116,6 @@
     RC=1
 fi
 
+cleanup
+
 exit ${RC}
--- a/jdk/test/tools/jar/UpdateManifest.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/tools/jar/UpdateManifest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -143,6 +143,7 @@
         } else {
             fail("did not match specVersion nor specTitle");
         }
+        zf.close();
     }
 
     // --------------------- Convenience ---------------------------
--- a/jdk/test/tools/jar/index/MetaInf.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/tools/jar/index/MetaInf.java	Wed Jul 05 17:16:45 2017 +0200
@@ -62,7 +62,13 @@
 
     static boolean contains(File jarFile, String entryName)
         throws IOException {
-        return new ZipFile(jarFile).getEntry(entryName) != null;
+        ZipFile zf = new ZipFile(jarFile);
+        if ( zf != null ) {
+            boolean result = zf.getEntry(entryName) != null;
+            zf.close();
+            return result;
+        }
+        return false;
     }
 
     static void checkContains(File jarFile, String entryName)
@@ -94,9 +100,13 @@
         String line;
         while ((line = index.readLine()) != null) {
             if (line.equals(SERVICES)) {
+                index.close();
+                f.close();
                 return;
             }
         }
+        index.close();
+        f.close();
         throw new Error(SERVICES + " not indexed.");
     }
 
--- a/jdk/test/tools/pack200/Pack200Test.java	Tue Jun 29 22:31:39 2010 -0700
+++ b/jdk/test/tools/pack200/Pack200Test.java	Wed Jul 05 17:16:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010 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
@@ -39,8 +39,8 @@
  */
 public class Pack200Test {
 
-    private static ArrayList <File> jarList = new ArrayList();
-    private static final String PACKEXT = ".pack";
+    private static ArrayList <File> jarList = new ArrayList<File>();
+    static final String PACKEXT = ".pack";
 
     /** Creates a new instance of Pack200Test */
     private Pack200Test() {}
@@ -48,7 +48,7 @@
     private static void doPackUnpack() {
         for (File in : jarList) {
             Pack200.Packer packer = Pack200.newPacker();
-            Map p = packer.properties();
+            Map<String, String> p = packer.properties();
             // Take the time optimization vs. space
             p.put(packer.EFFORT, "1");  // CAUTION: do not use 0.
             // Make the memory consumption as effective as possible
@@ -96,7 +96,7 @@
     }
 
     private static ArrayList <String> getZipFileEntryNames(ZipFile z) {
-        ArrayList <String> out = new ArrayList();
+        ArrayList <String> out = new ArrayList<String>();
         for (ZipEntry ze : Collections.list(z.entries())) {
             out.add(ze.getName());
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/pack200/PackageVersionTest.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,169 @@
+
+/*
+ * Copyright (c) 2010, 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 6712743
+  * @summary verify package versioning
+  * @compile -XDignore.symbol.file PackageVersionTest.java
+  * @run main PackageVersionTest
+  */
+
+import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.jar.JarFile;
+import java.util.jar.Pack200;
+import java.util.jar.Pack200.Packer;
+
+public class PackageVersionTest {
+    private static final File  javaHome = new File(System.getProperty("java.home"));
+
+    public final static int JAVA5_PACKAGE_MAJOR_VERSION = 150;
+    public final static int JAVA5_PACKAGE_MINOR_VERSION = 7;
+
+    public final static int JAVA6_PACKAGE_MAJOR_VERSION = 160;
+    public final static int JAVA6_PACKAGE_MINOR_VERSION = 1;
+
+    public static void main(String... args) {
+        if (!javaHome.getName().endsWith("jre")) {
+            throw new RuntimeException("Error: requires an SDK to run");
+        }
+
+        File out = new File("test.pack");
+        createClassFile("Test5");
+        createClassFile("Test6");
+        createClassFile("Test7");
+
+        verifyPack("Test5.class", JAVA5_PACKAGE_MAJOR_VERSION,
+                JAVA5_PACKAGE_MINOR_VERSION);
+
+        verifyPack("Test6.class", JAVA6_PACKAGE_MAJOR_VERSION,
+                JAVA6_PACKAGE_MINOR_VERSION);
+
+        // TODO: change this to the java7 package version as needed.
+        verifyPack("Test7.class", JAVA6_PACKAGE_MAJOR_VERSION,
+                JAVA6_PACKAGE_MINOR_VERSION);
+
+        // test for resource file, ie. no class files
+        verifyPack("Test6.java", JAVA5_PACKAGE_MAJOR_VERSION,
+                JAVA5_PACKAGE_MINOR_VERSION);
+    }
+
+    static void close(Closeable c) {
+        if (c == null) {
+            return;
+        }
+        try {
+            c.close();
+        } catch (IOException ignore) {}
+    }
+
+    static void createClassFile(String name) {
+        createJavaFile(name);
+        String target = name.substring(name.length() - 1);
+        String javacCmds[] = {
+            "-source",
+            "5",
+            "-target",
+            name.substring(name.length() - 1),
+            name + ".java"
+        };
+        compileJava(javacCmds);
+    }
+
+    static void createJavaFile(String name) {
+        PrintStream ps = null;
+        FileOutputStream fos = null;
+        File outputFile = new File(name + ".java");
+        outputFile.delete();
+        try {
+            fos = new FileOutputStream(outputFile);
+            ps = new PrintStream(fos);
+            ps.format("public class %s {}", name);
+        } catch (IOException ioe) {
+            throw new RuntimeException("creation of test file failed");
+        } finally {
+            close(ps);
+            close(fos);
+        }
+    }
+
+    static void compileJava(String... javacCmds) {
+        if (com.sun.tools.javac.Main.compile(javacCmds) != 0) {
+            throw new RuntimeException("compilation failed");
+        }
+    }
+
+    static void makeJar(String... jargs) {
+        sun.tools.jar.Main jarTool =
+                new sun.tools.jar.Main(System.out, System.err, "jartool");
+        if (!jarTool.run(jargs)) {
+            throw new RuntimeException("jar command failed");
+        }
+    }
+
+    static void verifyPack(String filename, int expected_major, int expected_minor) {
+
+        File jarFileName = new File("test.jar");
+        jarFileName.delete();
+        String jargs[] = {
+            "cvf",
+            jarFileName.getName(),
+            filename
+        };
+        makeJar(jargs);
+        JarFile jfin = null;
+
+        try {
+            jfin = new JarFile(jarFileName);
+            Packer packer = Pack200.newPacker();
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            packer.pack(jfin, baos);
+            baos.flush();
+            baos.close();
+            byte[] buf = baos.toByteArray();
+
+            int minor = buf[4] & 0x000000ff;
+            int major = buf[5] & 0x000000ff;
+
+            if (major != expected_major || minor != expected_minor) {
+                String msg =
+                        String.format("test fails: expected:%d.%d but got %d.%d\n",
+                        expected_major, expected_minor,
+                        major, minor);
+                throw new Error(msg);
+            }
+
+            System.out.println(filename + ": OK");
+        } catch (IOException ioe) {
+            throw new RuntimeException(ioe.getMessage());
+        } finally {
+            close(jfin);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/pack200/SegmentLimit.java	Wed Jul 05 17:16:45 2017 +0200
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2010, 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 6575373
+ * @summary verify default segment limit
+ * @compile SegmentLimit.java
+ * @run main SegmentLimit
+ */
+
+import java.io.BufferedReader;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+
+/*
+ * Run this against a large jar file, by default the packer should generate only
+ * one segment, parse the output of the packer to verify if this is indeed true.
+ */
+
+public class SegmentLimit {
+
+    private static final File  javaHome = new File(System.getProperty("java.home"));
+
+    public static void main(String... args) {
+        if (!javaHome.getName().endsWith("jre")) {
+            throw new RuntimeException("Error: requires an SDK to run");
+        }
+
+        File out = new File("test" + Pack200Test.PACKEXT);
+        out.delete();
+        runPack200(out);
+    }
+
+    static void close(Closeable c) {
+        if (c == null) {
+            return;
+        }
+        try {
+            c.close();
+        } catch (IOException ignore) {}
+    }
+
+    static void runPack200(File outFile) {
+        File binDir = new File(javaHome, "bin");
+        File pack200Exe = System.getProperty("os.name").startsWith("Windows")
+                ? new File(binDir, "pack200.exe")
+                : new File(binDir, "pack200");
+        File sdkHome = javaHome.getParentFile();
+        File testJar = new File(new File(sdkHome, "lib"), "tools.jar");
+
+        System.out.println("using pack200: " + pack200Exe.getAbsolutePath());
+
+        String[] cmds = { pack200Exe.getAbsolutePath(),
+                          "--effort=1",
+                          "--verbose",
+                          "--no-gzip",
+                          outFile.getName(),
+                          testJar.getAbsolutePath()
+        };
+        InputStream is = null;
+        BufferedReader br = null;
+        InputStreamReader ir = null;
+
+        FileOutputStream fos = null;
+        PrintStream ps = null;
+
+        try {
+            ProcessBuilder pb = new ProcessBuilder(cmds);
+            pb.redirectErrorStream(true);
+            Process p = pb.start();
+            is = p.getInputStream();
+            ir = new InputStreamReader(is);
+            br = new BufferedReader(ir);
+
+            File logFile = new File("pack200.log");
+            fos = new FileOutputStream(logFile);
+            ps  = new PrintStream(fos);
+
+            String line = br.readLine();
+            int count = 0;
+            while (line != null) {
+                line = line.trim();
+                if (line.matches(".*Transmitted.*files of.*input bytes in a segment of.*bytes")) {
+                    count++;
+                }
+                ps.println(line);
+                line=br.readLine();
+            }
+            p.waitFor();
+            if (p.exitValue() != 0) {
+                throw new RuntimeException("pack200 failed");
+            }
+            p.destroy();
+            if (count > 1) {
+                throw new Error("test fails: check for multiple segments(" +
+                        count + ") in: " + logFile.getAbsolutePath());
+            }
+        } catch (IOException ex) {
+            throw new RuntimeException(ex.getMessage());
+        } catch (InterruptedException ignore){
+        } finally {
+            close(is);
+            close(ps);
+            close(fos);
+        }
+    }
+}
+
--- a/make/Defs-internal.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/make/Defs-internal.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -52,7 +52,6 @@
 endif
 
 # Define absolute paths to TOPDIRs
-ABS_CONTROL_TOPDIR:=$(call OptFullPath,"$(CONTROL_TOPDIR)")
 ABS_LANGTOOLS_TOPDIR:=$(call OptFullPath,"$(LANGTOOLS_TOPDIR)")
 ABS_CORBA_TOPDIR:=$(call OptFullPath,"$(CORBA_TOPDIR)")
 ABS_JAXP_TOPDIR:=$(call OptFullPath,"$(JAXP_TOPDIR)")
--- a/make/jprt.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/make/jprt.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -45,11 +45,11 @@
 endif
 
 jprt_build_fastdebug: fastdebug_build
-	( $(CD) $(OUTPUTDIR)-fastdebug/j2sdk-image && \
+	( $(CD) $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/j2sdk-image && \
 	  $(ZIPEXE) -q -r $(JPRT_ARCHIVE_BUNDLE) . )
 
 jprt_build_debug: debug_build
-	( $(CD) $(OUTPUTDIR)-debug/j2sdk-image && \
+	( $(CD) $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/j2sdk-image && \
 	  $(ZIPEXE) -q -r $(JPRT_ARCHIVE_BUNDLE) . )
 
 ################################################################
--- a/make/sanity-rules.gmk	Tue Jun 29 22:31:39 2010 -0700
+++ b/make/sanity-rules.gmk	Wed Jul 05 17:16:45 2017 +0200
@@ -281,7 +281,6 @@
 	@$(ECHO) "Build Directory Structure:" >> $(MESSAGE_FILE)
 	@$(ECHO) "   CWD = `$(PWD)`" >> $(MESSAGE_FILE)
 	@$(ECHO) "   TOPDIR = $(TOPDIR)"  >> $(MESSAGE_FILE)
-	@$(ECHO) "   CONTROL_TOPDIR = $(CONTROL_TOPDIR)"  >> $(MESSAGE_FILE)
 ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
 	@$(ECHO) "   LANGTOOLS_TOPDIR = $(LANGTOOLS_TOPDIR)"  >> $(MESSAGE_FILE)
 endif
--- a/test/Makefile	Tue Jun 29 22:31:39 2010 -0700
+++ b/test/Makefile	Wed Jul 05 17:16:45 2017 +0200
@@ -54,30 +54,33 @@
 
 # Test target list for jdk repository
 JDK_TEST_LIST = \
-	jdk_awt \
-	jdk_beans jdk_beans1 jdk_beans2 jdk_beans3  \
+	jdk_beans1 jdk_beans2 jdk_beans3  \
 	jdk_io  \
 	jdk_lang  \
-	jdk_management jdk_management1 jdk_management2  \
+	jdk_management1 jdk_management2  \
 	jdk_math  \
 	jdk_misc  \
 	jdk_net  \
-	jdk_nio jdk_nio1 jdk_nio2 jdk_nio3  \
+	jdk_nio1 jdk_nio2 jdk_nio3  \
+	jdk_security1 jdk_security2 jdk_security3  \
+	jdk_text  \
+	jdk_tools1 jdk_tools2  \
+	jdk_util
+
+# These tests need a DISPLAY and can create window interaction complications
+JDK_TEST_LIST2 = \
+	jdk_awt \
 	jdk_rmi \
-	jdk_security jdk_security1 jdk_security2 jdk_security3  \
-	jdk_swing \
-	jdk_text  \
-	jdk_tools jdk_tools1 jdk_tools2  \
-	jdk_util
+	jdk_swing
 
 # Default test target (everything)
 all: $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST)
 
 # Test targets
 $(LANGTOOLS_TEST_LIST):
-	@$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@))
+	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@))
 $(JDK_TEST_LIST):
-	@$(call SUBDIR_TEST, $(JDK_DIR), $@)
+	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), $@)
 
 clean: