Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index fee85da..2180635 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -73,3 +73,4 @@
 cf71cb5151166f35433afebaf67dbf34a704a170 jdk7-b96
 5e197c942c6ebd8b92f324a31049c5f1d26d40ef jdk7-b97
 6cea9984d73d74de0cd01f30d07ac0a1ed196117 jdk7-b98
+e7f18db469a3e947b7096bfd12e87380e5a042cd jdk7-b99
diff --git a/Makefile b/Makefile
index 0e7f4b4..065e0c5 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \
diff --git a/corba/.hgtags b/corba/.hgtags
index dc12ef0..1e90707 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -73,3 +73,4 @@
 edc2a2659c77dabc55cb55bb617bad89e3a05bb3 jdk7-b96
 4ec9d59374caa1e5d72fa802291b4d66955a4936 jdk7-b97
 3b99409057e4c255da946f9f540d051a5ef4ab23 jdk7-b98
+95db968660e7d87c345d5cf3dc2e3db037fb7220 jdk7-b99
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java
index 59fe275..9f23ebf 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java
@@ -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;
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java
index 340e550..aca7676 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java
@@ -350,7 +350,7 @@
 
         if (useToString) {
             try {
-                cls.getDeclaredMethod( "toString", null ) ;
+                cls.getDeclaredMethod( "toString", (Class[])null ) ;
                 return true ;
             } catch (Exception exc) {
                 return false ;
diff --git a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java
index 06c192c..6b9452e 100644
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java
@@ -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 ) ;
             }
diff --git a/corba/src/share/classes/org/omg/CORBA/ORB.java b/corba/src/share/classes/org/omg/CORBA/ORB.java
index 7f02de2..4c1737a 100644
--- a/corba/src/share/classes/org/omg/CORBA/ORB.java
+++ b/corba/src/share/classes/org/omg/CORBA/ORB.java
@@ -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 ) {
diff --git a/corba/src/share/classes/sun/corba/Bridge.java b/corba/src/share/classes/sun/corba/Bridge.java
index e71eb94..e7ab067 100644
--- a/corba/src/share/classes/sun/corba/Bridge.java
+++ b/corba/src/share/classes/sun/corba/Bridge.java
@@ -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 ) ;
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index c1b84f6..4e8d770 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -102,3 +102,4 @@
 573e8ea5fd68e8e51eb6308d283ac3b3889d15e0 hs19-b02
 5f42499e57adc16380780f40541e1a66cd601891 jdk7-b97
 8a045b3f5c13eaad92ff4baf15ca671845fcad1a jdk7-b98
+6a236384a379642b5a2398e2819db9ab4e711e9b jdk7-b99
diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make
index 851fe4f..b126c70 100644
--- a/hotspot/make/windows/makefiles/defs.make
+++ b/hotspot/make/windows/makefiles/defs.make
@@ -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
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 96aff39..d3a0f20 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -73,3 +73,4 @@
 9510ed0e1c7ab46a8b6659234e1dc7786407a72b jdk7-b96
 ca01ec32561fee1855630b68a2fcd0042257a8ef jdk7-b97
 d4adf4f2d14c7b79df0a81de884b6b57c6850802 jdk7-b98
+7ef8469021fbc824ac49d57c83a14b1bb08f1766 jdk7-b99
diff --git a/jaxp/build-defs.xml b/jaxp/build-defs.xml
index d3e1968..27fb78c 100644
--- a/jaxp/build-defs.xml
+++ b/jaxp/build-defs.xml
@@ -55,9 +55,29 @@
     <drop-import name="jaxp_src"/>
     <!-- <drop-import name="jaxp_tests"/> -->
 
+    <!-- Fail and print helpful messages if source does not exist. -->
+    <target name="-src-help">
+      <fail message="${failed.url.src.message}">
+	<condition>
+	    <and>
+                <not>
+	            <available file="${jaxp_src.src.dir}" type="dir"/>
+	        </not>
+	        <istrue value="${allow.downloads}"/>
+	    </and>
+	</condition>
+      </fail>
+      <fail message="${failed.nourl.src.message}">
+	<condition>
+            <not>
+	        <available file="${jaxp_src.src.dir}" type="dir"/>
+	    </not>
+	</condition>
+      </fail>
+    </target>
 
-    <!-- Special build area preparation. -->
-    <target name="-drop-build-prep" depends="init, -init-src-dirs">
+    <!-- Special build area setup. -->
+    <target name="-drop-build-setup" depends="init, -init-src-dirs">
         <mkdir dir="${build.classes.dir}"/>
         <copy todir="${build.classes.dir}">
             <fileset dir="${primary.src.dir}"
@@ -84,7 +104,7 @@
 
     <!-- Source directory selection. -->
     <target name="-init-src-dirs"
-	    depends="init, -use-drop">
+	    depends="init, -use-drop,-src-help">
         <echo message="Using primary.src.dir=${primary.src.dir}"/>
         <pathconvert property="src.list.id" refid="src.dir.id"/>
         <echo message="Using src.dir.id=${src.list.id}"/>
diff --git a/jaxp/build-drop-template.xml b/jaxp/build-drop-template.xml
index cfccda9..3e7fc65 100644
--- a/jaxp/build-drop-template.xml
+++ b/jaxp/build-drop-template.xml
@@ -75,6 +75,7 @@
     <target name="-@DROP@-url-should-be-used" unless="@DROP@.url.should.be.used">
         <condition property="@DROP@.url.should.be.used">
             <and>
+                <istrue value="${allow.downloads}"/>
                 <not>
                     <isset property="@DROP@.master.bundle.copy.exists"/>
                 </not>
diff --git a/jaxp/build.properties b/jaxp/build.properties
index 7c4528c..14abe6b 100644
--- a/jaxp/build.properties
+++ b/jaxp/build.properties
@@ -104,4 +104,24 @@
   drops.dir=${drops.dir}${line.separator}\
 ${line.separator}
 
+# Failure messages when source cannot be found on the file system
+failed.nourl.src.message=\
+ERROR: Cannot find source for project ${ant.project.name}.\
+${line.separator}${line.separator}\
+HINT: Try setting drops.dir to indicate where the bundles can be found, \
+or try setting the ant property allow.downloads=true to download the bundle from the URL.\
+${line.separator}\
+e.g. ant -Dallow.downloads=true -OR- ant -Ddrops.dir=some_directory \
+${line.separator}
+
+# Failure message when source cannot be downloaded
+failed.url.src.message=\
+ERROR: Cannot find source for project ${ant.project.name}.\
+${line.separator}${line.separator}\
+HINT: Try setting drops.dir to indicate where the bundles can be found, \
+or try checking the URL with your browser.\
+${line.separator}\
+e.g. ant -Ddrops.dir=some_directory \
+${line.separator}
+
 #------------------------------------------------------------
diff --git a/jaxp/build.xml b/jaxp/build.xml
index e318021..c6de86f 100644
--- a/jaxp/build.xml
+++ b/jaxp/build.xml
@@ -36,6 +36,11 @@
       javac.debug          - true or false for debug classfiles
       javac.target         - classfile version target
       javac.source         - source version
+      drops.dir            - directory that holds source drop bundles
+      allow.download       - permit downloads from public url (default is false)
+                             (used if bundles not found in drops.dir)
+
+      Run 'make help' for help using the Makefile.
     </description>
 
     <!-- Mac is special, need to downgrade these before build.properties. -->
@@ -106,16 +111,20 @@
         <jar file="${dist.classes.jar}" basedir="${build.classes.dir}"/>
     </target>
 
-    <target name="-build-prep"
-	    depends="init, -init-src-dirs, -drop-build-prep">
+    <target name="-build-setup"
+	    depends="init, -init-src-dirs, -drop-build-setup">
     </target>
 
     <!-- Build (compilation) of sources to class files. -->
     <target name="build"
-	    depends="init, -init-src-dirs, -build-prep">
+	    depends="compile, -build-setup">
+    </target>
+    <target name="compile"
+	    depends="init, -init-src-dirs">
+        <mkdir dir="${build.classes.dir}"/>
         <javac 
-	     includeAntRuntime="false"
-	     classpath="${build.classes.dir}"
+	     includeAntRuntime="false" 
+	     classpath="${build.classes.dir}:${tools.jar}"
 	     fork="true"
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
diff --git a/jaxp/jaxp.properties b/jaxp/jaxp.properties
index ac6e79f..c143ad6 100644
--- a/jaxp/jaxp.properties
+++ b/jaxp/jaxp.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2009, 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
@@ -24,13 +24,13 @@
 #
 
 drops.master.copy.base=${drops.dir}
-drops.master.url.base=https://jaxp.dev.java.net/files/documents/913/147490
 
-jaxp_src.bundle.name=jdk7-jaxp-m6.zip
-jaxp_src.bundle.md5.checksum=080827d779c114365f8504bd79b34604
+jaxp_src.bundle.name=jdk7-jaxp-m7.zip
+jaxp_src.bundle.md5.checksum=22e95fbdb9fb7d8b6b6fc0a1d76d1fbd
 jaxp_src.master.bundle.dir=${drops.master.copy.base}
-jaxp_src.master.bundle.url.base=${drops.master.url.base}
+jaxp_src.master.bundle.url.base=https://jaxp.dev.java.net/files/documents/913/147490
 
-jaxp_tests.bundle.name=jdk7-jaxp-tests-2009_08_28.zip
-jaxp_tests.master.bundle.dir=${drops.master.copy.base}
-jaxp_tests.master.bundle.url.base=${drops.master.url.base}
+#jaxp_tests.bundle.name=jdk7-jaxp-tests-2009_08_28.zip
+#jaxp_tests.master.bundle.dir=${drops.master.copy.base}
+#jaxp_tests.master.bundle.url.base=https://jaxp.dev.java.net/files/documents/913/147490
+
diff --git a/jaxp/make/Makefile b/jaxp/make/Makefile
index ed40a37..9b9d3cb 100644
--- a/jaxp/make/Makefile
+++ b/jaxp/make/Makefile
@@ -65,6 +65,11 @@
   endif
 endif 
 
+# If downloads are allowed
+ifeq ($(ALLOW_DOWNLOADS),true)
+  ANT_OPTIONS += -Dallow.downloads=true
+endif
+
 # Figure out the platform we are using
 _SYSTEM_UNAME := $(shell uname)
 _PLATFORM_KIND = unix
@@ -159,6 +164,8 @@
 	@echo "    $(ANT_TARGETS)"
 	@echo " "
 	@echo "  Environment or command line variables (all optional):"
+	$(call helpenvline, ALT_DROPS_DIR,\
+	       "Directory that contains the drop source bundles i.e. drops.dir")
 	$(call helpenvline, ALT_BOOTDIR,\
 	       "JAVA_HOME to use when running ant")
 	$(call helpenvline, ALT_LANGTOOLS_DIST,\
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index e3918c2..d434b21 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -73,3 +73,4 @@
 208fd4451232f7a522ddb20334c598656844ccb7 jdk7-b96
 dac23846092ad4956ed41b5278f8686476ae46ef jdk7-b97
 4571098071094e705e680db5324bfa15a57b1290 jdk7-b98
+818366ce23d8919cafaa4db4c51605ee2a7c8eaf jdk7-b99
diff --git a/jaxws/build-defs.xml b/jaxws/build-defs.xml
index 9a1b405..70d5990 100644
--- a/jaxws/build-defs.xml
+++ b/jaxws/build-defs.xml
@@ -55,9 +55,36 @@
     <drop-import name="jaxws_src"/>
     <drop-import name="jaf_src"/>
     <!-- <drop-import name="jaxws_tests"/> -->
+    
+    <!-- Fail and print helpful messages if source does not exist. -->
+    <target name="-src-help">
+      <fail message="${failed.url.src.message}">
+	<condition>
+	    <and>
+                <not>
+                    <and>
+	                <available file="${jaxws_src.src.dir}" type="dir"/>
+                        <available file="${jaf_src.src.dir}" type="dir"/>
+	            </and>
+	        </not>
+	        <istrue value="${allow.downloads}"/>
+	    </and>
+	</condition>
+      </fail>
+      <fail message="${failed.nourl.src.message}">
+	<condition>
+            <not>
+                <and>
+	            <available file="${jaxws_src.src.dir}" type="dir"/>
+                    <available file="${jaf_src.src.dir}" type="dir"/>
+	        </and>
+	    </not>
+	</condition>
+      </fail>
+    </target>
 
-    <!-- Special build area preparation. -->
-    <target name="-drop-build-prep" depends="init, -init-src-dirs">
+    <!-- Special build area setup. -->
+    <target name="-drop-build-setup" depends="init, -init-src-dirs">
         <mkdir dir="${build.classes.dir}"/>
         <copy todir="${build.classes.dir}">
             <fileset dir="${primary.src.dir}"
@@ -99,7 +126,7 @@
 
     <!-- Source directory selection. -->
     <target name="-init-src-dirs"
-	    depends="init, -use-drop">
+	    depends="init, -use-drop,-src-help">
         <echo message="Using primary.src.dir=${primary.src.dir}"/>
         <pathconvert property="src.list.id" refid="src.dir.id"/>
         <echo message="Using src.dir.id=${src.list.id}"/>
diff --git a/jaxws/build-drop-template.xml b/jaxws/build-drop-template.xml
index cfccda9..3e7fc65 100644
--- a/jaxws/build-drop-template.xml
+++ b/jaxws/build-drop-template.xml
@@ -75,6 +75,7 @@
     <target name="-@DROP@-url-should-be-used" unless="@DROP@.url.should.be.used">
         <condition property="@DROP@.url.should.be.used">
             <and>
+                <istrue value="${allow.downloads}"/>
                 <not>
                     <isset property="@DROP@.master.bundle.copy.exists"/>
                 </not>
diff --git a/jaxws/build.properties b/jaxws/build.properties
index 7c4528c..14abe6b 100644
--- a/jaxws/build.properties
+++ b/jaxws/build.properties
@@ -104,4 +104,24 @@
   drops.dir=${drops.dir}${line.separator}\
 ${line.separator}
 
+# Failure messages when source cannot be found on the file system
+failed.nourl.src.message=\
+ERROR: Cannot find source for project ${ant.project.name}.\
+${line.separator}${line.separator}\
+HINT: Try setting drops.dir to indicate where the bundles can be found, \
+or try setting the ant property allow.downloads=true to download the bundle from the URL.\
+${line.separator}\
+e.g. ant -Dallow.downloads=true -OR- ant -Ddrops.dir=some_directory \
+${line.separator}
+
+# Failure message when source cannot be downloaded
+failed.url.src.message=\
+ERROR: Cannot find source for project ${ant.project.name}.\
+${line.separator}${line.separator}\
+HINT: Try setting drops.dir to indicate where the bundles can be found, \
+or try checking the URL with your browser.\
+${line.separator}\
+e.g. ant -Ddrops.dir=some_directory \
+${line.separator}
+
 #------------------------------------------------------------
diff --git a/jaxws/build.xml b/jaxws/build.xml
index 6283cbf..c21ae04 100644
--- a/jaxws/build.xml
+++ b/jaxws/build.xml
@@ -36,6 +36,11 @@
       javac.debug          - true or false for debug classfiles
       javac.target         - classfile version target
       javac.source         - source version
+      drops.dir            - directory that holds source drop bundles
+      allow.download       - permit downloads from public url (default is false)
+                             (used if bundles not found in drops.dir)
+
+      Run 'make help' for help using the Makefile.
     </description>
 
     <!-- Mac is special, need to downgrade these before build.properties. -->
@@ -106,13 +111,17 @@
         <jar file="${dist.classes.jar}" basedir="${build.classes.dir}"/>
     </target>
 
-    <target name="-build-prep"
-	    depends="init, -init-src-dirs, -drop-build-prep">
+    <target name="-build-setup"
+	    depends="init, -init-src-dirs, -drop-build-setup">
     </target>
 
     <!-- Build (compilation) of sources to class files. -->
     <target name="build"
-	    depends="init, -init-src-dirs, -build-prep">
+	    depends="compile, -build-setup">
+    </target>
+    <target name="compile"
+	    depends="init, -init-src-dirs">
+        <mkdir dir="${build.classes.dir}"/>
         <javac 
 	     includeAntRuntime="false" 
 	     classpath="${build.classes.dir}:${tools.jar}"
diff --git a/jaxws/jaxws.properties b/jaxws/jaxws.properties
index 17b911d..6e8e3a3 100644
--- a/jaxws/jaxws.properties
+++ b/jaxws/jaxws.properties
@@ -24,19 +24,18 @@
 #
 
 drops.master.copy.base=${drops.dir}
-drops.master.url.base=http://kenai.com/projects/jdk7-drops/downloads/download
 
-jaxws_src.bundle.name=jdk7-jaxws-2009_09_28.zip
-jaxws_src.bundle.md5.checksum=f5010ebf636db9f465a61a7a74944543
+jaxws_src.bundle.name=jdk7-jaxws-b100.zip
+jaxws_src.bundle.md5.checksum=e4fea255c6222b118bb1d0d3054d36e1
 jaxws_src.master.bundle.dir=${drops.master.copy.base}
-#jaxws_src.bundle.url.base=https://jaxws.dev.java.net/files/documents/913/142147
-jaxws_src.master.bundle.url.base=${drops.master.url.base}
+jaxws_src.master.bundle.url.base=https://jax-ws.dev.java.net/files/documents/4202/150896
 
 jaf_src.bundle.name=jdk7-jaf-2009_08_28.zip
 jaf_src.bundle.md5.checksum=eb8cb7a4a7f14e211fbe2354878a2472
 jaf_src.master.bundle.dir=${drops.master.copy.base}
-jaf_src.master.bundle.url.base=${drops.master.url.base}
+jaf_src.master.bundle.url.base=http://kenai.com/projects/jdk7-drops/downloads/download
 
-jaxws_tests.bundle.name=jdk7-jaxws-tests-2009_08_28.zip
-jaxws_tests.master.bundle.dir=${drops.master.copy.base}
-jaxws_tests.master.bundle.url.base=${drops.master.url.base}
+#jaxws_tests.bundle.name=jdk7-jaxws-tests-2009_08_28.zip
+#jaxws_tests.master.bundle.dir=${drops.master.copy.base}
+#jaxws_tests.master.bundle.url.base=http://kenai.com/projects/jdk7-drops/downloads/download
+
diff --git a/jaxws/make/Makefile b/jaxws/make/Makefile
index ed40a37..9b9d3cb 100644
--- a/jaxws/make/Makefile
+++ b/jaxws/make/Makefile
@@ -65,6 +65,11 @@
   endif
 endif 
 
+# If downloads are allowed
+ifeq ($(ALLOW_DOWNLOADS),true)
+  ANT_OPTIONS += -Dallow.downloads=true
+endif
+
 # Figure out the platform we are using
 _SYSTEM_UNAME := $(shell uname)
 _PLATFORM_KIND = unix
@@ -159,6 +164,8 @@
 	@echo "    $(ANT_TARGETS)"
 	@echo " "
 	@echo "  Environment or command line variables (all optional):"
+	$(call helpenvline, ALT_DROPS_DIR,\
+	       "Directory that contains the drop source bundles i.e. drops.dir")
 	$(call helpenvline, ALT_BOOTDIR,\
 	       "JAVA_HOME to use when running ant")
 	$(call helpenvline, ALT_LANGTOOLS_DIST,\
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 00265c9..35d898c 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -73,3 +73,4 @@
 51b9e5dbc2da0631414484b934ac3fb62e48a2c6 jdk7-b96
 b1903d7528d33b521df42bc9291bdcdd2f444a29 jdk7-b97
 82593186fa54ab12f17af31f86a7bf364efaf4df jdk7-b98
+2587c9f0b60dc3146b4247b8674ada456a643d6f jdk7-b99
diff --git a/jdk/make/common/Defs-linux.gmk b/jdk/make/common/Defs-linux.gmk
index 970cea9..df8cba2 100644
--- a/jdk/make/common/Defs-linux.gmk
+++ b/jdk/make/common/Defs-linux.gmk
@@ -320,6 +320,7 @@
 endif
 override LIBPOSIX4               =
 override LIBSOCKET               =
+override LIBNSL                  =
 override LIBTHREAD               =
 override MOOT_PRIORITIES         = true
 override NO_INTERRUPTIBLE_IO     = true
diff --git a/jdk/make/common/Defs-solaris.gmk b/jdk/make/common/Defs-solaris.gmk
index 32f8bf7..97b6a69 100644
--- a/jdk/make/common/Defs-solaris.gmk
+++ b/jdk/make/common/Defs-solaris.gmk
@@ -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
diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk
index 4c16022..cf16ea8 100644
--- a/jdk/make/common/Release.gmk
+++ b/jdk/make/common/Release.gmk
@@ -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)
diff --git a/jdk/make/common/shared/Defs-control.gmk b/jdk/make/common/shared/Defs-control.gmk
index b5f06e7..4e545ca 100644
--- a/jdk/make/common/shared/Defs-control.gmk
+++ b/jdk/make/common/shared/Defs-control.gmk
@@ -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
diff --git a/jdk/make/docs/CORE_PKGS.gmk b/jdk/make/docs/CORE_PKGS.gmk
index b1cb7e6..31aaeb1 100644
--- a/jdk/make/docs/CORE_PKGS.gmk
+++ b/jdk/make/docs/CORE_PKGS.gmk
@@ -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                        \
diff --git a/jdk/make/java/hpi/hpi_common.gmk b/jdk/make/java/hpi/hpi_common.gmk
index 5f77038..025d2de 100644
--- a/jdk/make/java/hpi/hpi_common.gmk
+++ b/jdk/make/java/hpi/hpi_common.gmk
@@ -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
diff --git a/jdk/make/java/java/Makefile b/jdk/make/java/java/Makefile
index 60542f2..827a0ec 100644
--- a/jdk/make/java/java/Makefile
+++ b/jdk/make/java/java/Makefile
@@ -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
 
diff --git a/jdk/make/java/java_hprof_demo/Makefile b/jdk/make/java/java_hprof_demo/Makefile
index f051de0..b6d0539 100644
--- a/jdk/make/java/java_hprof_demo/Makefile
+++ b/jdk/make/java/java_hprof_demo/Makefile
@@ -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
 
 #
diff --git a/jdk/make/java/net/Makefile b/jdk/make/java/net/Makefile
index ca898e5..0021087 100644
--- a/jdk/make/java/net/Makefile
+++ b/jdk/make/java/net/Makefile
@@ -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
diff --git a/jdk/make/jpda/transport/socket/Makefile b/jdk/make/jpda/transport/socket/Makefile
index a048e24..ee7980c 100644
--- a/jdk/make/jpda/transport/socket/Makefile
+++ b/jdk/make/jpda/transport/socket/Makefile
@@ -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)
diff --git a/jdk/make/mkdemo/jvmti/hprof/Makefile b/jdk/make/mkdemo/jvmti/hprof/Makefile
index 9a3cd19..b0c703f 100644
--- a/jdk/make/mkdemo/jvmti/hprof/Makefile
+++ b/jdk/make/mkdemo/jvmti/hprof/Makefile
@@ -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
 
 #
diff --git a/jdk/make/netbeans/README b/jdk/make/netbeans/README
index 8f68dce..b234334 100644
--- a/jdk/make/netbeans/README
+++ b/jdk/make/netbeans/README
@@ -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.
 
diff --git a/jdk/make/netbeans/world/README b/jdk/make/netbeans/world/README
index 72c21a9..54c2ccc 100644
--- a/jdk/make/netbeans/world/README
+++ b/jdk/make/netbeans/world/README
@@ -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
diff --git a/jdk/make/netbeans/world/build.xml b/jdk/make/netbeans/world/build.xml
index 99dbfbf..b502c28 100644
--- a/jdk/make/netbeans/world/build.xml
+++ b/jdk/make/netbeans/world/build.xml
@@ -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>
diff --git a/jdk/make/sun/nio/cs/Makefile b/jdk/make/sun/nio/cs/Makefile
index ff2f8ca..26437ef 100644
--- a/jdk/make/sun/nio/cs/Makefile
+++ b/jdk/make/sun/nio/cs/Makefile
@@ -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
 
 #
diff --git a/jdk/make/sun/pisces/Makefile b/jdk/make/sun/pisces/Makefile
index cb0f076..7823361 100644
--- a/jdk/make/sun/pisces/Makefile
+++ b/jdk/make/sun/pisces/Makefile
@@ -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)
diff --git a/jdk/make/sun/security/mscapi/Makefile b/jdk/make/sun/security/mscapi/Makefile
index 188e5d9..3afff4f 100644
--- a/jdk/make/sun/security/mscapi/Makefile
+++ b/jdk/make/sun/security/mscapi/Makefile
@@ -150,6 +150,7 @@
 # Rules
 #
 CLASSDESTDIR = $(TEMPDIR)/classes
+JAVAHFLAGS += -classpath $(CLASSDESTDIR)
 
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 
diff --git a/jdk/make/sun/security/pkcs11/Makefile b/jdk/make/sun/security/pkcs11/Makefile
index 0fa4b5b..7915e8c 100644
--- a/jdk/make/sun/security/pkcs11/Makefile
+++ b/jdk/make/sun/security/pkcs11/Makefile
@@ -148,6 +148,7 @@
 # Rules
 #
 CLASSDESTDIR = $(TEMPDIR)/classes
+JAVAHFLAGS += -classpath $(CLASSDESTDIR)
 
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 
diff --git a/jdk/make/sun/tools/Makefile b/jdk/make/sun/tools/Makefile
index a041eb0..ebfcff5 100644
--- a/jdk/make/sun/tools/Makefile
+++ b/jdk/make/sun/tools/Makefile
@@ -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
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
index 097e6a6..ae33ddd 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
@@ -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)) {
                 /*
diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/Constants.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/Constants.java
index a9deb0c..19ce04c 100644
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/Constants.java
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/Constants.java
@@ -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;
diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java
index ad7fdba..1ea0469 100644
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/Package.java
@@ -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;
         }
diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java
index c5eb8d7..6b92236 100644
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java
@@ -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);
diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
index 4ed945e..9e9c7de 100644
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java
@@ -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 {
diff --git a/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java b/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java
index 25cef88..78a9e7c 100644
--- a/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java
+++ b/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java
@@ -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.
diff --git a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java
index 3c032de..2ed055b 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Client.java
@@ -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
diff --git a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java
index 2e8c69b..c2e360c 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java
@@ -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
diff --git a/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java b/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java
index 0048ebc..8c492e8 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/ExternalClient.java
@@ -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.
   *
diff --git a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
index 636541f..f0e04aa 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java
@@ -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:
diff --git a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
index d5b0a40..474f430 100644
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java
@@ -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
diff --git a/jdk/src/share/classes/com/sun/servicetag/Registry.java b/jdk/src/share/classes/com/sun/servicetag/Registry.java
index 68386ce..14ad2fd 100644
--- a/jdk/src/share/classes/com/sun/servicetag/Registry.java
+++ b/jdk/src/share/classes/com/sun/servicetag/Registry.java
@@ -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() {
diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/jdk_header.png b/jdk/src/share/classes/com/sun/servicetag/resources/jdk_header.png
index 011cfd4..ccfe6da 100644
--- a/jdk/src/share/classes/com/sun/servicetag/resources/jdk_header.png
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/jdk_header.png
Binary files differ
diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/register.html b/jdk/src/share/classes/com/sun/servicetag/resources/register.html
index 7684268..cc1dee2 100644
--- a/jdk/src/share/classes/com/sun/servicetag/resources/register.html
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/register.html
@@ -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>
diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html b/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html
index dae4377..3da7072 100644
--- a/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/register_ja.html
@@ -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>
diff --git a/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html b/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html
index dfc24dc..f5bad11 100644
--- a/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html
+++ b/jdk/src/share/classes/com/sun/servicetag/resources/register_zh_CN.html
@@ -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>
diff --git a/jdk/src/share/classes/java/lang/AssertionError.java b/jdk/src/share/classes/java/lang/AssertionError.java
index 75e8cd8..8fb577a 100644
--- a/jdk/src/share/classes/java/lang/AssertionError.java
+++ b/jdk/src/share/classes/java/lang/AssertionError.java
@@ -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);
+    }
 }
diff --git a/jdk/src/share/classes/java/lang/Math.java b/jdk/src/share/classes/java/lang/Math.java
index 7ce3126..455a21f 100644
--- a/jdk/src/share/classes/java/lang/Math.java
+++ b/jdk/src/share/classes/java/lang/Math.java
@@ -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();
     }
 
     /**
diff --git a/jdk/src/share/classes/java/lang/ProcessBuilder.java b/jdk/src/share/classes/java/lang/ProcessBuilder.java
index 82fad4a..97ce45c 100644
--- a/jdk/src/share/classes/java/lang/ProcessBuilder.java
+++ b/jdk/src/share/classes/java/lang/ProcessBuilder.java
@@ -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");
         }
diff --git a/jdk/src/share/classes/java/lang/StrictMath.java b/jdk/src/share/classes/java/lang/StrictMath.java
index f2f275b..916b82f 100644
--- a/jdk/src/share/classes/java/lang/StrictMath.java
+++ b/jdk/src/share/classes/java/lang/StrictMath.java
@@ -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();
     }
 
     /**
diff --git a/jdk/src/share/classes/java/net/URI.java b/jdk/src/share/classes/java/net/URI.java
index ed8c27b..c05b7b2 100644
--- a/jdk/src/share/classes/java/net/URI.java
+++ b/jdk/src/share/classes/java/net/URI.java
@@ -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
diff --git a/jdk/src/share/classes/java/nio/charset/package.html b/jdk/src/share/classes/java/nio/charset/package.html
index 724b6ae..05fbb3d 100644
--- a/jdk/src/share/classes/java/nio/charset/package.html
+++ b/jdk/src/share/classes/java/nio/charset/package.html
@@ -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
diff --git a/jdk/src/share/classes/java/security/Security.java b/jdk/src/share/classes/java/security/Security.java
index 4aea17e..81e029b 100644
--- a/jdk/src/share/classes/java/security/Security.java
+++ b/jdk/src/share/classes/java/security/Security.java
@@ -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);
         }
     }
 
diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java
index 8b20182..e4329dc 100644
--- a/jdk/src/share/classes/java/util/Collections.java
+++ b/jdk/src/share/classes/java/util/Collections.java
@@ -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;
 
diff --git a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java
index ba83c80a7..c8a67dd 100644
--- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java
@@ -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;
     }
 
diff --git a/jdk/src/share/classes/java/util/jar/Pack200.java b/jdk/src/share/classes/java/util/jar/Pack200.java
index 83a5d20..41dec91 100644
--- a/jdk/src/share/classes/java/util/jar/Pack200.java
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java
@@ -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
diff --git a/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java b/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java
index 61297c8..6e2c08a 100644
--- a/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java
+++ b/jdk/src/share/classes/javax/management/remote/JMXServiceURL.java
@@ -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
diff --git a/jdk/src/share/classes/javax/naming/ldap/LdapName.java b/jdk/src/share/classes/javax/naming/ldap/LdapName.java
index ecb61ed..852f544 100644
--- a/jdk/src/share/classes/javax/naming/ldap/LdapName.java
+++ b/jdk/src/share/classes/javax/naming/ldap/LdapName.java
@@ -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.
      *
diff --git a/jdk/src/share/classes/javax/naming/ldap/Rdn.java b/jdk/src/share/classes/javax/naming/ldap/Rdn.java
index 2022700..a705fee 100644
--- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java
+++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java
@@ -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
diff --git a/jdk/src/share/classes/javax/net/ssl/SSLContext.java b/jdk/src/share/classes/javax/net/ssl/SSLContext.java
index 2ff862c..854e41e 100644
--- a/jdk/src/share/classes/javax/net/ssl/SSLContext.java
+++ b/jdk/src/share/classes/javax/net/ssl/SSLContext.java
@@ -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.
      *
diff --git a/jdk/src/share/classes/javax/print/DocFlavor.java b/jdk/src/share/classes/javax/print/DocFlavor.java
index b835efe..3a250d1 100644
--- a/jdk/src/share/classes/javax/print/DocFlavor.java
+++ b/jdk/src/share/classes/javax/print/DocFlavor.java
@@ -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.
diff --git a/jdk/src/share/classes/javax/swing/BorderFactory.java b/jdk/src/share/classes/javax/swing/BorderFactory.java
index d71ed98..0f53bed 100644
--- a/jdk/src/share/classes/javax/swing/BorderFactory.java
+++ b/jdk/src/share/classes/javax/swing/BorderFactory.java
@@ -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;
 
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java
index cfde2fc..37a1893 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java
@@ -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: " +
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
index 60888f6..0b55a61 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
@@ -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();
diff --git a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java
index 79da253..938fd84 100644
--- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java
+++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java
@@ -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()];
diff --git a/jdk/src/share/classes/javax/swing/text/GlyphView.java b/jdk/src/share/classes/javax/swing/text/GlyphView.java
index abb46de..72487ea 100644
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java
@@ -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;
 
     /**
diff --git a/jdk/src/share/classes/javax/swing/text/Utilities.java b/jdk/src/share/classes/javax/swing/text/Utilities.java
index bb0f8f3..394bba3 100644
--- a/jdk/src/share/classes/javax/swing/text/Utilities.java
+++ b/jdk/src/share/classes/javax/swing/text/Utilities.java
@@ -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;
diff --git a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java
index 7d01cd9..abdaf8d 100644
--- a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java
+++ b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java
@@ -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;
diff --git a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
index 5443ede..d489b48 100644
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -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.
diff --git a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
index 6a40b65..7b65372 100644
--- a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
+++ b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java
@@ -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
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO2022.java b/jdk/src/share/classes/sun/io/ByteToCharISO2022.java
index 4b2e21b..5fef812 100644
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022.java
+++ b/jdk/src/share/classes/sun/io/ByteToCharISO2022.java
@@ -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;
         }
 
diff --git a/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java b/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java
index 8000870..03027c2 100644
--- a/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java
+++ b/jdk/src/share/classes/sun/io/ByteToCharISO2022JP.java
@@ -141,7 +141,7 @@
                         } else {
                             savedSize = 2;
                             savedBytes[0] = (byte)byte1;
-                            savedBytes[1] = (byte)input[readOff + inputSize];
+                            savedBytes[1] = input[readOff + inputSize];
                             inputSize++;
                         }
                         break;
diff --git a/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java b/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java
index 97a0e88..8f00ef6 100644
--- a/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java
+++ b/jdk/src/share/classes/sun/io/ByteToCharJISAutoDetect.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/io/CharToBytePCK.java b/jdk/src/share/classes/sun/io/CharToBytePCK.java
index 0c877df..9a8d1a7 100644
--- a/jdk/src/share/classes/sun/io/CharToBytePCK.java
+++ b/jdk/src/share/classes/sun/io/CharToBytePCK.java
@@ -66,7 +66,7 @@
 
          switch (ch) {
             case '\u2015':
-                return (int)0x815C;
+                return 0x815C;
             case '\u2014':
                 return 0;
             default:
diff --git a/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine b/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
index 66b2ae9..607ff59 100644
--- a/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
+++ b/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
@@ -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
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
index da54a3d..a594888 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
index c1b3f3b..eff83e2 100644
--- a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
+++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
@@ -144,11 +144,7 @@
     }
 
     public void close() throws IOException {
-        try {
-            ssc.close();
-        } catch (Exception x) {
-            Net.translateException(x);
-        }
+        ssc.close();
     }
 
     public ServerSocketChannel getChannel() {
diff --git a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
index 36c8d9f..5838357 100644
--- a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
+++ b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
@@ -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 {
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java b/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java
index f76c9cc..265e03c 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java
@@ -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);
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP.java b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP.java
index 03de248..6443de3 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java
index fbbd30b..480a4a7 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_LINUX.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_Open.java b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_Open.java
index 4043dc1..b36b76d 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_Open.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_JP_Open.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/EUC_TW.java b/jdk/src/share/classes/sun/nio/cs/ext/EUC_TW.java
index 368b471..a4ae8df 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/EUC_TW.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/EUC_TW.java
@@ -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;
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/GB18030.java b/jdk/src/share/classes/sun/nio/cs/ext/GB18030.java
index 20df560..acbe23a 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/GB18030.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/GB18030.java
@@ -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);
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java b/jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java
index d2e118e..69002ee 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/HKSCS.java
@@ -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++;
                 }
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ISO2022.java b/jdk/src/share/classes/sun/nio/cs/ext/ISO2022.java
index faf8036..ad4e597 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/ISO2022.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/ISO2022.java
@@ -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;
             }
 
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java b/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java
index 78007a0..e190bd5 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/JISAutoDetect.java
@@ -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;
     }
 
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/PCK.java b/jdk/src/share/classes/sun/nio/cs/ext/PCK.java
index a11a9dd..2c2387e 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/PCK.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/PCK.java
@@ -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:
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/SJIS.java b/jdk/src/share/classes/sun/nio/cs/ext/SJIS.java
index 65a03ae..1f8a8ea 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/SJIS.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/SJIS.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
index ac54b14..ff920af 100644
--- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
@@ -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) {
diff --git a/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java b/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java
index 4073ddf..77f3798 100644
--- a/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java
+++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java
@@ -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");
             }
diff --git a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
index dca82a4..4bf1de7 100644
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
@@ -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;
diff --git a/jdk/src/share/classes/sun/security/validator/PKIXValidator.java b/jdk/src/share/classes/sun/security/validator/PKIXValidator.java
index 8068a9d..59daa9e 100644
--- a/jdk/src/share/classes/sun/security/validator/PKIXValidator.java
+++ b/jdk/src/share/classes/sun/security/validator/PKIXValidator.java
@@ -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
     }
diff --git a/jdk/src/share/classes/sun/swing/SwingUtilities2.java b/jdk/src/share/classes/sun/swing/SwingUtilities2.java
index 6358d98..d138531 100644
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java
@@ -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.
      */
diff --git a/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java b/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java
index 8187fea..78207ce 100644
--- a/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java
+++ b/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java
@@ -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 =
diff --git a/jdk/src/share/classes/sun/tools/jstat/Arguments.java b/jdk/src/share/classes/sun/tools/jstat/Arguments.java
index a645320..1519175 100644
--- a/jdk/src/share/classes/sun/tools/jstat/Arguments.java
+++ b/jdk/src/share/classes/sun/tools/jstat/Arguments.java
@@ -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;
     }
 }
diff --git a/jdk/src/share/classes/sun/tools/jstat/OptionFinder.java b/jdk/src/share/classes/sun/tools/jstat/OptionFinder.java
index 628bd6c..6efa573 100644
--- a/jdk/src/share/classes/sun/tools/jstat/OptionFinder.java
+++ b/jdk/src/share/classes/sun/tools/jstat/OptionFinder.java
@@ -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;
diff --git a/jdk/src/share/classes/sun/tools/jstat/OptionLister.java b/jdk/src/share/classes/sun/tools/jstat/OptionLister.java
index d274a40..5ed5564 100644
--- a/jdk/src/share/classes/sun/tools/jstat/OptionLister.java
+++ b/jdk/src/share/classes/sun/tools/jstat/OptionLister.java
@@ -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");
             }
         }
 
diff --git a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options
index a32027d..f339965 100644
--- a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options
+++ b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options
@@ -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
diff --git a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options
new file mode 100644
index 0000000..37008e3
--- /dev/null
+++ b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options
@@ -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"
+  }
+}
+
diff --git a/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt b/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt
index 4b7499e..3766a28 100644
--- a/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt
+++ b/jdk/src/share/demo/jvmti/hprof/sample.makefile.txt
@@ -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
diff --git a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
index 6c4b3a8..7a814d2 100644
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c
@@ -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);
diff --git a/jdk/src/share/native/sun/font/freetypeScaler.c b/jdk/src/share/native/sun/font/freetypeScaler.c
index 39768c4..c132a4a 100644
--- a/jdk/src/share/native/sun/font/freetypeScaler.c
+++ b/jdk/src/share/native/sun/font/freetypeScaler.c
@@ -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 +
diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
index 00eef09..af68ce1 100644
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux
@@ -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 */
+    /**
+     * The thread factory used to create "process reaper" daemon threads.
+     */
+    private static class ProcessReaperThreadFactory implements ThreadFactory {
+        private final static ThreadGroup group = getRootThreadGroup();
 
-    private static class Gate {
-
-        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 {
 
-        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).
-         */
+        pid = forkAndExec(prog,
+                          argBlock, argc,
+                          envBlock, envc,
+                          dir,
+                          fds,
+                          redirectErrorStream);
 
-        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));
-                        }
+        try {
+            AccessController.doPrivileged
+            (new PrivilegedExceptionAction<Void>() {
+                public Void run() throws IOException {
+                    initStreams(fds);
+                    return null;
+                }});
+        } catch (PrivilegedActionException ex) {
+            throw (IOException) ex.getException();
+        }
+    }
 
-                        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));
-                        }
+    static FileDescriptor newFileDescriptor(int fd) {
+        FileDescriptor fileDescriptor = new FileDescriptor();
+        fdAccess.set(fileDescriptor, fd);
+        return fileDescriptor;
+    }
 
-                        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);
-                        }
+    void initStreams(int[] fds) throws IOException {
+        stdin = (fds[0] == -1) ?
+            ProcessBuilder.NullOutputStream.INSTANCE :
+            new ProcessPipeOutputStream(fds[0]);
 
-                        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());
+        stdout = (fds[1] == -1) ?
+            ProcessBuilder.NullInputStream.INSTANCE :
+            new ProcessPipeInputStream(fds[1]);
+
+        stderr = (fds[2] == -1) ?
+            ProcessBuilder.NullInputStream.INSTANCE :
+            new ProcessPipeInputStream(fds[2]);
+
+        processReaperExecutor.execute(new Runnable() {
+            public void run() {
+                int exitcode = waitForProcessExit(pid);
+                UNIXProcess.this.processExited(exitcode);
+            }});
+    }
+
+    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;
+            }
+        }
+    }
 }
diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris
index 7f87d79..8d01b7e 100644
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris
@@ -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]);
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java
index e16c556..5825277 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java
@@ -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() {
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
index 0be90d0..3b98cb0 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -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
diff --git a/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine b/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
new file mode 100644
index 0000000..c79fdbd
--- /dev/null
+++ b/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
@@ -0,0 +1,5 @@
+# Jules Rendering Engine module
+sun.java2d.jules.JulesRenderingEngine
+
+#  Pisces Rendering Engine module
+sun.java2d.pisces.PiscesRenderingEngine
diff --git a/jdk/src/solaris/classes/sun/nio/cs/ext/COMPOUND_TEXT_Encoder.java b/jdk/src/solaris/classes/sun/nio/cs/ext/COMPOUND_TEXT_Encoder.java
index e7cc9c1..d73a21b 100644
--- a/jdk/src/solaris/classes/sun/nio/cs/ext/COMPOUND_TEXT_Encoder.java
+++ b/jdk/src/solaris/classes/sun/nio/cs/ext/COMPOUND_TEXT_Encoder.java
@@ -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) {
diff --git a/jdk/src/solaris/classes/sun/nio/cs/ext/CompoundTextSupport.java b/jdk/src/solaris/classes/sun/nio/cs/ext/CompoundTextSupport.java
index 07c87af..4f2a047 100644
--- a/jdk/src/solaris/classes/sun/nio/cs/ext/CompoundTextSupport.java
+++ b/jdk/src/solaris/classes/sun/nio/cs/ext/CompoundTextSupport.java
@@ -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) {
diff --git a/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java b/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
index cf194a2..bdec8fc 100644
--- a/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
+++ b/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
@@ -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;
diff --git a/jdk/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java b/jdk/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
index ed92363..0d6b234 100644
--- a/jdk/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
+++ b/jdk/src/solaris/classes/sun/tools/attach/SolarisVirtualMachine.java
@@ -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;
diff --git a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
index 717a383..f044364 100644
--- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+++ b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
@@ -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);
diff --git a/jdk/src/windows/classes/java/lang/ProcessImpl.java b/jdk/src/windows/classes/java/lang/ProcessImpl.java
index 19e0b3e..c0a0daa 100644
--- a/jdk/src/windows/classes/java/lang/ProcessImpl.java
+++ b/jdk/src/windows/classes/java/lang/ProcessImpl.java
@@ -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]);
diff --git a/jdk/src/windows/native/sun/font/fontpath.c b/jdk/src/windows/native/sun/font/fontpath.c
index 67a5aec..9c82f3d 100644
--- a/jdk/src/windows/native/sun/font/fontpath.c
+++ b/jdk/src/windows/native/sun/font/fontpath.c
@@ -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;
diff --git a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
index 3dfa490..64156b8 100644
--- a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
@@ -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);
     }
 }
 
diff --git a/jdk/src/windows/native/sun/nio/ch/Net.c b/jdk/src/windows/native/sun/nio/ch/Net.c
index da485d8..a145393 100644
--- a/jdk/src/windows/native/sun/nio/ch/Net.c
+++ b/jdk/src/windows/native/sun/nio/ch/Net.c
@@ -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;
 }
diff --git a/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c b/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c
index 78265a0..0fa7c35 100644
--- a/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c
+++ b/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c
@@ -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 */
diff --git a/jdk/src/windows/native/sun/nio/ch/nio_util.h b/jdk/src/windows/native/sun/nio/ch/nio_util.h
index 9c7a6d9..963e93e 100644
--- a/jdk/src/windows/native/sun/nio/ch/nio_util.h
+++ b/jdk/src/windows/native/sun/nio/ch/nio_util.h
@@ -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();
diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index 9272bbb..ad4ca16 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -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
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index c41d513..76d34d8 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -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
-
 ############################################################################
 
diff --git a/jdk/test/com/sun/jdi/PopAndInvokeTest.java b/jdk/test/com/sun/jdi/PopAndInvokeTest.java
index 3cc6381..b601f5e 100644
--- a/jdk/test/com/sun/jdi/PopAndInvokeTest.java
+++ b/jdk/test/com/sun/jdi/PopAndInvokeTest.java
@@ -24,6 +24,7 @@
 /**
  *  @test
  *  @bug 6517249
+ *  @ignore 6951287
  *  @summary JDWP: Cannot do an invokeMethod after a popFrames operation
  *
  *  @author jjh
diff --git a/jdk/test/com/sun/servicetag/FindServiceTags.java b/jdk/test/com/sun/servicetag/FindServiceTags.java
index 0d731d2..0e82673 100644
--- a/jdk/test/com/sun/servicetag/FindServiceTags.java
+++ b/jdk/test/com/sun/servicetag/FindServiceTags.java
@@ -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 {
diff --git a/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java b/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java
index eb72cc7..00713f9 100644
--- a/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java
+++ b/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java
@@ -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");
 
diff --git a/jdk/test/com/sun/servicetag/SystemRegistryTest.java b/jdk/test/com/sun/servicetag/SystemRegistryTest.java
index 0e0be1c..7e521c1 100644
--- a/jdk/test/com/sun/servicetag/SystemRegistryTest.java
+++ b/jdk/test/com/sun/servicetag/SystemRegistryTest.java
@@ -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);
diff --git a/jdk/test/com/sun/servicetag/Util.java b/jdk/test/com/sun/servicetag/Util.java
index 8fed8be..77bc7da 100644
--- a/jdk/test/com/sun/servicetag/Util.java
+++ b/jdk/test/com/sun/servicetag/Util.java
@@ -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();
+            }
+        }
+    }
 }
diff --git a/jdk/test/com/sun/tools/attach/BasicTests.sh b/jdk/test/com/sun/tools/attach/BasicTests.sh
index 4c9236c..3f8f857 100644
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh
+++ b/jdk/test/com/sun/tools/attach/BasicTests.sh
@@ -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
diff --git a/jdk/test/com/sun/tracing/BasicFunctionality.java b/jdk/test/com/sun/tracing/BasicFunctionality.java
index 0311fde..614e73e 100644
--- a/jdk/test/com/sun/tracing/BasicFunctionality.java
+++ b/jdk/test/com/sun/tracing/BasicFunctionality.java
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 6537506
+ * @ignore 6962535
  * @summary Basic unit test for tracing framework
  */
 
diff --git a/jdk/test/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java b/jdk/test/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java
index 323ede0..f93c2cd 100644
--- a/jdk/test/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java
+++ b/jdk/test/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java
@@ -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");
diff --git a/jdk/test/java/beans/Beans/Test4080522.java b/jdk/test/java/beans/Beans/Test4080522.java
index a26a2f1..c6ee1b8 100644
--- a/jdk/test/java/beans/Beans/Test4080522.java
+++ b/jdk/test/java/beans/Beans/Test4080522.java
@@ -29,6 +29,7 @@
  *          Beans.setGuiAvailable
  *          Introspector.setBeanInfoSearchPath
  *          PropertyEditorManager.setEditorSearchPath
+ * @run main/othervm Test4080522
  * @author Graham Hamilton
  */
 
diff --git a/jdk/test/java/beans/EventHandler/Test6277246.java b/jdk/test/java/beans/EventHandler/Test6277246.java
index e009aad..f0d9aaa 100644
--- a/jdk/test/java/beans/EventHandler/Test6277246.java
+++ b/jdk/test/java/beans/EventHandler/Test6277246.java
@@ -25,6 +25,7 @@
  * @test
  * @bug 6277246
  * @summary Tests problem with java.beans use of reflection
+ * @run main/othervm Test6277246
  * @author Jeff Nisewanger
  */
 
diff --git a/jdk/test/java/beans/EventHandler/Test6277266.java b/jdk/test/java/beans/EventHandler/Test6277266.java
index f64f852..a23a4da 100644
--- a/jdk/test/java/beans/EventHandler/Test6277266.java
+++ b/jdk/test/java/beans/EventHandler/Test6277266.java
@@ -25,6 +25,7 @@
  * @test
  * @bug 6277266
  * @summary Tests access control issue in EventHandler
+ * @run main/othervm Test6277266
  * @author Jeff Nisewanger
  */
 
diff --git a/jdk/test/java/beans/Introspector/Test6277246.java b/jdk/test/java/beans/Introspector/Test6277246.java
index 826f6e4..40ea016 100644
--- a/jdk/test/java/beans/Introspector/Test6277246.java
+++ b/jdk/test/java/beans/Introspector/Test6277246.java
@@ -25,6 +25,7 @@
  * @test
  * @bug 6277246
  * @summary Tests problem with java.beans use of reflection
+ * @run main/othervm Test6277246
  * @author Jeff Nisewanger
  */
 
diff --git a/jdk/test/java/io/BufferedReader/BigMark.java b/jdk/test/java/io/BufferedReader/BigMark.java
index 67b5dd3..fe336a4 100644
--- a/jdk/test/java/io/BufferedReader/BigMark.java
+++ b/jdk/test/java/io/BufferedReader/BigMark.java
@@ -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.*;
diff --git a/jdk/test/java/io/BufferedReader/ReadLineSync.java b/jdk/test/java/io/BufferedReader/ReadLineSync.java
index 1b2dd49..2af83e4 100644
--- a/jdk/test/java/io/BufferedReader/ReadLineSync.java
+++ b/jdk/test/java/io/BufferedReader/ReadLineSync.java
@@ -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 {
diff --git a/jdk/test/java/io/DataInputStream/OpsAfterClose.java b/jdk/test/java/io/DataInputStream/OpsAfterClose.java
index a0f0fdf..a54926b 100644
--- a/jdk/test/java/io/DataInputStream/OpsAfterClose.java
+++ b/jdk/test/java/io/DataInputStream/OpsAfterClose.java
@@ -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)
diff --git a/jdk/test/java/io/DataInputStream/ReadFully.java b/jdk/test/java/io/DataInputStream/ReadFully.java
index ad94280..53c0ee5 100644
--- a/jdk/test/java/io/DataInputStream/ReadFully.java
+++ b/jdk/test/java/io/DataInputStream/ReadFully.java
@@ -43,6 +43,7 @@
         } catch (IndexOutOfBoundsException ie) {
             caughtException = true;
         } finally {
+            dis.close();
             if (!caughtException)
                 throw new RuntimeException("Test failed");
         }
diff --git a/jdk/test/java/io/File/DeleteOnExit.java b/jdk/test/java/io/File/DeleteOnExit.java
index 74100ee..b332bf9 100644
--- a/jdk/test/java/io/File/DeleteOnExit.java
+++ b/jdk/test/java/io/File/DeleteOnExit.java
@@ -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())  {
diff --git a/jdk/test/java/io/File/DeleteOnExitNPE.java b/jdk/test/java/io/File/DeleteOnExitNPE.java
index dff7915..50a29c3 100644
--- a/jdk/test/java/io/File/DeleteOnExitNPE.java
+++ b/jdk/test/java/io/File/DeleteOnExitNPE.java
@@ -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()));
diff --git a/jdk/test/java/io/File/IsHidden.java b/jdk/test/java/io/File/IsHidden.java
index a0198d1..e34fcc3 100644
--- a/jdk/test/java/io/File/IsHidden.java
+++ b/jdk/test/java/io/File/IsHidden.java
@@ -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);
     }
diff --git a/jdk/test/java/io/FileInputStream/LeadingSlash.java b/jdk/test/java/io/FileInputStream/LeadingSlash.java
index 7b72be9..3b57243 100644
--- a/jdk/test/java/io/FileInputStream/LeadingSlash.java
+++ b/jdk/test/java/io/FileInputStream/LeadingSlash.java
@@ -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();
diff --git a/jdk/test/java/io/InputStream/OpsAfterClose.java b/jdk/test/java/io/InputStream/OpsAfterClose.java
index 7c64c98..9685782 100644
--- a/jdk/test/java/io/InputStream/OpsAfterClose.java
+++ b/jdk/test/java/io/InputStream/OpsAfterClose.java
@@ -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(
diff --git a/jdk/test/java/io/InputStream/ReadParams.java b/jdk/test/java/io/InputStream/ReadParams.java
index 36713aa..602445c 100644
--- a/jdk/test/java/io/InputStream/ReadParams.java
+++ b/jdk/test/java/io/InputStream/ReadParams.java
@@ -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);
diff --git a/jdk/test/java/io/InputStreamReader/GrowAfterEOF.java b/jdk/test/java/io/InputStreamReader/GrowAfterEOF.java
index 7434401..96bb2a9 100644
--- a/jdk/test/java/io/InputStreamReader/GrowAfterEOF.java
+++ b/jdk/test/java/io/InputStreamReader/GrowAfterEOF.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/ObjectInputStream/ResolveProxyClass.java b/jdk/test/java/io/ObjectInputStream/ResolveProxyClass.java
index 59cd3d3..eaea1c3 100644
--- a/jdk/test/java/io/ObjectInputStream/ResolveProxyClass.java
+++ b/jdk/test/java/io/ObjectInputStream/ResolveProxyClass.java
@@ -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(
diff --git a/jdk/test/java/io/RandomAccessFile/EOF.java b/jdk/test/java/io/RandomAccessFile/EOF.java
index aa65fd3..50b48de 100644
--- a/jdk/test/java/io/RandomAccessFile/EOF.java
+++ b/jdk/test/java/io/RandomAccessFile/EOF.java
@@ -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);
     }
 
 }
diff --git a/jdk/test/java/io/RandomAccessFile/ParameterCheck.java b/jdk/test/java/io/RandomAccessFile/ParameterCheck.java
index 97319fc..e483929 100644
--- a/jdk/test/java/io/RandomAccessFile/ParameterCheck.java
+++ b/jdk/test/java/io/RandomAccessFile/ParameterCheck.java
@@ -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();
         }
 
diff --git a/jdk/test/java/io/RandomAccessFile/ReadLine.java b/jdk/test/java/io/RandomAccessFile/ReadLine.java
index 879926f..1d63ce0 100644
--- a/jdk/test/java/io/RandomAccessFile/ReadLine.java
+++ b/jdk/test/java/io/RandomAccessFile/ReadLine.java
@@ -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!");
     }
diff --git a/jdk/test/java/io/RandomAccessFile/Seek.java b/jdk/test/java/io/RandomAccessFile/Seek.java
index a3f15cd..2a505e5 100644
--- a/jdk/test/java/io/RandomAccessFile/Seek.java
+++ b/jdk/test/java/io/RandomAccessFile/Seek.java
@@ -44,6 +44,8 @@
             throw new Exception
                 ("Should have thrown an IOException when seek offset is < 0");
         } catch (IOException e) {
+        } finally {
+            raf.close();
         }
     }
 }
diff --git a/jdk/test/java/io/RandomAccessFile/WriteBytesChars.java b/jdk/test/java/io/RandomAccessFile/WriteBytesChars.java
index 6803f2b..bbb9494 100644
--- a/jdk/test/java/io/RandomAccessFile/WriteBytesChars.java
+++ b/jdk/test/java/io/RandomAccessFile/WriteBytesChars.java
@@ -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();
         }
     }
diff --git a/jdk/test/java/io/RandomAccessFile/WriteUTF.java b/jdk/test/java/io/RandomAccessFile/WriteUTF.java
index ed83127..c3d13e0 100644
--- a/jdk/test/java/io/RandomAccessFile/WriteUTF.java
+++ b/jdk/test/java/io/RandomAccessFile/WriteUTF.java
@@ -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();
         }
 
diff --git a/jdk/test/java/io/RandomAccessFile/skipBytes/SkipBytes.java b/jdk/test/java/io/RandomAccessFile/skipBytes/SkipBytes.java
index 9c4cf04..0e8723e 100644
--- a/jdk/test/java/io/RandomAccessFile/skipBytes/SkipBytes.java
+++ b/jdk/test/java/io/RandomAccessFile/skipBytes/SkipBytes.java
@@ -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();
+        }
 
     }
 
diff --git a/jdk/test/java/io/Reader/Skip.java b/jdk/test/java/io/Reader/Skip.java
index cc4255b..08f627f 100644
--- a/jdk/test/java/io/Reader/Skip.java
+++ b/jdk/test/java/io/Reader/Skip.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Reader/SkipNegative.java b/jdk/test/java/io/Reader/SkipNegative.java
index 17ec0c0..e1aec0c 100644
--- a/jdk/test/java/io/Reader/SkipNegative.java
+++ b/jdk/test/java/io/Reader/SkipNegative.java
@@ -41,6 +41,8 @@
         } catch(IllegalArgumentException e){
             // Negative argument caught
             return;
+        } finally {
+            fr.close();
         }
         throw new Exception("Skip should not accept negative values");
     }
diff --git a/jdk/test/java/io/Serializable/ClassCastExceptionDetail/Read.java b/jdk/test/java/io/Serializable/ClassCastExceptionDetail/Read.java
index a606310..52373c5 100644
--- a/jdk/test/java/io/Serializable/ClassCastExceptionDetail/Read.java
+++ b/jdk/test/java/io/Serializable/ClassCastExceptionDetail/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java b/jdk/test/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java
index c5b5bdd..e27eaf4 100644
--- a/jdk/test/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java
+++ b/jdk/test/java/io/Serializable/auditStreamSubclass/AuditStreamSubclass.java
@@ -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.*;
 
diff --git a/jdk/test/java/io/Serializable/backRefCNFException/Read.java b/jdk/test/java/io/Serializable/backRefCNFException/Read.java
index e406899..9bc69ad 100644
--- a/jdk/test/java/io/Serializable/backRefCNFException/Read.java
+++ b/jdk/test/java/io/Serializable/backRefCNFException/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/checkModifiers/CheckModifiers.java b/jdk/test/java/io/Serializable/checkModifiers/CheckModifiers.java
index 6519af8..d984ad5 100644
--- a/jdk/test/java/io/Serializable/checkModifiers/CheckModifiers.java
+++ b/jdk/test/java/io/Serializable/checkModifiers/CheckModifiers.java
@@ -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();
+        }
     }
 };
diff --git a/jdk/test/java/io/Serializable/classDescFlagConflict/Read.java b/jdk/test/java/io/Serializable/classDescFlagConflict/Read.java
index c484379..f7eb5e5 100644
--- a/jdk/test/java/io/Serializable/classDescFlagConflict/Read.java
+++ b/jdk/test/java/io/Serializable/classDescFlagConflict/Read.java
@@ -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) {
         }
     }
diff --git a/jdk/test/java/io/Serializable/classDescHooks/ClassDescHooks.java b/jdk/test/java/io/Serializable/classDescHooks/ClassDescHooks.java
index c71cf33..9e382fe 100644
--- a/jdk/test/java/io/Serializable/classDescHooks/ClassDescHooks.java
+++ b/jdk/test/java/io/Serializable/classDescHooks/ClassDescHooks.java
@@ -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();
diff --git a/jdk/test/java/io/Serializable/duplicateSerialFields/Test.java b/jdk/test/java/io/Serializable/duplicateSerialFields/Test.java
index a9f21b6..020912f 100644
--- a/jdk/test/java/io/Serializable/duplicateSerialFields/Test.java
+++ b/jdk/test/java/io/Serializable/duplicateSerialFields/Test.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/enum/badResolve/Read.java b/jdk/test/java/io/Serializable/enum/badResolve/Read.java
index fb80678..c2b4a5c 100644
--- a/jdk/test/java/io/Serializable/enum/badResolve/Read.java
+++ b/jdk/test/java/io/Serializable/enum/badResolve/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/enum/constantSubclasses/Read.java b/jdk/test/java/io/Serializable/enum/constantSubclasses/Read.java
index e9f47fd..d114576 100644
--- a/jdk/test/java/io/Serializable/enum/constantSubclasses/Read.java
+++ b/jdk/test/java/io/Serializable/enum/constantSubclasses/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/enum/missingConstant/Read.java b/jdk/test/java/io/Serializable/enum/missingConstant/Read.java
index c4965b8..4bd6075 100644
--- a/jdk/test/java/io/Serializable/enum/missingConstant/Read.java
+++ b/jdk/test/java/io/Serializable/enum/missingConstant/Read.java
@@ -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 {
-            Object obj = oin.readObject();
-            throw new Error("read of " + obj + " should not succeed");
-        } catch (InvalidObjectException e) {
-            System.out.println("caught expected exception: " + e);
+            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);
+            }
+        } finally {
+            in.close();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/fieldTypeString/Read.java b/jdk/test/java/io/Serializable/fieldTypeString/Read.java
index 3056ca3..b8b7dd6 100644
--- a/jdk/test/java/io/Serializable/fieldTypeString/Read.java
+++ b/jdk/test/java/io/Serializable/fieldTypeString/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/illegalHandle/Test.java b/jdk/test/java/io/Serializable/illegalHandle/Test.java
index af2d526..74c7ad9 100644
--- a/jdk/test/java/io/Serializable/illegalHandle/Test.java
+++ b/jdk/test/java/io/Serializable/illegalHandle/Test.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/longString/LongString.java b/jdk/test/java/io/Serializable/longString/LongString.java
index bbb6701..7d342b1 100644
--- a/jdk/test/java/io/Serializable/longString/LongString.java
+++ b/jdk/test/java/io/Serializable/longString/LongString.java
@@ -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();
+        }
     }
 }
diff --git a/jdk/test/java/io/Serializable/oldTests/AnnotateClass.java b/jdk/test/java/io/Serializable/oldTests/AnnotateClass.java
index 4680b4c..17f3ab1 100644
--- a/jdk/test/java/io/Serializable/oldTests/AnnotateClass.java
+++ b/jdk/test/java/io/Serializable/oldTests/AnnotateClass.java
@@ -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: ");
diff --git a/jdk/test/java/io/Serializable/oldTests/ArrayFields.java b/jdk/test/java/io/Serializable/oldTests/ArrayFields.java
index 743268f..6833a03 100644
--- a/jdk/test/java/io/Serializable/oldTests/ArrayFields.java
+++ b/jdk/test/java/io/Serializable/oldTests/ArrayFields.java
@@ -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();
        }
    }
 }
diff --git a/jdk/test/java/io/Serializable/oldTests/ArraysOfArrays.java b/jdk/test/java/io/Serializable/oldTests/ArraysOfArrays.java
index 9349669..ba5fc0d 100644
--- a/jdk/test/java/io/Serializable/oldTests/ArraysOfArrays.java
+++ b/jdk/test/java/io/Serializable/oldTests/ArraysOfArrays.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/oldTests/BinaryTree.java b/jdk/test/java/io/Serializable/oldTests/BinaryTree.java
index 81e8e1d..b4d824f 100644
--- a/jdk/test/java/io/Serializable/oldTests/BinaryTree.java
+++ b/jdk/test/java/io/Serializable/oldTests/BinaryTree.java
@@ -37,28 +37,34 @@
             "with BinaryTree types \n");
 
         try {
-            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();
+            FileOutputStream ostream = new FileOutputStream("piotest3.tmp");
+            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);
+            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();
+            }
 
-            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();
-            }
             System.err.println("\nTEST PASSED");
         } catch (Exception e) {
             System.err.print("TEST FAILED: ");
diff --git a/jdk/test/java/io/Serializable/oldTests/CircularList.java b/jdk/test/java/io/Serializable/oldTests/CircularList.java
index 1a9723a..bd5814e 100644
--- a/jdk/test/java/io/Serializable/oldTests/CircularList.java
+++ b/jdk/test/java/io/Serializable/oldTests/CircularList.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/oldTests/SimpleArrays.java b/jdk/test/java/io/Serializable/oldTests/SimpleArrays.java
index c35b9b0..bbf4c85 100644
--- a/jdk/test/java/io/Serializable/oldTests/SimpleArrays.java
+++ b/jdk/test/java/io/Serializable/oldTests/SimpleArrays.java
@@ -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();
        }
     }
 }
diff --git a/jdk/test/java/io/Serializable/oldTests/WritePrimitive.java b/jdk/test/java/io/Serializable/oldTests/WritePrimitive.java
index d955045..3976cd4 100644
--- a/jdk/test/java/io/Serializable/oldTests/WritePrimitive.java
+++ b/jdk/test/java/io/Serializable/oldTests/WritePrimitive.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/packageAccess/Test.java b/jdk/test/java/io/Serializable/packageAccess/Test.java
index 1804611..15d2e4c 100644
--- a/jdk/test/java/io/Serializable/packageAccess/Test.java
+++ b/jdk/test/java/io/Serializable/packageAccess/Test.java
@@ -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);
 
diff --git a/jdk/test/java/io/Serializable/parents/EvolvedClass.java b/jdk/test/java/io/Serializable/parents/EvolvedClass.java
index db8b11d..edb8dee 100644
--- a/jdk/test/java/io/Serializable/parents/EvolvedClass.java
+++ b/jdk/test/java/io/Serializable/parents/EvolvedClass.java
@@ -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();
diff --git a/jdk/test/java/io/Serializable/parents/OriginalClass.java b/jdk/test/java/io/Serializable/parents/OriginalClass.java
index c83b76e..2f21c49 100644
--- a/jdk/test/java/io/Serializable/parents/OriginalClass.java
+++ b/jdk/test/java/io/Serializable/parents/OriginalClass.java
@@ -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();
diff --git a/jdk/test/java/io/Serializable/proxy/Basic.java b/jdk/test/java/io/Serializable/proxy/Basic.java
index a9152fd..92c989b 100644
--- a/jdk/test/java/io/Serializable/proxy/Basic.java
+++ b/jdk/test/java/io/Serializable/proxy/Basic.java
@@ -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();
diff --git a/jdk/test/java/io/Serializable/proxy/skipMissing/Read.java b/jdk/test/java/io/Serializable/proxy/skipMissing/Read.java
index 2a7ede9..511bb42 100644
--- a/jdk/test/java/io/Serializable/proxy/skipMissing/Read.java
+++ b/jdk/test/java/io/Serializable/proxy/skipMissing/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/proxy/skipMissing/Write.java b/jdk/test/java/io/Serializable/proxy/skipMissing/Write.java
index df1d5ca..c4b06f2 100644
--- a/jdk/test/java/io/Serializable/proxy/skipMissing/Write.java
+++ b/jdk/test/java/io/Serializable/proxy/skipMissing/Write.java
@@ -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"));
diff --git a/jdk/test/java/io/Serializable/readObjectNoData/Read.java b/jdk/test/java/io/Serializable/readObjectNoData/Read.java
index ccd485f..e786c6c 100644
--- a/jdk/test/java/io/Serializable/readObjectNoData/Read.java
+++ b/jdk/test/java/io/Serializable/readObjectNoData/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/skipWriteObject/Read.java b/jdk/test/java/io/Serializable/skipWriteObject/Read.java
index d8873eb..e1fcfe7 100644
--- a/jdk/test/java/io/Serializable/skipWriteObject/Read.java
+++ b/jdk/test/java/io/Serializable/skipWriteObject/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/skippedObjCNFException/Read.java b/jdk/test/java/io/Serializable/skippedObjCNFException/Read.java
index 9effc24..b502650 100644
--- a/jdk/test/java/io/Serializable/skippedObjCNFException/Read.java
+++ b/jdk/test/java/io/Serializable/skippedObjCNFException/Read.java
@@ -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();
+        }
     }
 }
diff --git a/jdk/test/java/io/Serializable/stopCustomDeserialization/Read.java b/jdk/test/java/io/Serializable/stopCustomDeserialization/Read.java
index c77a0cb..156fa50 100644
--- a/jdk/test/java/io/Serializable/stopCustomDeserialization/Read.java
+++ b/jdk/test/java/io/Serializable/stopCustomDeserialization/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/unresolvedClassDesc/Read.java b/jdk/test/java/io/Serializable/unresolvedClassDesc/Read.java
index 78a3545..c3fc28b 100644
--- a/jdk/test/java/io/Serializable/unresolvedClassDesc/Read.java
+++ b/jdk/test/java/io/Serializable/unresolvedClassDesc/Read.java
@@ -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();
-            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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/unshared/Read.java b/jdk/test/java/io/Serializable/unshared/Read.java
index c92d07e..7d7c9d4 100644
--- a/jdk/test/java/io/Serializable/unshared/Read.java
+++ b/jdk/test/java/io/Serializable/unshared/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/Serializable/wrongReturnTypes/Read.java b/jdk/test/java/io/Serializable/wrongReturnTypes/Read.java
index b5ef5e0..a41599f 100644
--- a/jdk/test/java/io/Serializable/wrongReturnTypes/Read.java
+++ b/jdk/test/java/io/Serializable/wrongReturnTypes/Read.java
@@ -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();
         }
     }
 }
diff --git a/jdk/test/java/io/StreamTokenizer/Comment.java b/jdk/test/java/io/StreamTokenizer/Comment.java
index 05636262..f1192fe 100644
--- a/jdk/test/java/io/StreamTokenizer/Comment.java
+++ b/jdk/test/java/io/StreamTokenizer/Comment.java
@@ -41,40 +41,45 @@
         int slashStarComment = 4;
 
         for (int i = 0; i < 8 ; i++) {
-            StreamTokenizer st = new StreamTokenizer(new FileReader(f));
+            FileReader reader = new FileReader(f);
+            try {
+                StreamTokenizer st = new StreamTokenizer(reader);
 
-            /* decide the state of this run */
-            boolean slashCommentFlag = ((i & slashIsCommentStart) != 0);
-            boolean slashSlashCommentFlag = ((i & slashSlashComment) != 0);
-            boolean slashStarCommentFlag = ((i & slashStarComment) != 0);
+                /* 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);
+                /* 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();
             }
         }
     }
diff --git a/jdk/test/java/io/readBytes/ReadBytesBounds.java b/jdk/test/java/io/readBytes/ReadBytesBounds.java
index 4f69e68..eef870b 100644
--- a/jdk/test/java/io/readBytes/ReadBytesBounds.java
+++ b/jdk/test/java/io/readBytes/ReadBytesBounds.java
@@ -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 {
diff --git a/jdk/test/java/lang/ClassLoader/UninitializedParent.java b/jdk/test/java/lang/ClassLoader/UninitializedParent.java
index 9b751f6..9d4459d 100644
--- a/jdk/test/java/lang/ClassLoader/UninitializedParent.java
+++ b/jdk/test/java/lang/ClassLoader/UninitializedParent.java
@@ -26,6 +26,7 @@
  * @bug 6636650
  * @summary Uninitialized class loaders should not be a parent of other
  *          class loaders.
+ * @run main/othervm UninitializedParent
  */
 
 
diff --git a/jdk/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java b/jdk/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java
index 0d4bf80..e1f79f7 100644
--- a/jdk/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java
+++ b/jdk/test/java/lang/ClassLoader/defineClass/DefineClassByteBuffer.java
@@ -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 */
diff --git a/jdk/test/java/lang/ClassLoader/findSystemClass/Loader.java b/jdk/test/java/lang/ClassLoader/findSystemClass/Loader.java
index 3406148..60f1b79 100644
--- a/jdk/test/java/lang/ClassLoader/findSystemClass/Loader.java
+++ b/jdk/test/java/lang/ClassLoader/findSystemClass/Loader.java
@@ -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
 */
 
 /*
diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java
index e14f665..f4e3c26 100644
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java
@@ -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);
diff --git a/jdk/test/java/lang/System/ExitFinalizersAndJIT.java b/jdk/test/java/lang/System/ExitFinalizersAndJIT.java
index bc98b12..4fe5078 100644
--- a/jdk/test/java/lang/System/ExitFinalizersAndJIT.java
+++ b/jdk/test/java/lang/System/ExitFinalizersAndJIT.java
@@ -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 {
diff --git a/jdk/test/java/lang/System/IgnoreNullSecurityManager.java b/jdk/test/java/lang/System/IgnoreNullSecurityManager.java
index 555238a..03a2c0cc 100644
--- a/jdk/test/java/lang/System/IgnoreNullSecurityManager.java
+++ b/jdk/test/java/lang/System/IgnoreNullSecurityManager.java
@@ -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 {
diff --git a/jdk/test/java/lang/Thread/GenerifyStackTraces.java b/jdk/test/java/lang/Thread/GenerifyStackTraces.java
index 4167265..98de450 100644
--- a/jdk/test/java/lang/Thread/GenerifyStackTraces.java
+++ b/jdk/test/java/lang/Thread/GenerifyStackTraces.java
@@ -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 " +
diff --git a/jdk/test/java/lang/Thread/StackTraces.java b/jdk/test/java/lang/Thread/StackTraces.java
index b5f3d05..141c81a 100644
--- a/jdk/test/java/lang/Thread/StackTraces.java
+++ b/jdk/test/java/lang/Thread/StackTraces.java
@@ -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 " +
diff --git a/jdk/test/java/lang/annotation/ParameterAnnotations.java b/jdk/test/java/lang/annotation/ParameterAnnotations.java
index ec36608..7c98241 100644
--- a/jdk/test/java/lang/annotation/ParameterAnnotations.java
+++ b/jdk/test/java/lang/annotation/ParameterAnnotations.java
@@ -27,6 +27,7 @@
  * @summary Check properties of Annotations returned from
  * getParameterAnnotations, including freedom from security
  * exceptions.
+ * @run main/othervm ParameterAnnotations
  * @author Martin Buchholz
  */
 
diff --git a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java
index 2eac763..d2daf80 100644
--- a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java
+++ b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java
@@ -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 {}
diff --git a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java
index efcd0e9..545d724 100644
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java
@@ -25,6 +25,7 @@
  * @test
  * @bug     5024531
  * @summary Basic Test for ManagementFactory.newPlatformMXBean().
+ * @run main/othervm MXBeanProxyTest
  * @author  Mandy Chung
  */
 import javax.management.*;
diff --git a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
index f81f40b..b7a04e0 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java
@@ -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 (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);
-        }
+            for (PoolRecord pr : result.values()) {
+                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 " +
diff --git a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
index f029ca2..00d8b4d 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
@@ -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.*;
diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java
index 9edabf1..f6b3b16 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagement.java
@@ -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.*;
diff --git a/jdk/test/java/lang/management/MemoryMXBean/Pending.java b/jdk/test/java/lang/management/MemoryMXBean/Pending.java
index 91c71c1..62df8fe 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/Pending.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/Pending.java
@@ -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)
diff --git a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
index b72d6c9..da37945 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
@@ -28,7 +28,7 @@
  * @author  Mandy Chung
  *
  * @build ResetPeakMemoryUsage MemoryUtil
- * @run main ResetPeakMemoryUsage
+ * @run main/othervm ResetPeakMemoryUsage
  */
 
 import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java
index f34e8d0..622fc68 100644
--- a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java
+++ b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java
@@ -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.");
diff --git a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java
index fc368f6..4dca590f 100644
--- a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java
+++ b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java
@@ -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)
diff --git a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
index 59df52b..fa6ec61 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java
@@ -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);
         }
diff --git a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java
index eb27760..f5b763a 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java
@@ -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.");
     }
diff --git a/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java b/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java
index 57085b5..a3530e4 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/EnableTest.java
@@ -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.");
     }
diff --git a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java
index 99c9edf..b913147 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java
@@ -33,7 +33,7 @@
  * @build MonitorDeadlock
  * @build SynchronizerDeadlock
  * @build ThreadDump
- * @run main FindDeadlocks
+ * @run main/othervm FindDeadlocks
  */
 
 import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java b/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java
index 06c55c4..7381bc0 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/FindMonitorDeadlock.java
@@ -30,7 +30,7 @@
  *
  * @build MonitorDeadlock
  * @build ThreadDump
- * @run main FindMonitorDeadlock
+ * @run main/othervm FindMonitorDeadlock
  */
 
 import java.lang.management.*;
diff --git a/jdk/test/java/lang/management/ThreadMXBean/Locks.java b/jdk/test/java/lang/management/ThreadMXBean/Locks.java
index 28a4027..1541a08 100644
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java
@@ -29,7 +29,7 @@
  * @author  Mandy Chung
  *
  * @build ThreadExecutionSynchronizer
- * @run main Locks
+ * @run main/othervm Locks
  */
 
 import java.lang.management.*;
diff --git a/jdk/test/java/lang/reflect/Proxy/Boxing.java b/jdk/test/java/lang/reflect/Proxy/Boxing.java
index a32a6f7..2c4c245 100644
--- a/jdk/test/java/lang/reflect/Proxy/Boxing.java
+++ b/jdk/test/java/lang/reflect/Proxy/Boxing.java
@@ -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++) {
diff --git a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java
index 905e351..6c35d75 100644
--- a/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java
+++ b/jdk/test/java/lang/reflect/Proxy/ClassRestrictions.java
@@ -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");
diff --git a/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java b/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java
index d775840..754e965 100644
--- a/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java
+++ b/jdk/test/java/lang/reflect/Proxy/returnTypes/Test.java
@@ -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);
diff --git a/jdk/test/java/net/ResponseCache/file1.cache b/jdk/test/java/net/ResponseCache/file1.cache
index 004b1e40..b00b097 100644
--- a/jdk/test/java/net/ResponseCache/file1.cache
+++ b/jdk/test/java/net/ResponseCache/file1.cache
Binary files differ
diff --git a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
index a18a936..b0fb0cf 100644
--- a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
+++ b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
@@ -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);
diff --git a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
index 7fbe8f6..f9755de 100644
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
@@ -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);
+    }
 }
diff --git a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java
index 561d7ea..5a855ac 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java
@@ -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,
diff --git a/jdk/test/java/nio/channels/DatagramChannel/Connect.java b/jdk/test/java/nio/channels/DatagramChannel/Connect.java
index 46a3068..318729a 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/Connect.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/Connect.java
@@ -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").
diff --git a/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java b/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java
index eebef98..f7c836a 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/EmptyBuffer.java
@@ -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,22 +63,21 @@
         server.throwException();
     }
 
-    public interface Sprintable extends Runnable {
-        public void throwException() throws Exception;
-        public boolean ready();
-    }
-
-    public static class Server implements Sprintable {
+    public static class Server implements Runnable {
+        final DatagramChannel dc;
         Exception e = null;
-        private volatile boolean ready = false;
 
-        public void throwException() throws Exception {
-            if (e != null)
-                throw e;
+        Server() throws IOException {
+            this.dc = DatagramChannel.open().bind(new InetSocketAddress(0));
         }
 
-        public boolean ready() {
-            return ready;
+        int port() {
+            return dc.socket().getLocalPort();
+        }
+
+        void throwException() throws Exception {
+            if (e != null)
+                throw e;
         }
 
         void showBuffer(String s, ByteBuffer bb) {
@@ -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
diff --git a/jdk/test/java/nio/channels/DatagramChannel/NoSender.java b/jdk/test/java/nio/channels/DatagramChannel/NoSender.java
index 6eb1cb1..ec559ce 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/NoSender.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/NoSender.java
@@ -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);
diff --git a/jdk/test/java/nio/channels/DatagramChannel/SRTest.java b/jdk/test/java/nio/channels/DatagramChannel/SRTest.java
index 50f9c29..f99a14d 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/SRTest.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/SRTest.java
@@ -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();
diff --git a/jdk/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java b/jdk/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java
new file mode 100644
index 0000000..fdbbd36
--- /dev/null
+++ b/jdk/test/java/nio/channels/DatagramChannel/SelectWhenRefused.java
@@ -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);
+    }
+}
diff --git a/jdk/test/java/nio/channels/DatagramChannel/Sender.java b/jdk/test/java/nio/channels/DatagramChannel/Sender.java
index 58d4a4a..60336f5 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/Sender.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/Sender.java
@@ -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,17 +88,21 @@
         }
     }
 
-    public static class Server implements Sprintable {
+    public static class Server implements Runnable {
+        final DatagramChannel dc;
         Exception e = null;
-        private volatile boolean ready = false;
 
-        public void throwException() throws Exception {
-            if (e != null)
-                throw e;
+        Server() throws IOException {
+            dc = DatagramChannel.open().bind(new InetSocketAddress(0));
         }
 
-        public boolean ready() {
-            return ready;
+        int port() {
+            return dc.socket().getLocalPort();
+        }
+
+        void throwException() throws Exception {
+            if (e != null)
+                throw e;
         }
 
         void showBuffer(String s, ByteBuffer bb) {
@@ -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;
diff --git a/jdk/test/java/nio/channels/Selector/ByteServer.java b/jdk/test/java/nio/channels/Selector/ByteServer.java
index 9cb7f96..53ab51f 100644
--- a/jdk/test/java/nio/channels/Selector/ByteServer.java
+++ b/jdk/test/java/nio/channels/Selector/ByteServer.java
@@ -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() {
diff --git a/jdk/test/java/nio/channels/Selector/CloseThenRegister.java b/jdk/test/java/nio/channels/Selector/CloseThenRegister.java
index 03deaf4..99192ea 100644
--- a/jdk/test/java/nio/channels/Selector/CloseThenRegister.java
+++ b/jdk/test/java/nio/channels/Selector/CloseThenRegister.java
@@ -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!");
     }
 
 }
diff --git a/jdk/test/java/nio/channels/Selector/OpRead.java b/jdk/test/java/nio/channels/Selector/OpRead.java
index 54a978e..b77feaf 100644
--- a/jdk/test/java/nio/channels/Selector/OpRead.java
+++ b/jdk/test/java/nio/channels/Selector/OpRead.java
@@ -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 {
-        InetSocketAddress isa
-            = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST),
-                                    DAYTIME_PORT);
-        SocketChannel sc = SocketChannel.open();
+        ServerSocketChannel ssc = null;
+        SocketChannel sc = null;
+        SocketChannel peer = null;
+        try {
+            ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0));
 
-        sc.connect(isa);
+            // loopback connection
+            InetAddress lh = InetAddress.getLocalHost();
+            sc = SocketChannel.open(new InetSocketAddress(lh, ssc.socket().getLocalPort()));
+            peer = ssc.accept();
 
-        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 {
diff --git a/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java
index 678a33a..136778f 100644
--- a/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java
+++ b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java
@@ -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);
diff --git a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java
index 9742131..d4b2bf1 100644
--- a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java
+++ b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java
@@ -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);
diff --git a/jdk/test/java/nio/channels/Selector/SelectWrite.java b/jdk/test/java/nio/channels/Selector/SelectWrite.java
index 5b15dab..8f18c7e 100644
--- a/jdk/test/java/nio/channels/Selector/SelectWrite.java
+++ b/jdk/test/java/nio/channels/Selector/SelectWrite.java
@@ -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);
diff --git a/jdk/test/java/nio/channels/SocketChannel/BigReadWrite.java b/jdk/test/java/nio/channels/SocketChannel/BigReadWrite.java
index 8a41665..bd2ed29 100644
--- a/jdk/test/java/nio/channels/SocketChannel/BigReadWrite.java
+++ b/jdk/test/java/nio/channels/SocketChannel/BigReadWrite.java
@@ -32,7 +32,6 @@
 
 public class BigReadWrite {
 
-    static int port = 40170;
     static int testSize = 15;
 
     public static void main(String[] args) throws Exception {
diff --git a/jdk/test/java/nio/channels/SocketChannel/OpenLeak.java b/jdk/test/java/nio/channels/SocketChannel/OpenLeak.java
index 9e9e6f1..ab5dfde 100644
--- a/jdk/test/java/nio/channels/SocketChannel/OpenLeak.java
+++ b/jdk/test/java/nio/channels/SocketChannel/OpenLeak.java
@@ -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;
diff --git a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java
index 67840be..0dfd2d6 100644
--- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java
+++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java
@@ -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();
diff --git a/jdk/test/java/nio/channels/SocketChannel/Write.java b/jdk/test/java/nio/channels/SocketChannel/Write.java
index 9a40c01..faa6289 100644
--- a/jdk/test/java/nio/channels/SocketChannel/Write.java
+++ b/jdk/test/java/nio/channels/SocketChannel/Write.java
@@ -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;
 
-    WriteServer() {
+    final ServerSocketChannel ssc;
+
+    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();
diff --git a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java
index 015705f..16298b8 100644
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java
@@ -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()) {
diff --git a/jdk/test/java/util/Locale/Bug4184873_he b/jdk/test/java/util/Locale/Bug4184873_he
index 37c909a..19bbd67 100644
--- a/jdk/test/java/util/Locale/Bug4184873_he
+++ b/jdk/test/java/util/Locale/Bug4184873_he
Binary files differ
diff --git a/jdk/test/java/util/Locale/Bug4184873_id b/jdk/test/java/util/Locale/Bug4184873_id
index f836772..aa0a2c2 100644
--- a/jdk/test/java/util/Locale/Bug4184873_id
+++ b/jdk/test/java/util/Locale/Bug4184873_id
Binary files differ
diff --git a/jdk/test/java/util/Locale/Bug4184873_yi b/jdk/test/java/util/Locale/Bug4184873_yi
index c0d8f3a..8405fb7 100644
--- a/jdk/test/java/util/Locale/Bug4184873_yi
+++ b/jdk/test/java/util/Locale/Bug4184873_yi
Binary files differ
diff --git a/jdk/test/java/util/ResourceBundle/Bug4168625Test.java b/jdk/test/java/util/ResourceBundle/Bug4168625Test.java
index 0c4c35a..1b2d2b5 100644
--- a/jdk/test/java/util/ResourceBundle/Bug4168625Test.java
+++ b/jdk/test/java/util/ResourceBundle/Bug4168625Test.java
@@ -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) {
diff --git a/jdk/test/java/util/ResourceBundle/Bug6359330.java b/jdk/test/java/util/ResourceBundle/Bug6359330.java
index 538ce9f..2755f33 100644
--- a/jdk/test/java/util/ResourceBundle/Bug6359330.java
+++ b/jdk/test/java/util/ResourceBundle/Bug6359330.java
@@ -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;
diff --git a/jdk/test/java/util/ResourceBundle/Test4300693.java b/jdk/test/java/util/ResourceBundle/Test4300693.java
index d40b45b..471c0c8 100644
--- a/jdk/test/java/util/ResourceBundle/Test4300693.java
+++ b/jdk/test/java/util/ResourceBundle/Test4300693.java
@@ -22,6 +22,7 @@
  */
 /*
     @test
+    @ignore 6876961
     @summary test that ResourceBundle.getBundle can be called recursively
     @build  Test4300693RB
     @run main Test4300693
diff --git a/jdk/test/java/util/ResourceBundle/TestBug4179766.java b/jdk/test/java/util/ResourceBundle/TestBug4179766.java
index 3546b13..0c6a8b9 100644
--- a/jdk/test/java/util/ResourceBundle/TestBug4179766.java
+++ b/jdk/test/java/util/ResourceBundle/TestBug4179766.java
@@ -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) {
diff --git a/jdk/test/java/util/logging/ParentLoggersTest.java b/jdk/test/java/util/logging/ParentLoggersTest.java
index 2f4a434..1caacb3 100644
--- a/jdk/test/java/util/logging/ParentLoggersTest.java
+++ b/jdk/test/java/util/logging/ParentLoggersTest.java
@@ -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);
diff --git a/jdk/test/java/util/zip/InfoZip.java b/jdk/test/java/util/zip/InfoZip.java
index 86249b1..aea1d32 100644
--- a/jdk/test/java/util/zip/InfoZip.java
+++ b/jdk/test/java/util/zip/InfoZip.java
@@ -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");
     }
diff --git a/jdk/test/java/util/zip/ZipFile/Comment.java b/jdk/test/java/util/zip/ZipFile/Comment.java
index db45dc8..d48cef2 100644
--- a/jdk/test/java/util/zip/ZipFile/Comment.java
+++ b/jdk/test/java/util/zip/ZipFile/Comment.java
@@ -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");
     }
diff --git a/jdk/test/java/util/zip/ZipFile/CorruptedZipFiles.java b/jdk/test/java/util/zip/ZipFile/CorruptedZipFiles.java
index 55c102b..a53fdbe 100644
--- a/jdk/test/java/util/zip/ZipFile/CorruptedZipFiles.java
+++ b/jdk/test/java/util/zip/ZipFile/CorruptedZipFiles.java
@@ -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++;
diff --git a/jdk/test/java/util/zip/ZipFile/ManyEntries.java b/jdk/test/java/util/zip/ZipFile/ManyEntries.java
index cbd11f5..4d36e7a 100644
--- a/jdk/test/java/util/zip/ZipFile/ManyEntries.java
+++ b/jdk/test/java/util/zip/ZipFile/ManyEntries.java
@@ -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();
diff --git a/jdk/test/javax/swing/JTable/6788484/bug6788484.java b/jdk/test/javax/swing/JTable/6788484/bug6788484.java
new file mode 100644
index 0000000..cbc2331
--- /dev/null
+++ b/jdk/test/javax/swing/JTable/6788484/bug6788484.java
@@ -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);
+    }
+}
diff --git a/jdk/test/javax/swing/plaf/synth/6771547/SynthTest.java b/jdk/test/javax/swing/plaf/synth/6771547/SynthTest.java
new file mode 100644
index 0000000..93921c9
--- /dev/null
+++ b/jdk/test/javax/swing/plaf/synth/6771547/SynthTest.java
@@ -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!");
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/plaf/synth/6771547/synthconfig.xml b/jdk/test/javax/swing/plaf/synth/6771547/synthconfig.xml
new file mode 100644
index 0000000..48aa2e7
--- /dev/null
+++ b/jdk/test/javax/swing/plaf/synth/6771547/synthconfig.xml
@@ -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>
diff --git a/jdk/test/javax/swing/plaf/synth/SynthToolBarUI/6739756/bug6739756.java b/jdk/test/javax/swing/plaf/synth/SynthToolBarUI/6739756/bug6739756.java
new file mode 100644
index 0000000..27e4867
--- /dev/null
+++ b/jdk/test/javax/swing/plaf/synth/SynthToolBarUI/6739756/bug6739756.java
@@ -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");
+                }
+            }
+        });
+    }
+}
diff --git a/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java b/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java
new file mode 100644
index 0000000..15619c9
--- /dev/null
+++ b/jdk/test/javax/swing/text/DefaultStyledDocument/6636983/bug6636983.java
@@ -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);
+                }
+            }
+        });
+    }
+}
diff --git a/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubBranchElement.java b/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubBranchElement.java
new file mode 100644
index 0000000..a96f18e
--- /dev/null
+++ b/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubBranchElement.java
@@ -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;
+    }
+}
diff --git a/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubLeafElement.java b/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubLeafElement.java
new file mode 100644
index 0000000..cdaa1d1
--- /dev/null
+++ b/jdk/test/javax/swing/text/WrappedPlainView/6857057/StubLeafElement.java
@@ -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;
+    }
+}
diff --git a/jdk/test/javax/swing/text/WrappedPlainView/6857057/bug6857057.java b/jdk/test/javax/swing/text/WrappedPlainView/6857057/bug6857057.java
new file mode 100644
index 0000000..b8ad6af
--- /dev/null
+++ b/jdk/test/javax/swing/text/WrappedPlainView/6857057/bug6857057.java
@@ -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");
+    }
+}
diff --git a/jdk/test/sun/jvmstat/testlibrary/utils.sh b/jdk/test/sun/jvmstat/testlibrary/utils.sh
index fc27e1c..a2e4608 100644
--- a/jdk/test/sun/jvmstat/testlibrary/utils.sh
+++ b/jdk/test/sun/jvmstat/testlibrary/utils.sh
@@ -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}"
+}
+
+
diff --git a/jdk/test/sun/security/krb5/auto/Context.java b/jdk/test/sun/security/krb5/auto/Context.java
index 60fa61a..14ba827 100644
--- a/jdk/test/sun/security/krb5/auto/Context.java
+++ b/jdk/test/sun/security/krb5/auto/Context.java
@@ -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
diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java
index 9e4fe52..6aca26c 100644
--- a/jdk/test/sun/security/krb5/auto/KDC.java
+++ b/jdk/test/sun/security/krb5/auto/KDC.java
@@ -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());
diff --git a/jdk/test/sun/security/krb5/auto/W83.java b/jdk/test/sun/security/krb5/auto/W83.java
new file mode 100644
index 0000000..a0951ca
--- /dev/null
+++ b/jdk/test/sun/security/krb5/auto/W83.java
@@ -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();
+    }
+}
diff --git a/jdk/test/sun/security/validator/CertReplace.java b/jdk/test/sun/security/validator/CertReplace.java
index e2a1a1b..e858cc7 100644
--- a/jdk/test/sun/security/validator/CertReplace.java
+++ b/jdk/test/sun/security/validator/CertReplace.java
@@ -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]);
diff --git a/jdk/test/sun/security/validator/certreplace.sh b/jdk/test/sun/security/validator/certreplace.sh
index af5ed1c..16470a3 100644
--- a/jdk/test/sun/security/validator/certreplace.sh
+++ b/jdk/test/sun/security/validator/certreplace.sh
@@ -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
diff --git a/jdk/test/sun/security/validator/samedn.sh b/jdk/test/sun/security/validator/samedn.sh
new file mode 100644
index 0000000..9d5afd4
--- /dev/null
+++ b/jdk/test/sun/security/validator/samedn.sh
@@ -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
diff --git a/jdk/test/sun/tools/jps/jps-Vvml_2.sh b/jdk/test/sun/tools/jps/jps-Vvml_2.sh
index 96f8678..83f9a05 100644
--- a/jdk/test/sun/tools/jps/jps-Vvml_2.sh
+++ b/jdk/test/sun/tools/jps/jps-Vvml_2.sh
@@ -51,3 +51,9 @@
 SLEEPER_PID=$!
 
 ${JPS} -J-XX:Flags=${TESTSRC}/vmflags -Vvml | awk -f ${TESTSRC}/jps-Vvml_Output2.awk
+RC=$?
+
+cleanup
+
+exit ${RC}
+
diff --git a/jdk/test/sun/tools/jps/jps-m_2.sh b/jdk/test/sun/tools/jps/jps-m_2.sh
index 2846ff3..afa0451 100644
--- a/jdk/test/sun/tools/jps/jps-m_2.sh
+++ b/jdk/test/sun/tools/jps/jps-m_2.sh
@@ -50,3 +50,9 @@
 SLEEPER_PID=$!
 
 ${JPS} -m | awk -f ${TESTSRC}/jps-m_Output2.awk
+RC=$?
+
+cleanup
+
+exit ${RC}
+
diff --git a/jdk/test/sun/tools/jstat/classloadOutput1.awk b/jdk/test/sun/tools/jstat/classloadOutput1.awk
new file mode 100644
index 0000000..66e2b5d
--- /dev/null
+++ b/jdk/test/sun/tools/jstat/classloadOutput1.awk
@@ -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
+	    }
+	}
diff --git a/jdk/test/sun/tools/jstat/jstatClassloadOutput1.sh b/jdk/test/sun/tools/jstat/jstatClassloadOutput1.sh
new file mode 100644
index 0000000..42e5bf1
--- /dev/null
+++ b/jdk/test/sun/tools/jstat/jstatClassloadOutput1.sh
@@ -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
diff --git a/jdk/test/sun/tools/jstat/jstatOptions1.sh b/jdk/test/sun/tools/jstat/jstatOptions1.sh
index c8d0120..af9367f 100644
--- a/jdk/test/sun/tools/jstat/jstatOptions1.sh
+++ b/jdk/test/sun/tools/jstat/jstatOptions1.sh
@@ -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
diff --git a/jdk/test/sun/tools/jstat/options2.out b/jdk/test/sun/tools/jstat/options2.out
new file mode 100644
index 0000000..5d05d60
--- /dev/null
+++ b/jdk/test/sun/tools/jstat/options2.out
@@ -0,0 +1,13 @@
+-class
+-classload
+-compiler
+-gc
+-gccapacity
+-gccause
+-gcnew
+-gcnewcapacity
+-gcold
+-gcoldcapacity
+-gcpermcapacity
+-gcutil
+-printcompilation
diff --git a/jdk/test/sun/tools/jstatd/jstatdDefaults.sh b/jdk/test/sun/tools/jstatd/jstatdDefaults.sh
index 1e25137..34b2180 100644
--- a/jdk/test/sun/tools/jstatd/jstatdDefaults.sh
+++ b/jdk/test/sun/tools/jstatd/jstatdDefaults.sh
@@ -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}
diff --git a/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh b/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
index ce52368..3385c82 100644
--- a/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
+++ b/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
@@ -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 ]
diff --git a/jdk/test/sun/tools/jstatd/jstatdPort.sh b/jdk/test/sun/tools/jstatd/jstatdPort.sh
index 48bed66..7e8f445 100644
--- a/jdk/test/sun/tools/jstatd/jstatdPort.sh
+++ b/jdk/test/sun/tools/jstatd/jstatdPort.sh
@@ -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}
diff --git a/jdk/test/sun/tools/jstatd/jstatdServerName.sh b/jdk/test/sun/tools/jstatd/jstatdServerName.sh
index 4215035..723a26c 100644
--- a/jdk/test/sun/tools/jstatd/jstatdServerName.sh
+++ b/jdk/test/sun/tools/jstatd/jstatdServerName.sh
@@ -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}
diff --git a/jdk/test/tools/jar/UpdateManifest.java b/jdk/test/tools/jar/UpdateManifest.java
index f2b5ca4..2bcd250 100644
--- a/jdk/test/tools/jar/UpdateManifest.java
+++ b/jdk/test/tools/jar/UpdateManifest.java
@@ -143,6 +143,7 @@
         } else {
             fail("did not match specVersion nor specTitle");
         }
+        zf.close();
     }
 
     // --------------------- Convenience ---------------------------
diff --git a/jdk/test/tools/jar/index/MetaInf.java b/jdk/test/tools/jar/index/MetaInf.java
index 2ffaa4a..ea62e2b 100644
--- a/jdk/test/tools/jar/index/MetaInf.java
+++ b/jdk/test/tools/jar/index/MetaInf.java
@@ -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.");
     }
 
diff --git a/jdk/test/tools/pack200/Pack200Test.java b/jdk/test/tools/pack200/Pack200Test.java
index ec0489a..631b507 100644
--- a/jdk/test/tools/pack200/Pack200Test.java
+++ b/jdk/test/tools/pack200/Pack200Test.java
@@ -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());
         }
diff --git a/jdk/test/tools/pack200/PackageVersionTest.java b/jdk/test/tools/pack200/PackageVersionTest.java
new file mode 100644
index 0000000..0cd9ca2
--- /dev/null
+++ b/jdk/test/tools/pack200/PackageVersionTest.java
@@ -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);
+        }
+    }
+}
diff --git a/jdk/test/tools/pack200/SegmentLimit.java b/jdk/test/tools/pack200/SegmentLimit.java
new file mode 100644
index 0000000..249e47b
--- /dev/null
+++ b/jdk/test/tools/pack200/SegmentLimit.java
@@ -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);
+        }
+    }
+}
+
diff --git a/make/Defs-internal.gmk b/make/Defs-internal.gmk
index f3c35bd..cab13f3 100644
--- a/make/Defs-internal.gmk
+++ b/make/Defs-internal.gmk
@@ -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)")
diff --git a/make/jprt.gmk b/make/jprt.gmk
index 6119177..57fd1d3 100644
--- a/make/jprt.gmk
+++ b/make/jprt.gmk
@@ -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) . )
 
 ################################################################
diff --git a/make/sanity-rules.gmk b/make/sanity-rules.gmk
index 88b4db5..6a17a5b 100644
--- a/make/sanity-rules.gmk
+++ b/make/sanity-rules.gmk
@@ -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
diff --git a/test/Makefile b/test/Makefile
index a1b7e6a..0e21411 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -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_rmi \
-	jdk_security jdk_security1 jdk_security2 jdk_security3  \
-	jdk_swing \
+	jdk_nio1 jdk_nio2 jdk_nio3  \
+	jdk_security1 jdk_security2 jdk_security3  \
 	jdk_text  \
-	jdk_tools jdk_tools1 jdk_tools2  \
+	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_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: