Merge
authorlana
Thu, 31 Mar 2011 22:07:32 -0700
changeset 9021 5cf29386a520
parent 9020 13b639abc930 (diff)
parent 8892 3db1444f8ac8 (current diff)
child 9022 b2e8758b10fd
child 9023 6175922846a4
child 9025 a72fc1fc4b71
child 9836 3d2b0ec3de09
Merge
hotspot/test/compiler/6987555/Test6987555.java
hotspot/test/compiler/6991596/Test6991596.java
jdk/make/common/Defs.gmk
jdk/make/common/Release.gmk
jdk/make/java/dyn/Makefile
jdk/src/share/classes/java/dyn/CallSite.java
jdk/src/share/classes/java/dyn/ClassValue.java
jdk/src/share/classes/java/dyn/ConstantCallSite.java
jdk/src/share/classes/java/dyn/InvokeDynamic.java
jdk/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java
jdk/src/share/classes/java/dyn/Linkage.java
jdk/src/share/classes/java/dyn/MethodHandle.java
jdk/src/share/classes/java/dyn/MethodHandles.java
jdk/src/share/classes/java/dyn/MethodType.java
jdk/src/share/classes/java/dyn/MethodTypeForm.java
jdk/src/share/classes/java/dyn/MutableCallSite.java
jdk/src/share/classes/java/dyn/SwitchPoint.java
jdk/src/share/classes/java/dyn/VolatileCallSite.java
jdk/src/share/classes/java/dyn/WrongMethodTypeException.java
jdk/src/share/classes/java/dyn/package-info.java
jdk/src/share/classes/sun/dyn/Access.java
jdk/src/share/classes/sun/dyn/AdapterMethodHandle.java
jdk/src/share/classes/sun/dyn/BoundMethodHandle.java
jdk/src/share/classes/sun/dyn/CallSiteImpl.java
jdk/src/share/classes/sun/dyn/DirectMethodHandle.java
jdk/src/share/classes/sun/dyn/FilterGeneric.java
jdk/src/share/classes/sun/dyn/FilterOneArgument.java
jdk/src/share/classes/sun/dyn/FromGeneric.java
jdk/src/share/classes/sun/dyn/InvokeGeneric.java
jdk/src/share/classes/sun/dyn/Invokers.java
jdk/src/share/classes/sun/dyn/MemberName.java
jdk/src/share/classes/sun/dyn/MethodHandleImpl.java
jdk/src/share/classes/sun/dyn/MethodHandleNatives.java
jdk/src/share/classes/sun/dyn/MethodTypeImpl.java
jdk/src/share/classes/sun/dyn/SpreadGeneric.java
jdk/src/share/classes/sun/dyn/ToGeneric.java
jdk/src/share/classes/sun/dyn/WrapperInstance.java
jdk/src/share/classes/sun/dyn/anon/AnonymousClassLoader.java
jdk/src/share/classes/sun/dyn/anon/ConstantPoolParser.java
jdk/src/share/classes/sun/dyn/anon/ConstantPoolPatch.java
jdk/src/share/classes/sun/dyn/anon/ConstantPoolVisitor.java
jdk/src/share/classes/sun/dyn/anon/InvalidConstantPoolFormatException.java
jdk/src/share/classes/sun/dyn/empty/Empty.java
jdk/src/share/classes/sun/dyn/package-info.java
jdk/src/share/classes/sun/dyn/util/BytecodeDescriptor.java
jdk/src/share/classes/sun/dyn/util/BytecodeName.java
jdk/src/share/classes/sun/dyn/util/ValueConversions.java
jdk/src/share/classes/sun/dyn/util/VerifyAccess.java
jdk/src/share/classes/sun/dyn/util/VerifyType.java
jdk/src/share/classes/sun/dyn/util/Wrapper.java
jdk/src/share/classes/sun/dyn/util/package-info.java
jdk/test/java/dyn/ClassValueTest.java
jdk/test/java/dyn/InvokeDynamicPrintArgs.java
jdk/test/java/dyn/InvokeGenericTest.java
jdk/test/java/dyn/JavaDocExamplesTest.java
jdk/test/java/dyn/MethodHandlesTest.java
jdk/test/java/dyn/MethodTypeTest.java
jdk/test/java/dyn/indify/Indify.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/common/Defs-embedded.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+#
+# Variable definitions for SE Embedded builds.  This file should
+# not contain rules.
+#
+ifdef JAVASE_EMBEDDED
+
+# Compress jar files
+COMPRESS_JARS = true
+
+# Don't mmap zip files
+LIBZIP_CAN_USE_MMAP = false
+
+# Disable ALSA version check
+REQUIRED_ALSA_VERSION =
+
+# Compilation settings
+OTHER_CPPFLAGS += -DJAVASE_EMBEDDED
+
+# Product naming
+PRODUCT_SUFFIX = SE Runtime Environment for Embedded
+RUNTIME_NAME = $(PRODUCT_NAME) $(PRODUCT_SUFFIX)
+
+# Reduced JRE locations
+JRE_REDUCED_HEADLESS_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-headless-image
+JRE_REDUCED_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-reduced-image
+
+endif # JAVASE_EMBEDDED
+
--- a/jdk/make/common/Defs.gmk	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/common/Defs.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -116,6 +116,12 @@
 include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
 
 #
+# SE-Embedded support, if enabled
+#
+
+include $(JDK_TOPDIR)/make/common/Defs-embedded.gmk
+
+#
 # Cross-compilation Settings
 #
 ifdef CROSS_COMPILE_ARCH
@@ -144,7 +150,6 @@
   VM_NAME = client
 endif
 
-
 #
 # Freetype logic is applicable to OpenJDK only
 #
--- a/jdk/make/common/Library.gmk	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/common/Library.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
 endif
 
 $(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders
-
+	@$(ECHO) Building lib:$(ACTUAL_LIBRARY) 
 #
 # COMPILE_APPROACH: Different approaches to compile up the native object
 #   files as quickly as possible.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/common/Release-embedded.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,232 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+#
+# SE-Embedded Reduced JRE targets
+#
+ifdef JAVASE_EMBEDDED
+
+reduced-image-jre reduced-headless-image-jre ::
+	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
+
+# Add the reduced-jre images as pre-reqs. These will be processed last
+images:: reduced-image-jre reduced-headless-image-jre
+
+
+######################################################
+# Create the headless rt.jar
+######################################################
+
+NOT_HEADLESS_RT_JAR_LIST = $(ABS_TEMPDIR)/not_hl_rt_jar.list
+HEADLESS_RT_JAR_FILELIST=$(JARFILELISTS_TEMPDIR)/hl_rt_jar_list
+TOTAL_HEADLESS_JAR_FILELIST=$(REORDER_TEMPDIR)/hl_file_list
+HEADLESS_CLASSLIST=$(ABS_TEMPDIR)/headless_classlist
+
+# Add the jar file directories that we don't want in the
+# headless JRE.  If you want to remove most classes in a
+# directory, put the directory in the NOT_HEADLESS_RT_JAR_LIST
+# and put the individual classes you want to keep in the 
+# HEADLESS_CLASSLIST file. 
+$(NOT_HEADLESS_RT_JAR_LIST): $(NOT_RT_JAR_LIST)
+	$(RM) $(HEADLESS_CLASSLIST)
+	$(RM) $(NOT_HEADLESS_RT_JAR_LIST)
+	$(CP) $(NOT_RT_JAR_LIST) $(NOT_HEADLESS_RT_JAR_LIST)
+	$(ECHO) "sun/awt/motif/" >> $@
+	$(ECHO) "sun/awt/X11/" >> $@
+	$(ECHO) "sun/applet/" >> $@
+	$(ECHO) "sun/java2d/opengl/" >> $@
+	$(ECHO) "com/sun/java/swing/plaf/" >> $@
+	$(ECHO) "sun/awt/motif/MFontConfiguration" >$(HEADLESS_CLASSLIST)
+	$(ECHO) "sun/applet/AppContextCreator" >>$(HEADLESS_CLASSLIST)
+	$(ECHO) "sun/applet/AppletAudioClip" >>$(HEADLESS_CLASSLIST)
+	$(ECHO) "sun/java2d/opengl/GLXSurfaceData" >>$(HEADLESS_CLASSLIST)
+	$(ECHO) "sun/java2d/opengl/GLXSurfaceData"\$$"GLXOffScreenSurfaceData" >>$(HEADLESS_CLASSLIST)
+	$(ECHO) "sun/java2d/opengl/GLXVolatileSurfaceManager" >>$(HEADLESS_CLASSLIST)
+	$(ECHO) "sun/java2d/opengl/OGLSurfaceData" >>$(HEADLESS_CLASSLIST)
+
+$(TOTAL_HEADLESS_JAR_FILELIST): $(JARREORDER_JARFILE) $(NOT_HEADLESS_RT_JAR_LIST)
+	$(prep-target)
+	$(RM) $@.temp
+	$(CD) $(CLASSBINDIR) ; \
+		$(BOOT_JAVA_CMD) -jar $(JARREORDER_JARFILE) \
+		-o  $@.temp $(HEADLESS_CLASSLIST) $(NOT_HEADLESS_RT_JAR_LIST)  .
+	$(MV) $@.temp $@
+	@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
+
+# Create the headless rt.jar file list & non-class files list
+MakeHeadlessJarFileList: $(TOTAL_HEADLESS_JAR_FILELIST) $(JARSPLIT_JARFILE)
+	@$(RM) $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
+	$(BOOT_JAVA_CMD) -jar $(JARSPLIT_JARFILE) $(TOTAL_HEADLESS_JAR_FILELIST) \
+		-o  $(HEADLESS_RT_JAR_FILELIST) $(RES_JAR_FILELIST)
+	@$(java-vm-cleanup)
+
+# Create headless rt.jar
+HL_RT_JAR=$(ABS_TEMPDIR)/rt-hl-orig.jar
+$(HL_RT_JAR): MakeHeadlessJarFileList $(JAR_MANIFEST_FILE)
+	$(prep-target)
+	$(CD) $(CLASSBINDIR) ; \
+		$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ @$(HEADLESS_RT_JAR_FILELIST) \
+		 $(JAR_JFLAGS)
+	@$(CD) $(CLASSBINDIR); $(java-vm-cleanup)
+
+
+#
+# Produce a reduced Headful JRE for Embedded Devices
+#
+# The deployment binaries are added during the deployment build process
+#
+
+# Binaries that don't get included in reduced jre image bin directory
+NOT_REDUCEDJRE_BIN = \
+ java_vm \
+ kinit \
+ klist \
+ ktab \
+ orbd \
+ policytool \
+ rmid \
+ rmiregistry \
+ servertool \
+ tnameserv \
+ pack200 \
+ unpack200
+
+# jars/resources/libs that don't get included in reduced jre image lib directory
+NOT_REDUCEDJRE_LIB = \
+ charsets.jar \
+ ext/dnsns.jar \
+ ext/localedata.jar \
+ $(LIBARCH)/client/classes.jsa \
+ $(LIBARCH)/libjavaplugin_jni.so \
+ $(LIBARCH)/libjavaplugin_nscp_gcc29.so \
+ $(LIBARCH)/libjavaplugin_nscp.so \
+ $(LIBARCH)/libjavaplugin_oji.so
+
+
+ifeq ($(PLATFORM), linux)
+  STRIP_OPTS = --strip-unneeded
+else
+  STRIP_OPTS = -x
+endif
+
+
+reduced-image-jre::
+	@$(ECHO) Starting to Produce Reduced JRE
+	@#
+	@# First make a copy of the full JRE
+	@#
+	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
+	$(MKDIR) -p $(JRE_REDUCED_IMAGE_DIR)
+	$(CD) $(JRE_IMAGE_DIR); \
+	    $(TAR) cf - . | ($(CD) $(JRE_REDUCED_IMAGE_DIR); $(TAR) xf - ); 
+
+	@# strip the main .so files
+	$(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/client/libjvm.so
+ifndef BUILD_CLIENT_ONLY
+	$(STRIP) $(STRIP_OPTS) $(JRE_REDUCED_IMAGE_DIR)/lib/$(LIBARCH)/server/libjvm.so
+endif
+
+	@#
+	@# Remove all of the files that are not needed for the
+	@# reduced JRE
+	@#
+	for l in $(NOT_REDUCEDJRE_BIN) ; do \
+	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/bin/$$l ; \
+	done
+	for l in $(NOT_REDUCEDJRE_LIB) ; do \
+	    $(RM) $(JRE_REDUCED_IMAGE_DIR)/lib/$$l ; \
+	done
+
+	@# Remove misc. other files
+	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)/man
+	$(RM) -f $(JRE_REDUCED_IMAGE_DIR)/CHANGES
+
+	@$(ECHO) Done Creating Reduced JRE
+
+#
+# Produce a reduced Headless JRE
+#
+reduced-headless-image-jre:: $(RT_JAR) $(RESOURCES_JAR) $(BUILD_META_INDEX) $(HL_RT_JAR)
+	@$(ECHO) Starting to Produce Reduced Headless JRE
+	@#
+	@# First make a copy of the reduced JRE we just built
+	@#
+	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
+	$(MKDIR) -p $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
+	$(CD) $(JRE_REDUCED_IMAGE_DIR); \
+	    $(TAR) cf - . | ($(CD) $(JRE_REDUCED_HEADLESS_IMAGE_DIR); $(TAR) xf - ); 
+
+	@# Replace the full rt.jar with the headless rt.jar
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
+	$(CP) $(HL_RT_JAR) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/rt.jar
+
+	@#
+	@# Remove all of the files that are not needed for the
+	@# reduced Headless JRE
+	@#
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/gtkhelper
+	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libjsoundalsa.so
+	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio
+	$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet
+	$(RM)  $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot
+	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/xawt
+	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so
+	@# Remove oblique fonts and reduce font support to LucidaSansRegular only
+	$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiBold.ttf
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightDemiItalic.ttf
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightItalic.ttf
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaBrightRegular.ttf
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaSansDemiBold.ttf
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterBold.ttf
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/LucidaTypewriterRegular.ttf
+
+ifeq ($(PLATFORM), linux)
+# put out minimal fonts.dir file for the remaining font
+	$(RM) -f $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) 6>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-2">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-4">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-5">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-7">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+	$(ECHO) "LucidaSansRegular.ttf -b&h-lucidasans-medium-r-normal-sans-0-0-0-0-p-0-iso8859-9">>$(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/fonts/fonts.dir
+
+endif # Linux
+
+	@#
+	@# all done with JRE reduced headless image
+	@#
+
+	@$(ECHO) Done Creating Reduced Headless JRE
+
+images-clobber::
+	$(RM) -r $(JRE_REDUCED_IMAGE_DIR)
+	$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)
+
+.PHONY: reduced-image-jre reduced-headless-image-jre 
+
+endif # JAVASE_EMBEDDED
+
--- a/jdk/make/common/Release.gmk	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/common/Release.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -38,7 +38,7 @@
 
 IMAGE_BINDIR = bin
 
-# The compiler should not issue a "Sun Propietary" warning when compiling
+# The compiler should not issue a "Proprietary" warning when compiling
 # classes in the com.sun.java.swing.plaf packages, since we've always
 # allowed, and even advocated, extending them (see bug 6476749).
 #
@@ -195,6 +195,16 @@
 fi
 endef
 
+
+# no compression unless requested
+ifndef COMPRESS_JARS
+  CREATE_JAR_OPTS = c0mf
+  CREATE_JAR_OPTS_NOMANIFEST = c0f
+else
+  CREATE_JAR_OPTS = cmf
+  CREATE_JAR_OPTS_NOMANIFEST = cf
+endif
+
 #
 # Targets.
 #
@@ -222,7 +232,7 @@
 	 $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
 	 trim-image-jre trim-image-jdk \
          identify-image-jre identify-image-jdk \
-	 process-image-jre process-image-jdk sec-files sec-files-win jgss-files
+	 process-image-jre process-image-jdk sec-files sec-files-win jgss-files 
 
 # Don't use these
 image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre
@@ -613,7 +623,7 @@
 $(RESOURCES_JAR): $(RES_JAR_FILELIST) $(JAR_MANIFEST_FILE)
 	$(prep-target)
 	$(CD) $(CLASSBINDIR) && \
-	    $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+	    $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
 	        @$(RES_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
 	@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
 
@@ -622,7 +632,7 @@
 $(JSSE_JAR): $(JAR_MANIFEST_FILE)
 	$(prep-target)
 	$(CD) $(CLASSBINDIR) && \
-	    $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+	    $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
 		$(JSSE_CLASSES_DIRS) $(BOOT_JAR_JFLAGS)
 	@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
 
@@ -669,7 +679,7 @@
 $(RT_JAR): $(RT_JAR_FILELIST) $(JAR_MANIFEST_FILE)
 	$(prep-target)
 	$(CD) $(CLASSBINDIR) && \
-	    $(BOOT_JAR_CMD) c0mf $(JAR_MANIFEST_FILE) $@ \
+	    $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS) $(JAR_MANIFEST_FILE) $@ \
 	        @$(RT_JAR_FILELIST) $(BOOT_JAR_JFLAGS)
 	@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
 
@@ -677,6 +687,10 @@
 
 BUILDMETAINDEX_JARFILE = $(ABS_BUILDTOOLJARDIR)/buildmetaindex.jar
 
+# SE-Embedded targets if enabled
+include $(JDK_TOPDIR)/make/common/Release-embedded.gmk
+
+
 ######################################################
 # JRE Image
 ######################################################
@@ -924,7 +938,7 @@
 	@# lib/tools.jar
 	@#
 	$(CD) $(CLASSBINDIR) && \
-	    $(BOOT_JAR_CMD) c0f $(ABS_LIBDIR)/tools.jar \
+	    $(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(ABS_LIBDIR)/tools.jar \
 	        $(TOOLS) $(BOOT_JAR_JFLAGS)
 	@$(CD) $(CLASSBINDIR) && $(java-vm-cleanup)
 	$(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar
@@ -937,7 +951,7 @@
 	    -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) $(EXPORTED_PRIVATE_PKGS)
-	$(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
+	$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(LIBDIR)/ct.sym \
 	    -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
 	@$(java-vm-cleanup)
 	$(CP) $(LIBDIR)/ct.sym $(JDK_IMAGE_DIR)/lib/ct.sym
--- a/jdk/make/common/shared/Sanity-Settings.gmk	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/common/shared/Sanity-Settings.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -185,7 +185,9 @@
   endif
 endif
 ifeq ($(PLATFORM),linux)
-  ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION)
+  ifdef REQUIRED_ALSA_VERSION
+    ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION)
+  endif
 endif
 ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION)
 ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME)
--- a/jdk/make/java/net/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/java/net/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -37,10 +37,6 @@
 AUTO_FILES_JAVA_DIRS = java/net
 
 ifeq ($(PLATFORM), windows)
-    # Windows 9x module only needed on 32-bit build
-    ifeq ($(ARCH_DATA_MODEL), 32)
-	FILES_c += NetworkInterface_win9x.c
-    endif
     FILES_c += NTLMAuthSequence.c
     FILES_c += NetworkInterface_winXP.c
 else
@@ -96,7 +92,9 @@
 include $(BUILDDIR)/common/Library.gmk
 
 ifeq ($(PLATFORM), windows)
-  OTHER_LDLIBS = ws2_32.lib $(JVMLIB)
+  OTHER_LDLIBS = ws2_32.lib $(JVMLIB) \
+                 secur32.lib iphlpapi.lib delayimp.lib \
+                 /DELAYLOAD:secur32.dll /DELAYLOAD:iphlpapi.dll
 else
   OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB)
 endif
--- a/jdk/make/java/zip/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/java/zip/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,10 @@
 	java/util/jar/JarFile.java
 
 ifneq ($(PLATFORM), windows)
-OTHER_CFLAGS += -DUSE_MMAP
+  # Use mmap unless explicitly disallowed
+  ifneq ($(LIBZIP_CAN_USE_MMAP),false)
+    OTHER_CFLAGS += -DUSE_MMAP
+  endif
 endif
 
 #
--- a/jdk/make/jprt.properties	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/jprt.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -52,8 +52,11 @@
     ${jprt.my.windows.i586}-{product|fastdebug}, 		\
     windows_x64_5.2-{product|fastdebug}
 
+# User can select the test set with jprt submit "-testset name" option
+jprt.my.test.set=${jprt.test.set}
+
 # Standard vm test target
-jprt.test.targets=						\
+jprt.vm.default.test.targets=					\
     solaris_sparc_5.10-product-c1-jvm98, 			\
     solaris_sparcv9_5.10-product-c2-jvm98, 			\
     solaris_i586_5.10-product-c1-jvm98, 			\
@@ -63,8 +66,10 @@
     ${jprt.my.windows.i586}-product-c1-jvm98, 			\
     windows_x64_5.2-product-c2-jvm98
 
-# User can select the test set with jprt submit "-testset name" option
-jprt.my.test.set=${jprt.test.set}
+# Select vm testlist to use (allow for testset to be empty too)
+jprt.vm.all.test.targets=${jprt.vm.default.test.targets}
+jprt.vm..test.targets=${jprt.vm.default.test.targets} 
+jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets} 
 
 # Default jdk test targets in test/Makefile (no fastdebug & limited c2)
 jprt.make.rule.default.test.targets=				\
@@ -281,6 +286,21 @@
     ${jprt.my.windows.i586}-product-c1-jdk_tools2, 		\
     windows_x64_5.2-product-c2-jdk_tools2
 
+# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
+jprt.my.jck.test.target.set=					\
+    solaris_sparc_5.10-product-c1-JCK7TESTRULE, 		\
+    solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, 		\
+    solaris_i586_5.10-product-c1-JCK7TESTRULE, 			\
+    solaris_x64_5.10-product-c2-JCK7TESTRULE, 			\
+    linux_i586_2.6-product-c1-JCK7TESTRULE, 			\
+    linux_x64_2.6-product-c2-JCK7TESTRULE
+
+# JCK testset targets (e.g. jprt submit -testset jck ... )
+jprt.make.rule.jck.test.targets=				\
+    ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7devtools},   \
+    ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7runtime},    \
+    ${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
+
 # Select list to use (allow for testset to be empty too)
 jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets} 
 jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets} 
--- a/jdk/make/launchers/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/launchers/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -44,8 +44,17 @@
 endef
 
 # Run MAKE $@ for all generic launchers
+ifndef BUILD_HEADLESS_ONLY
+define make-appletviewer
+$(call make-launcher, appletviewer, sun.applet.Main, , )
+endef
+else
+define make-appletviewer
+endef
+endif
+
 define make-all-launchers
-$(call make-launcher, appletviewer, sun.applet.Main, , )
+$(make-appletviewer)
 $(call make-launcher, apt, com.sun.tools.apt.Main, , )
 $(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , )
 $(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , )
--- a/jdk/make/sun/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -69,10 +69,17 @@
 
 # nio need to be compiled before awt to have all charsets ready
 SUBDIRS            = jar security javazic misc net nio text launcher
+
+ifdef BUILD_HEADLESS_ONLY
+  DISPLAY_LIBS = awt $(HEADLESS_SUBDIR)
+  DISPLAY_TOOLS = 
+else
+  DISPLAY_LIBS = awt splashscreen $(XAWT_SUBDIR) $(HEADLESS_SUBDIR)
+  DISPLAY_TOOLS = applet
+endif
 SUBDIRS_desktop    = audio $(RENDER_SUBDIR) image \
-                     awt splashscreen $(XAWT_SUBDIR) \
-                     $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
-                     jawt font jpeg cmm applet beans
+                     $(DISPLAY_LIBS) $(DGA_SUBDIR) \
+                     jawt font jpeg cmm $(DISPLAY_TOOLS) beans
 SUBDIRS_management = management
 SUBDIRS_misc       = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
 SUBDIRS_tools      = native2ascii serialver tools jconsole
--- a/jdk/make/sun/awt/mawt.gmk	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/awt/mawt.gmk	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -149,13 +149,13 @@
         LIBXT = -lXt
     else
     # Allows for builds on Debian GNU Linux, X11 is in a different place 
-       LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \
+       LIBXT = $(firstword $(wildcard $(OPENWIN_LIB)/libXt.a) \
                         $(wildcard /usr/lib/libXt.a))
-       LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \
+       LIBSM = $(firstword $(wildcard $(OPENWIN_LIB)/libSM.a) \
                         $(wildcard /usr/lib/libSM.a))
-       LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \
+       LIBICE = $(firstword $(wildcard $(OPENWIN_LIB)/libICE.a) \
                          $(wildcard /usr/lib/libICE.a))
-       LIBXTST = $(firstword $(wildcard /usr/X11R6/lib/libXtst.a) \
+       LIBXTST = $(firstword $(wildcard $(OPENWIN_LIB)/libXtst.a) \
                          $(wildcard /usr/lib/libXtst.a))
    endif
 endif
@@ -224,9 +224,9 @@
         $(EVENT_MODEL)
 
 ifeq ($(PLATFORM), linux)
-# Checking for the X11/extensions headers at the additional location
-  CPPFLAGS += -I/X11R6/include/X11/extensions \
-              -I/usr/include/X11/extensions
+  # Checking for the X11/extensions headers at the additional location
+  CPPFLAGS += -I$(firstword $(wildcard $(OPENWIN_HOME)/include/X11/extensions) \
+                        $(wildcard /usr/include/X11/extensions))
 endif
 
 ifeq ($(PLATFORM), solaris)
--- a/jdk/make/sun/jawt/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/jawt/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -112,11 +112,20 @@
 # Libraries to link in.
 #
 ifeq ($(PLATFORM), solaris)
-OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+  ifndef BUILD_HEADLESS_ONLY
+    OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+  else
+    OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/headless -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+  endif
 endif # PLATFORM
 
 ifeq ($(PLATFORM), linux)
-OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
+  ifndef BUILD_HEADLESS_ONLY
+    OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
+  else
+    OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/headless -lmawt
+    CFLAGS += -DHEADLESS
+  endif
 endif # PLATFORM
 
 endif # PLATFORM
--- a/jdk/make/sun/jpeg/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/jpeg/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -73,9 +73,10 @@
   # Recommended way to avoid such warning is to declare the variable as
   # volatile to prevent the optimization. However, this approach does not
   # work because we have to declare all variables as volatile in result.
-
+ifndef CROSS_COMPILE_ARCH
   OTHER_CFLAGS += -Wno-clobbered
 endif
+endif
 
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 include $(BUILDDIR)/common/Library.gmk
--- a/jdk/make/sun/nio/cs/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/nio/cs/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -120,8 +120,15 @@
   $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH)
 	$(install-file)
 
+# no compression unless requested
+ifndef COMPRESS_JARS
+  CREATE_JAR_OPTS_NOMANIFEST = cf0
+else
+  CREATE_JAR_OPTS_NOMANIFEST = cf
+endif
+
 $(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
-	$(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \
+	$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(CHARSETS_JAR) \
 	      -C $(CLASSDESTDIR) sun \
 	      -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH)  \
 	      $(BOOT_JAR_JFLAGS)
--- a/jdk/make/sun/security/tools/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/security/tools/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -46,5 +46,7 @@
 
 build:
 	$(call make-launcher, keytool, sun.security.tools.KeyTool, , )
+ifndef BUILD_HEADLESS_ONLY
 	$(call make-launcher, policytool, sun.security.tools.policytool.PolicyTool, , )
+endif
 
--- a/jdk/make/sun/xawt/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/make/sun/xawt/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -129,10 +129,17 @@
         -I$(PLATFORM_SRC)/native/sun/awt
 
 ifeq ($(PLATFORM), linux)
-# Allows for builds on Debian GNU Linux, X11 is in a different place 
-  CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
-              -I/usr/include/X11/extensions \
-              -I$(OPENWIN_HOME)/include 
+  ifndef CROSS_COMPILE_ARCH
+    # Allows for builds on Debian GNU Linux, X11 is in a different place 
+    # This should really be handled at a higher-level so we don't have to
+    # work-around this when cross-compiling
+    CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
+                -I/usr/include/X11/extensions \
+                -I$(OPENWIN_HOME)/include 
+  else
+    CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \
+                -I$(OPENWIN_HOME)/include 
+  endif
 endif
 
 # We have some odd logic here because some Solaris 10 updates
@@ -245,7 +252,11 @@
 
 $(SIZERS): $(SIZERS_C) 
 	$(prep-target)
+ifndef CROSS_COMPILE_ARCH
 	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
+else
+	$(HOST_CC) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
+endif
 
 $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
 	$(prep-target)
--- a/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,13 +30,14 @@
 import java.net.MalformedURLException;
 import java.net.SocketPermission;
 import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.text.MessageFormat;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.LinkedList;
 import java.util.ListIterator;
 import java.util.Vector;
 import java.util.StringTokenizer;
-import java.security.GeneralSecurityException;
 import sun.security.util.PropertyExpander;
 
 /**
@@ -368,8 +369,8 @@
                                 "WILDCARD class but no WILDCARD name");
                     throw new ParsingException
                         (st.lineno(),
-                        rb.getString("can.not.specify.Principal.with.a.") +
-                        rb.getString("wildcard.class.without.a.wildcard.name"));
+                        rb.getString("can.not.specify.Principal.with.a." +
+                                     "wildcard.class.without.a.wildcard.name"));
                 }
 
                 try {
@@ -525,9 +526,10 @@
                                         rb.getString("number.") +
                                         String.valueOf(st.nval));
         case StreamTokenizer.TT_EOF:
-           throw new ParsingException
-                (rb.getString("expected.") + expect +
-                rb.getString(".read.end.of.file"));
+            MessageFormat form = new MessageFormat(
+                    rb.getString("expected.expect.read.end.of.file."));
+            Object[] source = {expect};
+            throw new ParsingException(form.format(source));
         case StreamTokenizer.TT_WORD:
             if (expect.equalsIgnoreCase(st.sval)) {
                 lookahead = st.nextToken();
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -858,7 +858,7 @@
                         String nm = null;
                         Class cls = null;
                         try {
-                            nm = System.getProperty("awt.toolkit", "sun.awt.X11.XToolkit");
+                            nm = System.getProperty("awt.toolkit");
                             try {
                                 cls = Class.forName(nm);
                             } catch (ClassNotFoundException e) {
--- a/jdk/src/share/classes/java/lang/ArithmeticException.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/ArithmeticException.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,15 +30,18 @@
  * example, an integer "divide by zero" throws an
  * instance of this class.
  *
+ * {@code ArithmeticException} objects may be constructed by the
+ * virtual machine as if {@linkplain Throwable#Throwable(String,
+ * Throwable, boolean) suppression were disabled}.
+ *
  * @author  unascribed
  * @since   JDK1.0
  */
-public
-class ArithmeticException extends RuntimeException {
+public class ArithmeticException extends RuntimeException {
     private static final long serialVersionUID = 2256477558314496007L;
 
     /**
-     * Constructs an <code>ArithmeticException</code> with no detail
+     * Constructs an {@code ArithmeticException} with no detail
      * message.
      */
     public ArithmeticException() {
@@ -46,7 +49,7 @@
     }
 
     /**
-     * Constructs an <code>ArithmeticException</code> with the specified
+     * Constructs an {@code ArithmeticException} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/jdk/src/share/classes/java/lang/NullPointerException.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/NullPointerException.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,20 +26,24 @@
 package java.lang;
 
 /**
- * Thrown when an application attempts to use <code>null</code> in a
+ * Thrown when an application attempts to use {@code null} in a
  * case where an object is required. These include:
  * <ul>
- * <li>Calling the instance method of a <code>null</code> object.
- * <li>Accessing or modifying the field of a <code>null</code> object.
- * <li>Taking the length of <code>null</code> as if it were an array.
- * <li>Accessing or modifying the slots of <code>null</code> as if it
+ * <li>Calling the instance method of a {@code null} object.
+ * <li>Accessing or modifying the field of a {@code null} object.
+ * <li>Taking the length of {@code null} as if it were an array.
+ * <li>Accessing or modifying the slots of {@code null} as if it
  *     were an array.
- * <li>Throwing <code>null</code> as if it were a <code>Throwable</code>
+ * <li>Throwing {@code null} as if it were a {@code Throwable}
  *     value.
  * </ul>
  * <p>
  * Applications should throw instances of this class to indicate
- * other illegal uses of the <code>null</code> object.
+ * other illegal uses of the {@code null} object.
+ *
+ * {@code NullPointerException} objects may be constructed by the
+ * virtual machine as if {@linkplain Throwable#Throwable(String,
+ * Throwable, boolean) suppression were disabled}.
  *
  * @author  unascribed
  * @since   JDK1.0
@@ -49,14 +53,14 @@
     private static final long serialVersionUID = 5162710183389028792L;
 
     /**
-     * Constructs a <code>NullPointerException</code> with no detail message.
+     * Constructs a {@code NullPointerException} with no detail message.
      */
     public NullPointerException() {
         super();
     }
 
     /**
-     * Constructs a <code>NullPointerException</code> with the specified
+     * Constructs a {@code NullPointerException} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/jdk/src/share/classes/java/lang/OutOfMemoryError.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/OutOfMemoryError.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,22 +30,25 @@
  * because it is out of memory, and no more memory could be made
  * available by the garbage collector.
  *
+ * {@code OutOfMemoryError} objects may be constructed by the virtual
+ * machine as if {@linkplain Throwable#Throwable(String, Throwable,
+ * boolean) suppression were disabled}.
+ *
  * @author  unascribed
  * @since   JDK1.0
  */
-public
-class OutOfMemoryError extends VirtualMachineError {
+public class OutOfMemoryError extends VirtualMachineError {
     private static final long serialVersionUID = 8228564086184010517L;
 
     /**
-     * Constructs an <code>OutOfMemoryError</code> with no detail message.
+     * Constructs an {@code OutOfMemoryError} with no detail message.
      */
     public OutOfMemoryError() {
         super();
     }
 
     /**
-     * Constructs an <code>OutOfMemoryError</code> with the specified
+     * Constructs an {@code OutOfMemoryError} with the specified
      * detail message.
      *
      * @param   s   the detail message.
--- a/jdk/src/share/classes/java/lang/Throwable.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Thu Mar 31 22:07:32 2011 -0700
@@ -46,13 +46,16 @@
  * are freshly created in the context of the exceptional situation so
  * as to include relevant information (such as stack trace data).
  *
- * <p>A throwable contains a snapshot of the execution stack of its thread at
- * the time it was created. It can also contain a message string that gives
- * more information about the error. Finally, it can contain a <i>cause</i>:
- * another throwable that caused this throwable to get thrown.  The cause
- * facility is new in release 1.4.  It is also known as the <i>chained
- * exception</i> facility, as the cause can, itself, have a cause, and so on,
- * leading to a "chain" of exceptions, each caused by another.
+ * <p>A throwable contains a snapshot of the execution stack of its
+ * thread at the time it was created. It can also contain a message
+ * string that gives more information about the error. Over time, a
+ * throwable can {@linkplain Throwable#addSuppressed suppress} other
+ * throwables from being propagated.  Finally, the throwable can also
+ * contain a <i>cause</i>: another throwable that caused this
+ * throwable to be constructed.  The recording of this causal information
+ * is referred to as the <i>chained exception</i> facility, as the
+ * cause can, itself, have a cause, and so on, leading to a "chain" of
+ * exceptions, each caused by another.
  *
  * <p>One reason that a throwable may have a cause is that the class that
  * throws it is built atop a lower layered abstraction, and an operation on
@@ -86,47 +89,12 @@
  * {@link #initCause(Throwable)} method.  New throwable classes that
  * wish to allow causes to be associated with them should provide constructors
  * that take a cause and delegate (perhaps indirectly) to one of the
- * {@code Throwable} constructors that takes a cause.  For example:
- * <pre>
- *     try {
- *         lowLevelOp();
- *     } catch (LowLevelException le) {
- *         throw new HighLevelException(le);  // Chaining-aware constructor
- *     }
- * </pre>
+ * {@code Throwable} constructors that takes a cause.
+ *
  * Because the {@code initCause} method is public, it allows a cause to be
  * associated with any throwable, even a "legacy throwable" whose
  * implementation predates the addition of the exception chaining mechanism to
- * {@code Throwable}. For example:
- * <pre>
- *     try {
- *         lowLevelOp();
- *     } catch (LowLevelException le) {
- *         throw (HighLevelException)
- *               new HighLevelException().initCause(le);  // Legacy constructor
- *     }
- * </pre>
- *
- * <p>Prior to release 1.4, there were many throwables that had their own
- * non-standard exception chaining mechanisms (
- * {@link ExceptionInInitializerError}, {@link ClassNotFoundException},
- * {@link java.lang.reflect.UndeclaredThrowableException},
- * {@link java.lang.reflect.InvocationTargetException},
- * {@link java.io.WriteAbortedException},
- * {@link java.security.PrivilegedActionException},
- * {@link java.awt.print.PrinterIOException},
- * {@link java.rmi.RemoteException} and
- * {@link javax.naming.NamingException}).
- * All of these throwables have been retrofitted to
- * use the standard exception chaining mechanism, while continuing to
- * implement their "legacy" chaining mechanisms for compatibility.
- *
- * <p>Further, as of release 1.4, many general purpose {@code Throwable}
- * classes (for example {@link Exception}, {@link RuntimeException},
- * {@link Error}) have been retrofitted with constructors that take
- * a cause.  This was not strictly necessary, due to the existence of the
- * {@code initCause} method, but it is more convenient and expressive to
- * delegate to a constructor that takes a cause.
+ * {@code Throwable}.
  *
  * <p>By convention, class {@code Throwable} and its subclasses have two
  * constructors, one that takes no arguments and one that takes a
@@ -137,14 +105,6 @@
  * {@code String} (the detail message) and a {@code Throwable} (the
  * cause).
  *
- * <p>Also introduced in release 1.4 is the {@link #getStackTrace()} method,
- * which allows programmatic access to the stack trace information that was
- * previously available only in text form, via the various forms of the
- * {@link #printStackTrace()} method.  This information has been added to the
- * <i>serialized representation</i> of this class so {@code getStackTrace}
- * and {@code printStackTrace} will operate properly on a throwable that
- * was obtained by deserialization.
- *
  * @author  unascribed
  * @author  Josh Bloch (Added exception chaining and programmatic access to
  *          stack trace in 1.4.)
@@ -323,6 +283,41 @@
     }
 
     /**
+     * Constructs a new throwable with the specified detail message,
+     * cause, and {@linkplain #addSuppressed suppression} enabled or
+     * disabled.  If suppression is disabled, {@link #getSuppressed}
+     * for this object will return a zero-length array and calls to
+     * {@link #addSuppressed} that would otherwise append an exception
+     * to the suppressed list will have no effect.
+     *
+     * <p>Note that the other constructors of {@code Throwable} treat
+     * suppression as being enabled.  Subclasses of {@code Throwable}
+     * should document any conditions under which suppression is
+     * disabled.  Disabling of suppression should only occur in
+     * exceptional circumstances where special requirements exist,
+     * such as a virtual machine reusing exception objects under
+     * low-memory situations.
+     *
+     * @param  message the detail message.
+     * @param cause the cause.  (A {@code null} value is permitted,
+     * and indicates that the cause is nonexistent or unknown.)
+     * @param enableSuppression whether or not suppression is enabled or disabled
+     *
+     * @see OutOfMemoryError
+     * @see NullPointerException
+     * @see ArithmeticException
+     * @since 1.7
+     */
+    protected Throwable(String message, Throwable cause,
+                        boolean enableSuppression) {
+        fillInStackTrace();
+        detailMessage = message;
+        this.cause = cause;
+        if (!enableSuppression)
+            suppressedExceptions = null;
+    }
+
+    /**
      * Returns the detail message string of this throwable.
      *
      * @return  the detail message string of this {@code Throwable} instance
@@ -870,54 +865,64 @@
      * typically called (automatically and implicitly) by the {@code
      * try}-with-resources statement.
      *
-     * If the first exception to be suppressed is {@code null}, that
-     * indicates suppressed exception information will <em>not</em> be
-     * recorded for this exception.  Subsequent calls to this method
-     * will not record any suppressed exceptions.  Otherwise,
-     * attempting to suppress {@code null} after an exception has
-     * already been successfully suppressed results in a {@code
-     * NullPointerException}.
+     * <p>The suppression behavior is enabled <em>unless</em> disabled
+     * {@linkplain #Throwable(String, Throwable, boolean) via a
+     * constructor}.  When suppression is disabled, this method does
+     * nothing other than to validate its argument.
      *
      * <p>Note that when one exception {@linkplain
      * #initCause(Throwable) causes} another exception, the first
      * exception is usually caught and then the second exception is
-     * thrown in response.  In contrast, when one exception suppresses
-     * another, two exceptions are thrown in sibling code blocks, such
-     * as in a {@code try} block and in its {@code finally} block, and
-     * control flow can only continue with one exception so the second
-     * is recorded as a suppressed exception of the first.
+     * thrown in response.  In other words, there is a causal
+     * connection between the two exceptions.
+     *
+     * In contrast, there are situations where two independent
+     * exceptions can be thrown in sibling code blocks, in particular
+     * in the {@code try} block of a {@code try}-with-resources
+     * statement and the compiler-generated {@code finally} block
+     * which closes the resource.
+     *
+     * In these situations, only one of the thrown exceptions can be
+     * propagated.  In the {@code try}-with-resources statement, when
+     * there are two such exceptions, the exception originating from
+     * the {@code try} block is propagated and the exception from the
+     * {@code finally} block is added to the list of exceptions
+     * suppressed by the exception from the {@code try} block.  As an
+     * exception unwinds the stack, it can accumulate multiple
+     * suppressed exceptions.
+     *
+     * <p>An exception may have suppressed exceptions while also being
+     * caused by another exception.  Whether or not an exception has a
+     * cause is semantically known at the time of its creation, unlike
+     * whether or not an exception will suppress other exceptions
+     * which is typically only determined after an exception is
+     * thrown.
+     *
+     * <p>Note that programmer written code is also able to take
+     * advantage of calling this method in situations where there are
+     * multiple sibling exceptions and only one can be propagated.
      *
      * @param exception the exception to be added to the list of
      *        suppressed exceptions
      * @throws IllegalArgumentException if {@code exception} is this
      *         throwable; a throwable cannot suppress itself.
-     * @throws NullPointerException if {@code exception} is null and
-     *         an exception has already been suppressed by this exception
+     * @throws NullPointerException if {@code exception} is {@code null}
      * @since 1.7
      */
     public final synchronized void addSuppressed(Throwable exception) {
         if (exception == this)
             throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
 
-        if (exception == null) {
-            if (suppressedExceptions == SUPPRESSED_SENTINEL) {
-                suppressedExceptions = null; // No suppression information recorded
-                return;
-            } else
-                throw new NullPointerException(NULL_CAUSE_MESSAGE);
-        } else {
-            assert exception != null && exception != this;
+        if (exception == null)
+            throw new NullPointerException(NULL_CAUSE_MESSAGE);
 
-            if (suppressedExceptions == null) // Suppressed exceptions not recorded
-                return;
+        if (suppressedExceptions == null) // Suppressed exceptions not recorded
+            return;
 
-            if (suppressedExceptions == SUPPRESSED_SENTINEL)
-                suppressedExceptions = new ArrayList<>(1);
+        if (suppressedExceptions == SUPPRESSED_SENTINEL)
+            suppressedExceptions = new ArrayList<>(1);
 
-            assert suppressedExceptions != SUPPRESSED_SENTINEL;
-
-            suppressedExceptions.add(exception);
-        }
+        suppressedExceptions.add(exception);
     }
 
     private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];
@@ -927,7 +932,9 @@
      * suppressed, typically by the {@code try}-with-resources
      * statement, in order to deliver this exception.
      *
-     * If no exceptions were suppressed, an empty array is returned.
+     * If no exceptions were suppressed or {@linkplain
+     * Throwable(String, Throwable, boolean) suppression is disabled},
+     * an empty array is returned.
      *
      * @return an array containing all of the exceptions that were
      *         suppressed to deliver this exception.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.management;
+
+/**
+ * The management interface for a buffer pool, for example a pool of
+ * {@link java.nio.ByteBuffer#allocateDirect direct} or {@link
+ * java.nio.MappedByteBuffer mapped} buffers.
+ *
+ * <p> A class implementing this interface is an
+ * {@link javax.management.MXBean}. A Java
+ * virtual machine has one or more implementations of this interface. The {@link
+ * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
+ * method can be used to obtain the list of {@code BufferPoolMXBean} objects
+ * representing the management interfaces for pools of buffers as follows:
+ * <pre>
+ *     List&lt;BufferPoolMXBean&gt; pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
+ * </pre>
+ *
+ * <p> The management interfaces are also registered with the platform {@link
+ * javax.management.MBeanServer MBeanServer}. The {@link
+ * javax.management.ObjectName ObjectName} that uniquely identifies the
+ * management interface within the {@code MBeanServer} takes the form:
+ * <pre>
+ *     java.nio:type=BufferPool,name=<i>pool name</i>
+ * </pre>
+ * where <em>pool name</em> is the {@link #getName name} of the buffer pool.
+ *
+ * @since   1.7
+ */
+public interface BufferPoolMXBean extends PlatformManagedObject {
+
+    /**
+     * Returns the name representing this buffer pool.
+     *
+     * @return  The name of this buffer pool.
+     */
+    String getName();
+
+    /**
+     * Returns an estimate of the number of buffers in the pool.
+     *
+     * @return  An estimate of the number of buffers in this pool
+     */
+    long getCount();
+
+    /**
+     * Returns an estimate of the total capacity of the buffers in this pool.
+     * A buffer's capacity is the number of elements it contains and the value
+     * returned by this method is an estimate of the total capacity of buffers
+     * in the pool in bytes.
+     *
+     * @return  An estimate of the total capacity of the buffers in this pool
+     *          in bytes
+     */
+    long getTotalCapacity();
+
+    /**
+     * Returns an estimate of the memory that the Java virtual machine is using
+     * for this buffer pool. The value returned by this method may differ
+     * from the estimate of the total {@link #getTotalCapacity capacity} of
+     * the buffers in this pool. This difference is explained by alignment,
+     * memory allocator, and other implementation specific reasons.
+     *
+     * @return  An estimate of the memory that the Java virtual machine is using
+     *          for this buffer pool in bytes, or {@code -1L} if an estimate of
+     *          the memory usage is not available
+     */
+    long getMemoryUsed();
+}
--- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Thu Mar 31 22:07:32 2011 -0700
@@ -40,8 +40,9 @@
 import javax.management.StandardEmitterMBean;
 import javax.management.StandardMBean;
 import java.util.Collections;
-import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 import java.security.AccessController;
 import java.security.Permission;
 import java.security.PrivilegedAction;
@@ -51,37 +52,63 @@
 import sun.management.ManagementFactoryHelper;
 
 /**
- * The <tt>ManagementFactory</tt> class is a factory class for getting
+ * The {@code ManagementFactory} class is a factory class for getting
  * managed beans for the Java platform.
  * This class consists of static methods each of which returns
- * one or more <a href="#MXBean">platform MXBean(s)</a> representing
+ * one or more <i>platform MXBeans</i> representing
  * the management interface of a component of the Java virtual
  * machine.
+ * <p>
+ * <h4><a name="MXBean">Platform MXBeans</a></h4>
+ * <p>
+ * A platform MXBean is a <i>managed bean</i> that
+ * conforms to the <a href="../../../javax/management/package-summary.html">JMX</a>
+ * Instrumentation Specification and only uses a set of basic data types.
+ * A JMX management application and the {@linkplain
+ * #getPlatformMBeanServer platform MBeanServer}
+ * can interoperate without requiring classes for MXBean specific
+ * data types.
+ * The data types being transmitted between the JMX connector
+ * server and the connector client are
+ * {@linkplain javax.management.openmbean.OpenType open types}
+ * and this allows interoperation across versions.
+ * See <a href="../../../javax/management/MXBean.html#MXBean-spec">
+ * the specification of MXBeans</a> for details.
+ *
+ * <a name="MXBeanNames"></a>
+ * <p>Each platform MXBean is a {@link PlatformManagedObject}
+ * and it has a unique
+ * {@link javax.management.ObjectName ObjectName} for
+ * registration in the platform {@code MBeanServer} as returned by
+ * by the {@link PlatformManagedObject#getObjectName getObjectName}
+ * method.
  *
  * <p>
  * An application can access a platform MXBean in the following ways:
+ * <h5>1. Direct access to an MXBean interface</h5>
+ * <blockquote>
  * <ul>
- * <li><i>Direct access to an MXBean interface</i>
- *     <ol type="a">
- *     <li>Get the MXBean instance through the static factory method,
- *         or the {@link #getPlatformMXBeans(Class)} method
- *         and access the MXBean locally of the running
+ *     <li>Get an MXBean instance by calling the
+ *         {@link #getPlatformMXBean(Class) getPlatformMXBean} or
+ *         {@link #getPlatformMXBeans(Class) getPlatformMXBeans} method
+ *         and access the MXBean locally in the running
  *         virtual machine.
  *         </li>
  *     <li>Construct an MXBean proxy instance that forwards the
  *         method calls to a given {@link MBeanServer MBeanServer} by calling
- *         the {@link #newPlatformMXBeanProxy newPlatformMXBeanProxy} method
- *         or the {@link #getPlatformMXBeans(MBeanServerConnection, Class)}
- *         method.
+ *         the {@link #getPlatformMXBean(MBeanServerConnection, Class)} or
+ *         {@link #getPlatformMXBeans(MBeanServerConnection, Class)} method.
+ *         The {@link #newPlatformMXBeanProxy newPlatformMXBeanProxy} method
+ *         can also be used to construct an MXBean proxy instance of
+ *         a given {@code ObjectName}.
  *         A proxy is typically constructed to remotely access
  *         an MXBean of another running virtual machine.
  *         </li>
- *     </ol></li>
- * <li><i>Indirect access to an MXBean interface via MBeanServer</i>
- *     <ol type="a">
- *     <li>Go through the {@link #getPlatformMBeanServer
- *         platform MBeanServer} to access MXBeans locally or
- *         a specific <tt>MBeanServerConnection</tt> to access
+ * </ul>
+ * <h5>2. Indirect access to an MXBean interface via MBeanServer</h5>
+ * <ul>
+ *     <li>Go through the platform {@code MBeanServer} to access MXBeans
+ *         locally or a specific <tt>MBeanServerConnection</tt> to access
  *         MXBeans remotely.
  *         The attributes and operations of an MXBean use only
  *         <em>JMX open types</em> which include basic data types,
@@ -89,133 +116,19 @@
  *         and {@link javax.management.openmbean.TabularData TabularData}
  *         defined in
  *         {@link javax.management.openmbean.OpenType OpenType}.
- *         The mapping is specified below.
+ *         The mapping is specified in
+ *         the {@linkplain javax.management.MXBean MXBean} specification
+ *         for details.
  *        </li>
- *     </ol></li>
  * </ul>
- *
- * <h4><a name="MXBean">Platform MXBeans</a></h4>
- * A platform MXBean is a <i>managed bean</i> that conforms to
- * the JMX Instrumentation Specification and only uses
- * a set of basic data types described below.
- * See <a href="../../../javax/management/MXBean.html#MXBean-spec">
- * the specification of MXBeans</a> for details.
- * All platform MXBean interfaces extend {@link PlatformManagedObject}s
- * and new methods may be added in these interfaces
- * in future Java SE releases.
- * <p>
- * A JMX management application and the platform <tt>MBeanServer</tt>
- * can interoperate without requiring classes for MXBean specific
- * data types.
- * The data types being transmitted between the JMX connector
- * server and the connector client are
- * {@linkplain javax.management.openmbean.OpenType open types}
- * and this allows interoperation across versions.
- * <p>
- * The platform MXBean interfaces use only the following data types:
- * <ul>
- *   <li>Primitive types such as <tt>int</tt>, <tt>long</tt>,
- *       <tt>boolean</tt>, etc</li>
- *   <li>Wrapper classes for primitive types such as
- *       {@link java.lang.Integer Integer}, {@link java.lang.Long Long},
- *       {@link java.lang.Boolean Boolean}, etc and
- *       {@link java.lang.String String}</li>
- *   <li>{@link java.lang.Enum Enum} classes</li>
- *   <li>Classes that define only getter methods and define a static
- *       <tt>from</tt> method with a
- *       {@link javax.management.openmbean.CompositeData CompositeData}
- *       argument to convert from an input <tt>CompositeData</tt> to
- *       an instance of that class
- *       </li>
- *   <li>{@link java.util.List List&lt;E&gt;}
- *       where <tt>E</tt> is a primitive type, a wrapper class,
- *       an enum class, or a class supporting conversion from a
- *       <tt>CompositeData</tt> to its class
- *       </li>
- *   <li>{@link java.util.Map Map&lt;K,V&gt;}
- *       where <tt>K</tt> and <tt>V</tt> are
- *       a primitive type, a wrapper class,
- *       an enum class, or a class supporting conversion from a
- *       <tt>CompositeData</tt> to its class
- *       </li>
- * </ul>
+ * </blockquote>
  *
  * <p>
- * When an attribute or operation of a platform MXBean
- * is accessed via an <tt>MBeanServer</tt>, the data types are mapped
- * as follows:
- * <ul>
- *   <li>A primitive type or a wrapper class is mapped
- *       to the same type.
- *       </li>
- *   <li>An {@link Enum} is mapped to
- *       <tt>String</tt> whose value is the name of the enum constant.
- *   <li>A class that defines only getter methods and a static
- *       <tt>from</tt> method with a
- *       {@link javax.management.openmbean.CompositeData CompositeData}
- *       argument is mapped to
- *       {@link javax.management.openmbean.CompositeData CompositeData}.
- *       </li>
- *   <li><tt>Map&lt;K,V&gt;</tt> is mapped to
- *       {@link javax.management.openmbean.TabularData TabularData}
- *       whose row type is a
- *       {@link javax.management.openmbean.CompositeType CompositeType} with
- *       two items whose names are <i>"key"</i> and <i>"value"</i>
- *       and the item types are
- *       the corresponding mapped type of <tt>K</tt> and <tt>V</tt>
- *       respectively and the <i>"key"</i> is the index.
- *       </li>
- *   <li><tt>List&lt;E&gt;</tt> is mapped to an array with the mapped
- *       type of <tt>E</tt> as the element type.
- *       </li>
- *   <li>An array of element type <tt>E</tt> is mapped to
- *       an array of the same dimenions with the mapped type of <tt>E</tt>
- *       as the element type.</li>
- * </ul>
- *
- * The {@link javax.management.MBeanInfo MBeanInfo}
- * for a platform MXBean
- * describes the data types of the attributes and operations
- * as primitive or open types mapped as specified above.
- *
+ * The {@link #getPlatformManagementInterfaces getPlatformManagementInterfaces}
+ * method returns all management interfaces supported in the Java virtual machine
+ * including the standard management interfaces listed in the tables
+ * below as well as the management interfaces extended by the JDK implementation.
  * <p>
- * For example, the {@link MemoryMXBean}
- * interface has the following <i>getter</i> and <i>setter</i> methods:
- *
- * <blockquote><pre>
- * public MemoryUsage getHeapMemoryUsage();
- * public boolean isVerbose();
- * public void setVerbose(boolean value);
- * </pre></blockquote>
- *
- * These attributes in the <tt>MBeanInfo</tt>
- * of the <tt>MemoryMXBean</tt> have the following names and types:
- *
- * <blockquote>
- * <table border>
- * <tr>
- *   <th>Attribute Name</th>
- *   <th>Type</th>
- *   </tr>
- * <tr>
- *   <td><tt>HeapMemoryUsage</tt></td>
- *   <td>{@link MemoryUsage#from
- *              CompositeData representing MemoryUsage}</td>
- * </tr>
- * <tr>
- *   <td><tt>Verbose</tt></td>
- *   <td><tt>boolean</tt></td>
- * </tr>
- * </table>
- * </blockquote>
- *
- * <h4><a name="MXBeanNames">MXBean Names</a></h4>
- * Each platform MXBean for a Java virtual machine has a unique
- * {@link javax.management.ObjectName ObjectName} for
- * registration in the platform <tt>MBeanServer</tt> that can
- * be obtained by calling the {@link PlatformManagedObject#getObjectName}
- * method.
- *
  * A Java virtual machine has a single instance of the following management
  * interfaces:
  *
@@ -228,27 +141,32 @@
  * <tr>
  * <td> {@link ClassLoadingMXBean} </td>
  * <td> {@link #CLASS_LOADING_MXBEAN_NAME
- *             <tt>java.lang:type=ClassLoading</tt>}</td>
+ *             java.lang:type=ClassLoading}</td>
  * </tr>
  * <tr>
  * <td> {@link MemoryMXBean} </td>
  * <td> {@link #MEMORY_MXBEAN_NAME
- *             <tt>java.lang:type=Memory</tt>}</td>
+ *             java.lang:type=Memory}</td>
  * </tr>
  * <tr>
  * <td> {@link ThreadMXBean} </td>
  * <td> {@link #THREAD_MXBEAN_NAME
- *             <tt>java.lang:type=Threading</tt>}</td>
+ *             java.lang:type=Threading}</td>
  * </tr>
  * <tr>
  * <td> {@link RuntimeMXBean} </td>
  * <td> {@link #RUNTIME_MXBEAN_NAME
- *             <tt>java.lang:type=Runtime</tt>}</td>
+ *             java.lang:type=Runtime}</td>
  * </tr>
  * <tr>
  * <td> {@link OperatingSystemMXBean} </td>
  * <td> {@link #OPERATING_SYSTEM_MXBEAN_NAME
- *             <tt>java.lang:type=OperatingSystem</tt>}</td>
+ *             java.lang:type=OperatingSystem}</td>
+ * </tr>
+ * <tr>
+ * <td> {@link PlatformLoggingMXBean} </td>
+ * <td> {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME
+ *             java.util.logging:type=Logging}</td>
  * </tr>
  * </table>
  * </blockquote>
@@ -266,7 +184,7 @@
  * <tr>
  * <td> {@link CompilationMXBean} </td>
  * <td> {@link #COMPILATION_MXBEAN_NAME
- *             <tt>java.lang:type=Compilation</tt>}</td>
+ *             java.lang:type=Compilation}</td>
  * </tr>
  * </table>
  * </blockquote>
@@ -283,17 +201,21 @@
  * <tr>
  * <td> {@link GarbageCollectorMXBean} </td>
  * <td> {@link #GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
- *    <tt>java.lang:type=GarbageCollector</tt>}<tt>,name=</tt><i>collector's name</i></td>
+ *             java.lang:type=GarbageCollector}<tt>,name=</tt><i>collector's name</i></td>
  * </tr>
  * <tr>
  * <td> {@link MemoryManagerMXBean} </td>
  * <td> {@link #MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
- *    <tt>java.lang:type=MemoryManager</tt>}<tt>,name=</tt><i>manager's name</i></td>
+ *             java.lang:type=MemoryManager}<tt>,name=</tt><i>manager's name</i></td>
  * </tr>
  * <tr>
  * <td> {@link MemoryPoolMXBean} </td>
  * <td> {@link #MEMORY_POOL_MXBEAN_DOMAIN_TYPE
- *    <tt>java.lang:type=MemoryPool</tt>}<tt>,name=</tt><i>pool's name</i></td>
+ *             java.lang:type=MemoryPool}<tt>,name=</tt><i>pool's name</i></td>
+ * </tr>
+ * <tr>
+ * <td> {@link BufferPoolMXBean} </td>
+ * <td> {@code java.nio:type=BufferPool,name=}<i>pool name</i></td>
  * </tr>
  * </table>
  * </blockquote>
@@ -302,7 +224,6 @@
  *      JMX Specification</a>
  * @see <a href="package-summary.html#examples">
  *      Ways to Access Management Metrics</a>
- * @see java.util.logging.LoggingMXBean
  * @see javax.management.MXBean
  *
  * @author  Mandy Chung
@@ -496,35 +417,35 @@
     /**
      * Returns the platform {@link javax.management.MBeanServer MBeanServer}.
      * On the first call to this method, it first creates the platform
-     * <tt>MBeanServer</tt> by calling the
+     * {@code MBeanServer} by calling the
      * {@link javax.management.MBeanServerFactory#createMBeanServer
      * MBeanServerFactory.createMBeanServer}
-     * method and registers the platform MXBeans in this platform
-     * <tt>MBeanServer</tt> using the <a href="#MXBeanNames">MXBean names</a>
-     * defined in the class description.
+     * method and registers each platform MXBean in this platform
+     * {@code MBeanServer} with its
+     * {@link PlatformManagedObject#getObjectName ObjectName}.
      * This method, in subsequent calls, will simply return the
-     * initially created platform <tt>MBeanServer</tt>.
+     * initially created platform {@code MBeanServer}.
      * <p>
      * MXBeans that get created and destroyed dynamically, for example,
      * memory {@link MemoryPoolMXBean pools} and
      * {@link MemoryManagerMXBean managers},
      * will automatically be registered and deregistered into the platform
-     * <tt>MBeanServer</tt>.
+     * {@code MBeanServer}.
      * <p>
-     * If the system property <tt>javax.management.builder.initial</tt>
-     * is set, the platform <tt>MBeanServer</tt> creation will be done
+     * If the system property {@code javax.management.builder.initial}
+     * is set, the platform {@code MBeanServer} creation will be done
      * by the specified {@link javax.management.MBeanServerBuilder}.
      * <p>
      * It is recommended that this platform MBeanServer also be used
      * to register other application managed beans
      * besides the platform MXBeans.
      * This will allow all MBeans to be published through the same
-     * <tt>MBeanServer</tt> and hence allow for easier network publishing
+     * {@code MBeanServer} and hence allow for easier network publishing
      * and discovery.
      * Name conflicts with the platform MXBeans should be avoided.
      *
-     * @return the platform <tt>MBeanServer</tt>; the platform
-     *         MXBeans are registered into the platform <tt>MBeanServer</tt>
+     * @return the platform {@code MBeanServer}; the platform
+     *         MXBeans are registered into the platform {@code MBeanServer}
      *         at the first time this method is called.
      *
      * @exception SecurityException if there is a security manager
@@ -671,7 +592,9 @@
 
         try {
             final ObjectName objName = new ObjectName(mxbeanName);
-            if (!connection.isInstanceOf(objName, interfaceClass.getName())) {
+            // skip the isInstanceOf check for LoggingMXBean
+            String intfName = interfaceClass.getName();
+            if (!connection.isInstanceOf(objName, intfName)) {
                 throw new IllegalArgumentException(mxbeanName +
                     " is not an instance of " + interfaceClass);
             }
@@ -683,55 +606,128 @@
             // create an MXBean proxy
             return JMX.newMXBeanProxy(connection, objName, mxbeanInterface,
                                       emitter);
-        } catch (InstanceNotFoundException e) {
-            final IllegalArgumentException iae =
-                new IllegalArgumentException(mxbeanName +
-                    " not found in the connection.");
-            iae.initCause(e);
-            throw iae;
-        } catch (MalformedObjectNameException e) {
-            final IllegalArgumentException iae =
-                new IllegalArgumentException(mxbeanName +
-                    " is not a valid ObjectName format.");
-            iae.initCause(e);
-            throw iae;
+        } catch (InstanceNotFoundException|MalformedObjectNameException e) {
+            throw new IllegalArgumentException(e);
         }
     }
 
     /**
-     * Returns the list of platform MXBeans that implement
-     * the given {@code mxbeanInterface} in the running Java
+     * Returns the platform MXBean implementing
+     * the given {@code mxbeanInterface} which is specified
+     * to have one single instance in the Java virtual machine.
+     * This method may return {@code null} if the management interface
+     * is not implemented in the Java virtual machine (for example,
+     * a Java virtual machine with no compilation system does not
+     * implement {@link CompilationMXBean});
+     * otherwise, this method is equivalent to calling:
+     * <pre>
+     *    {@link #getPlatformMXBeans(Class)
+     *      getPlatformMXBeans(mxbeanInterface)}.get(0);
+     * </pre>
+     *
+     * @param mxbeanInterface a management interface for a platform
+     *     MXBean with one single instance in the Java virtual machine
+     *     if implemented.
+     *
+     * @return the platform MXBean that implements
+     * {@code mxbeanInterface}, or {@code null} if not exist.
+     *
+     * @throws IllegalArgumentException if {@code mxbeanInterface}
+     * is not a platform management interface or
+     * not a singleton platform MXBean.
+     *
+     * @since 1.7
+     */
+    public static <T extends PlatformManagedObject>
+            T getPlatformMXBean(Class<T> mxbeanInterface) {
+        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
+        if (pc == null)
+            throw new IllegalArgumentException(mxbeanInterface.getName() +
+                " is not a platform management interface");
+        if (!pc.isSingleton())
+            throw new IllegalArgumentException(mxbeanInterface.getName() +
+                " can have zero or more than one instances");
+
+        return pc.getSingletonMXBean(mxbeanInterface);
+    }
+
+    /**
+     * Returns the list of platform MXBeans implementing
+     * the given {@code mxbeanInterface} in the Java
      * virtual machine.
      * The returned list may contain zero, one, or more instances.
      * The number of instances in the returned list is defined
      * in the specification of the given management interface.
+     * The order is undefined and there is no guarantee that
+     * the list returned is in the same order as previous invocations.
      *
      * @param mxbeanInterface a management interface for a platform
      *                        MXBean
      *
-     * @return the list of platform MXBeans that implements
+     * @return the list of platform MXBeans that implement
      * {@code mxbeanInterface}.
      *
      * @throws IllegalArgumentException if {@code mxbeanInterface}
-     * is not a management interface for the platform.
+     * is not a platform management interface.
      *
      * @since 1.7
      */
     public static <T extends PlatformManagedObject> List<T>
             getPlatformMXBeans(Class<T> mxbeanInterface) {
-        String className = mxbeanInterface.getName();
-        for (PlatformComponent component: PlatformComponent.values()) {
-            // comparing the class name first instead of the Class instance
-            // to avoid causing unnecessary class loading of
-            // the other MXBean interfaces
-            if (className.equals(component.getMXBeanInterfaceName())) {
-                if (component.getMXBeanInterface() == mxbeanInterface) {
-                    return component.getMXBeans(mxbeanInterface);
-                }
-            }
-        }
-        throw new IllegalArgumentException(mxbeanInterface.getName() +
-            " is not implemented by any of the platform MXBeans.");
+        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
+        if (pc == null)
+            throw new IllegalArgumentException(mxbeanInterface.getName() +
+                " is not a platform management interface");
+        return Collections.unmodifiableList(pc.getMXBeans(mxbeanInterface));
+    }
+
+    /**
+     * Returns the platform MXBean proxy for
+     * {@code mxbeanInterface} which is specified to have one single
+     * instance in a Java virtual machine and the proxy will
+     * forward the method calls through the given {@code MBeanServerConnection}.
+     * This method may return {@code null} if the management interface
+     * is not implemented in the Java virtual machine being monitored
+     * (for example, a Java virtual machine with no compilation system
+     * does not implement {@link CompilationMXBean});
+     * otherwise, this method is equivalent to calling:
+     * <pre>
+     *     {@link #getPlatformMXBeans(MBeanServerConnection, Class)
+     *        getPlatformMXBeans(connection, mxbeanInterface)}.get(0);
+     * </pre>
+     *
+     * @param connection the {@code MBeanServerConnection} to forward to.
+     * @param mxbeanInterface a management interface for a platform
+     *     MXBean with one single instance in the Java virtual machine
+     *     being monitored, if implemented.
+     *
+     * @return the platform MXBean proxy for
+     * forwarding the method calls of the {@code mxbeanInterface}
+     * through the given {@code MBeanServerConnection},
+     * or {@code null} if not exist.
+     *
+     * @throws IllegalArgumentException if {@code mxbeanInterface}
+     * is not a platform management interface or
+     * not a singleton platform MXBean.
+     * @throws java.io.IOException if a communication problem
+     * occurred when accessing the {@code MBeanServerConnection}.
+     *
+     * @see #newPlatformMXBeanProxy
+     * @since 1.7
+     */
+    public static <T extends PlatformManagedObject>
+            T getPlatformMXBean(MBeanServerConnection connection,
+                                Class<T> mxbeanInterface)
+        throws java.io.IOException
+    {
+        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
+        if (pc == null)
+            throw new IllegalArgumentException(mxbeanInterface.getName() +
+                " is not a platform management interface");
+        if (!pc.isSingleton())
+            throw new IllegalArgumentException(mxbeanInterface.getName() +
+                " can have zero or more than one instances");
+        return pc.getSingletonMXBean(connection, mxbeanInterface);
     }
 
     /**
@@ -741,6 +737,8 @@
      * The returned list may contain zero, one, or more instances.
      * The number of instances in the returned list is defined
      * in the specification of the given management interface.
+     * The order is undefined and there is no guarantee that
+     * the list returned is in the same order as previous invocations.
      *
      * @param connection the {@code MBeanServerConnection} to forward to.
      * @param mxbeanInterface a management interface for a platform
@@ -751,54 +749,49 @@
      * through the given {@code MBeanServerConnection}.
      *
      * @throws IllegalArgumentException if {@code mxbeanInterface}
-     * is not a management interface for the platform.
+     * is not a platform management interface.
      *
      * @throws java.io.IOException if a communication problem
      * occurred when accessing the {@code MBeanServerConnection}.
      *
+     * @see #newPlatformMXBeanProxy
      * @since 1.7
      */
     public static <T extends PlatformManagedObject>
-        List<T> getPlatformMXBeans(MBeanServerConnection connection,
-                                   Class<T> mxbeanInterface)
+            List<T> getPlatformMXBeans(MBeanServerConnection connection,
+                                       Class<T> mxbeanInterface)
         throws java.io.IOException
     {
-        String className = mxbeanInterface.getName();
-        for (PlatformComponent component: PlatformComponent.values()) {
-            // comparing the class name first instead of the Class instance
-            // to avoid causing unnecessary class loading of
-            // the other MXBean interfaces
-            if (className.equals(component.getMXBeanInterfaceName())) {
-                if (component.getMXBeanInterface() == mxbeanInterface) {
-                    return component.getMXBeans(connection,
-                                                mxbeanInterface);
-                }
-            }
+        PlatformComponent pc = PlatformComponent.getPlatformComponent(mxbeanInterface);
+        if (pc == null) {
+            throw new IllegalArgumentException(mxbeanInterface.getName() +
+                " is not a platform management interface");
         }
-        throw new IllegalArgumentException(mxbeanInterface.getName() +
-            " is not implemented by any of the platform MXBeans.");
+        return Collections.unmodifiableList(pc.getMXBeans(connection, mxbeanInterface));
     }
 
     /**
-     * Returns a list of {@code Class} objects, subinterface of
+     * Returns the set of {@code Class} objects, subinterface of
      * {@link PlatformManagedObject}, representing
      * all management interfaces for
      * monitoring and managing the Java platform.
      *
-     * @return a list of {@code Class} objects, subinterface of
+     * @return the set of {@code Class} objects, subinterface of
      * {@link PlatformManagedObject} representing
      * the management interfaces for
      * monitoring and managing the Java platform.
      *
      * @since 1.7
      */
-    public static List<Class<? extends PlatformManagedObject>> getAllPlatformMXBeanInterfaces() {
-        List<Class<? extends PlatformManagedObject>> result =
-            new ArrayList<>();
+    public static Set<Class<? extends PlatformManagedObject>>
+           getPlatformManagementInterfaces()
+    {
+        Set<Class<? extends PlatformManagedObject>> result =
+            new TreeSet<>();
         for (PlatformComponent component: PlatformComponent.values()) {
             result.add(component.getMXBeanInterface());
         }
-        return result;
+        return Collections.unmodifiableSet(result);
     }
 
     private static final String NOTIF_EMITTER =
@@ -810,7 +803,9 @@
     private static void addMXBean(final MBeanServer mbs, final PlatformManagedObject pmo) {
         // Make DynamicMBean out of MXBean by wrapping it with a StandardMBean
         final DynamicMBean dmbean;
-        if (pmo instanceof NotificationEmitter) {
+        if (pmo instanceof DynamicMBean) {
+            dmbean = DynamicMBean.class.cast(pmo);
+        } else if (pmo instanceof NotificationEmitter) {
             dmbean = new StandardEmitterMBean(pmo, null, true, (NotificationEmitter) pmo);
         } else {
             dmbean = new StandardMBean(pmo, null, true);
--- a/jdk/src/share/classes/java/lang/management/PlatformComponent.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/PlatformComponent.java	Thu Mar 31 22:07:32 2011 -0700
@@ -29,9 +29,9 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
-import java.util.logging.PlatformLoggingMXBean;
-import java.nio.BufferPoolMXBean;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 
@@ -66,6 +66,7 @@
     CLASS_LOADING(
         "java.lang.management.ClassLoadingMXBean",
         "java.lang", "ClassLoading", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<ClassLoadingMXBean>() {
             public List<ClassLoadingMXBean> getMXBeans() {
                 return Collections.singletonList(ManagementFactoryHelper.getClassLoadingMXBean());
@@ -78,6 +79,7 @@
     COMPILATION(
         "java.lang.management.CompilationMXBean",
         "java.lang", "Compilation", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<CompilationMXBean>() {
             public List<CompilationMXBean> getMXBeans() {
                 CompilationMXBean m = ManagementFactoryHelper.getCompilationMXBean();
@@ -95,6 +97,7 @@
     MEMORY(
         "java.lang.management.MemoryMXBean",
         "java.lang", "Memory", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<MemoryMXBean>() {
             public List<MemoryMXBean> getMXBeans() {
                 return Collections.singletonList(ManagementFactoryHelper.getMemoryMXBean());
@@ -107,6 +110,7 @@
     GARBAGE_COLLECTOR(
         "java.lang.management.GarbageCollectorMXBean",
         "java.lang", "GarbageCollector", keyProperties("name"),
+        false, // zero or more instances
         new MXBeanFetcher<GarbageCollectorMXBean>() {
             public List<GarbageCollectorMXBean> getMXBeans() {
                 return ManagementFactoryHelper.
@@ -120,6 +124,7 @@
     MEMORY_MANAGER(
         "java.lang.management.MemoryManagerMXBean",
         "java.lang", "MemoryManager", keyProperties("name"),
+        false, // zero or more instances
         new MXBeanFetcher<MemoryManagerMXBean>() {
             public List<MemoryManagerMXBean> getMXBeans() {
                 return ManagementFactoryHelper.getMemoryManagerMXBeans();
@@ -133,6 +138,7 @@
     MEMORY_POOL(
         "java.lang.management.MemoryPoolMXBean",
         "java.lang", "MemoryPool", keyProperties("name"),
+        false, // zero or more instances
         new MXBeanFetcher<MemoryPoolMXBean>() {
             public List<MemoryPoolMXBean> getMXBeans() {
                 return ManagementFactoryHelper.getMemoryPoolMXBeans();
@@ -145,6 +151,7 @@
     OPERATING_SYSTEM(
         "java.lang.management.OperatingSystemMXBean",
         "java.lang", "OperatingSystem", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<OperatingSystemMXBean>() {
             public List<OperatingSystemMXBean> getMXBeans() {
                 return Collections.singletonList(ManagementFactoryHelper.getOperatingSystemMXBean());
@@ -157,6 +164,7 @@
     RUNTIME(
         "java.lang.management.RuntimeMXBean",
         "java.lang", "Runtime", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<RuntimeMXBean>() {
             public List<RuntimeMXBean> getMXBeans() {
                 return Collections.singletonList(ManagementFactoryHelper.getRuntimeMXBean());
@@ -169,6 +177,7 @@
     THREADING(
         "java.lang.management.ThreadMXBean",
         "java.lang", "Threading", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<ThreadMXBean>() {
             public List<ThreadMXBean> getMXBeans() {
                 return Collections.singletonList(ManagementFactoryHelper.getThreadMXBean());
@@ -180,11 +189,17 @@
      * Logging facility.
      */
     LOGGING(
-        "java.util.logging.PlatformLoggingMXBean",
+        "java.lang.management.PlatformLoggingMXBean",
         "java.util.logging", "Logging", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<PlatformLoggingMXBean>() {
             public List<PlatformLoggingMXBean> getMXBeans() {
-                return ManagementFactoryHelper.getLoggingMXBean();
+                PlatformLoggingMXBean m = ManagementFactoryHelper.getPlatformLoggingMXBean();
+                if (m == null) {
+                   return Collections.emptyList();
+                } else {
+                   return Collections.singletonList(m);
+                }
             }
         }),
 
@@ -192,8 +207,9 @@
      * Buffer pools.
      */
     BUFFER_POOL(
-        "java.nio.BufferPoolMXBean",
+        "java.lang.management.BufferPoolMXBean",
         "java.nio", "BufferPool", keyProperties("name"),
+        false, // zero or more instances
         new MXBeanFetcher<BufferPoolMXBean>() {
             public List<BufferPoolMXBean> getMXBeans() {
                 return ManagementFactoryHelper.getBufferPoolMXBeans();
@@ -209,6 +225,7 @@
     SUN_GARBAGE_COLLECTOR(
         "com.sun.management.GarbageCollectorMXBean",
         "java.lang", "GarbageCollector", keyProperties("name"),
+        false, // zero or more instances
         new MXBeanFetcher<com.sun.management.GarbageCollectorMXBean>() {
             public List<com.sun.management.GarbageCollectorMXBean> getMXBeans() {
                 return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class);
@@ -222,6 +239,7 @@
     SUN_OPERATING_SYSTEM(
         "com.sun.management.OperatingSystemMXBean",
         "java.lang", "OperatingSystem", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<com.sun.management.OperatingSystemMXBean>() {
             public List<com.sun.management.OperatingSystemMXBean> getMXBeans() {
                 return getOSMXBeanList(com.sun.management.OperatingSystemMXBean.class);
@@ -234,6 +252,7 @@
     SUN_UNIX_OPERATING_SYSTEM(
         "com.sun.management.UnixOperatingSystemMXBean",
         "java.lang", "OperatingSystem", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<UnixOperatingSystemMXBean>() {
             public List<UnixOperatingSystemMXBean> getMXBeans() {
                 return getOSMXBeanList(com.sun.management.UnixOperatingSystemMXBean.class);
@@ -246,6 +265,7 @@
     HOTSPOT_DIAGNOSTIC(
         "com.sun.management.HotSpotDiagnosticMXBean",
         "com.sun.management", "HotSpotDiagnostic", defaultKeyProperties(),
+        true, // singleton
         new MXBeanFetcher<HotSpotDiagnosticMXBean>() {
             public List<HotSpotDiagnosticMXBean> getMXBeans() {
                 return Collections.singletonList(ManagementFactoryHelper.getDiagnosticMXBean());
@@ -296,27 +316,19 @@
     private final Set<String> keyProperties;
     private final MXBeanFetcher fetcher;
     private final PlatformComponent[] subComponents;
+    private final boolean singleton;
 
     private PlatformComponent(String intfName,
                               String domain, String type,
                               Set<String> keyProperties,
-                              MXBeanFetcher fetcher) {
-        this.mxbeanInterfaceName = intfName;
-        this.domain = domain;
-        this.type = type;
-        this.keyProperties = keyProperties;
-        this.fetcher = fetcher;
-        this.subComponents = new PlatformComponent[0];
-    }
-    private PlatformComponent(String intfName,
-                              String domain, String type,
-                              Set<String> keyProperties,
+                              boolean singleton,
                               MXBeanFetcher fetcher,
                               PlatformComponent... subComponents) {
         this.mxbeanInterfaceName = intfName;
         this.domain = domain;
         this.type = type;
         this.keyProperties = keyProperties;
+        this.singleton = singleton;
         this.fetcher = fetcher;
         this.subComponents = subComponents;
     }
@@ -338,6 +350,10 @@
         return set;
     }
 
+    boolean isSingleton() {
+        return singleton;
+    }
+
     String getMXBeanInterfaceName() {
         return mxbeanInterfaceName;
     }
@@ -360,8 +376,35 @@
         return fetcher.getMXBeans();
     }
 
+    <T extends PlatformManagedObject> T getSingletonMXBean(Class<T> mxbeanInterface)
+    {
+        if (!singleton)
+            throw new IllegalArgumentException(mxbeanInterfaceName +
+                " can have zero or more than one instances");
+
+        List<T> list = fetcher.getMXBeans();
+        assert list.size() == 1;
+        return list.isEmpty() ? null : list.get(0);
+    }
+
     <T extends PlatformManagedObject>
-        List<T> getMXBeans(MBeanServerConnection mbs, Class<T> mxbeanInterface)
+            T getSingletonMXBean(MBeanServerConnection mbs, Class<T> mxbeanInterface)
+        throws java.io.IOException
+    {
+        if (!singleton)
+            throw new IllegalArgumentException(mxbeanInterfaceName +
+                " can have zero or more than one instances");
+
+        // ObjectName of a singleton MXBean contains only domain and type
+        assert keyProperties.size() == 1;
+        String on = domain + ":type=" + type;
+        return ManagementFactory.newPlatformMXBeanProxy(mbs,
+                                                        on,
+                                                        mxbeanInterface);
+    }
+
+    <T extends PlatformManagedObject>
+            List<T> getMXBeans(MBeanServerConnection mbs, Class<T> mxbeanInterface)
         throws java.io.IOException
     {
         List<T> result = new ArrayList<>();
@@ -391,5 +434,34 @@
         return set;
     }
 
+    // a map from MXBean interface name to PlatformComponent
+    private static Map<String, PlatformComponent> enumMap;
+    private static synchronized void ensureInitialized() {
+        if (enumMap == null) {
+            enumMap = new HashMap<>();
+            for (PlatformComponent pc: PlatformComponent.values()) {
+                // Use String as the key rather than Class<?> to avoid
+                // causing unnecessary class loading of management interface
+                enumMap.put(pc.getMXBeanInterfaceName(), pc);
+            }
+        }
+    }
+
+    static boolean isPlatformMXBean(String cn) {
+        ensureInitialized();
+        return enumMap.containsKey(cn);
+    }
+
+    static <T extends PlatformManagedObject>
+        PlatformComponent getPlatformComponent(Class<T> mxbeanInterface)
+    {
+        ensureInitialized();
+        String cn = mxbeanInterface.getName();
+        PlatformComponent pc = enumMap.get(cn);
+        if (pc != null && pc.getMXBeanInterface() == mxbeanInterface)
+            return pc;
+        return null;
+    }
+
     private static final long serialVersionUID = 6992337162326171013L;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/management/PlatformLoggingMXBean.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.management;
+
+/**
+ * The management interface for the {@linkplain java.util.logging logging} facility.
+ *
+ * <p>There is a single global instance of the <tt>PlatformLoggingMXBean</tt>.
+ * The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean} method can be used to obtain
+ * the {@code PlatformLoggingMXBean} object as follows:
+ * <pre>
+ *     PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
+ * </pre>
+ * The {@code PlatformLoggingMXBean} object is also registered with the
+ * platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
+ * MBeanServer}.
+ * The {@link javax.management.ObjectName ObjectName} for uniquely
+ * identifying the {@code PlatformLoggingMXBean} within an MBeanServer is:
+ * <pre>
+ *      {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
+ * </pre>
+ *
+ * <p>The instance registered in the platform <tt>MBeanServer</tt> with
+ * this {@code ObjectName} implements all attributes defined by
+ * {@link java.util.logging.LoggingMXBean}.
+ *
+ * @since   1.7
+ */
+public interface PlatformLoggingMXBean extends PlatformManagedObject {
+
+    /**
+     * Returns the list of the currently registered
+     * {@linkplain java.util.logging.Logger logger} names. This method
+     * calls {@link java.util.logging.LogManager#getLoggerNames} and
+     * returns a list of the logger names.
+     *
+     * @return A list of {@code String} each of which is a
+     *         currently registered {@code Logger} name.
+     */
+    java.util.List<String> getLoggerNames();
+
+    /**
+     * Gets the name of the log {@linkplain java.util.logging.Logger#getLevel
+     * level} associated with the specified logger.
+     * If the specified logger does not exist, {@code null}
+     * is returned.
+     * This method first finds the logger of the given name and
+     * then returns the name of the log level by calling:
+     * <blockquote>
+     *   {@link java.util.logging.Logger#getLevel
+     *    Logger.getLevel()}.{@link java.util.logging.Level#getName getName()};
+     * </blockquote>
+     *
+     * <p>
+     * If the {@code Level} of the specified logger is {@code null},
+     * which means that this logger's effective level is inherited
+     * from its parent, an empty string will be returned.
+     *
+     * @param loggerName The name of the {@code Logger} to be retrieved.
+     *
+     * @return The name of the log level of the specified logger; or
+     *         an empty string if the log level of the specified logger
+     *         is {@code null}.  If the specified logger does not
+     *         exist, {@code null} is returned.
+     *
+     * @see java.util.logging.Logger#getLevel
+     */
+    String getLoggerLevel(String loggerName);
+
+    /**
+     * Sets the specified logger to the specified new
+     * {@linkplain java.util.logging.Logger#setLevel level}.
+     * If the {@code levelName} is not {@code null}, the level
+     * of the specified logger is set to the parsed
+     * {@link java.util.logging.Level Level}
+     * matching the {@code levelName}.
+     * If the {@code levelName} is {@code null}, the level
+     * of the specified logger is set to {@code null} and
+     * the effective level of the logger is inherited from
+     * its nearest ancestor with a specific (non-null) level value.
+     *
+     * @param loggerName The name of the {@code Logger} to be set.
+     *                   Must be non-null.
+     * @param levelName The name of the level to set on the specified logger,
+     *                 or  {@code null} if setting the level to inherit
+     *                 from its nearest ancestor.
+     *
+     * @throws IllegalArgumentException if the specified logger
+     * does not exist, or {@code levelName} is not a valid level name.
+     *
+     * @throws SecurityException if a security manager exists and if
+     * the caller does not have LoggingPermission("control").
+     *
+     * @see java.util.logging.Logger#setLevel
+     */
+    void setLoggerLevel(String loggerName, String levelName);
+
+    /**
+     * Returns the name of the
+     * {@linkplain java.util.logging.Logger#getParent parent}
+     * for the specified logger.
+     * If the specified logger does not exist, {@code null} is returned.
+     * If the specified logger is the root {@code Logger} in the namespace,
+     * the result will be an empty string.
+     *
+     * @param loggerName The name of a {@code Logger}.
+     *
+     * @return the name of the nearest existing parent logger;
+     *         an empty string if the specified logger is the root logger.
+     *         If the specified logger does not exist, {@code null}
+     *         is returned.
+     */
+    String getParentLoggerName(String loggerName);
+}
--- a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java	Thu Mar 31 22:07:32 2011 -0700
@@ -46,7 +46,7 @@
  * intended for the management interfaces for the platform to extend but
  * not for applications.
  *
- * @see <a href="ManagementFactory.html#MXBean">Platform MXBeans</a>
+ * @see ManagementFactory
  * @since 1.7
  */
 public interface PlatformManagedObject {
--- a/jdk/src/share/classes/java/lang/management/package.html	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/package.html	Thu Mar 31 22:07:32 2011 -0700
@@ -27,160 +27,124 @@
 <html>
 <body bgcolor="white">
 
-Provides the management interface for monitoring and management of the 
-Java virtual machine as well as the operating system on which the 
-Java virtual machine is running.  It allows both local and remote 
-monitoring and management of the running Java virtual machine.  
-
-<h4>Platform MXBeans</h4>
-
-This package defines the management interface of the following
-components:
+Provides the management interfaces for monitoring and management of the
+Java virtual machine and other components in the Java runtime.
+It allows both local and remote
+monitoring and management of the running Java virtual machine.
+<p>
 
-<blockquote>
-<table cellspacing=1 summary="Description of the MBeans">
-<tr>
-<th><p align="left">Management Interface</p></th>
-<th><p align="left">Description</p></th>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.ClassLoadingMXBean}</tt> </td>
-<td> Class loading system of the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.CompilationMXBean}</tt> </td>
-<td> Compilation system of the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.MemoryMXBean}</tt> </td>
-<td> Memory system of the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.ThreadMXBean}</tt> </td>
-<td> Threads system of the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.RuntimeMXBean}</tt> </td>
-<td> Runtime system of the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.OperatingSystemMXBean}</tt> </td>
-<td> Operating system on which the Java virtual machine is running.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.GarbageCollectorMXBean}</tt> </td>
-<td> Garbage collector in the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.MemoryManagerMXBean}</tt> </td>
-<td> Memory manager in the Java virtual machine.</td>
-</tr>
-<tr>
-<td> <tt>{@link java.lang.management.MemoryPoolMXBean}</tt> </td>
-<td> Memory pool in the Java virtual machine.</td>
-</tr>
-</table>
-</blockquote>
-
+<h4><a name="MXBean">Platform MXBean</a></h4>
 <p>
-A platform MXBean is a <i>managed bean</i> that defines the management
-interface for one component for the platform and is specified in the
-<a href="ManagementFactory.html#MXBean">
-ManagementFactory</a> class.
-
-<p>An application can monitor the instrumentation of the 
-Java virtual machine and manage certain characteristics in
-the following ways:
-<ul>
-<li><i>Direct access to an MXBean interface</i>
-    <ol type="a">
-    <li>Get the MXBean instance through the static factory method
-        and access the MXBean interface locally of the running
-        virtual machine.</li>
-    <li>Construct an MXBean proxy instance that
-        forwards the method calls to a given 
-        {@link javax.management.MBeanServer MBeanServer}
-        by calling
-        {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
-         ManagementFactory.newPlatformMXBeanProxy}.
-         A proxy is typically constructed to remotely access
-         an MXBean of another running virtual machine.</li>
-    </ol></li>
-<li><i>Indirect access via {@link javax.management.MBeanServer MBeanServer} 
-       interface</i>
-    <ol type="a">
-    <li>Go through the 
-        {@link java.lang.management.ManagementFactory#getPlatformMBeanServer
-        platform MBeanServer} to access MXBeans locally or
-        a specific <tt>MBeanServerConnection</tt> to access
-        MXBeans remotely.
-        The attributes and operations of an MXBean use only
-        <em>JMX open types</em> which include basic data types, 
-        {@link javax.management.openmbean.CompositeData CompositeData},
-        and {@link javax.management.openmbean.TabularData TabularData} 
-        defined in {@link javax.management.openmbean.OpenType OpenType}.
-       </li>
-    </ol></li>
-</ul>
-
-Below shows a few <a href="#examples">examples</a> of different
-ways to access MXBeans.
-
+A platform MXBean is a <i>managed bean</i> that
+conforms to the <a href="../../../javax/management/package-summary.html">JMX</a>
+Instrumentation Specification and only uses a set of basic data types.
+Each platform MXBean is a {@link java.lang.management.PlatformManagedObject}
+with a unique
+{@linkplain java.lang.management.PlatformManagedObject#getObjectName name}.
+<p>
 <h4>ManagementFactory</h4>
 
-The {@link java.lang.management.ManagementFactory} class is the management
-factory class for the Java platform.  This class provides a set of 
+<p>The {@link java.lang.management.ManagementFactory} class is the management
+factory class for the Java platform.  This class provides a set of
 static factory methods to obtain the MXBeans for the Java platform
 to allow an application to access the MXBeans directly.
 
 <p>A <em>platform MBeanServer</em> can be accessed with the
 {@link java.lang.management.ManagementFactory#getPlatformMBeanServer
  getPlatformMBeanServer} method.  On the first call to this method,
-it creates the platform MBeanServer and registers all platform MXBeans 
-including platform MXBeans defined in other packages such as
-{@link java.util.logging.LoggingMXBean}.  
-Each platform MXBean is registered with a unique name defined in the
-{@link java.lang.management.ManagementFactory ManagementFactory} class
-for constructing {@link javax.management.ObjectName ObjectName}. 
-This is a single MBeanServer that can be shared by different managed 
+it creates the platform MBeanServer and registers all platform MXBeans
+including {@linkplain java.lang.management.PlatformManagedObject
+platform MXBeans}.
+Each platform MXBean is registered with a unique name defined in
+the specification of the management interface.
+This is a single MBeanServer that can be shared by different managed
 components running within the same Java virtual machine.
- 
+
 <h4>Interoperability</h4>
 
-A management application and a platform MBeanServer of a running
-virtual machine can interoperate 
+<p>A management application and a platform MBeanServer of a running
+virtual machine can interoperate
 without requiring classes used by the platform MXBean interfaces.
 The data types being transmitted between the JMX connector
 server and the connector client are JMX
-{@link javax.management.openmbean.OpenType open types} and
+{@linkplain javax.management.openmbean.OpenType open types} and
 this allows interoperation across versions.
-
-<p>A data type used by the MXBean interfaces are mapped to
-an open type when being accessed via MBeanServer interface.
-The data type mapping is specified in the
-{@link java.lang.management.ManagementFactory ManagementFactory} class.
+A data type used by the MXBean interfaces are mapped to an
+open type when being accessed via MBeanServer interface.
+See the <a href="../../../javax/management/MXBean.html#MXBean-spec">
+MXBean</a> specification for details.
 
 <h4><a name="examples">Ways to Access MXBeans</a></h4>
 
-There are three different ways to access the management interfaces. 
-
+<p>An application can monitor the instrumentation of the
+Java virtual machine and the runtime in the following ways:
 <p>
-<ol>
-<li>Call the methods in the MXBean directly within the same 
-    Java virtual machine.
-<blockquote><pre>
+<b>1. Direct access to an MXBean interface</b>
+<p>
+<ul>
+<li>Get an MXBean instance locally in the running Java virtual machine:<p>
+<pre>
    RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
 
    // Get the standard attribute "VmVendor"
    String vendor = mxbean.getVmVendor();
-
 </pre>
-</blockquote>
+<p>Or by calling the
+        {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+               getPlatformMXBean} or
+        {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
+               getPlatformMXBeans} method:
+<pre>
+   RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
+
+   // Get the standard attribute "VmVendor"
+   String vendor = mxbean.getVmVendor();
+</pre>
+<p>
 </li>
+<li>Construct an MXBean proxy instance that forwards the
+    method calls to a given MBeanServer:<p>
+<pre>
+   MBeanServerConnection mbs;
 
-<li>Go through a <tt>MBeanServerConnection</tt> connecting 
-    to the <tt>platform MBeanServer</tt> of a running virtual machine.</li>
-<blockquote><pre>
+   // Connect to a running JVM (or itself) and get MBeanServerConnection
+   // that has the JVM MBeans registered in it
+   ...
+
+   // Get a MBean proxy for RuntimeMXBean interface
+   RuntimeMXBean proxy =
+       {@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
+       ManagementFactory.getPlatformMXBean}(mbs,
+                                           RuntimeMXBean.class);
+   // Get standard attribute "VmVendor"
+   String vendor = proxy.getVmVendor();
+</pre>
+<p>A proxy is typically used to access an MXBean
+   in a remote Java virtual machine.
+   An alternative way to create an MXBean proxy is:
+<pre>
+   RuntimeMXBean proxy =
+       {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
+              ManagementFactory.newPlatformMXBeanProxy}(mbs,
+                                                ManagementFactory.RUNTIME_MXBEAN_NAME,
+                                                RuntimeMXBean.class);
+</pre>
+</li>
+</ul>
+<p>
+<b>2. Indirect access to an MXBean interface via MBeanServer</b><p>
+<ul>
+<li>Go through the
+    {@link java.lang.management.ManagementFactory#getPlatformMBeanServer
+    platform MBeanServer} to access MXBeans locally or
+    a specific {@code MBeanServerConnection} to access
+    MXBeans remotely.
+    The attributes and operations of an MXBean use only
+    <em>JMX open types</em> which include basic data types,
+    {@link javax.management.openmbean.CompositeData CompositeData},
+    and {@link javax.management.openmbean.TabularData TabularData}
+    defined in {@link javax.management.openmbean.OpenType OpenType}.<p>
+<pre>
    MBeanServerConnection mbs;
 
    // Connect to a running JVM (or itself) and get MBeanServerConnection
@@ -190,7 +154,7 @@
    try {
        // Assuming the RuntimeMXBean has been registered in mbs
        ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-    
+
        // Get standard attribute "VmVendor"
        String vendor = (String) mbs.getAttribute(oname, "VmVendor");
    } catch (....) {
@@ -198,36 +162,19 @@
        // and MBeanServer.getAttribute method
        ...
    }
-
-</pre></blockquote>
-
-<li>Use MXBean proxy.</li>
-<blockquote><pre>
-   MBeanServerConnection mbs;
-
-   // Connect to a running JVM (or itself) and get MBeanServerConnection
-   // that has the JVM MBeans registered in it
-   ...
-
-   // Get a MBean proxy for RuntimeMXBean interface
-   RuntimeMXBean proxy = 
-       ManagementFactory.newPlatformMXBeanProxy(mbs,
-                                                ManagementFactory.RUNTIME_MXBEAN_NAME,
-                                                RuntimeMXBean.class);
-   // Get standard attribute "VmVendor" 
-   String vendor = proxy.getVmVendor();
-</pre></blockquote>
-</ol>
+</pre>
+</li>
+</ul>
 
 
 <h4><a name="extension">Platform Extension</a></h4>
 
-A Java virtual machine implementation may add its platform extension to
+<p>A Java virtual machine implementation may add its platform extension to
 the management interface by defining platform-dependent
 interfaces that extend the standard management interfaces to include
-platform-specific metrics and management operations.  
+platform-specific metrics and management operations.
 The static factory methods in the <tt>ManagementFactory</tt> class will
-return the MBeans with the platform extension.
+return the MXBeans with the platform extension.
 
 <p>
 It is recommended to name the platform-specific attributes with
@@ -240,26 +187,30 @@
 the applications accessing that vendor-specific attribute would have
 to be modified to cope with versioning and compatibility issues.
 
-<p>Below is an example showing how to access a platform-specific
-attribute from Sun's implementation of the <tt>RuntimeMXBean</tt>.
+<p>Below is an example showing how to access an attribute
+from the platform extension:
 
 <p>
-1) Direct access to the Sun-specific MXBean interface
-<blockquote><pre>
-   com.sun.management.RuntimeMXBean mxbean = 
-       (com.sun.management.RuntimeMXBean) ManagementFactory.getRuntimeMXBean();
+1) Direct access to the Oracle-specific MXBean interface
+<blockquote>
+<pre>
+   List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
+       ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
 
-   // Get the standard attribute "VmVendor"
-   String vendor = mxbean.getVmVendor();
+   for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+       // Get the standard attribute "CollectionCount"
+       String count = mxbean.getCollectionCount();
 
-   // Get the platform-specific attribute "Bar"
-   BarType bar = mxbean.getBar();
-
+       // Get the platform-specific attribute "LastGcInfo"
+       GcInfo gcinfo = gc.getLastGcInfo();
+       ...
+   }
 </pre>
 </blockquote>
 
 <p>
-2) Access the Sun-specific MXBean interface via <tt>MBeanServer</tt>
+2) Access the Oracle-specific MXBean interface via <tt>MBeanServer</tt>
+   through proxy
 
 <blockquote><pre>
    MBeanServerConnection mbs;
@@ -268,24 +219,17 @@
    // that has the JVM MXBeans registered in it
    ...
 
-   try {
-       // Assuming the RuntimeMXBean has been registered in mbs
-       ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-    
-       // Get standard attribute "VmVendor"
-       String vendor = (String) mbs.getAttribute(oname, "VmVendor");
+   List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
+       ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
 
-       // Check if this MXBean contains Sun's extension
-       if (mbs.isInstanceOf(oname, "com.sun.management.RuntimeMXBean")) {
-           // Get platform-specific attribute "Bar"
-           BarType bar = (String) mbs.getAttribute(oname, "Bar");
-       }
-   } catch (....) {
-       // Catch the exceptions thrown by ObjectName constructor
-       // and MBeanServer methods
+   for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+       // Get the standard attribute "CollectionCount"
+       String count = mxbean.getCollectionCount();
+
+       // Get the platform-specific attribute "LastGcInfo"
+       GcInfo gcinfo = gc.getLastGcInfo();
        ...
    }
-
 </pre></blockquote>
 
 <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
--- a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java	Thu Mar 31 18:14:17 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.nio;
-
-import java.lang.management.PlatformManagedObject;
-
-/**
- * The management interface for a buffer pool.
- *
- * <p> A class implementing this interface is an <a href=
- * "java.lang.management.ManagementFactory.html#MXBean">MXBean</a>. A Java
- * virtual machine has one or more implementations of this interface. The {@link
- * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
- * method can be used to obtain the list of {@code BufferPoolMXBean} objects
- * representing the management interfaces for pools of buffers as follows:
- * <pre>
- *     List&lt;BufferPoolMXBean&gt; pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
- * </pre>
- *
- * <p> The management interfaces are also registered with the platform {@link
- * javax.management.MBeanServer MBeanServer}. The {@link
- * javax.management.ObjectName ObjectName} that uniquely identifies the
- * management interface within the {@code MBeanServer} takes the form:
- * <blockquote>
- *    <tt>java.nio:type=BufferPool</tt><tt>,name=</tt><i>pool name</i>
- * </blockquote>
- * where <em>pool name</em> is the {@link #getName name} of the buffer pool.
- *
- * @since   1.7
- */
-
-public interface BufferPoolMXBean extends PlatformManagedObject {
-
-    /**
-     * Returns the name representing this buffer pool.
-     *
-     * @return  The name of this buffer pool.
-     */
-    String getName();
-
-    /**
-     * Returns an estimate of the number of buffers in the pool.
-     *
-     * @return  An estimate of the number of buffers in this pool
-     */
-    long getCount();
-
-    /**
-     * Returns an estimate of the total capacity of the buffers in this pool.
-     * A buffer's capacity is the number of elements it contains and the value
-     * returned by this method is an estimate of the total capacity of buffers
-     * in the pool in bytes.
-     *
-     * @return  An estimate of the total capacity of the buffers in this pool
-     *          in bytes
-     */
-    long getTotalCapacity();
-
-    /**
-     * Returns an estimate of the memory that the Java virtual machine is using
-     * for this buffer pool. The value returned by this method may differ
-     * from the estimate of the total {@link #getTotalCapacity capacity} of
-     * the buffers in this pool. This difference is explained by alignment,
-     * memory allocator, and other implementation specific reasons.
-     *
-     * @return  An estimate of the memory that the Java virtual machine is using
-     *          for this buffer pool in bytes, or {@code -1L} if an estimate of
-     *          the memory usage is not available
-     */
-    long getMemoryUsed();
-}
--- a/jdk/src/share/classes/java/util/Collections.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/Collections.java	Thu Mar 31 22:07:32 2011 -0700
@@ -3533,20 +3533,20 @@
     }
 
     /**
-     * Returns a comparator that imposes the reverse of the <i>natural
-     * ordering</i> on a collection of objects that implement the
-     * <tt>Comparable</tt> interface.  (The natural ordering is the ordering
-     * imposed by the objects' own <tt>compareTo</tt> method.)  This enables a
+     * Returns a comparator that imposes the reverse of the <em>natural
+     * ordering</em> on a collection of objects that implement the
+     * {@code Comparable} interface.  (The natural ordering is the ordering
+     * imposed by the objects' own {@code compareTo} method.)  This enables a
      * simple idiom for sorting (or maintaining) collections (or arrays) of
-     * objects that implement the <tt>Comparable</tt> interface in
-     * reverse-natural-order.  For example, suppose a is an array of
+     * objects that implement the {@code Comparable} interface in
+     * reverse-natural-order.  For example, suppose {@code a} is an array of
      * strings. Then: <pre>
      *          Arrays.sort(a, Collections.reverseOrder());
      * </pre> sorts the array in reverse-lexicographic (alphabetical) order.<p>
      *
      * The returned comparator is serializable.
      *
-     * @return a comparator that imposes the reverse of the <i>natural
+     * @return A comparator that imposes the reverse of the <i>natural
      *         ordering</i> on a collection of objects that implement
      *         the <tt>Comparable</tt> interface.
      * @see Comparable
@@ -3575,16 +3575,18 @@
 
     /**
      * Returns a comparator that imposes the reverse ordering of the specified
-     * comparator.  If the specified comparator is null, this method is
+     * comparator.  If the specified comparator is {@code null}, this method is
      * equivalent to {@link #reverseOrder()} (in other words, it returns a
-     * comparator that imposes the reverse of the <i>natural ordering</i> on a
-     * collection of objects that implement the Comparable interface).
+     * comparator that imposes the reverse of the <em>natural ordering</em> on
+     * a collection of objects that implement the Comparable interface).
      *
      * <p>The returned comparator is serializable (assuming the specified
-     * comparator is also serializable or null).
+     * comparator is also serializable or {@code null}).
      *
-     * @return a comparator that imposes the reverse ordering of the
-     *         specified comparator
+     * @param cmp a comparator who's ordering is to be reversed by the returned
+     * comparator or {@code null}
+     * @return A comparator that imposes the reverse ordering of the
+     *         specified comparator.
      * @since 1.5
      */
     public static <T> Comparator<T> reverseOrder(Comparator<T> cmp) {
--- a/jdk/src/share/classes/java/util/ComparableTimSort.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/ComparableTimSort.java	Thu Mar 31 22:07:32 2011 -0700
@@ -241,7 +241,7 @@
              * pivot < all in [left, start), so pivot belongs at left.  Note
              * that if there are elements equal to pivot, left points to the
              * first slot after them -- that's why this sort is stable.
-             * Slide elements over to make room to make room for pivot.
+             * Slide elements over to make room for pivot.
              */
             int n = start - left;  // The number of elements to move
             // Switch is just an optimization for arraycopy in default case
--- a/jdk/src/share/classes/java/util/SortedMap.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/SortedMap.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,69 +26,70 @@
 package java.util;
 
 /**
- * A {@link Map} that further provides a <i>total ordering</i> on its keys.
+ * A {@link Map} that further provides a <em>total ordering</em> on its keys.
  * The map is ordered according to the {@linkplain Comparable natural
  * ordering} of its keys, or by a {@link Comparator} typically
  * provided at sorted map creation time.  This order is reflected when
  * iterating over the sorted map's collection views (returned by the
- * <tt>entrySet</tt>, <tt>keySet</tt> and <tt>values</tt> methods).
+ * {@code entrySet}, {@code keySet} and {@code values} methods).
  * Several additional operations are provided to take advantage of the
- * ordering.  (This interface is the map analogue of {@link
- * SortedSet}.)
+ * ordering.  (This interface is the map analogue of {@link SortedSet}.)
  *
- * <p>All keys inserted into a sorted map must implement the <tt>Comparable</tt>
+ * <p>All keys inserted into a sorted map must implement the {@code Comparable}
  * interface (or be accepted by the specified comparator).  Furthermore, all
- * such keys must be <i>mutually comparable</i>: <tt>k1.compareTo(k2)</tt> (or
- * <tt>comparator.compare(k1, k2)</tt>) must not throw a
- * <tt>ClassCastException</tt> for any keys <tt>k1</tt> and <tt>k2</tt> in
+ * such keys must be <em>mutually comparable</em>: {@code k1.compareTo(k2)} (or
+ * {@code comparator.compare(k1, k2)}) must not throw a
+ * {@code ClassCastException} for any keys {@code k1} and {@code k2} in
  * the sorted map.  Attempts to violate this restriction will cause the
  * offending method or constructor invocation to throw a
- * <tt>ClassCastException</tt>.
+ * {@code ClassCastException}.
  *
  * <p>Note that the ordering maintained by a sorted map (whether or not an
- * explicit comparator is provided) must be <i>consistent with equals</i> if
- * the sorted map is to correctly implement the <tt>Map</tt> interface.  (See
- * the <tt>Comparable</tt> interface or <tt>Comparator</tt> interface for a
- * precise definition of <i>consistent with equals</i>.)  This is so because
- * the <tt>Map</tt> interface is defined in terms of the <tt>equals</tt>
+ * explicit comparator is provided) must be <em>consistent with equals</em> if
+ * the sorted map is to correctly implement the {@code Map} interface.  (See
+ * the {@code Comparable} interface or {@code Comparator} interface for a
+ * precise definition of <em>consistent with equals</em>.)  This is so because
+ * the {@code Map} interface is defined in terms of the {@code equals}
  * operation, but a sorted map performs all key comparisons using its
- * <tt>compareTo</tt> (or <tt>compare</tt>) method, so two keys that are
+ * {@code compareTo} (or {@code compare}) method, so two keys that are
  * deemed equal by this method are, from the standpoint of the sorted map,
- * equal.  The behavior of a tree map <i>is</i> well-defined even if its
+ * equal.  The behavior of a tree map <em>is</em> well-defined even if its
  * ordering is inconsistent with equals; it just fails to obey the general
- * contract of the <tt>Map</tt> interface.
+ * contract of the {@code Map} interface.
  *
- * <p>All general-purpose sorted map implementation classes should
- * provide four "standard" constructors: 1) A void (no arguments)
- * constructor, which creates an empty sorted map sorted according to
- * the natural ordering of its keys.  2) A constructor with a
- * single argument of type <tt>Comparator</tt>, which creates an empty
- * sorted map sorted according to the specified comparator.  3) A
- * constructor with a single argument of type <tt>Map</tt>, which
- * creates a new map with the same key-value mappings as its argument,
- * sorted according to the keys' natural ordering.  4) A constructor
- * with a single argument of type <tt>SortedMap</tt>,
- * which creates a new sorted map with the same key-value mappings and
- * the same ordering as the input sorted map.  There is no way to
- * enforce this recommendation, as interfaces cannot contain
- * constructors.
+ * <p>All general-purpose sorted map implementation classes should provide four
+ * "standard" constructors. It is not possible to enforce this recommendation
+ * though as required constructors cannot be specified by interfaces. The
+ * expected "standard" constructors for all sorted map implementations are:
+ * <ol>
+ *   <li>A void (no arguments) constructor, which creates an empty sorted map
+ *   sorted according to the natural ordering of its keys.</li>
+ *   <li>A constructor with a single argument of type {@code Comparator}, which
+ *   creates an empty sorted map sorted according to the specified comparator.</li>
+ *   <li>A constructor with a single argument of type {@code Map}, which creates
+ *   a new map with the same key-value mappings as its argument, sorted
+ *   according to the keys' natural ordering.</li>
+ *   <li>A constructor with a single argument of type {@code SortedMap}, which
+ *   creates a new sorted map with the same key-value mappings and the same
+ *   ordering as the input sorted map.</li>
+ * </ol>
  *
- * <p>Note: several methods return submaps with restricted key ranges.
- * Such ranges are <i>half-open</i>, that is, they include their low
+ * <p><strong>Note</strong>: several methods return submaps with restricted key
+ * ranges. Such ranges are <em>half-open</em>, that is, they include their low
  * endpoint but not their high endpoint (where applicable).  If you need a
- * <i>closed range</i> (which includes both endpoints), and the key type
+ * <em>closed range</em> (which includes both endpoints), and the key type
  * allows for calculation of the successor of a given key, merely request
- * the subrange from <tt>lowEndpoint</tt> to
- * <tt>successor(highEndpoint)</tt>.  For example, suppose that <tt>m</tt>
+ * the subrange from {@code lowEndpoint} to
+ * {@code successor(highEndpoint)}.  For example, suppose that {@code m}
  * is a map whose keys are strings.  The following idiom obtains a view
- * containing all of the key-value mappings in <tt>m</tt> whose keys are
- * between <tt>low</tt> and <tt>high</tt>, inclusive:<pre>
+ * containing all of the key-value mappings in {@code m} whose keys are
+ * between {@code low} and {@code high}, inclusive:<pre>
  *   SortedMap&lt;String, V&gt; sub = m.subMap(low, high+"\0");</pre>
  *
- * A similar technique can be used to generate an <i>open range</i>
+ * A similar technique can be used to generate an <em>open range</em>
  * (which contains neither endpoint).  The following idiom obtains a
- * view containing all of the key-value mappings in <tt>m</tt> whose keys
- * are between <tt>low</tt> and <tt>high</tt>, exclusive:<pre>
+ * view containing all of the key-value mappings in {@code m} whose keys
+ * are between {@code low} and {@code high}, exclusive:<pre>
  *   SortedMap&lt;String, V&gt; sub = m.subMap(low+"\0", high);</pre>
  *
  * <p>This interface is a member of the
@@ -112,96 +113,96 @@
 public interface SortedMap<K,V> extends Map<K,V> {
     /**
      * Returns the comparator used to order the keys in this map, or
-     * <tt>null</tt> if this map uses the {@linkplain Comparable
+     * {@code null} if this map uses the {@linkplain Comparable
      * natural ordering} of its keys.
      *
      * @return the comparator used to order the keys in this map,
-     *         or <tt>null</tt> if this map uses the natural ordering
+     *         or {@code null} if this map uses the natural ordering
      *         of its keys
      */
     Comparator<? super K> comparator();
 
     /**
      * Returns a view of the portion of this map whose keys range from
-     * <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive.  (If
-     * <tt>fromKey</tt> and <tt>toKey</tt> are equal, the returned map
+     * {@code fromKey}, inclusive, to {@code toKey}, exclusive.  (If
+     * {@code fromKey} and {@code toKey} are equal, the returned map
      * is empty.)  The returned map is backed by this map, so changes
      * in the returned map are reflected in this map, and vice-versa.
      * The returned map supports all optional map operations that this
      * map supports.
      *
-     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
+     * <p>The returned map will throw an {@code IllegalArgumentException}
      * on an attempt to insert a key outside its range.
      *
      * @param fromKey low endpoint (inclusive) of the keys in the returned map
      * @param toKey high endpoint (exclusive) of the keys in the returned map
      * @return a view of the portion of this map whose keys range from
-     *         <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive
-     * @throws ClassCastException if <tt>fromKey</tt> and <tt>toKey</tt>
+     *         {@code fromKey}, inclusive, to {@code toKey}, exclusive
+     * @throws ClassCastException if {@code fromKey} and {@code toKey}
      *         cannot be compared to one another using this map's comparator
      *         (or, if the map has no comparator, using natural ordering).
      *         Implementations may, but are not required to, throw this
-     *         exception if <tt>fromKey</tt> or <tt>toKey</tt>
+     *         exception if {@code fromKey} or {@code toKey}
      *         cannot be compared to keys currently in the map.
-     * @throws NullPointerException if <tt>fromKey</tt> or <tt>toKey</tt>
+     * @throws NullPointerException if {@code fromKey} or {@code toKey}
      *         is null and this map does not permit null keys
-     * @throws IllegalArgumentException if <tt>fromKey</tt> is greater than
-     *         <tt>toKey</tt>; or if this map itself has a restricted
-     *         range, and <tt>fromKey</tt> or <tt>toKey</tt> lies
+     * @throws IllegalArgumentException if {@code fromKey} is greater than
+     *         {@code toKey}; or if this map itself has a restricted
+     *         range, and {@code fromKey} or {@code toKey} lies
      *         outside the bounds of the range
      */
     SortedMap<K,V> subMap(K fromKey, K toKey);
 
     /**
      * Returns a view of the portion of this map whose keys are
-     * strictly less than <tt>toKey</tt>.  The returned map is backed
+     * strictly less than {@code toKey}.  The returned map is backed
      * by this map, so changes in the returned map are reflected in
      * this map, and vice-versa.  The returned map supports all
      * optional map operations that this map supports.
      *
-     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
+     * <p>The returned map will throw an {@code IllegalArgumentException}
      * on an attempt to insert a key outside its range.
      *
      * @param toKey high endpoint (exclusive) of the keys in the returned map
      * @return a view of the portion of this map whose keys are strictly
-     *         less than <tt>toKey</tt>
-     * @throws ClassCastException if <tt>toKey</tt> is not compatible
+     *         less than {@code toKey}
+     * @throws ClassCastException if {@code toKey} is not compatible
      *         with this map's comparator (or, if the map has no comparator,
-     *         if <tt>toKey</tt> does not implement {@link Comparable}).
+     *         if {@code toKey} does not implement {@link Comparable}).
      *         Implementations may, but are not required to, throw this
-     *         exception if <tt>toKey</tt> cannot be compared to keys
+     *         exception if {@code toKey} cannot be compared to keys
      *         currently in the map.
-     * @throws NullPointerException if <tt>toKey</tt> is null and
+     * @throws NullPointerException if {@code toKey} is null and
      *         this map does not permit null keys
      * @throws IllegalArgumentException if this map itself has a
-     *         restricted range, and <tt>toKey</tt> lies outside the
+     *         restricted range, and {@code toKey} lies outside the
      *         bounds of the range
      */
     SortedMap<K,V> headMap(K toKey);
 
     /**
      * Returns a view of the portion of this map whose keys are
-     * greater than or equal to <tt>fromKey</tt>.  The returned map is
+     * greater than or equal to {@code fromKey}.  The returned map is
      * backed by this map, so changes in the returned map are
      * reflected in this map, and vice-versa.  The returned map
      * supports all optional map operations that this map supports.
      *
-     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
+     * <p>The returned map will throw an {@code IllegalArgumentException}
      * on an attempt to insert a key outside its range.
      *
      * @param fromKey low endpoint (inclusive) of the keys in the returned map
      * @return a view of the portion of this map whose keys are greater
-     *         than or equal to <tt>fromKey</tt>
-     * @throws ClassCastException if <tt>fromKey</tt> is not compatible
+     *         than or equal to {@code fromKey}
+     * @throws ClassCastException if {@code fromKey} is not compatible
      *         with this map's comparator (or, if the map has no comparator,
-     *         if <tt>fromKey</tt> does not implement {@link Comparable}).
+     *         if {@code fromKey} does not implement {@link Comparable}).
      *         Implementations may, but are not required to, throw this
-     *         exception if <tt>fromKey</tt> cannot be compared to keys
+     *         exception if {@code fromKey} cannot be compared to keys
      *         currently in the map.
-     * @throws NullPointerException if <tt>fromKey</tt> is null and
+     * @throws NullPointerException if {@code fromKey} is null and
      *         this map does not permit null keys
      * @throws IllegalArgumentException if this map itself has a
-     *         restricted range, and <tt>fromKey</tt> lies outside the
+     *         restricted range, and {@code fromKey} lies outside the
      *         bounds of the range
      */
     SortedMap<K,V> tailMap(K fromKey);
@@ -228,12 +229,12 @@
      * The set is backed by the map, so changes to the map are
      * reflected in the set, and vice-versa.  If the map is modified
      * while an iteration over the set is in progress (except through
-     * the iterator's own <tt>remove</tt> operation), the results of
+     * the iterator's own {@code remove} operation), the results of
      * the iteration are undefined.  The set supports element removal,
      * which removes the corresponding mapping from the map, via the
-     * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
-     * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
-     * operations.  It does not support the <tt>add</tt> or <tt>addAll</tt>
+     * {@code Iterator.remove}, {@code Set.remove},
+     * {@code removeAll}, {@code retainAll}, and {@code clear}
+     * operations.  It does not support the {@code add} or {@code addAll}
      * operations.
      *
      * @return a set view of the keys contained in this map, sorted in
@@ -248,13 +249,13 @@
      * The collection is backed by the map, so changes to the map are
      * reflected in the collection, and vice-versa.  If the map is
      * modified while an iteration over the collection is in progress
-     * (except through the iterator's own <tt>remove</tt> operation),
+     * (except through the iterator's own {@code remove} operation),
      * the results of the iteration are undefined.  The collection
      * supports element removal, which removes the corresponding
-     * mapping from the map, via the <tt>Iterator.remove</tt>,
-     * <tt>Collection.remove</tt>, <tt>removeAll</tt>,
-     * <tt>retainAll</tt> and <tt>clear</tt> operations.  It does not
-     * support the <tt>add</tt> or <tt>addAll</tt> operations.
+     * mapping from the map, via the {@code Iterator.remove},
+     * {@code Collection.remove}, {@code removeAll},
+     * {@code retainAll} and {@code clear} operations.  It does not
+     * support the {@code add} or {@code addAll} operations.
      *
      * @return a collection view of the values contained in this map,
      *         sorted in ascending key order
@@ -267,14 +268,14 @@
      * The set is backed by the map, so changes to the map are
      * reflected in the set, and vice-versa.  If the map is modified
      * while an iteration over the set is in progress (except through
-     * the iterator's own <tt>remove</tt> operation, or through the
-     * <tt>setValue</tt> operation on a map entry returned by the
+     * the iterator's own {@code remove} operation, or through the
+     * {@code setValue} operation on a map entry returned by the
      * iterator) the results of the iteration are undefined.  The set
      * supports element removal, which removes the corresponding
-     * mapping from the map, via the <tt>Iterator.remove</tt>,
-     * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
-     * <tt>clear</tt> operations.  It does not support the
-     * <tt>add</tt> or <tt>addAll</tt> operations.
+     * mapping from the map, via the {@code Iterator.remove},
+     * {@code Set.remove}, {@code removeAll}, {@code retainAll} and
+     * {@code clear} operations.  It does not support the
+     * {@code add} or {@code addAll} operations.
      *
      * @return a set view of the mappings contained in this map,
      *         sorted in ascending key order
--- a/jdk/src/share/classes/java/util/TimSort.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/TimSort.java	Thu Mar 31 22:07:32 2011 -0700
@@ -274,7 +274,7 @@
              * pivot < all in [left, start), so pivot belongs at left.  Note
              * that if there are elements equal to pivot, left points to the
              * first slot after them -- that's why this sort is stable.
-             * Slide elements over to make room to make room for pivot.
+             * Slide elements over to make room for pivot.
              */
             int n = start - left;  // The number of elements to move
             // Switch is just an optimization for arraycopy in default case
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Thu Mar 31 22:07:32 2011 -0700
@@ -415,6 +415,12 @@
         pendingBlocks = null;
         signerCache = null;
         manDig = null;
+        // MANIFEST.MF is always treated as signed and verified,
+        // move its signers from sigFileSigners to verifiedSigners.
+        if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
+            verifiedSigners.put(JarFile.MANIFEST_NAME,
+                    sigFileSigners.remove(JarFile.MANIFEST_NAME));
+        }
     }
 
     static class VerifierStream extends java.io.InputStream {
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1166,7 +1166,12 @@
     private static LoggingMXBean loggingMXBean = null;
     /**
      * String representation of the
-     * {@link javax.management.ObjectName} for {@link LoggingMXBean}.
+     * {@link javax.management.ObjectName} for the management interface
+     * for the logging facility.
+     *
+     * @see java.lang.management.PlatformLoggingMXBean
+     * @see java.util.logging.LoggingMXBean
+     *
      * @since 1.5
      */
     public final static String LOGGING_MXBEAN_NAME
@@ -1174,20 +1179,20 @@
 
     /**
      * Returns <tt>LoggingMXBean</tt> for managing loggers.
-     * An alternative way to manage loggers is using
-     * the {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
-     * ManagementFactory.getPlatformMXBeans} method as follows:
+     * An alternative way to manage loggers is through the
+     * {@link java.lang.management.PlatformLoggingMXBean} interface
+     * that can be obtained by calling:
      * <pre>
-     *     List&lt{@link PlatformLoggingMXBean}&gt result = ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
+     *     PlatformLoggingMXBean logging = {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+     *         ManagementFactory.getPlatformMXBean}(PlatformLoggingMXBean.class);
      * </pre>
      *
      * @return a {@link LoggingMXBean} object.
      *
-     * @see PlatformLoggingMXBean
-     * @see java.lang.management.ManagementFactory
+     * @see java.lang.management.PlatformLoggingMXBean
      * @since 1.5
      */
-    public static synchronized LoggingMXBean  getLoggingMXBean() {
+    public static synchronized LoggingMXBean getLoggingMXBean() {
         if (loggingMXBean == null) {
             loggingMXBean =  new Logging();
         }
--- a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java	Thu Mar 31 22:07:32 2011 -0700
@@ -27,36 +27,41 @@
 
 
 /**
- * The management interface for the logging facility.
+ * The management interface for the logging facility. It is recommended
+ * to use the {@link java.lang.management.PlatformLoggingMXBean} management
+ * interface that implements all attributes defined in this
+ * {@code LoggingMXBean}.  The
+ * {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean} method can be used to obtain
+ * the {@code PlatformLoggingMXBean} object representing the management
+ * interface for logging.
  *
  * <p>There is a single global instance of the <tt>LoggingMXBean</tt>.
- * This instance is an
- * <a href="../../lang/management/ManagementFactory.html#MXBean">MXBean</a>
- * can be obtained by calling
- * the {@link LogManager#getLoggingMXBean} method or from the
+ * This instance is an {@link javax.management.MXBean MXBean} that
+ * can be obtained by calling the {@link LogManager#getLoggingMXBean}
+ * method or from the
  * {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
  * platform <tt>MBeanServer</tt>}.
- *
- * The {@link javax.management.ObjectName ObjectName} for uniquely
- * identifying the <tt>LoggingMXBean</tt> within an MBeanServer is:
- * <blockquote>
- *    {@link LogManager#LOGGING_MXBEAN_NAME
- *           <tt>java.util.logging:type=Logging</tt>}
- * </blockquote>
- *
- * The instance registered in the platform <tt>MBeanServer</tt> with
- * this {@code ObjectName} is also a {@link PlatformLoggingMXBean}.
+ * <p>
+ * The {@link javax.management.ObjectName ObjectName} that uniquely identifies
+ * the management interface for logging within the {@code MBeanServer} is:
+ * <pre>
+ *    {@link LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
+ * </pre>
+ * <p>
+ * The instance registered in the platform {@code MBeanServer}
+ * is also a {@link java.lang.management.PlatformLoggingMXBean}.
  *
  * @author  Ron Mann
  * @author  Mandy Chung
  * @since   1.5
  *
- * @see PlatformLoggingMXBean
+ * @see java.lang.management.PlatformLoggingMXBean
  */
 public interface LoggingMXBean {
 
     /**
-     * Returns the list of currently registered loggers. This method
+     * Returns the list of currently registered logger names. This method
      * calls {@link LogManager#getLoggerNames} and returns a list
      * of the logger names.
      *
@@ -89,7 +94,7 @@
      *
      * @see Logger#getLevel
      */
-    public String getLoggerLevel( String loggerName );
+    public String getLoggerLevel(String loggerName);
 
     /**
      * Sets the specified logger to the specified new level.
@@ -115,7 +120,7 @@
      *
      * @see Logger#setLevel
      */
-    public void setLoggerLevel( String loggerName, String levelName );
+    public void setLoggerLevel(String loggerName, String levelName);
 
     /**
      * Returns the name of the parent for the specified logger.
--- a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java	Thu Mar 31 22:07:32 2011 -0700
@@ -99,4 +99,9 @@
     public String getLevelName(Object level) {
         return ((Level) level).getName();
     }
+
+    @Override
+    public String getProperty(String key) {
+        return LogManager.getLogManager().getProperty(key);
+    }
 }
--- a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java	Thu Mar 31 18:14:17 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.util.logging;
-
-import java.lang.management.PlatformManagedObject;
-
-/**
- * The {@linkplain PlatformManagedObject platform managed object} for the
- * logging facility.  This interface simply unifies {@link LoggingMXBean}
- * {@link PlatformManagedObject};
- * and it does not specify any new operations.
- *
- * <p>The {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
- * ManagementFactory.getPlatformMXBeans} method can be used to obtain
- * the {@code PlatformLoggingMXBean} object as follows:
- * <pre>
- *     ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
- * </pre>
- * or from the {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>}.
- *
- * The {@link javax.management.ObjectName ObjectName} for uniquely
- * identifying the <tt>LoggingMXBean</tt> within an MBeanServer is:
- * <blockquote>
- *           <tt>java.util.logging:type=Logging</tt>
- * </blockquote>
- *
- * The {@link PlatformManagedObject#getObjectName} method
- * can be used to obtain its {@code ObjectName}.
- *
- * @see java.lang.management.PlatformManagedObject
- *
- * @author  Mandy Chung
- * @since   1.7
- */
-public interface PlatformLoggingMXBean extends LoggingMXBean, PlatformManagedObject {
-}
--- a/jdk/src/share/classes/java/util/logging/SimpleFormatter.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java	Thu Mar 31 22:07:32 2011 -0700
@@ -29,31 +29,108 @@
 import java.io.*;
 import java.text.*;
 import java.util.Date;
+import sun.util.logging.LoggingSupport;
 
 /**
- * Print a brief summary of the LogRecord in a human readable
+ * Print a brief summary of the {@code LogRecord} in a human readable
  * format.  The summary will typically be 1 or 2 lines.
  *
+ * <p>
+ * <a name="formatting">
+ * <b>Configuration:</b></a>
+ * The {@code SimpleFormatter} is initialized with the
+ * <a href="../Formatter.html#syntax">format string</a>
+ * specified in the {@code java.util.logging.SimpleFormatter.format}
+ * property to {@linkplain #format format} the log messages.
+ * This property can be defined
+ * in the {@linkplain LogManager#getProperty logging properties}
+ * configuration file
+ * or as a system property.  If this property is set in both
+ * the logging properties and system properties,
+ * the format string specified in the system property will be used.
+ * If this property is not defined or the given format string
+ * is {@linkplain java.util.IllegalFormatException illegal},
+ * the default format is implementation-specific.
+ *
  * @since 1.4
+ * @see java.util.Formatter
  */
 
 public class SimpleFormatter extends Formatter {
 
-    Date dat = new Date();
-    private final static String format = "{0,date} {0,time}";
-    private MessageFormat formatter;
-
-    private Object args[] = new Object[1];
-
-    // Line separator string.  This is the value of the line.separator
-    // property at the moment that the SimpleFormatter was created.
-    private String lineSeparator = java.security.AccessController.doPrivileged(
-               new sun.security.action.GetPropertyAction("line.separator"));
+    // format string for printing the log record
+    private static final String format = LoggingSupport.getSimpleFormat();
+    private final Date dat = new Date();
 
     /**
      * Format the given LogRecord.
      * <p>
-     * This method can be overridden in a subclass.
+     * The formatting can be customized by specifying the
+     * <a href="../Formatter.html#syntax">format string</a>
+     * in the <a href="#formatting">
+     * {@code java.util.logging.SimpleFormatter.format}</a> property.
+     * The given {@code LogRecord} will be formatted as if by calling:
+     * <pre>
+     *    {@link String#format String.format}(format, date, source, logger, level, message, thrown);
+     * </pre>
+     * where the arguments are:<br>
+     * <ol>
+     * <li>{@code format} - the {@link java.util.Formatter
+     *     java.util.Formatter} format string specified in the
+     *     {@code java.util.logging.SimpleFormatter.format} property
+     *     or the default format.</li>
+     * <li>{@code date} - a {@link Date} object representing
+     *     {@linkplain LogRecord#getMillis event time} of the log record.</li>
+     * <li>{@code source} - a string representing the caller, if available;
+     *     otherwise, the logger's name.</li>
+     * <li>{@code logger} - the logger's name.</li>
+     * <li>{@code level} - the {@linkplain Level#getLocalizedName
+     *     log level}.</li>
+     * <li>{@code message} - the formatted log message
+     *     returned from the {@link Formatter#formatMessage(LogRecord)}
+     *     method.  It uses {@link java.text.MessageFormat java.text}
+     *     formatting and does not use the {@code java.util.Formatter
+     *     format} argument.</li>
+     * <li>{@code thrown} - a string representing
+     *     the {@linkplain LogRecord#getThrown throwable}
+     *     associated with the log record and its backtrace
+     *     beginning with a newline character, if any;
+     *     otherwise, an empty string.</li>
+     * </ol>
+     *
+     * <p>Some example formats:<br>
+     * <ul>
+     * <li> {@code java.util.logging.SimpleFormatter.format="%4$s: %5$s [%1$tc]%n"}
+     *     <p>This prints 1 line with the log level ({@code 4$}),
+     *     the log message ({@code 5$}) and the timestamp ({@code 1$}) in
+     *     a square bracket.
+     *     <pre>
+     *     WARNING: warning message [Tue Mar 22 13:11:31 PDT 2011]
+     *     </pre></li>
+     * <li> {@code java.util.logging.SimpleFormatter.format="%1$tc %2$s%n%4$s: %5$s%6$s%n"}
+     *     <p>This prints 2 lines where the first line includes
+     *     the timestamp ({@code 1$}) and the source ({@code 2$});
+     *     the second line includes the log level ({@code 4$}) and
+     *     the log message ({@code 5$}) followed with the throwable
+     *     and its backtrace ({@code 6$}), if any:
+     *     <pre>
+     *     Tue Mar 22 13:11:31 PDT 2011 MyClass fatal
+     *     SEVERE: several message with an exception
+     *     java.lang.IllegalArgumentException: invalid argument
+     *             at MyClass.mash(MyClass.java:9)
+     *             at MyClass.crunch(MyClass.java:6)
+     *             at MyClass.main(MyClass.java:3)
+     *     </pre></li>
+     * <li> {@code java.util.logging.SimpleFormatter.format="%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%n"}
+     *      <p>This prints 2 lines similar to the example above
+     *         with a different date/time formatting and does not print
+     *         the throwable and its backtrace:
+     *     <pre>
+     *     Mar 22, 2011 1:11:31 PM MyClass fatal
+     *     SEVERE: several message with an exception
+     *     </pre></li>
+     * </ul>
+     * <p>This method can also be overridden in a subclass.
      * It is recommended to use the {@link Formatter#formatMessage}
      * convenience method to localize and format the message field.
      *
@@ -61,42 +138,32 @@
      * @return a formatted log record
      */
     public synchronized String format(LogRecord record) {
-        StringBuffer sb = new StringBuffer();
-        // Minimize memory allocations here.
         dat.setTime(record.getMillis());
-        args[0] = dat;
-        StringBuffer text = new StringBuffer();
-        if (formatter == null) {
-            formatter = new MessageFormat(format);
-        }
-        formatter.format(args, text, null);
-        sb.append(text);
-        sb.append(" ");
+        String source;
         if (record.getSourceClassName() != null) {
-            sb.append(record.getSourceClassName());
+            source = record.getSourceClassName();
+            if (record.getSourceMethodName() != null) {
+               source += " " + record.getSourceMethodName();
+            }
         } else {
-            sb.append(record.getLoggerName());
+            source = record.getLoggerName();
         }
-        if (record.getSourceMethodName() != null) {
-            sb.append(" ");
-            sb.append(record.getSourceMethodName());
-        }
-        sb.append(lineSeparator);
         String message = formatMessage(record);
-        sb.append(record.getLevel().getLocalizedName());
-        sb.append(": ");
-        sb.append(message);
-        sb.append(lineSeparator);
+        String throwable = "";
         if (record.getThrown() != null) {
-            try {
-                StringWriter sw = new StringWriter();
-                PrintWriter pw = new PrintWriter(sw);
-                record.getThrown().printStackTrace(pw);
-                pw.close();
-                sb.append(sw.toString());
-            } catch (Exception ex) {
-            }
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            pw.println();
+            record.getThrown().printStackTrace(pw);
+            pw.close();
+            throwable = sw.toString();
         }
-        return sb.toString();
+        return String.format(format,
+                             dat,
+                             source,
+                             record.getLoggerName(),
+                             record.getLevel().getLocalizedName(),
+                             message,
+                             throwable);
     }
 }
--- a/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
      * @exception NullPointerException if builder is null
      */
     public KeyStoreBuilderParameters(Builder builder) {
-        parameters = Collections.singletonList(builder);
+        parameters = Collections.singletonList(Objects.requireNonNull(builder));
     }
 
     /**
@@ -64,11 +64,12 @@
      * @exception IllegalArgumentException if parameters is an empty list
      */
     public KeyStoreBuilderParameters(List<Builder> parameters) {
+        if (parameters.isEmpty()) {
+            throw new IllegalArgumentException();
+        }
+
         this.parameters = Collections.unmodifiableList(
             new ArrayList<Builder>(parameters));
-        if (this.parameters.isEmpty()) {
-            throw new IllegalArgumentException();
-        }
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/HToolkit.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.awt;
+
+import java.awt.*;
+import java.awt.dnd.*;
+import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.im.InputMethodHighlight;
+import java.awt.im.spi.InputMethodDescriptor;
+import java.awt.image.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.peer.*;
+import java.util.Map;
+import java.util.Properties;
+
+/*
+ * HToolkit is a platform independent Toolkit used
+ * with the HeadlessToolkit.  It is primarily used
+ * in embedded JRE's that do not have sun/awt/X11 classes.
+ */
+public class HToolkit extends SunToolkit
+    implements ComponentFactory {
+
+    public HToolkit() {
+    }
+
+    /*
+     * Component peer objects - unsupported.
+     */
+
+    public WindowPeer createWindow(Window target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public FramePeer createFrame(Frame target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public DialogPeer createDialog(Dialog target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public ButtonPeer createButton(Button target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public TextFieldPeer createTextField(TextField target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public ChoicePeer createChoice(Choice target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public LabelPeer createLabel(Label target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public ListPeer createList(List target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public CheckboxPeer createCheckbox(Checkbox target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public ScrollbarPeer createScrollbar(Scrollbar target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public ScrollPanePeer createScrollPane(ScrollPane target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public TextAreaPeer createTextArea(TextArea target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public FileDialogPeer createFileDialog(FileDialog target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public MenuBarPeer createMenuBar(MenuBar target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public MenuPeer createMenu(Menu target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public PopupMenuPeer createPopupMenu(PopupMenu target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public MenuItemPeer createMenuItem(MenuItem target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public DragSourceContextPeer createDragSourceContextPeer(
+        DragGestureEvent dge)
+        throws InvalidDnDOperationException {
+        throw new InvalidDnDOperationException("Headless environment");
+    }
+
+    public RobotPeer createRobot(Robot target, GraphicsDevice screen)
+        throws AWTException, HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
+        // See 6833019.
+        return
+            new KeyboardFocusManagerPeer() {
+                public Window getCurrentFocusedWindow() { return null; }
+                public void setCurrentFocusOwner(Component comp) {}
+                public Component getCurrentFocusOwner() { return null; }
+                public void clearGlobalFocusOwner(Window activeWindow) {}
+            };
+    }
+
+    public TrayIconPeer createTrayIcon(TrayIcon target)
+      throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public SystemTrayPeer createSystemTray(SystemTray target)
+      throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public boolean isTraySupported() {
+        return false;
+    }
+
+    public GlobalCursorManager getGlobalCursorManager()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    /*
+     * Headless toolkit - unsupported.
+     */
+    protected void loadSystemColors(int[] systemColors)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public ColorModel getColorModel()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public int getScreenResolution()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public int getMenuShortcutKeyMask()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public boolean getLockingKeyState(int keyCode)
+        throws UnsupportedOperationException {
+        throw new HeadlessException();
+    }
+
+    public void setLockingKeyState(int keyCode, boolean on)
+        throws UnsupportedOperationException {
+        throw new HeadlessException();
+    }
+
+    public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
+        throws IndexOutOfBoundsException, HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public int getMaximumCursorColors()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public <T extends DragGestureRecognizer> T
+        createDragGestureRecognizer(Class<T> abstractRecognizerClass,
+                                    DragSource ds, Component c,
+                                    int srcActions, DragGestureListener dgl)
+    {
+        return null;
+    }
+
+    public int getScreenHeight()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public int getScreenWidth()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public Dimension getScreenSize()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public Insets getScreenInsets(GraphicsConfiguration gc)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public void setDynamicLayout(boolean dynamic)
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    protected boolean isDynamicLayoutSet()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public boolean isDynamicLayoutActive()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    public Clipboard getSystemClipboard()
+        throws HeadlessException {
+        throw new HeadlessException();
+    }
+
+    /*
+     * Printing
+     */
+    public PrintJob getPrintJob(Frame frame, String jobtitle,
+        JobAttributes jobAttributes,
+        PageAttributes pageAttributes) {
+        if (frame != null) {
+            // Should never happen
+            throw new HeadlessException();
+        }
+        throw new IllegalArgumentException(
+                "PrintJob not supported in a headless environment");
+    }
+
+    public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)
+    {
+        if (frame != null) {
+            // Should never happen
+            throw new HeadlessException();
+        }
+        throw new IllegalArgumentException(
+                "PrintJob not supported in a headless environment");
+    }
+
+    /*
+     * Headless toolkit - supported.
+     */
+
+    public void sync() {
+        // Do nothing
+    }
+
+    protected boolean syncNativeQueue(final long timeout) {
+        return false;
+    }
+
+    public void beep() {
+        // Send alert character
+        System.out.write(0x07);
+    }
+
+
+    /*
+     * Fonts
+     */
+    public FontPeer getFontPeer(String name, int style) {
+        return (FontPeer)null;
+    }
+
+    /*
+     * Modality
+     */
+    public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
+        return false;
+    }
+
+    public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
+        return false;
+    }
+
+    public boolean isDesktopSupported() {
+        return false;
+    }
+
+    public DesktopPeer createDesktopPeer(Desktop target)
+    throws HeadlessException{
+        throw new HeadlessException();
+    }
+
+    public boolean isWindowOpacityControlSupported() {
+        return false;
+    }
+
+    public boolean isWindowShapingSupported() {
+        return false;
+    }
+
+    public boolean isWindowTranslucencySupported() {
+        return false;
+    }
+
+    public  void grab(Window w) { }
+
+    public void ungrab(Window w) { }
+
+    protected boolean syncNativeQueue() { return false; }
+
+    public InputMethodDescriptor getInputMethodAdapterDescriptor()
+        throws AWTException
+    {
+        return (InputMethodDescriptor)null;
+    }
+}
--- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Thu Mar 31 22:07:32 2011 -0700
@@ -27,20 +27,18 @@
 
 import java.lang.management.*;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
 import javax.management.MBeanRegistrationException;
 import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
 import javax.management.RuntimeOperationsException;
-import java.nio.BufferPoolMXBean;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import sun.security.action.LoadLibraryAction;
 
-import java.util.logging.PlatformLoggingMXBean;
 import sun.util.logging.LoggingSupport;
 
 import java.util.ArrayList;
@@ -139,61 +137,80 @@
         return result;
     }
 
-    public static List<PlatformLoggingMXBean> getLoggingMXBean() {
+    public static PlatformLoggingMXBean getPlatformLoggingMXBean() {
         if (LoggingSupport.isAvailable()) {
-            return Collections.singletonList(createPlatformLoggingMXBean());
+            return PlatformLoggingImpl.instance;
         } else {
-            return Collections.emptyList();
+            return null;
         }
     }
 
-    private final static String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging";
-    private static PlatformLoggingMXBean createPlatformLoggingMXBean() {
-        return new PlatformLoggingMXBean() {
-            private volatile ObjectName objname;  // created lazily
-            @Override
-            public ObjectName getObjectName() {
-                ObjectName result = objname;
-                if (result == null) {
-                    synchronized (this) {
-                        if (objname == null) {
-                            result = Util.newObjectName(LOGGING_MXBEAN_NAME);
-                            objname = result;
-                        }
+    // The logging MXBean object is an instance of
+    // PlatformLoggingMXBean and java.util.logging.LoggingMXBean
+    // but it can't directly implement two MXBean interfaces
+    // as a compliant MXBean implements exactly one MXBean interface,
+    // or if it implements one interface that is a subinterface of
+    // all the others; otherwise, it is a non-compliant MXBean
+    // and MBeanServer will throw NotCompliantMBeanException.
+    // See the Definition of an MXBean section in javax.management.MXBean spec.
+    //
+    // To create a compliant logging MXBean, define a LoggingMXBean interface
+    // that extend PlatformLoggingMXBean and j.u.l.LoggingMXBean
+    interface LoggingMXBean
+        extends PlatformLoggingMXBean, java.util.logging.LoggingMXBean {
+    }
+
+    static class PlatformLoggingImpl implements LoggingMXBean
+    {
+        final static PlatformLoggingMXBean instance = new PlatformLoggingImpl();
+        final static String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging";
+
+        private volatile ObjectName objname;  // created lazily
+        @Override
+        public ObjectName getObjectName() {
+            ObjectName result = objname;
+            if (result == null) {
+                synchronized (this) {
+                    if (objname == null) {
+                        result = Util.newObjectName(LOGGING_MXBEAN_NAME);
+                        objname = result;
                     }
                 }
-                return result;
             }
+            return result;
+        }
 
-            @Override
-            public java.util.List<String> getLoggerNames() {
-                return LoggingSupport.getLoggerNames();
-            }
+        @Override
+        public java.util.List<String> getLoggerNames() {
+            return LoggingSupport.getLoggerNames();
+        }
 
-            @Override
-            public String getLoggerLevel(String loggerName) {
-                return LoggingSupport.getLoggerLevel(loggerName);
-            }
+        @Override
+        public String getLoggerLevel(String loggerName) {
+            return LoggingSupport.getLoggerLevel(loggerName);
+        }
 
-            @Override
-            public void setLoggerLevel(String loggerName, String levelName) {
-                LoggingSupport.setLoggerLevel(loggerName, levelName);
-            }
+        @Override
+        public void setLoggerLevel(String loggerName, String levelName) {
+            LoggingSupport.setLoggerLevel(loggerName, levelName);
+        }
 
-            @Override
-            public String getParentLoggerName(String loggerName) {
-                return LoggingSupport.getParentLoggerName(loggerName);
-            }
-        };
+        @Override
+        public String getParentLoggerName(String loggerName) {
+            return LoggingSupport.getParentLoggerName(loggerName);
+        }
     }
 
-    public static List<BufferPoolMXBean> getBufferPoolMXBeans() {
-        List<BufferPoolMXBean> pools = new ArrayList<BufferPoolMXBean>(2);
-        pools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess()
-            .getDirectBufferPool()));
-        pools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl
-            .getMappedBufferPool()));
-        return pools;
+    private static List<BufferPoolMXBean> bufferPools = null;
+    public static synchronized List<BufferPoolMXBean> getBufferPoolMXBeans() {
+        if (bufferPools == null) {
+            bufferPools = new ArrayList<>(2);
+            bufferPools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess()
+                .getDirectBufferPool()));
+            bufferPools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl
+                .getMappedBufferPool()));
+        }
+        return bufferPools;
     }
 
     private final static String BUFFER_POOL_MXBEAN_NAME = "java.nio:type=BufferPool";
--- a/jdk/src/share/classes/sun/misc/Version.java.template	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/Version.java.template	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,8 @@
         "@@java_version@@";
 
     private static final String java_runtime_name =
-        "@@java_runtime_name@@";
-
+	"@@java_runtime_name@@";
+ 
     private static final String java_runtime_version =
         "@@java_runtime_version@@";
 
@@ -87,12 +87,26 @@
      * Give a stream, it will print version info on it.
      */
     public static void print(PrintStream ps) {
+        boolean isHeadless = false;
+
+        /* Report that we're running headless if the property is true */
+	String headless = System.getProperty("java.awt.headless");
+	if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
+            isHeadless = true;
+	} 
+
         /* First line: platform version. */
         ps.println(launcher_name + " version \"" + java_version + "\"");
 
         /* Second line: runtime version (ie, libraries). */
-        ps.println(java_runtime_name + " (build " +
-                           java_runtime_version + ")");
+
+	ps.print(java_runtime_name + " (build " + java_runtime_version);
+
+	if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
+	    // embedded builds report headless state
+	    ps.print(", headless");
+	}
+	ps.println(')');
 
         /* Third line: JVM information. */
         String java_vm_name    = System.getProperty("java.vm.name");
--- a/jdk/src/share/classes/sun/security/krb5/Realm.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Realm.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -362,19 +362,15 @@
         Stack<String> iStack = new Stack<>();
 
         /*
-         * I don't expect any more than a handful of intermediaries.
+         * The half-established reversed-path, starting from the final target
+         * (sRealm), each item can be connected to by the next one.
+         * Might contains wrong item, if found, a bad track is performed
          */
         Vector<String> tempList = new Vector<>(8, 8);
-
-        /*
-         * The initiator at first location.
-         */
-        tempList.add(cRealm);
+        tempList.add(sRealm);
 
         int count = 0; // For debug only
-        if (DEBUG) {
-            tempTarget = sRealm;
-        }
+        tempTarget = sRealm;
 
         out: do {
             if (DEBUG) {
@@ -384,8 +380,8 @@
             }
 
             if (intermediaries != null &&
-                !intermediaries.equals(PrincipalName.REALM_COMPONENT_SEPARATOR_STR))
-            {
+                !intermediaries.equals(".") &&
+                !intermediaries.equals(cRealm)) {
                 if (DEBUG) {
                     System.out.println(">>> Realm parseCapaths: loop " +
                                        count + ": intermediaries=[" +
@@ -466,11 +462,15 @@
 
         } while (true);
 
+        if (tempList.isEmpty()) {
+            return null;
+        }
+
+        // From (SREALM, T1, T2) to (CREALM, T2, T1)
         retList = new String[tempList.size()];
-        try {
-            retList = tempList.toArray(retList);
-        } catch (ArrayStoreException exc) {
-            retList = null;
+        retList[0] = cRealm;
+        for (int i=1; i<tempList.size(); i++) {
+            retList[i] = tempList.elementAt(tempList.size()-i);
         }
 
         if (DEBUG && retList != null) {
--- a/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -694,47 +694,6 @@
     // the preferable signature algorithm used by this ServerKeyExchange message
     private SignatureAndHashAlgorithm preferableSignatureAlgorithm;
 
-    /* Return the Diffie-Hellman modulus */
-    BigInteger getModulus() {
-        return new BigInteger(1, dh_p);
-    }
-
-    /* Return the Diffie-Hellman base/generator */
-    BigInteger getBase() {
-        return new BigInteger(1, dh_g);
-    }
-
-    /* Return the server's Diffie-Hellman public key */
-    BigInteger getServerPublicKey() {
-        return new BigInteger(1, dh_Ys);
-    }
-
-    /*
-     * Update sig with nonces and Diffie-Hellman public key.
-     */
-    private void updateSignature(Signature sig, byte clntNonce[],
-            byte svrNonce[]) throws SignatureException {
-        int tmp;
-
-        sig.update(clntNonce);
-        sig.update(svrNonce);
-
-        tmp = dh_p.length;
-        sig.update((byte)(tmp >> 8));
-        sig.update((byte)(tmp & 0x0ff));
-        sig.update(dh_p);
-
-        tmp = dh_g.length;
-        sig.update((byte)(tmp >> 8));
-        sig.update((byte)(tmp & 0x0ff));
-        sig.update(dh_g);
-
-        tmp = dh_Ys.length;
-        sig.update((byte)(tmp >> 8));
-        sig.update((byte)(tmp & 0x0ff));
-        sig.update(dh_Ys);
-    }
-
     /*
      * Construct from initialized DH key object, for DH_anon
      * key exchange.
@@ -779,12 +738,6 @@
         signature = sig.sign();
     }
 
-    private void setValues(DHCrypt obj) {
-        dh_p = toByteArray(obj.getModulus());
-        dh_g = toByteArray(obj.getBase());
-        dh_Ys = toByteArray(obj.getPublicKey());
-    }
-
     /*
      * Construct a DH_ServerKeyExchange message from an input
      * stream, as if sent from server to client for use with
@@ -875,6 +828,53 @@
         }
     }
 
+    /* Return the Diffie-Hellman modulus */
+    BigInteger getModulus() {
+        return new BigInteger(1, dh_p);
+    }
+
+    /* Return the Diffie-Hellman base/generator */
+    BigInteger getBase() {
+        return new BigInteger(1, dh_g);
+    }
+
+    /* Return the server's Diffie-Hellman public key */
+    BigInteger getServerPublicKey() {
+        return new BigInteger(1, dh_Ys);
+    }
+
+    /*
+     * Update sig with nonces and Diffie-Hellman public key.
+     */
+    private void updateSignature(Signature sig, byte clntNonce[],
+            byte svrNonce[]) throws SignatureException {
+        int tmp;
+
+        sig.update(clntNonce);
+        sig.update(svrNonce);
+
+        tmp = dh_p.length;
+        sig.update((byte)(tmp >> 8));
+        sig.update((byte)(tmp & 0x0ff));
+        sig.update(dh_p);
+
+        tmp = dh_g.length;
+        sig.update((byte)(tmp >> 8));
+        sig.update((byte)(tmp & 0x0ff));
+        sig.update(dh_g);
+
+        tmp = dh_Ys.length;
+        sig.update((byte)(tmp >> 8));
+        sig.update((byte)(tmp & 0x0ff));
+        sig.update(dh_Ys);
+    }
+
+    private void setValues(DHCrypt obj) {
+        dh_p = toByteArray(obj.getModulus());
+        dh_g = toByteArray(obj.getBase());
+        dh_Ys = toByteArray(obj.getPublicKey());
+    }
+
     int messageLength() {
         int temp = 6;   // overhead for p, g, y(s) values.
 
@@ -945,8 +945,7 @@
  * We support named curves only, no explicitly encoded curves.
  */
 static final
-class ECDH_ServerKeyExchange extends ServerKeyExchange
-{
+class ECDH_ServerKeyExchange extends ServerKeyExchange {
 
     // constants for ECCurveType
     private final static int CURVE_EXPLICIT_PRIME = 1;
@@ -1120,10 +1119,12 @@
     }
 
     int messageLength() {
-        int sigLen = (signatureBytes == null) ? 0 : 2 + signatureBytes.length;
-
-        if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
-            sigLen += SignatureAndHashAlgorithm.sizeInRecord();
+        int sigLen = 0;
+        if (signatureBytes != null) {
+            sigLen = 2 + signatureBytes.length;
+            if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
+                sigLen += SignatureAndHashAlgorithm.sizeInRecord();
+            }
         }
 
         return 4 + pointBytes.length + sigLen;
@@ -1133,12 +1134,13 @@
         s.putInt8(CURVE_NAMED_CURVE);
         s.putInt16(curveId);
         s.putBytes8(pointBytes);
-        if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
-            s.putInt8(preferableSignatureAlgorithm.getHashValue());
-            s.putInt8(preferableSignatureAlgorithm.getSignatureValue());
-        }
 
         if (signatureBytes != null) {
+            if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
+                s.putInt8(preferableSignatureAlgorithm.getHashValue());
+                s.putInt8(preferableSignatureAlgorithm.getSignatureValue());
+            }
+
             s.putBytes16(signatureBytes);
         }
     }
@@ -1147,9 +1149,13 @@
         s.println("*** ECDH ServerKeyExchange");
 
         if (debug != null && Debug.isOn("verbose")) {
-            if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
-                s.println("Signature Algorithm " +
-                        preferableSignatureAlgorithm.getAlgorithmName());
+            if (signatureBytes == null) {
+                s.println("Anonymous");
+            } else {
+                if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
+                    s.println("Signature Algorithm " +
+                            preferableSignatureAlgorithm.getAlgorithmName());
+                }
             }
 
             s.println("Server key: " + publicKey);
--- a/jdk/src/share/classes/sun/security/tools/JarSigner.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1238,10 +1238,11 @@
                 // Provide a helpful message when TSA is beyond a firewall
                 error(rb.getString("unable.to.sign.jar.") +
                 rb.getString("no.response.from.the.Timestamping.Authority.") +
-                rb.getString("When.connecting.from.behind.a.firewall.then.an.HTTP.proxy.may.need.to.be.specified.") +
-                rb.getString("Supply.the.following.options.to.jarsigner.") +
-                "\n  -J-Dhttp.proxyHost=<hostname> " +
-                "\n  -J-Dhttp.proxyPort=<portnumber> ", e);
+                "\n  -J-Dhttp.proxyHost=<hostname>" +
+                "\n  -J-Dhttp.proxyPort=<portnumber>\n" +
+                rb.getString("or") +
+                "\n  -J-Dhttps.proxyHost=<hostname> " +
+                "\n  -J-Dhttps.proxyPort=<portnumber> ", e);
             }
 
             sfFilename = sf.getMetaName();
--- a/jdk/src/share/classes/sun/security/tools/JarSignerResources.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/JarSignerResources.java	Thu Mar 31 22:07:32 2011 -0700
@@ -181,11 +181,10 @@
         {"TSA.location.", "TSA location: "},
         {"TSA.certificate.", "TSA certificate: "},
         {"no.response.from.the.Timestamping.Authority.",
-                "no response from the Timestamping Authority. "},
-        {"When.connecting.from.behind.a.firewall.then.an.HTTP.proxy.may.need.to.be.specified.",
-                "When connecting from behind a firewall then an HTTP proxy may need to be specified. "},
-        {"Supply.the.following.options.to.jarsigner.",
-                "Supply the following options to jarsigner: "},
+                "no response from the Timestamping Authority. When connecting"
+                + " from behind a firewall an HTTP or HTTPS proxy may need to"
+                + " be specified. Supply the following options to jarsigner:"},
+        {"or", "or"},
         {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
                 "Certificate not found for: {0}.  {1} must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority."},
         {"using.an.alternative.signing.mechanism",
--- a/jdk/src/share/classes/sun/security/tools/KeyTool.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1740,16 +1740,19 @@
                 KeyStore.TrustedCertificateEntry.class)) {
             // We have a trusted certificate entry
             Certificate cert = keyStore.getCertificate(alias);
+            Object[] source = {"trustedCertEntry"};
+            String mf = new MessageFormat(
+                    rb.getString("Entry.type.type.")).format(source) + "\n";
             if (verbose && (cert instanceof X509Certificate)) {
-                out.println(rb.getString("Entry.type.trustedCertEntry."));
+                out.println(mf);
                 printX509Cert((X509Certificate)cert, out);
             } else if (rfc) {
-                out.println(rb.getString("Entry.type.trustedCertEntry."));
+                out.println(mf);
                 dumpCert(cert, out);
             } else if (debug) {
                 out.println(cert.toString());
             } else {
-                out.println(rb.getString("trustedCertEntry."));
+                out.println("trustedCertEntry, ");
                 out.println(rb.getString("Certificate.fingerprint.SHA1.")
                             + getCertFingerPrint("SHA1", cert));
             }
@@ -1837,10 +1840,6 @@
             System.err.println(rb.getString
                 (".The.integrity.of.the.information.stored.in.the.srckeystore."));
             System.err.println(rb.getString
-                (".has.NOT.been.verified.In.order.to.verify.its.integrity."));
-            System.err.println(rb.getString
-                (".you.must.provide.the.srckeystore.password."));
-            System.err.println(rb.getString
                 (".WARNING.WARNING.WARNING."));
             System.err.println();
         }
@@ -3187,10 +3186,6 @@
         System.err.println(rb.getString
             (".The.integrity.of.the.information.stored.in.your.keystore."));
         System.err.println(rb.getString
-            (".has.NOT.been.verified.In.order.to.verify.its.integrity."));
-        System.err.println(rb.getString
-            (".you.must.provide.your.keystore.password."));
-        System.err.println(rb.getString
             (".WARNING.WARNING.WARNING."));
         System.err.println();
     }
--- a/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java	Thu Mar 31 22:07:32 2011 -0700
@@ -250,10 +250,10 @@
      * (<a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280</a>).
      * The extension's <tt>accessMethod</tt> field should contain the object
      * identifier defined for timestamping: 1.3.6.1.5.5.7.48.3 and its
-     * <tt>accessLocation</tt> field should contain an HTTP URL.
+     * <tt>accessLocation</tt> field should contain an HTTP or HTTPS URL.
      *
      * @param tsaCertificate An X.509 certificate for the TSA.
-     * @return An HTTP URL or null if none was found.
+     * @return An HTTP or HTTPS URL or null if none was found.
      */
     public static String getTimestampingUrl(X509Certificate tsaCertificate) {
 
@@ -279,7 +279,8 @@
                     location = description.getAccessLocation();
                     if (location.getType() == GeneralNameInterface.NAME_URI) {
                         uri = (URIName) location.getName();
-                        if (uri.getScheme().equalsIgnoreCase("http")) {
+                        if (uri.getScheme().equalsIgnoreCase("http") ||
+                                uri.getScheme().equalsIgnoreCase("https")) {
                             return uri.getName();
                         }
                     }
--- a/jdk/src/share/classes/sun/security/util/AuthResources.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/AuthResources.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,17 +111,15 @@
 
         // com.sun.security.auth.PolicyParser
         {"expected.keystore.type", "expected keystore type"},
-        {"can.not.specify.Principal.with.a.",
-                "can not specify Principal with a "},
-        {"wildcard.class.without.a.wildcard.name",
-                "wildcard class without a wildcard name"},
+        {"can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name",
+                "can not specify Principal with a wildcard class without a wildcard name"},
         {"expected.codeBase.or.SignedBy", "expected codeBase or SignedBy"},
         {"only.Principal.based.grant.entries.permitted",
                 "only Principal-based grant entries permitted"},
         {"expected.permission.entry", "expected permission entry"},
         {"number.", "number "},
-        {"expected.", "expected "},
-        {".read.end.of.file", ", read end of file"},
+        {"expected.expect.read.end.of.file.",
+                "expected {0}, read end of file"},
         {"expected.read.end.of.file", "expected ';', read end of file"},
         {"line.", "line "},
         {".expected.", ": expected '"},
@@ -136,6 +134,9 @@
         {"SolarisNumericUserPrincipal.",
                 "SolarisNumericUserPrincipal: "},
         {"SolarisPrincipal.", "SolarisPrincipal: "},
+        // provided.null.name is the NullPointerException message when a
+        // developer incorrectly passes a null name to the constructor of
+        // subclasses of java.security.Principal
         {"provided.null.name", "provided null name"}
 
     };
--- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Thu Mar 31 22:07:32 2011 -0700
@@ -195,8 +195,7 @@
                 Hashtable<String, CodeSigner[]> sigFileSigners)
         throws JarException
     {
-        // MANIFEST.MF should not be skipped. It has signers.
-        if (skip && !entry.getName().equals(JarFile.MANIFEST_NAME)) {
+        if (skip) {
             return null;
         }
 
--- a/jdk/src/share/classes/sun/security/util/Resources.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/Resources.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -304,8 +304,6 @@
         {"Certificate.chain.length.", "Certificate chain length: "},
         {"Certificate.i.1.", "Certificate[{0,number,integer}]:"},
         {"Certificate.fingerprint.SHA1.", "Certificate fingerprint (SHA1): "},
-        {"Entry.type.trustedCertEntry.", "Entry type: trustedCertEntry\n"},
-        {"trustedCertEntry.", "trustedCertEntry,"},
         {"Keystore.type.", "Keystore type: "},
         {"Keystore.provider.", "Keystore provider: "},
         {"Your.keystore.contains.keyStore.size.entry",
@@ -378,21 +376,15 @@
         {"No.certificate.from.the.SSL.server",
                 "No certificate from the SSL server"},
 
-        // Translators of the following 5 pairs, ATTENTION:
-        // the next 5 string pairs are meant to be combined into 2 paragraphs,
-        // 1+3+4 and 2+3+5. make sure your translation also does.
         {".The.integrity.of.the.information.stored.in.your.keystore.",
-            "* The integrity of the information stored in your keystore  *"},
+            "* The integrity of the information stored in your keystore  *\n" +
+            "* has NOT been verified!  In order to verify its integrity, *\n" +
+            "* you must provide your keystore password.                  *"},
         {".The.integrity.of.the.information.stored.in.the.srckeystore.",
-            "* The integrity of the information stored in the srckeystore*"},
-        {".has.NOT.been.verified.In.order.to.verify.its.integrity.",
-            "* has NOT been verified!  In order to verify its integrity, *"},
-        {".you.must.provide.your.keystore.password.",
-            "* you must provide your keystore password.                  *"},
-        {".you.must.provide.the.srckeystore.password.",
+            "* The integrity of the information stored in the srckeystore*\n" +
+            "* has NOT been verified!  In order to verify its integrity, *\n" +
             "* you must provide the srckeystore password.                *"},
 
-
         {"Certificate.reply.does.not.contain.public.key.for.alias.",
                 "Certificate reply does not contain public key for <{0}>"},
         {"Incomplete.certificate.chain.in.reply",
--- a/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Thu Mar 31 22:07:32 2011 -0700
@@ -3457,13 +3457,18 @@
          */
         static final AttributedCharacterIterator.Attribute RUN_DIRECTION =
             getTextAttribute("RUN_DIRECTION");
-        static final Boolean RUN_DIRECTION_LTR =
-            (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR");
         static final AttributedCharacterIterator.Attribute NUMERIC_SHAPING =
             getTextAttribute("NUMERIC_SHAPING");
         static final AttributedCharacterIterator.Attribute BIDI_EMBEDDING =
             getTextAttribute("BIDI_EMBEDDING");
 
+        /**
+         * TextAttribute.RUN_DIRECTION_LTR
+         */
+        static final Boolean RUN_DIRECTION_LTR = (clazz == null) ?
+            Boolean.FALSE : (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR");
+
+
         private static Class<?> getClass(String name) {
             try {
                 return Class.forName(name, true, null);
@@ -3473,25 +3478,23 @@
         }
 
         private static Object getStaticField(Class<?> clazz, String name) {
-            if (clazz == null) {
-                // fake attribute
-                return new AttributedCharacterIterator.Attribute(name) { };
-            } else {
-                try {
-                    Field f = clazz.getField(name);
-                    return f.get(null);
-                } catch (NoSuchFieldException x) {
-                    throw new AssertionError(x);
-                } catch (IllegalAccessException x) {
-                    throw new AssertionError(x);
-                }
+            try {
+                Field f = clazz.getField(name);
+                return f.get(null);
+            } catch (NoSuchFieldException | IllegalAccessException x) {
+                throw new AssertionError(x);
             }
         }
 
         private static AttributedCharacterIterator.Attribute
             getTextAttribute(String name)
         {
-            return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name);
+            if (clazz == null) {
+                // fake attribute
+                return new AttributedCharacterIterator.Attribute(name) { };
+            } else {
+                return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name);
+            }
         }
     }
 
--- a/jdk/src/share/classes/sun/util/logging/LoggingProxy.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/LoggingProxy.java	Thu Mar 31 22:07:32 2011 -0700
@@ -60,4 +60,7 @@
     public Object parseLevel(String levelName);
 
     public String getLevelName(Object level);
+
+    // return the logging property
+    public String getProperty(String key);
 }
--- a/jdk/src/share/classes/sun/util/logging/LoggingSupport.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/LoggingSupport.java	Thu Mar 31 22:07:32 2011 -0700
@@ -29,6 +29,7 @@
 import java.lang.reflect.Field;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Date;
 
 /**
  * Internal API to support JRE implementation to detect if the java.util.logging
@@ -138,4 +139,42 @@
         ensureAvailable();
         return proxy.getLevelName(level);
     }
+
+    private static final String DEFAULT_FORMAT =
+        "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n";
+
+    private static final String FORMAT_PROP_KEY = "java.util.logging.SimpleFormatter.format";
+    public static String getSimpleFormat() {
+        return getSimpleFormat(true);
+    }
+
+    // useProxy if true will cause initialization of
+    // java.util.logging and read its configuration
+    static String getSimpleFormat(boolean useProxy) {
+        String format =
+            AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
+                        return System.getProperty(FORMAT_PROP_KEY);
+                    }
+                });
+
+        if (useProxy && proxy != null && format == null) {
+            format = proxy.getProperty(FORMAT_PROP_KEY);
+        }
+
+        if (format != null) {
+            try {
+                // validate the user-defined format string
+                String.format(format, new Date(), "", "", "", "", "");
+            } catch (IllegalArgumentException e) {
+                // illegal syntax; fall back to the default format
+                format = DEFAULT_FORMAT;
+            }
+        } else {
+            format = DEFAULT_FORMAT;
+        }
+        return format;
+    }
+
 }
--- a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java	Thu Mar 31 22:07:32 2011 -0700
@@ -316,12 +316,6 @@
      */
     static class LoggerProxy {
         private static final PrintStream defaultStream = System.err;
-        private static final String lineSeparator = AccessController.doPrivileged(
-            new PrivilegedAction<String>() {
-                public String run() {
-                    return System.getProperty("line.separator");
-                }
-            });
 
         final String name;
         volatile int levelValue;
@@ -353,14 +347,14 @@
             if (level < levelValue || levelValue == OFF) {
                 return;
             }
-            defaultStream.println(format(level, msg, null));
+            defaultStream.print(format(level, msg, null));
         }
 
         void doLog(int level, String msg, Throwable thrown) {
             if (level < levelValue || levelValue == OFF) {
                 return;
             }
-            defaultStream.println(format(level, msg, thrown));
+            defaultStream.print(format(level, msg, thrown));
         }
 
         void doLog(int level, String msg, Object... params) {
@@ -368,7 +362,7 @@
                 return;
             }
             String newMsg = formatMessage(msg, params);
-            defaultStream.println(format(level, newMsg, null));
+            defaultStream.print(format(level, newMsg, null));
         }
 
         public boolean isLoggable(int level) {
@@ -378,12 +372,6 @@
             return true;
         }
 
-        private static final String format = "{0,date} {0,time}";
-
-        private Object args[] = new Object[1];
-        private MessageFormat formatter;
-        private Date dat;
-
         // Copied from java.util.logging.Formatter.formatMessage
         private String formatMessage(String format, Object... parameters) {
             // Do the formatting.
@@ -408,37 +396,30 @@
             }
         }
 
+        private static final String formatString =
+            LoggingSupport.getSimpleFormat(false); // don't check logging.properties
+
+        // minimize memory allocation
+        private Date date = new Date();
         private synchronized String format(int level, String msg, Throwable thrown) {
-            StringBuffer sb = new StringBuffer();
-            // Minimize memory allocations here.
-            if (dat == null) {
-                dat = new Date();
-                formatter = new MessageFormat(format);
-            }
-            dat.setTime(System.currentTimeMillis());
-            args[0] = dat;
-            StringBuffer text = new StringBuffer();
-            formatter.format(args, text, null);
-            sb.append(text);
-            sb.append(" ");
-            sb.append(getCallerInfo());
-            sb.append(lineSeparator);
-            sb.append(PlatformLogger.getLevelName(level));
-            sb.append(": ");
-            sb.append(msg);
+            date.setTime(System.currentTimeMillis());
+            String throwable = "";
             if (thrown != null) {
-                try {
-                    StringWriter sw = new StringWriter();
-                    PrintWriter pw = new PrintWriter(sw);
-                    thrown.printStackTrace(pw);
-                    pw.close();
-                    sb.append(sw.toString());
-                } catch (Exception ex) {
-                    throw new AssertionError(ex);
-                }
+                StringWriter sw = new StringWriter();
+                PrintWriter pw = new PrintWriter(sw);
+                pw.println();
+                thrown.printStackTrace(pw);
+                pw.close();
+                throwable = sw.toString();
             }
 
-            return sb.toString();
+            return String.format(formatString,
+                                 date,
+                                 getCallerInfo(),
+                                 name,
+                                 PlatformLogger.getLevelName(level),
+                                 msg,
+                                 throwable);
         }
 
         // Returns the caller's class and method's name; best effort
--- a/jdk/src/share/lib/logging.properties	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/share/lib/logging.properties	Thu Mar 31 22:07:32 2011 -0700
@@ -43,6 +43,11 @@
 java.util.logging.ConsoleHandler.level = INFO
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
 
+# Example to customize the SimpleFormatter output format 
+# to print one-line log message like this:
+#     <level>: <log message> [<date/time>]
+#
+# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
 
 ############################################################
 # Facility specific properties.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/bin/arm/jvm.cfg	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,38 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-client KNOWN
+-server KNOWN
+-hotspot ERROR
+-classic WARN
+-native ERROR
+-green ERROR
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/bin/ppc/jvm.cfg	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,38 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-client KNOWN
+-server KNOWN
+-hotspot ERROR
+-classic WARN
+-native ERROR
+-green ERROR
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,6 +135,12 @@
         noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
     }
 
+    /*
+     * Return (potentially) platform specific display timeout for the
+     * tray icon
+     */
+    static native long getTrayIconDisplayTimeout();
+
     //---- ERROR HANDLER CODE ----//
 
     /*
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -230,7 +230,7 @@
 
         // Wait till the EmbeddedFrame is reparented
         long start = System.currentTimeMillis();
-        final long PERIOD = 2000L;
+        final long PERIOD = XToolkit.getTrayIconDisplayTimeout();
         XToolkit.awtLock();
         try {
             while (!isTrayIconDisplayed) {
--- a/jdk/src/solaris/native/java/lang/java_props_md.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/solaris/native/java/lang/java_props_md.c	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,11 @@
 #endif
 #endif
 
+#ifdef JAVASE_EMBEDDED
+#include <dlfcn.h>
+#include <sys/stat.h>
+#endif
+
 /* Take an array of string pairs (map of key->value) and a string (key).
  * Examine each pair in the map to see if the first string (key) matches the
  * string.  If so, store the second string of the pair (value) in the value and
@@ -304,6 +309,36 @@
     return 1;
 }
 
+#ifdef JAVASE_EMBEDDED
+/* Determine the default embedded toolkit based on whether lib/xawt/
+ * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
+ */
+static char* getEmbeddedToolkit() {
+    Dl_info dlinfo;
+    char buf[MAXPATHLEN];
+    int32_t len;
+    char *p;
+    struct stat statbuf;
+
+    /* Get address of this library and the directory containing it. */
+    dladdr((void *)getEmbeddedToolkit, &dlinfo);
+    realpath((char *)dlinfo.dli_fname, buf);
+    len = strlen(buf);
+    p = strrchr(buf, '/');
+    /* Default AWT Toolkit on Linux and Solaris is XAWT. */
+    strncpy(p, "/xawt/", MAXPATHLEN-len-1);
+    /* Check if it exists */
+    if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
+        /* No - this is a reduced-headless-jre so use special HToolkit */
+        return "sun.awt.HToolkit";
+    }
+    else {
+        /* Yes - this is a headful JRE so fallback to SE defaults */
+        return NULL;
+    }
+}
+#endif
+
 /* This function gets called very early, before VM_CALLS are setup.
  * Do not use any of the VM_CALLS entries!!!
  */
@@ -328,7 +363,12 @@
 
     /* Java 2D properties */
     sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
-    sprops.awt_toolkit = NULL;
+
+#ifdef JAVASE_EMBEDDED
+    sprops.awt_toolkit = getEmbeddedToolkit();
+    if (sprops.awt_toolkit == NULL) // default as below
+#endif
+    sprops.awt_toolkit = "sun.awt.X11.XToolkit";
 
     /* This is used only for debugging of font problems. */
     v = getenv("JAVA2D_FONTPATH");
--- a/jdk/src/solaris/native/sun/awt/jawt.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/jawt.c	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,10 @@
  */
 JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
 {
+#if defined(JAVASE_EMBEDDED) && defined(HEADLESS)
+    /* there are no AWT libs available at all */
+    return JNI_FALSE;
+#else
     if (awt == NULL) {
         return JNI_FALSE;
     }
@@ -51,4 +55,5 @@
     }
 
     return JNI_TRUE;
+#endif
 }
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,21 @@
 
 /*
  * Class:     sun_awt_X11_XToolkit
+ * Method:    getTrayIconDisplayTimeout
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout
+  (JNIEnv *env, jclass clazz)
+{
+#ifndef JAVASE_EMBEDDED
+    return (jlong) 2000;
+#else
+    return (jlong) 10000;
+#endif
+}
+
+/*
+ * Class:     sun_awt_X11_XToolkit
  * Method:    getDefaultXColormap
  * Signature: ()J
  */
@@ -340,15 +355,34 @@
 #define AWT_READPIPE            (awt_pipe_fds[0])
 #define AWT_WRITEPIPE           (awt_pipe_fds[1])
 
-#define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
+#ifdef JAVASE_EMBEDDED
+  #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) /* milliseconds */
+#else
+  #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
+#endif
+
 #define DEF_AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */
 #define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
 
 #define TIMEOUT_TIMEDOUT 0
 #define TIMEOUT_EVENTS 1
 
+/* awt_poll_alg - AWT Poll Events Aging Algorithms */
+#define AWT_POLL_FALSE        1
+#define AWT_POLL_AGING_SLOW   2
+#define AWT_POLL_AGING_FAST   3
+
+#define AWT_POLL_THRESHOLD 1000  // msec, Block if delay is larger
+#define AWT_POLL_BLOCK       -1  // cause poll() block
+
 // Static fields
 
+#ifdef JAVASE_EMBEDDED
+  static int          awt_poll_alg = AWT_POLL_AGING_FAST;
+#else
+  static int          awt_poll_alg = AWT_POLL_AGING_SLOW;
+#endif
+
 static uint32_t AWT_FLUSH_TIMEOUT  =  DEF_AWT_FLUSH_TIMEOUT; /* milliseconds */
 static uint32_t AWT_MAX_POLL_TIMEOUT = DEF_AWT_MAX_POLL_TIMEOUT; /* milliseconds */
 static pthread_t    awt_MainThread = 0;
@@ -417,6 +451,7 @@
  */
 static void readEnv() {
     char * value;
+    int tmp_poll_alg;
     static Boolean env_read = False;
     if (env_read) return;
 
@@ -451,6 +486,23 @@
     if (static_poll_timeout != 0) {
         curPollTimeout = static_poll_timeout;
     }
+
+    // non-blocking poll()
+    value = getenv("_AWT_POLL_ALG");
+    if (value != NULL) {
+        tmp_poll_alg = atoi(value);
+        switch(tmp_poll_alg) {
+        case AWT_POLL_FALSE:
+        case AWT_POLL_AGING_SLOW:
+        case AWT_POLL_AGING_FAST:
+            awt_poll_alg = tmp_poll_alg;
+            break;
+        default:
+            PRINT("Unknown value of _AWT_POLL_ALG, assuming Slow Aging Algorithm by default");
+            awt_poll_alg = AWT_POLL_AGING_SLOW;
+            break;
+        }
+    }
 }
 
 /**
@@ -478,14 +530,29 @@
     if (static_poll_timeout != 0) return;
 
     // Update it otherwise
-    if (timeout_control == TIMEOUT_TIMEDOUT) {
-        /* add 1/4 (plus 1, in case the division truncates to 0) */
-        curPollTimeout += ((curPollTimeout>>2) + 1);
-        curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
-    } else if (timeout_control == TIMEOUT_EVENTS) {
-        /* subtract 1/4 (plus 1, in case the division truncates to 0) */
-        curPollTimeout -= ((curPollTimeout>>2) + 1);
-        curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout);
+
+    switch(awt_poll_alg) {
+    case AWT_POLL_AGING_SLOW:
+        if (timeout_control == TIMEOUT_TIMEDOUT) {
+            /* add 1/4 (plus 1, in case the division truncates to 0) */
+            curPollTimeout += ((curPollTimeout>>2) + 1);
+            curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
+        } else if (timeout_control == TIMEOUT_EVENTS) {
+            /* subtract 1/4 (plus 1, in case the division truncates to 0) */
+            curPollTimeout -= ((curPollTimeout>>2) + 1);
+            curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, curPollTimeout);
+        }
+        break;
+    case AWT_POLL_AGING_FAST:
+        if (timeout_control == TIMEOUT_TIMEDOUT) {
+            curPollTimeout += ((curPollTimeout>>2) + 1);
+            curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
+            if((int)curPollTimeout > AWT_POLL_THRESHOLD || (int)curPollTimeout == AWT_POLL_BLOCK)
+                curPollTimeout = AWT_POLL_BLOCK;
+        } else if (timeout_control == TIMEOUT_EVENTS) {
+            curPollTimeout = max(AWT_MIN_POLL_TIMEOUT, 1);
+        }
+        break;
     }
 }
 
@@ -497,16 +564,37 @@
  */
 static uint32_t get_poll_timeout(jlong nextTaskTime)
 {
+    uint32_t ret_timeout;
+    uint32_t timeout;
+    uint32_t taskTimeout;
+    uint32_t flushTimeout;
+
     jlong curTime = awtJNI_TimeMillis();
-    uint32_t timeout = curPollTimeout;
-    uint32_t taskTimeout = (nextTaskTime == -1) ? AWT_MAX_POLL_TIMEOUT : (uint32_t)max(0, (int32_t)(nextTaskTime - curTime));
-    uint32_t flushTimeout = (awt_next_flush_time > 0) ? (uint32_t)max(0, (int32_t)(awt_next_flush_time - curTime)) : AWT_MAX_POLL_TIMEOUT;
+    timeout = curPollTimeout;
+    switch(awt_poll_alg) {
+    case AWT_POLL_AGING_SLOW:
+    case AWT_POLL_AGING_FAST:
+        taskTimeout = (nextTaskTime == -1) ? AWT_MAX_POLL_TIMEOUT : (uint32_t)max(0, (int32_t)(nextTaskTime - curTime));
+        flushTimeout = (awt_next_flush_time > 0) ? (uint32_t)max(0, (int32_t)(awt_next_flush_time - curTime)) : AWT_MAX_POLL_TIMEOUT;
+
+        PRINT2("to: %d, ft: %d, to: %d, tt: %d, mil: %d\n", taskTimeout, flushTimeout, timeout, (int)nextTaskTime, (int)curTime);
 
-    PRINT2("to: %d, ft: %d, to: %d, tt: %d, mil: %d\n", taskTimeout, flushTimeout, timeout, (int)nextTaskTime, (int)curTime);
+        // Adjust timeout to flush_time and task_time
+        ret_timeout = min(flushTimeout, min(taskTimeout, timeout));
+        if((int)curPollTimeout == AWT_POLL_BLOCK)
+           ret_timeout = AWT_POLL_BLOCK;
+        break;
 
-    // Adjust timeout to flush_time and task_time
-    return min(flushTimeout, min(taskTimeout, timeout));
-} /* awt_get_poll_timeout() */
+    case AWT_POLL_FALSE:
+        ret_timeout = (nextTaskTime > curTime) ?
+            (nextTaskTime - curTime) :
+            ((nextTaskTime == -1) ? -1 : 0);
+        break;
+    }
+
+    return ret_timeout;
+
+} /* get_poll_timeout() */
 
 /*
  * Waits for X/Xt events to appear on the pipe. Returns only when
@@ -598,6 +686,8 @@
     if (result == 0) {
         /* poll() timed out -- update timeout value */
         update_poll_timeout(TIMEOUT_TIMEDOUT);
+        PRINT2("%s(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n",
+              performPoll, curPollTimeout);
     }
     if (pollFds[1].revents) {
         int count;
@@ -606,10 +696,14 @@
         do {
             count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE );
         } while (count == AWT_POLL_BUFSIZE );
+        PRINT2("%s():  data on the AWT pipe: curPollTimeout = %d \n",
+               performPoll, curPollTimeout);
     }
     if (pollFds[0].revents) {
         // Events in X pipe
         update_poll_timeout(TIMEOUT_EVENTS);
+        PRINT2("%s(): TIMEOUT_EVENTS curPollTimeout = %ld \n",
+               performPoll, curPollTimeout);
     }
     return;
 
--- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Thu Mar 31 22:07:32 2011 -0700
@@ -90,6 +90,7 @@
     jobjectArray ret = 0;
     int retLen = 0;
     jboolean preferIPv6Address;
+    static jfieldID ia_preferIPv6AddressID;
 
     int error=0;
     struct addrinfo hints, *res, *resNew = NULL;
@@ -116,166 +117,163 @@
     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
     CHECK_NULL_RETURN(hostname, NULL);
 
-    if (NET_addrtransAvailable()) {
-        static jfieldID ia_preferIPv6AddressID;
-        if (ia_preferIPv6AddressID == NULL) {
-            jclass c = (*env)->FindClass(env,"java/net/InetAddress");
-            if (c)  {
-                ia_preferIPv6AddressID =
-                    (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z");
-            }
-            if (ia_preferIPv6AddressID == NULL) {
-                JNU_ReleaseStringPlatformChars(env, host, hostname);
-                return NULL;
-            }
+    if (ia_preferIPv6AddressID == NULL) {
+        jclass c = (*env)->FindClass(env,"java/net/InetAddress");
+        if (c)  {
+            ia_preferIPv6AddressID =
+                (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z");
         }
-        /* get the address preference */
-        preferIPv6Address
-            = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
-
-        /* Try once, with our static buffer. */
-        memset(&hints, 0, sizeof(hints));
-        hints.ai_flags = AI_CANONNAME;
-        hints.ai_family = AF_UNSPEC;
-
-        error = (*getaddrinfo_ptr)(hostname, NULL, &hints, &res);
-
-        if (error) {
-            /* report error */
-            JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
-                            (char *)hostname);
+        if (ia_preferIPv6AddressID == NULL) {
             JNU_ReleaseStringPlatformChars(env, host, hostname);
             return NULL;
-        } else {
-            int i = 0;
-            int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
-            struct addrinfo *itr, *last, *iterator = res;
-            while (iterator != NULL) {
-                int skip = 0;
-                itr = resNew;
-                while (itr != NULL) {
-                    if (iterator->ai_family == itr->ai_family &&
-                        iterator->ai_addrlen == itr->ai_addrlen) {
-                        if (itr->ai_family == AF_INET) { /* AF_INET */
-                            struct sockaddr_in *addr1, *addr2;
-                            addr1 = (struct sockaddr_in *)iterator->ai_addr;
-                            addr2 = (struct sockaddr_in *)itr->ai_addr;
-                            if (addr1->sin_addr.s_addr ==
-                                addr2->sin_addr.s_addr) {
-                                skip = 1;
-                                break;
-                            }
-                        } else {
-                            int t;
-                            struct sockaddr_in6 *addr1, *addr2;
-                            addr1 = (struct sockaddr_in6 *)iterator->ai_addr;
-                            addr2 = (struct sockaddr_in6 *)itr->ai_addr;
+        }
+    }
+    /* get the address preference */
+    preferIPv6Address
+        = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
+
+    /* Try once, with our static buffer. */
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_flags = AI_CANONNAME;
+    hints.ai_family = AF_UNSPEC;
+
+    error = getaddrinfo(hostname, NULL, &hints, &res);
 
-                            for (t = 0; t < 16; t++) {
-                                if (addr1->sin6_addr.s6_addr[t] !=
-                                    addr2->sin6_addr.s6_addr[t]) {
-                                    break;
-                                }
-                            }
-                            if (t < 16) {
-                                itr = itr->ai_next;
-                                continue;
-                            } else {
-                                skip = 1;
+    if (error) {
+        /* report error */
+        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
+                        (char *)hostname);
+        JNU_ReleaseStringPlatformChars(env, host, hostname);
+        return NULL;
+    } else {
+        int i = 0;
+        int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
+        struct addrinfo *itr, *last, *iterator = res;
+        while (iterator != NULL) {
+            int skip = 0;
+            itr = resNew;
+            while (itr != NULL) {
+                if (iterator->ai_family == itr->ai_family &&
+                    iterator->ai_addrlen == itr->ai_addrlen) {
+                    if (itr->ai_family == AF_INET) { /* AF_INET */
+                        struct sockaddr_in *addr1, *addr2;
+                        addr1 = (struct sockaddr_in *)iterator->ai_addr;
+                        addr2 = (struct sockaddr_in *)itr->ai_addr;
+                        if (addr1->sin_addr.s_addr ==
+                            addr2->sin_addr.s_addr) {
+                            skip = 1;
+                            break;
+                        }
+                    } else {
+                        int t;
+                        struct sockaddr_in6 *addr1, *addr2;
+                        addr1 = (struct sockaddr_in6 *)iterator->ai_addr;
+                        addr2 = (struct sockaddr_in6 *)itr->ai_addr;
+
+                        for (t = 0; t < 16; t++) {
+                            if (addr1->sin6_addr.s6_addr[t] !=
+                                addr2->sin6_addr.s6_addr[t]) {
                                 break;
                             }
                         }
-                    } else if (iterator->ai_family != AF_INET &&
-                               iterator->ai_family != AF_INET6) {
-                        /* we can't handle other family types */
-                        skip = 1;
-                        break;
-                    }
-                    itr = itr->ai_next;
-                }
-
-                if (!skip) {
-                    struct addrinfo *next
-                        = (struct addrinfo*) malloc(sizeof(struct addrinfo));
-                    if (!next) {
-                        JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
-                        ret = NULL;
-                        goto cleanupAndReturn;
+                        if (t < 16) {
+                            itr = itr->ai_next;
+                            continue;
+                        } else {
+                            skip = 1;
+                            break;
+                        }
                     }
-                    memcpy(next, iterator, sizeof(struct addrinfo));
-                    next->ai_next = NULL;
-                    if (resNew == NULL) {
-                        resNew = next;
-                    } else {
-                        last->ai_next = next;
-                    }
-                    last = next;
-                    i++;
-                    if (iterator->ai_family == AF_INET) {
-                        inetCount ++;
-                    } else if (iterator->ai_family == AF_INET6) {
-                        inet6Count ++;
-                    }
+                } else if (iterator->ai_family != AF_INET &&
+                           iterator->ai_family != AF_INET6) {
+                    /* we can't handle other family types */
+                    skip = 1;
+                    break;
                 }
-                iterator = iterator->ai_next;
-            }
-            retLen = i;
-            iterator = resNew;
-            i = 0;
-            ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL);
-
-            if (IS_NULL(ret)) {
-                /* we may have memory to free at the end of this */
-                goto cleanupAndReturn;
+                itr = itr->ai_next;
             }
 
-            if (preferIPv6Address) {
-                inetIndex = inet6Count;
-                inet6Index = 0;
-            } else {
-                inetIndex = 0;
-                inet6Index = inetCount;
-            }
-
-            while (iterator != NULL) {
-                if (iterator->ai_family == AF_INET) {
-                  jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
-                  if (IS_NULL(iaObj)) {
+            if (!skip) {
+                struct addrinfo *next
+                    = (struct addrinfo*) malloc(sizeof(struct addrinfo));
+                if (!next) {
+                    JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
                     ret = NULL;
                     goto cleanupAndReturn;
-                  }
-                  (*env)->SetIntField(env, iaObj, ni_iaaddressID,
-                                      ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
-                  (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
-                  (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
-                    inetIndex ++;
+                }
+                memcpy(next, iterator, sizeof(struct addrinfo));
+                next->ai_next = NULL;
+                if (resNew == NULL) {
+                    resNew = next;
+                } else {
+                    last->ai_next = next;
+                }
+                last = next;
+                i++;
+                if (iterator->ai_family == AF_INET) {
+                    inetCount ++;
                 } else if (iterator->ai_family == AF_INET6) {
-                  jint scope = 0;
-                  jbyteArray ipaddress;
-                  jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
-                  if (IS_NULL(iaObj)) {
-                    ret = NULL;
-                    goto cleanupAndReturn;
-                  }
-                  ipaddress = (*env)->NewByteArray(env, 16);
-                  if (IS_NULL(ipaddress)) {
-                    ret = NULL;
-                    goto cleanupAndReturn;
-                  }
-                  (*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
-                                             (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
-                  scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
-                  if (scope != 0) { /* zero is default value, no need to set */
-                    (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
-                    (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
-                  }
-                  (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
-                  (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
-                  (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
-                  inet6Index ++;
+                    inet6Count ++;
                 }
-                iterator = iterator->ai_next;
             }
+            iterator = iterator->ai_next;
+        }
+        retLen = i;
+        iterator = resNew;
+        i = 0;
+        ret = (*env)->NewObjectArray(env, retLen, ni_iacls, NULL);
+
+        if (IS_NULL(ret)) {
+            /* we may have memory to free at the end of this */
+            goto cleanupAndReturn;
+        }
+
+        if (preferIPv6Address) {
+            inetIndex = inet6Count;
+            inet6Index = 0;
+        } else {
+            inetIndex = 0;
+            inet6Index = inetCount;
+        }
+
+        while (iterator != NULL) {
+            if (iterator->ai_family == AF_INET) {
+              jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
+              if (IS_NULL(iaObj)) {
+                ret = NULL;
+                goto cleanupAndReturn;
+              }
+              (*env)->SetIntField(env, iaObj, ni_iaaddressID,
+                                  ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
+              (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
+              (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+                inetIndex ++;
+            } else if (iterator->ai_family == AF_INET6) {
+              jint scope = 0;
+              jbyteArray ipaddress;
+              jobject iaObj = (*env)->NewObject(env, ni_ia6cls, ni_ia6ctrID);
+              if (IS_NULL(iaObj)) {
+                ret = NULL;
+                goto cleanupAndReturn;
+              }
+              ipaddress = (*env)->NewByteArray(env, 16);
+              if (IS_NULL(ipaddress)) {
+                ret = NULL;
+                goto cleanupAndReturn;
+              }
+              (*env)->SetByteArrayRegion(env, ipaddress, 0, 16,
+                                         (jbyte *)&(((struct sockaddr_in6*)iterator->ai_addr)->sin6_addr));
+              scope = ((struct sockaddr_in6*)iterator->ai_addr)->sin6_scope_id;
+              if (scope != 0) { /* zero is default value, no need to set */
+                (*env)->SetIntField(env, iaObj, ia6_scopeidID, scope);
+                (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
+              }
+              (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
+              (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
+              (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+              inet6Index ++;
+            }
+            iterator = iterator->ai_next;
         }
     }
 
@@ -291,8 +289,7 @@
         JNU_ReleaseStringPlatformChars(env, host, hostname);
     }
 
-    if (NET_addrtransAvailable())
-        (*freeaddrinfo_ptr)(res);
+    freeaddrinfo(res);
 
     return ret;
 }
@@ -312,44 +309,41 @@
     int len = 0;
     jbyte caddr[16];
 
-    if (NET_addrtransAvailable()) {
-        struct sockaddr_in him4;
-        struct sockaddr_in6 him6;
-        struct sockaddr *sa;
+    struct sockaddr_in him4;
+    struct sockaddr_in6 him6;
+    struct sockaddr *sa;
 
+    /*
+     * For IPv4 addresses construct a sockaddr_in structure.
+     */
+    if ((*env)->GetArrayLength(env, addrArray) == 4) {
+        jint addr;
+        (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
+        addr = ((caddr[0]<<24) & 0xff000000);
+        addr |= ((caddr[1] <<16) & 0xff0000);
+        addr |= ((caddr[2] <<8) & 0xff00);
+        addr |= (caddr[3] & 0xff);
+        memset((char *) &him4, 0, sizeof(him4));
+        him4.sin_addr.s_addr = (uint32_t) htonl(addr);
+        him4.sin_family = AF_INET;
+        sa = (struct sockaddr *) &him4;
+        len = sizeof(him4);
+    } else {
         /*
-         * For IPv4 addresses construct a sockaddr_in structure.
+         * For IPv6 address construct a sockaddr_in6 structure.
          */
-        if ((*env)->GetArrayLength(env, addrArray) == 4) {
-            jint addr;
-            (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-            addr = ((caddr[0]<<24) & 0xff000000);
-            addr |= ((caddr[1] <<16) & 0xff0000);
-            addr |= ((caddr[2] <<8) & 0xff00);
-            addr |= (caddr[3] & 0xff);
-            memset((char *) &him4, 0, sizeof(him4));
-            him4.sin_addr.s_addr = (uint32_t) htonl(addr);
-            him4.sin_family = AF_INET;
-            sa = (struct sockaddr *) &him4;
-            len = sizeof(him4);
-        } else {
-            /*
-             * For IPv6 address construct a sockaddr_in6 structure.
-             */
-            (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
-            memset((char *) &him6, 0, sizeof(him6));
-            memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
-            him6.sin6_family = AF_INET6;
-            sa = (struct sockaddr *) &him6 ;
-            len = sizeof(him6) ;
-        }
+        (*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
+        memset((char *) &him6, 0, sizeof(him6));
+        memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
+        him6.sin6_family = AF_INET6;
+        sa = (struct sockaddr *) &him6 ;
+        len = sizeof(him6) ;
+    }
 
-        error = (*getnameinfo_ptr)(sa, len, host, NI_MAXHOST, NULL, 0,
-                                   NI_NAMEREQD);
+    error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
 
-        if (!error) {
-            ret = (*env)->NewStringUTF(env, host);
-        }
+    if (!error) {
+        ret = (*env)->NewStringUTF(env, host);
     }
 
     if (ret == NULL) {
--- a/jdk/src/windows/native/java/net/NetworkInterface.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c	Thu Mar 31 22:07:32 2011 -0700
@@ -53,36 +53,6 @@
  * order and this ensures consistent device number across invocations.
  */
 
-
-/* IP helper library routines */
-int (PASCAL FAR *GetIpAddrTable_fn)();
-int (PASCAL FAR *GetIfTable_fn)();
-int (PASCAL FAR *GetFriendlyIfIndex_fn)();
-int (PASCAL FAR *GetAdaptersAddresses_fn)();
-int (PASCAL FAR *GetAdaptersInfo_fn)();
-int (PASCAL FAR *GetNumberOfInterfaces_fn)();
-
-/* Enumeration routines */
-typedef int (*EnumerateNetInterfaces)(JNIEnv *, netif **);
-typedef int(*EnumerateNetAddresses)(JNIEnv *, netif *, netaddr **);
-
-static EnumerateNetInterfaces enumInterfaces_fn;
-static EnumerateNetAddresses enumAddresses_fn;
-
-/* Windows 9x routines are external (not needed on 64-bit) */
-#ifndef _WIN64
-extern int enumInterfaces_win9x(JNIEnv *, netif **);
-extern int enumAddresses_win9x(JNIEnv *, netif *, netaddr **);
-extern int init_win9x(void);
-#endif
-
-
-/* Windows 95/98/ME running */
-static jboolean isW9x;
-
-/* Windows version supports */
-static jboolean os_supports_ipv6;
-
 /* various JNI ids */
 
 jclass ni_class;            /* NetworkInterface */
@@ -154,10 +124,10 @@
      */
     size = sizeof(MIB_IFTABLE);
     tableP = (MIB_IFTABLE *)malloc(size);
-    count = (*GetIfTable_fn)(tableP, &size, TRUE);
+    count = GetIfTable(tableP, &size, TRUE);
     if (count == ERROR_INSUFFICIENT_BUFFER || count == ERROR_BUFFER_OVERFLOW) {
         tableP = (MIB_IFTABLE *)realloc(tableP, size);
-        count = (*GetIfTable_fn)(tableP, &size, TRUE);
+        count = GetIfTable(tableP, &size, TRUE);
     }
 
     if (count != NO_ERROR) {
@@ -172,7 +142,7 @@
         /*
          * Warning the real index is obtained by GetFriendlyIfIndex()
          */
-        ifindex = (*GetFriendlyIfIndex_fn)(ifrowP->dwIndex);
+        ifindex = GetFriendlyIfIndex(ifrowP->dwIndex);
         if (ifindex == index) {
           /*
            * Create a copy of the entry so that we can free the table.
@@ -199,7 +169,7 @@
  * occurs then netifPP be returned as list of netif structures or NULL
  * if no interfaces are found.
  */
-int enumInterfaces_win(JNIEnv *env, netif **netifPP)
+int enumInterfaces(JNIEnv *env, netif **netifPP)
 {
     MIB_IFTABLE *tableP;
     MIB_IFROW *ifrowP;
@@ -215,32 +185,16 @@
      */
     size = sizeof(MIB_IFTABLE);
     tableP = (MIB_IFTABLE *)malloc(size);
-    ret = (*GetIfTable_fn)(tableP, &size, TRUE);
+    ret = GetIfTable(tableP, &size, TRUE);
     if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
         tableP = (MIB_IFTABLE *)realloc(tableP, size);
-        ret = (*GetIfTable_fn)(tableP, &size, TRUE);
+        ret = GetIfTable(tableP, &size, TRUE);
     }
 
     if (ret != NO_ERROR) {
         if (tableP != NULL)
             free(tableP);
 
-#ifndef _WIN64
-        if (isW9x && ret == ERROR_NOT_SUPPORTED) {
-            /*
-             * If ERROR_NOT_SUPPORTED is returned on Windows 98 it means that
-             * IE5.0 has been installed. In this case we revert to the Windows 95
-             * approach and avoid using the IP Helper Library.
-             * See: http://support.microsoft.com/support/kb/articles/q234/5/73.asp
-             */
-            enumInterfaces_fn = enumInterfaces_win9x;
-            enumAddresses_fn = enumAddresses_win9x;
-            init_win9x();
-
-            return (*enumInterfaces_fn)(env, netifPP);
-        }
-#endif
-
         JNU_ThrowByName(env, "java/lang/Error",
                 "IP Helper Library GetIfTable function failed");
 
@@ -328,7 +282,7 @@
         curr->displayName[ifrowP->dwDescrLen] = '\0';
         curr->dwIndex = ifrowP->dwIndex;
         curr->ifType = ifrowP->dwType;
-        curr->index = (*GetFriendlyIfIndex_fn)(ifrowP->dwIndex);
+        curr->index = GetFriendlyIfIndex(ifrowP->dwIndex);
 
         /*
          * Put the interface at tail of list as GetIfTable(,,TRUE) is
@@ -384,10 +338,10 @@
     size = sizeof(MIB_IPADDRTABLE);
     tableP = (MIB_IPADDRTABLE *)malloc(size);
 
-    ret = (*GetIpAddrTable_fn)(&tableP, &size, FALSE);
+    ret = GetIpAddrTable(tableP, &size, FALSE);
     if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
         tableP = (MIB_IPADDRTABLE *)realloc(tableP, size);
-        ret = (*GetIpAddrTable_fn)(tableP, &size, FALSE);
+        ret = GetIpAddrTable(tableP, &size, FALSE);
     }
     if (ret != NO_ERROR) {
         if (tableP) {
@@ -477,71 +431,6 @@
 JNIEXPORT void JNICALL
 Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
 {
-    OSVERSIONINFO ver;
-    HANDLE h;
-
-    /*
-     * First check if this is a Windows 9x machine.
-     */
-    ver.dwOSVersionInfoSize = sizeof(ver);
-    GetVersionEx(&ver);
-    if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && ver.dwMajorVersion == 4) {
-        isW9x = JNI_TRUE;
-    }
-
-    /*
-     * Try to load the IP Helper Library and obtain the entry points we
-     * require. This will succeed on 98, NT SP4+, 2000 & XP. It will
-     * fail on Windows 95 (if IE hasn't been updated) and old versions
-     * of NT (IP helper library only appeared at SP4). If it fails on
-     * Windows 9x we will use the registry approach, otherwise if it
-     * fails we throw an Error indicating that we have an incompatible
-     * IP helper library.
-     */
-    h = LoadLibrary("iphlpapi.dll");
-    if (h != NULL) {
-        GetIpAddrTable_fn =
-            (int (PASCAL FAR *)())GetProcAddress(h, "GetIpAddrTable");
-        GetIfTable_fn =
-            (int (PASCAL FAR *)())GetProcAddress(h, "GetIfTable");
-        GetFriendlyIfIndex_fn =
-            (int (PASCAL FAR *)())GetProcAddress(h, "GetFriendlyIfIndex");
-        GetNumberOfInterfaces_fn =
-            (int (PASCAL FAR *)())GetProcAddress(h, "GetNumberOfInterfaces");
-        GetAdaptersAddresses_fn =
-            (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersAddresses");
-        GetAdaptersInfo_fn =
-            (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersInfo");
-    }
-
-    /* IPv6 is supported on Windows versions if the following APIs avail */
-
-    os_supports_ipv6 = (GetAdaptersAddresses_fn != NULL) &&
-                       (GetNumberOfInterfaces_fn != NULL) &&
-                       (GetAdaptersInfo_fn != NULL);
-
-    if (GetIpAddrTable_fn == NULL ||
-        GetIfTable_fn == NULL ||
-        GetFriendlyIfIndex_fn == NULL) {
-
-#ifndef _WIN64
-        if (isW9x) {
-            /* Use Windows 9x registry approach which requires initialization */
-            enumInterfaces_fn = enumInterfaces_win9x;
-            enumAddresses_fn = enumAddresses_win9x;
-            init_win9x();
-        } else
-#endif
-        {
-            JNU_ThrowByName(env, "java/lang/Error",
-                "Incompatible IP helper library (iphlpapi.dll)");
-            return;
-        }
-    } else {
-        enumInterfaces_fn = enumInterfaces_win;
-        enumAddresses_fn = enumAddresses_win;
-    }
-
     /*
      * Get the various JNI ids that we require
      */
@@ -581,7 +470,8 @@
  * populate the InetAddress array based on the IP addresses for this
  * interface.
  */
-jobject createNetworkInterface(JNIEnv *env, netif *ifs, int netaddrCount, netaddr *netaddrP)
+jobject createNetworkInterface
+    (JNIEnv *env, netif *ifs, int netaddrCount, netaddr *netaddrP)
 {
     jobject netifObj;
     jobject name, displayName;
@@ -596,7 +486,8 @@
     netifObj = (*env)->NewObject(env, ni_class, ni_ctor);
     name = (*env)->NewStringUTF(env, ifs->name);
     if (ifs->dNameIsUnicode) {
-        displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, wcslen ((PWCHAR)ifs->displayName));
+        displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName,
+                                       (jsize)wcslen ((PWCHAR)ifs->displayName));
     } else {
         displayName = (*env)->NewStringUTF(env, ifs->displayName);
     }
@@ -612,7 +503,7 @@
      * Note that 0 is a valid number of addresses.
      */
     if (netaddrCount < 0) {
-        netaddrCount = (*enumAddresses_fn)(env, ifs, &netaddrP);
+        netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
         if ((*env)->ExceptionOccurred(env)) {
             free_netaddr(netaddrP);
             return NULL;
@@ -725,12 +616,13 @@
     const char *name_utf;
     jobject netifObj = NULL;
 
-    if (os_supports_ipv6 && ipv6_available()) {
+    // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+    if (ipv6_available()) {
         return Java_java_net_NetworkInterface_getByName0_XP (env, cls, name);
     }
 
     /* get the list of interfaces */
-    if ((*enumInterfaces_fn)(env, &ifList) < 0) {
+    if (enumInterfaces(env, &ifList) < 0) {
         return NULL;
     }
 
@@ -771,12 +663,13 @@
     netif *ifList, *curr;
     jobject netifObj = NULL;
 
-    if (os_supports_ipv6 && ipv6_available()) {
+    // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+    if (ipv6_available()) {
         return Java_java_net_NetworkInterface_getByIndex0_XP (env, cls, index);
     }
 
     /* get the list of interfaces */
-    if ((*enumInterfaces_fn)(env, &ifList) < 0) {
+    if (enumInterfaces(env, &ifList) < 0) {
         return NULL;
     }
 
@@ -812,12 +705,13 @@
     jint addr = (*env)->GetIntField(env, iaObj, ni_iaAddr);
     jobject netifObj = NULL;
 
-    if (os_supports_ipv6 && ipv6_available()) {
+    // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+    if (ipv6_available()) {
         return Java_java_net_NetworkInterface_getByInetAddress0_XP (env, cls, iaObj);
     }
 
     /* get the list of interfaces */
-    if ((*enumInterfaces_fn)(env, &ifList) < 0) {
+    if (enumInterfaces(env, &ifList) < 0) {
         return NULL;
     }
 
@@ -832,7 +726,7 @@
         netaddr *addrP;
 
         /* enumerate the addresses on this interface */
-        count = (*enumAddresses_fn)(env, curr, &addrList);
+        count = enumAddresses_win(env, curr, &addrList);
         if (count < 0) {
             free_netif(ifList);
             return NULL;
@@ -881,14 +775,15 @@
     jobjectArray netIFArr;
     jint arr_index;
 
-    if (os_supports_ipv6 && ipv6_available()) {
+    // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+    if (ipv6_available()) {
         return Java_java_net_NetworkInterface_getAll_XP (env, cls);
     }
 
     /*
      * Get list of interfaces
      */
-    count = (*enumInterfaces_fn)(env, &ifList);
+    count = enumInterfaces(env, &ifList);
     if (count < 0) {
         return NULL;
     }
@@ -934,13 +829,16 @@
     (JNIEnv *env, jclass cls, jstring name, jint index) {
   jboolean ret = JNI_FALSE;
 
-  if (os_supports_ipv6 && ipv6_available()) {
+  // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+  if (ipv6_available()) {
     return Java_java_net_NetworkInterface_isUp0_XP(env, cls, name, index);
   } else {
     MIB_IFROW *ifRowP;
     ifRowP = getIF(index);
     if (ifRowP != NULL) {
-      ret = ifRowP->dwAdminStatus == 1 && (ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL || ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED);
+      ret = ifRowP->dwAdminStatus == 1 &&
+            (ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL ||
+             ifRowP->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED);
       free(ifRowP);
     }
   }
@@ -952,11 +850,13 @@
  * Method:    isP2P0
  * Signature: (Ljava/lang/String;I)Z
  */
-JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0(JNIEnv *env, jclass cls, jstring name, jint index) {
+JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_isP2P0
+    (JNIEnv *env, jclass cls, jstring name, jint index) {
   MIB_IFROW *ifRowP;
   jboolean ret = JNI_FALSE;
 
-  if (os_supports_ipv6 && ipv6_available()) {
+  // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+  if (ipv6_available()) {
     return Java_java_net_NetworkInterface_isP2P0_XP(env, cls, name, index);
   } else {
     ifRowP = getIF(index);
@@ -983,7 +883,8 @@
   MIB_IFROW *ifRowP;
   jboolean ret = JNI_FALSE;
 
-  if (os_supports_ipv6 && ipv6_available()) {
+  // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+  if (ipv6_available()) {
     return Java_java_net_NetworkInterface_isLoopback0_XP(env, cls, name, index);
   } else {
     ifRowP = getIF(index);
@@ -1003,22 +904,8 @@
  */
 JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_supportsMulticast0
     (JNIEnv *env, jclass cls, jstring name, jint index) {
-  MIB_IFROW *ifRowP;
-  jboolean ret = JNI_TRUE;
-
-  // Let's try to use the newer API (XP & 2003 only)
-  if (GetAdaptersAddresses_fn != NULL) {
-    ret = Java_java_net_NetworkInterface_supportsMulticast0_XP(env, cls,
+    return Java_java_net_NetworkInterface_supportsMulticast0_XP(env, cls,
                                                                name, index);
-    return ret;
-  }
-  ifRowP = getIF(index);
-  if (ifRowP != NULL) {
-    if (ifRowP->dwType == MIB_IF_TYPE_LOOPBACK)
-      ret = JNI_FALSE;
-    free(ifRowP);
-  }
-  return ret;
 }
 
 /*
@@ -1026,12 +913,14 @@
  * Method:    getMacAddr0
  * Signature: ([bLjava/lang/String;I)[b
  */
-JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv *env, jclass class, jbyteArray addrArray, jstring name, jint index) {
+JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0
+    (JNIEnv *env, jclass class, jbyteArray addrArray, jstring name, jint index) {
   jbyteArray ret = NULL;
   int len;
   MIB_IFROW *ifRowP;
 
-  if (os_supports_ipv6 && ipv6_available()) {
+  // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+  if (ipv6_available()) {
     return Java_java_net_NetworkInterface_getMacAddr0_XP(env, class, name, index);
   } else {
     ifRowP = getIF(index);
@@ -1058,11 +947,13 @@
  * Method:      getMTU0
  * Signature:   ([bLjava/lang/String;I)I
  */
-JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclass class, jstring name, jint index) {
+JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0
+    (JNIEnv *env, jclass class, jstring name, jint index) {
   jint ret = -1;
   MIB_IFROW *ifRowP;
 
-  if (os_supports_ipv6 && ipv6_available()) {
+  // Retained for now to support IPv4 only stack, java.net.preferIPv4Stack
+  if (ipv6_available()) {
     return Java_java_net_NetworkInterface_getMTU0_XP(env, class, name, index);
   } else {
     ifRowP = getIF(index);
--- a/jdk/src/windows/native/java/net/NetworkInterface.h	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.h	Thu Mar 31 22:07:32 2011 -0700
@@ -87,338 +87,6 @@
 extern jfieldID ni_ibbroadcastID;   /* InterfaceAddress.broadcast */
 extern jfieldID ni_ibmaskID;        /* InterfaceAddress.maskLength */
 
-int enumInterfaces_win(JNIEnv *env, netif **netifPP);
-
-/* We have included iphlpapi.h which includes iptypes.h which has the definition
- * for MAX_ADAPTER_DESCRIPTION_LENGTH (along with the other definitions in this
- * ifndef block). Therefore if MAX_ADAPTER_DESCRIPTION_LENGTH is defined we can
- * be sure that the other definitions are also defined */
-#ifndef MAX_ADAPTER_DESCRIPTION_LENGTH
-
-/*
- * Following includes come from iptypes.h
- */
-
-#pragma warning(push)
-#pragma warning(disable:4201)
-
-#include <time.h>
-
-// Definitions and structures used by getnetworkparams and getadaptersinfo apis
-
-#define MAX_ADAPTER_DESCRIPTION_LENGTH  128 // arb.
-#define MAX_ADAPTER_NAME_LENGTH         256 // arb.
-#define MAX_ADAPTER_ADDRESS_LENGTH      8   // arb.
-#define DEFAULT_MINIMUM_ENTITIES        32  // arb.
-#define MAX_HOSTNAME_LEN                128 // arb.
-#define MAX_DOMAIN_NAME_LEN             128 // arb.
-#define MAX_SCOPE_ID_LEN                256 // arb.
-
-//
-// types
-//
-
-// Node Type
-
-#define BROADCAST_NODETYPE              1
-#define PEER_TO_PEER_NODETYPE           2
-#define MIXED_NODETYPE                  4
-#define HYBRID_NODETYPE                 8
-
-//
-// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
-//
-
-typedef struct {
-    char String[4 * 4];
-} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
-
-//
-// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
-// both as dotted decimal strings
-//
-
-typedef struct _IP_ADDR_STRING {
-    struct _IP_ADDR_STRING* Next;
-    IP_ADDRESS_STRING IpAddress;
-    IP_MASK_STRING IpMask;
-    DWORD Context;
-} IP_ADDR_STRING, *PIP_ADDR_STRING;
-
-//
-// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
-// strings
-//
-
-typedef struct _IP_ADAPTER_INFO {
-    struct _IP_ADAPTER_INFO* Next;
-    DWORD ComboIndex;
-    char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
-    char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
-    UINT AddressLength;
-    BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
-    DWORD Index;
-    UINT Type;
-    UINT DhcpEnabled;
-    PIP_ADDR_STRING CurrentIpAddress;
-    IP_ADDR_STRING IpAddressList;
-    IP_ADDR_STRING GatewayList;
-    IP_ADDR_STRING DhcpServer;
-    BOOL HaveWins;
-    IP_ADDR_STRING PrimaryWinsServer;
-    IP_ADDR_STRING SecondaryWinsServer;
-    time_t LeaseObtained;
-    time_t LeaseExpires;
-} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
-
-#ifdef _WINSOCK2API_
-
-//
-// The following types require Winsock2.
-//
-
-typedef enum {
-    IpPrefixOriginOther = 0,
-    IpPrefixOriginManual,
-    IpPrefixOriginWellKnown,
-    IpPrefixOriginDhcp,
-    IpPrefixOriginRouterAdvertisement,
-} IP_PREFIX_ORIGIN;
-
-typedef enum {
-    IpSuffixOriginOther = 0,
-    IpSuffixOriginManual,
-    IpSuffixOriginWellKnown,
-    IpSuffixOriginDhcp,
-    IpSuffixOriginLinkLayerAddress,
-    IpSuffixOriginRandom,
-} IP_SUFFIX_ORIGIN;
-
-typedef enum {
-    IpDadStateInvalid    = 0,
-    IpDadStateTentative,
-    IpDadStateDuplicate,
-    IpDadStateDeprecated,
-    IpDadStatePreferred,
-} IP_DAD_STATE;
-
-typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
-    union {
-        ULONGLONG Alignment;
-        struct {
-            ULONG Length;
-            DWORD Flags;
-        };
-    };
-    struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
-    SOCKET_ADDRESS Address;
-
-    IP_PREFIX_ORIGIN PrefixOrigin;
-    IP_SUFFIX_ORIGIN SuffixOrigin;
-    IP_DAD_STATE DadState;
-
-    ULONG ValidLifetime;
-    ULONG PreferredLifetime;
-    ULONG LeaseLifetime;
-} IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
-
-typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
-    union {
-        ULONGLONG Alignment;
-        struct {
-            ULONG Length;
-            DWORD Flags;
-        };
-    };
-    struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
-    SOCKET_ADDRESS Address;
-} IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
-
-typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
-    union {
-        ULONGLONG Alignment;
-        struct {
-            ULONG Length;
-            DWORD Flags;
-        };
-    };
-    struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
-    SOCKET_ADDRESS Address;
-} IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
-
-//
-// Per-address Flags
-//
-#define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x01
-#define IP_ADAPTER_ADDRESS_TRANSIENT    0x02
-
-typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
-    union {
-        ULONGLONG Alignment;
-        struct {
-            ULONG Length;
-            DWORD Reserved;
-        };
-    };
-    struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
-    SOCKET_ADDRESS Address;
-} IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
-
-typedef struct _IP_ADAPTER_PREFIX {
-    union {
-        ULONGLONG Alignment;
-        struct {
-            ULONG Length;
-            DWORD Flags;
-        };
-    };
-    struct _IP_ADAPTER_PREFIX *Next;
-    SOCKET_ADDRESS Address;
-    ULONG PrefixLength;
-} IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
-
-//
-// Per-adapter Flags
-//
-#define IP_ADAPTER_DDNS_ENABLED               0x01
-#define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX    0x02
-#define IP_ADAPTER_DHCP_ENABLED               0x04
-#define IP_ADAPTER_RECEIVE_ONLY               0x08
-#define IP_ADAPTER_NO_MULTICAST               0x10
-#define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20
-
-//
-// OperStatus values from RFC 2863
-//
-typedef enum {
-    IfOperStatusUp = 1,
-    IfOperStatusDown,
-    IfOperStatusTesting,
-    IfOperStatusUnknown,
-    IfOperStatusDormant,
-    IfOperStatusNotPresent,
-    IfOperStatusLowerLayerDown
-} IF_OPER_STATUS;
-
-//
-// Scope levels from RFC 2373 used with ZoneIndices array.
-//
-typedef enum {
-    ScopeLevelInterface    = 1,
-    ScopeLevelLink         = 2,
-    ScopeLevelSubnet       = 3,
-    ScopeLevelAdmin        = 4,
-    ScopeLevelSite         = 5,
-    ScopeLevelOrganization = 8,
-    ScopeLevelGlobal       = 14
-} SCOPE_LEVEL;
-
-typedef struct _IP_ADAPTER_ADDRESSES {
-    union {
-        ULONGLONG Alignment;
-        struct {
-            ULONG Length;
-            DWORD IfIndex;
-        };
-    };
-    struct _IP_ADAPTER_ADDRESSES *Next;
-    PCHAR AdapterName;
-    PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
-    PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
-    PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
-    PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
-    PWCHAR DnsSuffix;
-    PWCHAR Description;
-    PWCHAR FriendlyName;
-    BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
-    DWORD PhysicalAddressLength;
-    DWORD Flags;
-    DWORD Mtu;
-    DWORD IfType;
-    IF_OPER_STATUS OperStatus;
-    DWORD Ipv6IfIndex;
-    DWORD ZoneIndices[16];
-    PIP_ADAPTER_PREFIX FirstPrefix;
-} IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
-
-//
-// Flags used as argument to GetAdaptersAddresses().
-// "SKIP" flags are added when the default is to include the information.
-// "INCLUDE" flags are added when the default is to skip the information.
-//
-#define GAA_FLAG_SKIP_UNICAST       0x0001
-#define GAA_FLAG_SKIP_ANYCAST       0x0002
-#define GAA_FLAG_SKIP_MULTICAST     0x0004
-#define GAA_FLAG_SKIP_DNS_SERVER    0x0008
-#define GAA_FLAG_INCLUDE_PREFIX     0x0010
-#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
-
-#endif /* _WINSOCK2API_ */
-
-//
-// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list.
-//
-
-typedef struct _IP_PER_ADAPTER_INFO {
-    UINT AutoconfigEnabled;
-    UINT AutoconfigActive;
-    PIP_ADDR_STRING CurrentDnsServer;
-    IP_ADDR_STRING DnsServerList;
-} IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
-
-//
-// FIXED_INFO - the set of IP-related information which does not depend on DHCP
-//
-
-typedef struct {
-    char HostName[MAX_HOSTNAME_LEN + 4] ;
-    char DomainName[MAX_DOMAIN_NAME_LEN + 4];
-    PIP_ADDR_STRING CurrentDnsServer;
-    IP_ADDR_STRING DnsServerList;
-    UINT NodeType;
-    char ScopeId[MAX_SCOPE_ID_LEN + 4];
-    UINT EnableRouting;
-    UINT EnableProxy;
-    UINT EnableDns;
-} FIXED_INFO, *PFIXED_INFO;
-
-#pragma warning(pop)
-
-#endif /*!MAX_ADAPTER_DESCRIPTION_LENGTH*/
-
-#ifndef IP_INTERFACE_NAME_INFO_DEFINED
-#define IP_INTERFACE_NAME_INFO_DEFINED
-
-typedef struct ip_interface_name_info {
-    ULONG           Index;      // Interface Index
-    ULONG           MediaType;  // Interface Types - see ipifcons.h
-    UCHAR           ConnectionType;
-    UCHAR           AccessType;
-    GUID            DeviceGuid; // Device GUID is the guid of the device
-                                // that IP exposes
-    GUID            InterfaceGuid; // Interface GUID, if not GUID_NULL is the
-                                // GUID for the interface mapped to the device.
-} IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO;
+int enumInterfaces(JNIEnv *env, netif **netifPP);
 
 #endif
-
-
-/* from ipifcons.h */
-
-#ifndef IF_TYPE_PPP
-#define IF_TYPE_PPP 23
-#endif
-
-#ifndef IF_TYPE_SOFTWARE_LOOPBACK
-#define IF_TYPE_SOFTWARE_LOOPBACK 24
-#endif
-
-#ifndef IF_TYPE_SLIP
-#define IF_TYPE_SLIP 28
-#endif
-
-#ifndef IF_TYPE_TUNNEL
-#define IF_TYPE_TUNNEL 131
-#endif
-
-#endif
--- a/jdk/src/windows/native/java/net/NetworkInterface_win9x.c	Thu Mar 31 18:14:17 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1141 +0,0 @@
-/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <windows.h>
-#include <winsock2.h>
-#include <assert.h>
-
-#include "jni_util.h"
-
-#include "NetworkInterface.h"
-
-/*
- * Windows 9x specific routines to enumerate network interfaces and the
- * IP addresses bound to those interfaces.
- *
- * Windows 95 does not include IP helper library support by default.
- * Additionally Windows 98 can have its IP helper library support
- * trashed by certain IE installations. For these environments we
- * combine information from the registry with the list of IP addresses
- * obtained via SIO_GET_INTERFACE_LIST.
- */
-
-/*
- * Header files are missing these
- */
-#if !defined(SIO_GET_INTERFACE_LIST)
-#define SIO_GET_INTERFACE_LIST  _IOR('t', 127, u_long)
-
-struct in_addr6 {
-                u_char  s6_addr[16];
-};
-
-struct sockaddr_in6 {
-                short   sin6_family;
-                u_short sin6_port;
-                u_long  sin6_flowinfo;
-                struct in_addr6 sin6_addr;
-};
-
-typedef union sockaddr_gen{
-                struct sockaddr Address;
-                struct sockaddr_in  AddressIn;
-                struct sockaddr_in6 AddressIn6;
-} sockaddr_gen;
-
-typedef struct _INTERFACE_INFO
-{
-        u_long          iiFlags;
-        sockaddr_gen    iiAddress;
-        sockaddr_gen    iiBroadcastAddress;
-        sockaddr_gen    iiNetmask;
-} INTERFACE_INFO;
-
-#define IFF_UP              0x00000001
-#endif
-
-
-#define MAX_STR_LEN         256
-
-
-/*
- * A network adapter (similiar to the netif structure except contains
- * Windows 9x specific fields).
- */
-typedef struct _adapter {
-    char *name;
-    char *displayName;
-    int index;
-    char *reg_key;
-    int is_wan_driver;
-    netaddr *addrs;
-    struct _adapter *next;
-} adapter;
-
-
-/*
- * Cached adapter list.
- */
-static CRITICAL_SECTION cacheLock;
-static adapter *cachedAdapterList;
-
-/*
- * Initialize cache
- */
-void init_win9x() {
-    InitializeCriticalSection(&cacheLock);
-}
-
-
-/*
- * Free adapter list and any addresses bound to the adpater.
- */
-static void free_adapters(adapter *adapterP) {
-    adapter *curr = adapterP;
-    while (curr != NULL) {
-        if (curr->name != NULL)
-            free(curr->name);
-
-        if (curr->displayName != NULL)
-            free(curr->displayName);
-
-        if (curr->reg_key != NULL)
-            free(curr->reg_key);
-
-        if (curr->addrs != NULL)
-            free_netaddr(curr->addrs);
-
-        adapterP = adapterP->next;
-        free(curr);
-        curr = adapterP;
-    }
-}
-
-
-/*
- * Returns the SIO_GET_INTERFACE_LIST output
- */
-static int getInterfaceList(JNIEnv *env, INTERFACE_INFO *infoP, DWORD dwSize) {
-    SOCKET sock;
-    DWORD ret;
-
-    /* create a socket and do the ioctl */
-    sock = socket(AF_INET, SOCK_DGRAM, 0);
-    if (sock == INVALID_SOCKET) {
-        JNU_ThrowByName(env, "java/lang/Error", "socket failed");
-        return -1;
-    }
-    ret = WSAIoctl(sock, SIO_GET_INTERFACE_LIST, NULL, 0,
-                   infoP, dwSize, &dwSize, NULL, NULL);
-    closesocket(sock);
-    if (ret == SOCKET_ERROR) {
-        JNU_ThrowByName(env, "java/lang/Error", "WSAIoctl failed");
-        return -1;
-    }
-    return dwSize;
-}
-
-
-/*
- * Gross, ugly, and crude way of guessing if this is a WAN (dial-up) driver.
- * Returns 1 if it's the normal PPCMAC VxD, otherwise 0.
- */
-static int isWanDriver(char *driver) {
-    LONG ret;
-    HKEY hKey;
-    DWORD dwLen;
-    ULONG ulType;
-    char key[MAX_STR_LEN];
-    char vxd[MAX_STR_LEN];
-
-    sprintf(key, "System\\CurrentControlSet\\Services\\Class\\%s", driver);
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey);
-    if (ret != ERROR_SUCCESS) {
-        return 0;
-    }
-    dwLen = sizeof(vxd);
-    ret = RegQueryValueEx(hKey, "DeviceVxDs",  NULL, &ulType,
-                         (LPBYTE)vxd, &dwLen);
-    RegCloseKey(hKey);
-    if (ret != ERROR_SUCCESS) {
-        return 0;
-    }
-    return (strcmp(vxd, "pppmac.vxd") == 0);
-}
-
-/*
- * Windows 9x routine to get the network adapters using the registry.
- * We enumerate HKEY_LOCAL_MACHINE\Enum and iterate through the tree
- * looking for devices of class "Net". As these devices may not have a
- * unique name we assign them a generated name.
- *
- * Returns a list of adapters without IP addresses (addrs member is NULL).
- */
-static int getAdapters(JNIEnv *env, adapter **adapterPP)
-{
-    LONG ret;
-    HKEY enumKey;
-    DWORD dwLen;
-    DWORD dwEnumKeys;
-    DWORD enumIndex;
-    ULONG ulType;
-    int adapterCount = 0;
-    adapter *adapterP = NULL;
-    adapter *curr;
-
-    /*
-     * Start at HKEY_LOCAL_MACHINE\Enum
-     */
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Enum", 0, KEY_READ, (PHKEY)&enumKey);
-    if (ret != ERROR_SUCCESS) {
-        return -1;
-    }
-    ret = RegQueryInfoKey(enumKey, NULL, NULL, NULL, &dwEnumKeys,
-                          NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-    if (ret != ERROR_SUCCESS) {
-        RegCloseKey(enumKey);
-        return -1;
-    }
-
-    /*
-     * Iterate through the sub-keys (PCI, Root, ...)
-     */
-    for(enumIndex = 0; enumIndex<dwEnumKeys; enumIndex++) {
-        TCHAR deviceType[MAX_STR_LEN];
-        HKEY deviceKey;
-        DWORD deviceIndex;
-        DWORD dwDeviceKeys;
-
-        dwLen = sizeof(deviceType);
-        ret = RegEnumKeyEx(enumKey, enumIndex, deviceType, &dwLen, NULL, NULL, NULL, NULL);
-        if (ret != ERROR_SUCCESS) {
-            /* ignore this tree */
-            continue;
-        }
-
-        ret = RegOpenKeyEx(enumKey, deviceType, 0, KEY_READ, (PHKEY)&deviceKey);
-        if (ret != ERROR_SUCCESS) {
-            /* ignore this tree */
-            continue;
-        }
-        ret = RegQueryInfoKey(deviceKey, NULL, NULL, NULL, &dwDeviceKeys,
-                              NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-        if (ret != ERROR_SUCCESS) {
-            /* ignore this tree */
-            RegCloseKey(deviceKey);
-            continue;
-        }
-
-        /*
-         * Iterate through each of the sub-keys under PCI, Root, ...
-         */
-        for (deviceIndex=0; deviceIndex<dwDeviceKeys; deviceIndex++) {
-            TCHAR name[MAX_STR_LEN];
-            HKEY nameKey;
-            DWORD nameIndex;
-            DWORD dwNameKeys;
-
-            dwLen = sizeof(name);
-            ret = RegEnumKeyEx(deviceKey, deviceIndex, name, &dwLen, NULL, NULL, NULL, NULL);
-
-            if (ret != ERROR_SUCCESS) {
-                /* ignore this sub-tree */
-                continue;
-            }
-
-            ret = RegOpenKeyEx(deviceKey, name, 0, KEY_READ, (PHKEY)&nameKey);
-            if (ret != ERROR_SUCCESS) {
-                /* ignore this sub-tree */
-                continue;
-            }
-            ret = RegQueryInfoKey(nameKey, NULL, NULL, NULL, &dwNameKeys,
-                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-            if (ret != ERROR_SUCCESS) {
-                RegCloseKey(nameKey);
-                /* ignore this sub-tree */
-                continue;
-            }
-
-            /*
-             * Finally iterate through the Enum\Root\Net level keys
-             */
-            for (nameIndex=0; nameIndex<dwNameKeys; nameIndex++) {
-                TCHAR dev[MAX_STR_LEN];
-                TCHAR cls[MAX_STR_LEN];
-                HKEY clsKey;
-
-                dwLen = sizeof(dev);
-                ret = RegEnumKeyEx(nameKey, nameIndex, dev, &dwLen, NULL, NULL, NULL, NULL);
-                if (ret != ERROR_SUCCESS) {
-                    continue;
-                }
-
-                ret = RegOpenKeyEx(nameKey, dev, 0, KEY_READ, (PHKEY)&clsKey);
-                if (ret == ERROR_SUCCESS) {
-                    dwLen = sizeof(cls);
-                    ret = RegQueryValueEx(clsKey, "Class",  NULL, &ulType,
-                                          (LPBYTE)cls, &dwLen);
-
-                    if (ret == ERROR_SUCCESS) {
-                        if (strcmp(cls, "Net") == 0) {
-                            TCHAR deviceDesc[MAX_STR_LEN];
-
-                            dwLen = sizeof(deviceDesc);
-                            ret = RegQueryValueEx(clsKey, "DeviceDesc",  NULL, &ulType,
-                                                  (LPBYTE)deviceDesc, &dwLen);
-
-                            if (ret == ERROR_SUCCESS) {
-                                char key_name[MAX_STR_LEN];
-                                char ps_name[8];
-                                char driver[MAX_STR_LEN];
-                                int wan_device;
-
-                                /*
-                                 * Generate a pseudo device name
-                                 */
-                                sprintf(ps_name, "net%d", adapterCount);
-
-                                /*
-                                 * Try to determine if this a WAN adapter. This is
-                                 * useful when we try to eliminate WAN adapters from
-                                 * the interface list when probing for DHCP info
-                                 */
-                                dwLen = sizeof(driver);
-                                ret = RegQueryValueEx(clsKey, "Driver",  NULL,
-                                                      &ulType, (LPBYTE)driver, &dwLen);
-                                if (ret == ERROR_SUCCESS) {
-                                    wan_device = isWanDriver(driver);
-                                } else {
-                                    wan_device = 0;
-                                }
-
-                                /*
-                                 * We have found a Net device. In order to get the
-                                 * static IP addresses we must note the key.
-                                 */
-                                sprintf(key_name, "Enum\\%s\\%s\\%s", deviceType, name, dev);
-
-                                /*
-                                 * Create the net adapter
-                                 */
-                                curr = (adapter *)calloc(1, sizeof(adapter));
-                                if (curr != NULL) {
-                                    curr->is_wan_driver = wan_device;
-                                    curr->name = (char *)malloc(strlen(ps_name) + 1);
-                                    if (curr->name) {
-                                        curr->displayName = (char *)malloc(strlen(deviceDesc) + 1);
-                                        if (curr->displayName) {
-                                            curr->reg_key = (char *)malloc(strlen(key_name)+1);
-                                            if (curr->reg_key == NULL) {
-                                                free(curr->displayName);
-                                                free(curr->name);
-                                                free(curr);
-                                                curr = NULL;
-                                            }
-                                        } else {
-                                            free(curr->name);
-                                            free(curr);
-                                            curr = NULL;
-                                        }
-                                    } else {
-                                        free(curr);
-                                        curr = NULL;
-                                    }
-                                }
-
-                                /* At OutOfMemory occurred */
-                                if (curr == NULL) {
-                                    JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-                                    free_adapters(adapterP);
-                                    RegCloseKey(clsKey);
-                                    RegCloseKey(nameKey);
-                                    RegCloseKey(deviceKey);
-                                    RegCloseKey(enumKey);
-                                    return -1;
-                                }
-
-                                /* index starts at 1 (not 0) */
-                                curr->index = ++adapterCount;
-
-                                strcpy(curr->name, ps_name);
-                                strcpy(curr->displayName, deviceDesc);
-                                strcpy(curr->reg_key, key_name);
-
-                                /*
-                                 * Put the adapter at the end of the list.
-                                 */
-                                if (adapterP == NULL) {
-                                    adapterP = curr;
-                                } else {
-                                    adapter *tail = adapterP;
-                                    while (tail->next != NULL) {
-                                        tail = tail->next;
-                                    }
-                                    tail->next = curr;
-                                }
-                            }
-                        }
-                    }
-                }
-                RegCloseKey(clsKey);
-            }
-            RegCloseKey(nameKey);
-        }
-        RegCloseKey(deviceKey);
-    }
-    RegCloseKey(enumKey);
-
-    /*
-     * Insert an entry for the loopback interface
-     */
-    curr = (adapter *)calloc(1, sizeof(adapter));
-    if (curr == NULL) {
-        JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-        free_adapters(adapterP);
-        return -1;
-    }
-    curr->index = ++adapterCount;
-    curr->name = _strdup("lo");
-    curr->displayName = _strdup("TCP Loopback interface");
-    curr->next = adapterP;
-    *adapterPP = curr;
-
-    return adapterCount;
-}
-
-/*
- * Windows 9x routine to obtain any static addresses for a specified
- * TCP/IP binding.
- *
- * We first open Enum\Network\${binding} and check that the driver
- * is TCP/IP. If so we pick up the driver and check for any IP addresses
- * in System\\CurrentControlSet\\Services\\Class\\${driver}
- *
- * Returns 0 if found, otherwise -1.
- */
-static int getStaticAddressEntry(char *binding, char *addresses) {
-    LONG ret;
-    HKEY hKey;
-    char name[255];
-    char desc[255];
-    char driver[255];
-    char ipaddr[255];
-    DWORD dwName;
-    ULONG ulType;
-
-    /* assume nothing will be returned */
-    strcpy(addresses, "");
-
-    /*
-     * Open the binding and check that it's TCP/IP
-     */
-    sprintf(name, "Enum\\Network\\%s", binding);
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, name, 0, KEY_READ, (PHKEY)&hKey);
-    if (ret != ERROR_SUCCESS) {
-        return -1;
-    }
-    dwName = sizeof(desc);
-    ret = RegQueryValueEx(hKey, "DeviceDesc",  NULL, &ulType,
-                         (LPBYTE)desc, &dwName);
-    if (ret != ERROR_SUCCESS) {
-        RegCloseKey(hKey);
-        return -1;
-    }
-    if (strcmp(desc, "TCP/IP") != 0) {
-        /* ignore non-TCP/IP bindings */
-        RegCloseKey(hKey);
-        return -1;
-    }
-
-    /*
-     * Get the driver for this TCP/IP binding
-     */
-    dwName = sizeof(driver);
-    ret = RegQueryValueEx(hKey, "Driver",  NULL, &ulType,
-                          (LPBYTE)driver, &dwName);
-    RegCloseKey(hKey);
-    if (ret != ERROR_SUCCESS) {
-        return -1;
-    }
-
-    /*
-     * Finally check if there is an IPAddress value for this driver.
-     */
-    sprintf(name, "System\\CurrentControlSet\\Services\\Class\\%s", driver);
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, name, 0, KEY_READ, (PHKEY)&hKey);
-    if (ret != ERROR_SUCCESS) {
-        return -1;
-    }
-    dwName = sizeof(ipaddr);
-    ret = RegQueryValueEx(hKey, "IPAddress",  NULL, &ulType,
-                          (LPBYTE)ipaddr, &dwName);
-    RegCloseKey(hKey);
-    if (ret != ERROR_SUCCESS) {
-        return -1;
-    }
-
-    /* Return the address(es) */
-    strcpy( addresses, ipaddr );
-    return 0;
-}
-
-/*
- * Windows 9x routine to enumerate the static IP addresses on a
- * particular interface using the registry.
- *
- * Returns a count of the number of addresses found.
- */
-static int getStaticAddresses(JNIEnv *env, char *reg_key, netaddr **netaddrPP)
-{
-    LONG ret;
-    HKEY enumKey, bindingKey;
-    DWORD dwLen;
-    ULONG ulType;
-    char addresses[MAX_STR_LEN];
-    unsigned long addr;     /* IPv4 address */
-    unsigned char byte;
-    netaddr *netaddrP, *curr;
-    int i, addrCount;
-
-    /*
-     * Open the HKEY_LOCAL_MACHINE\Enum\%s\%s\%s key
-     */
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_key, 0, KEY_READ,
-                       (PHKEY)&enumKey);
-    if (ret != ERROR_SUCCESS) {
-        /* interface has been removed */
-        *netaddrPP = NULL;
-        return 0;
-    }
-
-    /*
-     * Iterate through each of the bindings to find any TCP/IP bindings
-     * and any static address assoicated with the binding.
-     */
-    strcpy(addresses, "");
-    addrCount = 0;
-    netaddrP = NULL;
-
-    ret = RegOpenKeyEx(enumKey, "Bindings", 0, KEY_READ, (PHKEY)&bindingKey);
-    if (ret == ERROR_SUCCESS) {
-        DWORD dwBindingKeys;
-        DWORD dwBindingIndex;
-
-        ret = RegQueryInfoKey(bindingKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwBindingKeys,
-                              NULL, NULL, NULL, NULL);
-        if (ret == ERROR_SUCCESS) {
-            TCHAR binding[MAX_STR_LEN];
-
-            dwBindingIndex=0;
-            while (dwBindingIndex<dwBindingKeys) {
-                dwLen = sizeof(binding);
-                ret = RegEnumValue(bindingKey, dwBindingIndex, binding, &dwLen,
-                                   NULL, &ulType, NULL, NULL);
-                if (ret == ERROR_SUCCESS) {
-                    if (getStaticAddressEntry(binding, addresses) == 0) {
-                        /*
-                         * On Windows 9x IP addresses are strings. Multi-homed hosts have
-                         * the IP addresses seperated by commas.
-                         */
-                        addr = 0;
-                        byte = 0;
-                        i = 0;
-                        while ((DWORD)i < strlen(addresses)+1) {
-                            /* eof or seperator */
-                            if (addresses[i] == ',' || addresses[i] == 0) {
-                                if (addr != 0) {
-                                    addr = (addr << 8) | byte;
-
-                                    curr = (netaddr *)malloc(sizeof(netaddr));
-                                    if (curr == NULL) {
-                                        JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-                                        free_netaddr(netaddrP);
-                                        RegCloseKey(enumKey);
-                                        return -1;
-                                    }
-                                    curr->addr.him4.sin_family = AF_INET;
-                                    curr->addr.him4.sin_addr.s_addr = htonl(addr);
-                                    curr->next = netaddrP;
-
-                                    netaddrP = curr;
-                                    addrCount++;
-
-                                    /* reset the address for the next iteration */
-                                    addr = 0;
-                                }
-                                byte = 0;
-                            } else {
-                                if (addresses[i] == '.') {
-                                    addr = (addr << 8) | byte;
-                                    byte = 0;
-                                } else {
-                                    byte = (byte * 10) + (addresses[i] - '0');
-                                }
-                            }
-                            i++;
-                        }
-                    }
-                }
-                if (addrCount > 0) {
-                    break;
-                }
-                dwBindingIndex++;
-            }
-        }
-        RegCloseKey(bindingKey);
-    }
-
-    /* close the registry */
-    RegCloseKey(enumKey);
-
-
-    /* return the list */
-    *netaddrPP = netaddrP;
-    return addrCount;
-}
-
-/*
- * Windows 9x routine to probe the registry for a DHCP allocated address.
- * This routine is only useful if we know that only one interface has its
- * address allocated using DHCP. Returns 0.0.0.0 if none or multiple
- * addresses found.0
- */
-static DWORD getDHCPAddress()
-{
-    LONG ret;
-    HKEY hKey;
-    DWORD dwLen;
-    ULONG ulType;
-    char key[MAX_STR_LEN];
-    int index;
-    DWORD dhcp_addr = 0;
-
-    index = 0;
-    while (index < 99) {
-        DWORD addr;
-
-        sprintf(key, "SYSTEM\\CurrentControlSet\\Services\\VxD\\DHCP\\DhcpInfo%02d", index);
-
-        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey);
-        if (ret != ERROR_SUCCESS) {
-            return dhcp_addr;
-        }
-
-        /*
-         * On Windows 9x the DHCP address is in the DhcpIPAddress key. We
-         * are assuming here that this is Windows Socket 2. If Windows
-         * Sockets is the original 1.1 release then this doesn't work because
-         * the IP address if in the DhcpInfo key (a blob with the first 4
-         * bytes set to the IP address).
-         */
-        dwLen = sizeof(addr);
-        ret = RegQueryValueEx(hKey, "DhcpIPAddress",  NULL, &ulType,
-                              (LPBYTE)&addr, &dwLen);
-        RegCloseKey(hKey);
-
-        if (ret == ERROR_SUCCESS) {
-            if (addr) {
-                /* more than 1 DHCP address in registry */
-                if (dhcp_addr) {
-                    return 0;
-                }
-                dhcp_addr = htonl(addr);
-            }
-        }
-        index++;
-    }
-
-    /* if we get here it means we've examined 100 registry entries */
-    return 0;
-}
-
-
-/*
- * Attempt to allocate the remaining addresses on addrList to the adpaters
- * on adapterList. Returns the number of address remaining.
- */
-int allocateRemaining(adapter *adapterList, int address_count, netaddr *addrList) {
-    adapter *adapterP = adapterList;
-    adapter *nobindingsP = NULL;
-
-    /*
-     * If all addresses have been assigned there's nothing to do.
-     */
-    if (address_count == 0) {
-        return 0;
-    }
-
-    /*
-     * Determine if there is only one adapter without an address
-     */
-    while (adapterP != NULL) {
-        if (adapterP->addrs == NULL) {
-            if (nobindingsP == NULL) {
-                nobindingsP = adapterP;
-            } else {
-                nobindingsP = NULL;
-                break;
-            }
-        }
-        adapterP = adapterP->next;
-    }
-
-    /*
-     * Found (only one)
-     */
-    if (nobindingsP) {
-        nobindingsP->addrs = addrList;
-        address_count = 0;
-    }
-
-    return address_count;
-}
-
-
-/*
- * 1. Network adapters are enumerated by traversing through the
- *    HKEY_LOCAL_MACHINE\Enum tree and picking out class "Net" devices.
- *
- * 2. Address enumeration starts with the list of IP addresses returned
- *    by SIO_GET_INTERFACE_LIST and then we "allocate" the addresses to
- *    the network adapters enumerated in step 1. Allocation works as
- *    follows :-
- *
- *    i.   Loopback address is assigned to the loopback interface. If there
- *         is one network adapter then all other addresses must be bound
- *         to that adapter.
- *
- *    ii.  Enumerate all static IP addresses using the registry. This allows
- *         us to allocate all static IP address to the corresponding adapter.
- *
- *    iii. After step ii. if there is one network adapter that has not been
- *         allocated an IP address then we know that the remaining IP addresses
- *         must be bound to this adapter.
- *
- *    iv.  If we get to this step it means we are dealing with a complex
- *         configuration whereby multiple network adapters have their address
- *         configured dynamically (eg: NIC using DHCP plus modem using PPP).
- *         We employ a gross hack based on a crude determination done in step 1.
- *         If there is a DHCP address configured and if one remaining
- *         network adapter that is not a WAN adapter then the DHCP address
- *         must be bound to it.
- */
-static adapter *loadConfig(JNIEnv *env) {
-    adapter *adapterList;
-    int adapter_count;
-    INTERFACE_INFO interfaceInfo[8];
-    DWORD dwSize;
-    int address_count, i;
-    netaddr *addrList;
-
-    /*
-     * Enumerate the network adapters
-     */
-    adapter_count = getAdapters(env, &adapterList);
-    if (adapter_count < 0) {
-        return NULL;
-    }
-    /* minimum of loopback interface */
-    assert(adapter_count >= 1);
-
-    /*
-     * Enumerate all IP addresses as known to winsock
-     */
-    dwSize = getInterfaceList(env, interfaceInfo, sizeof(interfaceInfo));
-    if (dwSize < 0) {
-        free_adapters(adapterList);
-        return NULL;
-    }
-    address_count = dwSize/sizeof(INTERFACE_INFO);
-
-    /* minimum of loopback address */
-    assert(address_count >= 1);
-
-    /*
-     * Create an address list (addrList) from the INTERFACE_INFO
-     * structure.
-     */
-    addrList = NULL;
-    for (i=0; i<address_count; i++) {
-        netaddr *addrP = (netaddr *)calloc(1, sizeof(netaddr));
-        if (addrP == NULL) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-            free_netaddr(addrList);
-            free(adapterList);
-            return NULL;
-        }
-
-        addrP->addr.him4.sin_family = AF_INET;
-        addrP->addr.him4.sin_addr.s_addr =
-            ((SOCKADDR_IN *)&(interfaceInfo[i].iiAddress))->sin_addr.S_un.S_addr;
-
-        addrP->next = addrList;
-        addrList = addrP;
-    }
-
-
-    /*
-     * First we assign the loopback address to the lo adapter.
-     * If lo is the only adapter then we are done.
-     */
-    {
-        adapter *loopbackAdapter;
-        netaddr *addrP, *prevP;
-
-        /* find the loopback adapter */
-        loopbackAdapter = adapterList;
-        while (strcmp(loopbackAdapter->name, "lo") != 0) {
-            loopbackAdapter = loopbackAdapter->next;
-        }
-        assert(loopbackAdapter != NULL);
-
-        /* find the loopback address and move it to the loopback adapter */
-        addrP = addrList;
-        prevP = NULL;
-        while (addrP != NULL) {
-            if (addrP->addr.him4.sin_addr.s_addr == htonl(0x7f000001)) {
-                loopbackAdapter->addrs = addrP;
-                if (prevP == NULL) {
-                    addrList = addrP->next;
-                } else {
-                    prevP->next = addrP->next;
-                }
-                loopbackAdapter->addrs->next = NULL;
-                address_count--;
-                break;
-            }
-            prevP = addrP;
-            addrP = addrP->next;
-        }
-    }
-
-
-    /*
-     * Special case. If there's only one network adapter then all remaining
-     * IP addresses must be bound to that adapter.
-     */
-    address_count = allocateRemaining(adapterList, address_count, addrList);
-    if (address_count == 0) {
-        return adapterList;
-    }
-
-    /*
-     * Locate any static IP addresses defined in the registry. Validate the
-     * addresses against the SIO_GET_INTERFACE_LIST (as registry may have
-     * stale settings). If valid we move the addresses from addrList to
-     * the adapter.
-     */
-    {
-        adapter *adapterP;
-
-        adapterP = adapterList;
-        while (adapterP != NULL) {
-            int cnt;
-            netaddr *static_addrP;
-
-            /*
-             * Skip loopback
-             */
-            if (strcmp(adapterP->name, "lo") == 0) {
-                adapterP = adapterP->next;
-                continue;
-            }
-
-            /*
-             * Get the static addresses for this adapter.
-             */
-            cnt = getStaticAddresses(env, adapterP->reg_key, &static_addrP);
-            if (cnt < 0) {
-                free_netaddr(addrList);
-                free(adapterList);
-                return NULL;
-            }
-
-            /*
-             * Validate against the SIO_GET_INTERFACE_LIST.
-             * (avoids stale registry settings).
-             */
-            while (static_addrP != NULL) {
-                netaddr *addrP = addrList;
-                netaddr *prev = NULL;
-
-                while (addrP != NULL) {
-                    if (addrP->addr.him4.sin_addr.s_addr == static_addrP->addr.him4.sin_addr.s_addr)
-                        break;
-
-                    prev = addrP;
-                    addrP = addrP->next;
-                }
-
-                /*
-                 * if addrP is not NULL it means we have a match
-                 * (ie: address from the registry is valid).
-                 */
-                if (addrP != NULL) {
-                    /* remove from addrList */
-                    if (prev == NULL) {
-                        addrList = addrP->next;
-                    } else {
-                        prev->next = addrP->next;
-                    }
-                    address_count--;
-
-                    /* add to adapter list */
-                    addrP->next = adapterP->addrs;
-                    adapterP->addrs = addrP;
-                }
-
-                /*
-                 * On the next static address.
-                 */
-                static_addrP = static_addrP->next;
-            }
-
-            /* not needed */
-            free_netaddr(static_addrP);
-
-            adapterP = adapterP->next;
-        }
-    }
-
-
-    /*
-     * Static addresses are now assigned so try again to allocate the
-     * remaining addresses. This will succeed if there is one adapter
-     * with a dynamically assigned address (DHCP or PPP).
-     */
-    address_count = allocateRemaining(adapterList, address_count, addrList);
-    if (address_count == 0) {
-        return adapterList;
-    }
-
-    /*
-     * Next we see if there is a DHCP address in the registry. If there is
-     * an address (and it's valid) then we know it must be bound to a LAN
-     * adapter. Additionally, when we enumerate the network adapters
-     * we made a crude determination on if an adapter is dial-up. Thus if
-     * we know there is one remaining LAN adapter without an IP address
-     * then the DHCP address must be bound to it.
-     */
-    {
-        long dhcp_addr = getDHCPAddress(); /* returns in network order */
-        if (dhcp_addr) {
-            netaddr *addrP, *prevP;
-
-            /*
-             * Check that the DHCP address is valid
-             */
-            addrP = addrList;
-            prevP = NULL;
-            while (addrP != NULL) {
-                if (addrP->addr.him4.sin_addr.s_addr == dhcp_addr) {
-                    break;
-                }
-                prevP = addrP;
-                addrP = addrP->next;
-            }
-
-            /*
-             * Address is valid - now check how many non-WAN adapters
-             * don't have addresses yet.
-             */
-            if (addrP != NULL) {
-                adapter *adapterP = adapterList;
-                adapter *nobindingsP = NULL;
-
-                while (adapterP != NULL) {
-                    if (adapterP->addrs == NULL && !adapterP->is_wan_driver) {
-                        if (nobindingsP == NULL) {
-                            nobindingsP = adapterP;
-                        } else {
-                            /* already found one */
-                            nobindingsP = NULL;
-                            break;
-                        }
-                    }
-                    adapterP = adapterP->next;
-                }
-
-                /*
-                 * One non-WAN adapter remaining
-                 */
-                if (nobindingsP != NULL) {
-                    nobindingsP->addrs = addrP;
-
-                    /* remove from addrList */
-                    if (prevP == NULL) {
-                        addrList = addrP->next;
-                    } else {
-                        prevP->next = addrP->next;
-                    }
-                    addrP->next = NULL;
-                    address_count--;
-                }
-            }
-        }
-    }
-
-    /*
-     * Finally we do one final attempt to re-assign any remaining
-     * addresses. This catches the case of 2 adapters that have their
-     * addresses dynamically assigned (specifically NIC with DHCP, and
-     * Modem using RAS/PPP).
-     */
-    address_count = allocateRemaining(adapterList, address_count, addrList);
-    if (address_count == 0) {
-        return adapterList;
-    }
-
-    /*
-     * Free any unallocated addresses
-     */
-    if (address_count > 0) {
-        free_netaddr(addrList);
-    }
-
-    /*
-     * Return the adapter List.
-     */
-    return adapterList;
-
-}
-
-
-/*
- * Enumerate network interfaces. If successful returns the number of
- * network interfaces and netifPP returning a list of netif structures.
- * Returns -1 with exception thrown if error.
- */
-int enumInterfaces_win9x(JNIEnv *env, netif **netifPP) {
-    adapter *adapters, *adapterP;
-    int cnt = 0;
-    netif *netifP = NULL;
-
-    /* enumerate network configuration */
-    adapters = loadConfig(env);
-    if (adapters == NULL) {
-        return -1;
-    }
-
-    /*
-     * loadConfig returns an adapter list - we need to create a corresponding
-     * list of netif structures.
-     */
-    adapterP = adapters;
-    while (adapterP != NULL) {
-        netif *ifs = (netif *)calloc(1, sizeof(netif));
-
-        if (ifs == NULL) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-            free_adapters(adapters);
-            free_netif(netifP);
-            return -1;
-        }
-
-        ifs->name = _strdup(adapterP->name);
-        ifs->displayName = _strdup(adapterP->displayName);
-        ifs->dwIndex = adapterP->index;
-        ifs->index = adapterP->index;
-        ifs->next = netifP;
-        netifP = ifs;
-
-        if (ifs->name == NULL || ifs->displayName == NULL) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-            free_adapters(adapters);
-            free_netif(netifP);
-            return -1;
-        }
-
-        cnt++;
-        adapterP = adapterP->next;
-    }
-
-    /*
-     * Put the adapter list in the cache
-     */
-    EnterCriticalSection(&cacheLock);
-    {
-        if (cachedAdapterList != NULL) {
-            free_adapters(cachedAdapterList);
-        }
-        cachedAdapterList = adapters;
-    }
-    LeaveCriticalSection(&cacheLock);
-
-    /*
-     * Return the netif list
-     */
-    *netifPP = netifP;
-    return cnt;
-}
-
-/*
- * Enumerate the addresses for the specified network interface. If successful
- * returns the number of addresses bound to the interface and sets netaddrPP
- * to be a list of netaddr structures. Returns -1 if error.
- */
-int enumAddresses_win9x(JNIEnv *env, netif *netifP, netaddr **netaddrPP) {
-
-    EnterCriticalSection(&cacheLock);
-    {
-        adapter *adapterP = cachedAdapterList;
-        while (adapterP != NULL) {
-            if (strcmp(adapterP->name, netifP->name) == 0) {
-
-                netaddr *newlist = NULL;
-                netaddr *curr = adapterP->addrs;
-                int cnt = 0;
-
-                while (curr != NULL) {
-                    /*
-                     * Clone the netaddr and add it to newlist.
-                     */
-                    netaddr *tmp = (netaddr *)calloc(1, sizeof(netaddr));
-                    if (tmp == NULL) {
-                        LeaveCriticalSection(&cacheLock);
-                        JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
-                        free_netaddr(newlist);
-                        return -1;
-                    }
-                    tmp->addr = curr->addr;
-                    tmp->next = newlist;
-                    newlist = tmp;
-
-                    cnt++;
-                    curr = curr->next;
-                }
-
-                *netaddrPP = newlist;
-                LeaveCriticalSection(&cacheLock);
-                return cnt;
-            }
-            adapterP = adapterP->next;
-        }
-    }
-    LeaveCriticalSection(&cacheLock);
-
-    *netaddrPP = NULL;
-    return 0;
-}
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Thu Mar 31 22:07:32 2011 -0700
@@ -43,14 +43,6 @@
 extern int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP);
 int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);
 
-/* IP helper library routines */
-int (PASCAL FAR *GetIpAddrTable_fn)();
-int (PASCAL FAR *GetIfTable_fn)();
-int (PASCAL FAR *GetFriendlyIfIndex_fn)();
-int (PASCAL FAR *GetAdaptersAddresses_fn)();
-int (PASCAL FAR *GetAdaptersInfo_fn)();
-int (PASCAL FAR *GetNumberOfInterfaces_fn)();
-
 #ifdef DEBUG
 void printnif (netif *nif) {
 #ifdef _WIN64
@@ -96,14 +88,14 @@
     flags = GAA_FLAG_SKIP_DNS_SERVER;
     flags |= GAA_FLAG_SKIP_MULTICAST;
     flags |= GAA_FLAG_INCLUDE_PREFIX;
-    ret = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+    ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     if (ret == ERROR_BUFFER_OVERFLOW) {
         adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
         if (adapterInfo == 0) {
             return -1;
         }
         bufsize = len;
-        ret = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+        ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     }
     if (ret != ERROR_SUCCESS) {
         free (adapterInfo);
@@ -133,7 +125,7 @@
     flags = GAA_FLAG_SKIP_DNS_SERVER;
     flags |= GAA_FLAG_SKIP_MULTICAST;
     flags |= GAA_FLAG_INCLUDE_PREFIX;
-    val = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+    val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     if (val == ERROR_BUFFER_OVERFLOW) {
         adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
         if (adapterInfo == 0) {
@@ -141,7 +133,7 @@
             return NULL;
         }
         bufsize = len;
-        val = (*GetAdaptersAddresses_fn) (AF_UNSPEC, flags, NULL, adapterInfo, &len);
+        val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     }
     if (val != ERROR_SUCCESS) {
         free (adapterInfo);
@@ -182,7 +174,7 @@
     * as what previous JDK versions would return.
     */
 
-    ret = enumInterfaces_win (env, netifPP);
+    ret = enumInterfaces(env, netifPP);
     if (ret == -1) {
         return -1;
     } else {
@@ -221,7 +213,7 @@
      *  (b)  IPv6 information for IPv6 only interfaces (probably tunnels)
      *
      * For compatibility with previous releases we use the naming
-     * information gotten from enumInterfaces_win() for (a) entries
+     * information gotten from enumInterfaces() for (a) entries
      * However, the index numbers are taken from the new API.
      *
      * The procedure is to go through the list of adapters returned
@@ -439,7 +431,8 @@
     netifObj = (*env)->NewObject(env, ni_class, ni_ctor);
     name = (*env)->NewStringUTF(env, ifs->name);
     if (ifs->dNameIsUnicode) {
-        displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName, wcslen ((PWCHAR)ifs->displayName));
+        displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName,
+                                        (jsize)wcslen ((PWCHAR)ifs->displayName));
     } else {
         displayName = (*env)->NewStringUTF(env, ifs->displayName);
     }
--- a/jdk/src/windows/native/java/net/net_util_md.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/java/net/net_util_md.c	Thu Mar 31 22:07:32 2011 -0700
@@ -39,10 +39,6 @@
 /* true if SO_RCVTIMEO is supported */
 jboolean isRcvTimeoutSupported = JNI_TRUE;
 
-LPFN_GETADDRINFO getaddrinfo_ptr = NULL;
-LPFN_FREEADDRINFO freaddrinfo_ptr = NULL;
-LPFN_GETNAMEINFO getnameinfo_ptr = NULL;
-
 /*
  * Table of Windows Sockets errors, the specific exception we
  * throw for the error, and the error text.
@@ -233,38 +229,15 @@
 
 jint  IPv6_supported()
 {
-    HMODULE lib;
-    int fd = socket(AF_INET6, SOCK_STREAM, 0) ;
-    if (fd < 0) {
-        return JNI_FALSE;
-    }
-    closesocket (fd);
-
-    if ((lib = LoadLibrary ("ws2_32.dll")) == NULL) {
+    SOCKET s = socket(AF_INET6, SOCK_STREAM, 0) ;
+    if (s == INVALID_SOCKET) {
         return JNI_FALSE;
     }
-    if ((getaddrinfo_ptr = (LPFN_GETADDRINFO)GetProcAddress (lib, "getaddrinfo")) == NULL) {
-        FreeLibrary (lib);
-        return JNI_FALSE;
-    }
-    if ((freeaddrinfo_ptr = (LPFN_FREEADDRINFO)GetProcAddress (lib, "freeaddrinfo")) == NULL) {
-        FreeLibrary (lib);
-        return JNI_FALSE;
-    }
-    if ((getnameinfo_ptr = (LPFN_GETNAMEINFO)GetProcAddress (lib, "getnameinfo")) == NULL) {
-        FreeLibrary (lib);
-        return JNI_FALSE;
-    }
-    FreeLibrary(lib);
+    closesocket(s);
 
     return JNI_TRUE;
 }
 
-jboolean NET_addrtransAvailable() {
-    return (jboolean)(getaddrinfo_ptr != NULL);
-}
-
-
 /*
  * Return the default TOS value
  */
@@ -664,7 +637,7 @@
     if (family == AF_INET && (b->addr->him4.sin_addr.s_addr != INADDR_ANY)) {
         /* bind to v4 only */
         int ret;
-        ret = NET_Bind (b->ipv4_fd, (struct sockaddr *)b->addr,
+        ret = NET_Bind ((int)b->ipv4_fd, (struct sockaddr *)b->addr,
                                 sizeof (struct sockaddr_in));
         if (ret == SOCKET_ERROR) {
             CLOSE_SOCKETS_AND_RETURN;
@@ -676,7 +649,7 @@
     if (family == AF_INET6 && (!IN6_IS_ADDR_ANY(&b->addr->him6.sin6_addr))) {
         /* bind to v6 only */
         int ret;
-        ret = NET_Bind (b->ipv6_fd, (struct sockaddr *)b->addr,
+        ret = NET_Bind ((int)b->ipv6_fd, (struct sockaddr *)b->addr,
                                 sizeof (struct SOCKADDR_IN6));
         if (ret == SOCKET_ERROR) {
             CLOSE_SOCKETS_AND_RETURN;
@@ -691,15 +664,15 @@
     memset (&oaddr, 0, sizeof(oaddr));
     if (family == AF_INET) {
         ofamily = AF_INET6;
-        fd = b->ipv4_fd;
-        ofd = b->ipv6_fd;
+        fd = (int)b->ipv4_fd;
+        ofd = (int)b->ipv6_fd;
         port = (u_short)GET_PORT (b->addr);
         IN6ADDR_SETANY (&oaddr.him6);
         oaddr.him6.sin6_port = port;
     } else {
         ofamily = AF_INET;
-        ofd = b->ipv4_fd;
-        fd = b->ipv6_fd;
+        ofd = (int)b->ipv4_fd;
+        fd = (int)b->ipv6_fd;
         port = (u_short)GET_PORT (b->addr);
         oaddr.him4.sin_family = AF_INET;
         oaddr.him4.sin_port = port;
@@ -744,11 +717,11 @@
             b->ipv6_fd = SOCKET_ERROR;
 
             /* create two new sockets */
-            fd = socket (family, sotype, 0);
+            fd = (int)socket (family, sotype, 0);
             if (fd == SOCKET_ERROR) {
                 CLOSE_SOCKETS_AND_RETURN;
             }
-            ofd = socket (ofamily, sotype, 0);
+            ofd = (int)socket (ofamily, sotype, 0);
             if (ofd == SOCKET_ERROR) {
                 CLOSE_SOCKETS_AND_RETURN;
             }
@@ -802,7 +775,7 @@
     DWORD b;
     struct sockaddr_in6 route;
     SOCKET fd = socket(AF_INET6, SOCK_STREAM, 0);
-    if (fd < 0) {
+    if (fd == INVALID_SOCKET) {
         return 0;
     }
 
@@ -810,7 +783,7 @@
                     (void *)target_addr, sizeof(struct sockaddr_in6),
                     (void *)&route, sizeof(struct sockaddr_in6),
                     &b, 0, 0);
-    if (ret < 0) {
+    if (ret == SOCKET_ERROR) {
         // error
         closesocket(fd);
         return 0;
@@ -1001,10 +974,10 @@
 }
 
 int NET_Socket (int domain, int type, int protocol) {
-    int sock;
+    SOCKET sock;
     sock = socket (domain, type, protocol);
     if (sock != INVALID_SOCKET) {
         SetHandleInformation((HANDLE)(uintptr_t)sock, HANDLE_FLAG_INHERIT, FALSE);
     }
-    return sock;
+    return (int)sock;
 }
--- a/jdk/src/windows/native/java/net/net_util_md.h	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/java/net/net_util_md.h	Thu Mar 31 22:07:32 2011 -0700
@@ -209,10 +209,6 @@
     );
 #endif
 
-LPFN_GETADDRINFO getaddrinfo_ptr;
-LPFN_FREEADDRINFO freeaddrinfo_ptr;
-LPFN_GETNAMEINFO getnameinfo_ptr;
-
 /* used to disable connection reset messages on Windows XP */
 #ifndef SIO_UDP_CONNRESET
 #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
@@ -302,8 +298,6 @@
 
 void NET_ThrowSocketException(JNIEnv *env, char* msg);
 
-jboolean NET_addrtransAvailable();
-
 /*
  * differs from NET_Timeout() as follows:
  *
--- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 #include <iprtrmib.h>
 #include <time.h>
 #include <assert.h>
+#include <iphlpapi.h>
 
 #include "jni_util.h"
 
@@ -42,93 +43,17 @@
 #define IS_SL_FOUND(sts)    (sts & STS_SL_FOUND)
 #define IS_NS_FOUND(sts)    (sts & STS_NS_FOUND)
 
-/*
- * Visual C++ SP3 (as required by J2SE 1.4.0) is missing some of
- * the definitions required for the IP helper library routines that
- * were added in Windows 98 & Windows 2000.
- */
-#ifndef MAX_ADAPTER_NAME_LENGTH
-
-#define MAX_ADAPTER_ADDRESS_LENGTH      8
-#define MAX_ADAPTER_DESCRIPTION_LENGTH  128
-#define MAX_ADAPTER_NAME_LENGTH         256
-#define MAX_HOSTNAME_LEN                128
-#define MAX_DOMAIN_NAME_LEN             128
-#define MAX_SCOPE_ID_LEN                256
-
-typedef struct {
-    char String[4 * 4];
-} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
-
-typedef struct _IP_ADDR_STRING {
-    struct _IP_ADDR_STRING* Next;
-    IP_ADDRESS_STRING IpAddress;
-    IP_MASK_STRING IpMask;
-    DWORD Context;
-} IP_ADDR_STRING, *PIP_ADDR_STRING;
-
-typedef struct _IP_ADAPTER_INFO {
-    struct _IP_ADAPTER_INFO* Next;
-    DWORD ComboIndex;
-    char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
-    char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
-    UINT AddressLength;
-    BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
-    DWORD Index;
-    UINT Type;
-    UINT DhcpEnabled;
-    PIP_ADDR_STRING CurrentIpAddress;
-    IP_ADDR_STRING IpAddressList;
-    IP_ADDR_STRING GatewayList;
-    IP_ADDR_STRING DhcpServer;
-    BOOL HaveWins;
-    IP_ADDR_STRING PrimaryWinsServer;
-    IP_ADDR_STRING SecondaryWinsServer;
-    time_t LeaseObtained;
-    time_t LeaseExpires;
-} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
-
-typedef struct _FIXED_INFO {
-    char HostName[MAX_HOSTNAME_LEN + 4] ;
-    char DomainName[MAX_DOMAIN_NAME_LEN + 4];
-    PIP_ADDR_STRING CurrentDnsServer;
-    IP_ADDR_STRING DnsServerList;
-    UINT NodeType;
-    char ScopeId[MAX_SCOPE_ID_LEN + 4];
-    UINT EnableRouting;
-    UINT EnableProxy;
-    UINT EnableDns;
-} FIXED_INFO, *PFIXED_INFO;
-
-#endif
-
-
-/* IP helper library routine used on 98/2000/XP */
-static int (PASCAL FAR *GetNetworkParams_fn)();
-static int (PASCAL FAR *GetAdaptersInfo_fn)();
-static int (PASCAL FAR *NotifyAddrChange_fn)();
-
-/*
- * Routines to obtain domain name and name servers are OS specific
- */
-typedef int (*LoadConfig)(char *sl, char *ns);
-static LoadConfig loadconfig_fn;
-
-
-/*
- * JNI ids
- */
+/* JNI ids */
 static jfieldID searchlistID;
 static jfieldID nameserversID;
 
-
 /*
  * Utility routine to append s2 to s1 with a space delimiter.
  *  strappend(s1="abc", "def")  => "abc def"
  *  strappend(s1="", "def")     => "def
  */
 void strappend(char *s1, char *s2) {
-    int len;
+    size_t len;
 
     if (s2[0] == '\0')                      /* nothing to append */
         return;
@@ -145,356 +70,6 @@
     strcat(s1, s2);
 }
 
-
-/*
- * Windows 95/98/ME for static TCP/IP configuration.
- *
- * Use registry approach for statically configured TCP/IP settings.
- * Registry entries described in "MS TCP/IP and Windows 95 Networking"
- * (Microsoft TechNet site).
- */
-static int loadStaticConfig9x(char *sl, char *ns) {
-    LONG ret;
-    HANDLE hKey;
-    DWORD dwLen;
-    ULONG ulType;
-    char result[MAX_STR_LEN];
-    int sts = STS_NO_CONFIG;
-
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                       "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP",
-                       0,
-                       KEY_READ,
-                       (PHKEY)&hKey);
-    if (ret == ERROR_SUCCESS) {
-        /*
-         * Determine suffix list
-         */
-        result[0] = '\0';
-        dwLen = sizeof(result);
-        ret = RegQueryValueEx(hKey, "SearchList", NULL, &ulType,
-                              (LPBYTE)&result, &dwLen);
-        if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
-            dwLen = sizeof(result);
-            ret = RegQueryValueEx(hKey, "Domain", NULL, &ulType,
-                                 (LPBYTE)&result, &dwLen);
-        }
-        if (ret == ERROR_SUCCESS) {
-            assert(ulType == REG_SZ);
-            if (strlen(result) > 0) {
-                strappend(sl, result);
-                sts |= STS_SL_FOUND;
-            }
-        }
-
-        /*
-         * Determine DNS name server(s)
-         */
-        result[0] = '\0';
-        dwLen = sizeof(result);
-        ret = RegQueryValueEx(hKey, "NameServer", NULL, &ulType,
-                              (LPBYTE)&result, &dwLen);
-        if (ret == ERROR_SUCCESS) {
-            assert(ulType == REG_SZ);
-            if (strlen(result) > 0) {
-                strappend(ns, result);
-                sts |= STS_NS_FOUND;
-            }
-        }
-
-        RegCloseKey(hKey);
-    }
-
-    return sts;
-}
-
-
-/*
- * Windows 95
- *
- * Use registry approach for statically configured TCP/IP settings
- * (see loadStaticConfig9x).
- *
- * If DHCP is used we examine the DHCP vendor specific extensions. We parse
- * this based on format described in RFC 2132.
- *
- * If Dial-up Networking (DUN) is used then this TCP/IP settings cannot
- * be determined here.
- */
-static int loadConfig95(char *sl, char *ns) {
-    int sts;
-    int index;
-    LONG ret;
-    HANDLE hKey;
-    DWORD dwLen;
-    ULONG ulType;
-    char optionInfo[MAX_STR_LEN];
-
-    /*
-     * First try static configuration - if found we are done.
-     */
-    sts = loadStaticConfig9x(sl, ns);
-    if (IS_SL_FOUND(sts) && IS_NS_FOUND(sts)) {
-        return sts;
-    }
-
-    /*
-     * Try DHCP. DHCP information is stored in :-
-     * SYSTEM\CurrentControlSet\Services\VxD\DHCP\DhcpInfoXX
-     *
-     * The key is normally DhcpInfo00\OptionInfo (see Article Q255245 on
-     * Microsoft site). However when multiple cards are added & removed we
-     * have observed that it can be located in DhcpInfo{01,02, ...}.
-     * As a hack we search all DhcpInfoXX keys until we find OptionInfo.
-     */
-    for (index=0; index<99; index++) {
-        char key[MAX_STR_LEN];
-        sprintf(key, "SYSTEM\\CurrentControlSet\\Services\\VxD\\DHCP\\DhcpInfo%02d",
-                index);
-
-        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, (PHKEY)&hKey);
-        if (ret != ERROR_SUCCESS) {
-            /* end of DhcpInfoXX entries */
-            break;
-        }
-
-        dwLen = sizeof(optionInfo);
-        ret = RegQueryValueEx(hKey, "OptionInfo",  NULL, &ulType,
-                              (LPBYTE)optionInfo, &dwLen);
-        RegCloseKey(hKey);
-
-        if (ret == ERROR_SUCCESS) {
-            /* OptionInfo found */
-            break;
-        }
-    }
-
-    /*
-     * If OptionInfo was found then we parse (as the 'options' field of
-     * the DHCP packet - see RFC 2132).
-     */
-    if (ret == ERROR_SUCCESS) {
-        unsigned int pos = 0;
-
-        while (pos < dwLen) {
-            int code, len;
-
-            code = optionInfo[pos];
-            pos++;
-            if (pos >= dwLen) break;    /* bad packet */
-
-            len = optionInfo[pos];
-            pos++;
-
-            if (pos+len > dwLen) break; /* bad packet */
-
-            /*
-             * Domain Name - see RFC 2132 section 3.17
-             */
-            if (!IS_SL_FOUND(sts)) {
-                if (code == 0xf) {
-                    char domain[MAX_STR_LEN];
-
-                    assert(len < MAX_STR_LEN);
-
-                    memcpy((void *)domain, (void *)&(optionInfo[pos]), (size_t)len);
-                    domain[len] = '\0';
-
-                    strappend(sl, domain);
-                    sts |= STS_SL_FOUND;
-                }
-            }
-
-            /*
-             * DNS Option - see RFC 2132 section 3.8
-             */
-            if (!IS_NS_FOUND(sts)) {
-                if (code == 6 && (len % 4) == 0) {
-                    while (len > 0 && pos < dwLen) {
-                        char addr[32];
-                        sprintf(addr, "%d.%d.%d.%d",
-                               (unsigned char)optionInfo[pos],
-                               (unsigned char)optionInfo[pos+1],
-                               (unsigned char)optionInfo[pos+2],
-                               (unsigned char)optionInfo[pos+3]);
-                        pos += 4;
-                        len -= 4;
-
-                        /*
-                         * Append to list of name servers
-                         */
-                        strappend(ns, addr);
-                        sts |= STS_NS_FOUND;
-                    }
-                }
-            }
-
-            /*
-             * Onto the next options
-             */
-            pos += len;
-        }
-    }
-
-    return sts;
-}
-
-/*
- * Windows 98/ME
- *
- * Use registry approach for statically configured TCP/IP settings
- * (see loadStaticConfig9x).
- *
- * If configuration is not static then use IP helper library routine
- * GetNetworkParams to obtain the network settings which include the
- * domain name and the DNS servers. Note that we use the registry in
- * preference to GetNetworkParams as the domain name is not populated
- * by GetNetworkParams if the configuration is static.
- */
-static int loadConfig98(char *sl, char *ns) {
-    FIXED_INFO *infoP;
-    ULONG size;
-    DWORD ret;
-    int sts;
-
-    /*
-     * Use registry approach to pick up static configuation.
-     */
-    sts = loadStaticConfig9x(sl, ns);
-    if (IS_SL_FOUND(sts) && IS_NS_FOUND(sts)) {
-        return sts;
-    }
-
-    /*
-     * Use IP helper library to obtain dynamic configuration (DHCP and
-     * DUN).
-     */
-    size = sizeof(FIXED_INFO);
-    infoP = (FIXED_INFO *)malloc(size);
-    if (infoP) {
-        ret = (*GetNetworkParams_fn)(infoP, &size);
-        if (ret == ERROR_BUFFER_OVERFLOW) {
-            infoP = (FIXED_INFO *)realloc(infoP, size);
-            if (infoP != NULL)
-                ret = (*GetNetworkParams_fn)(infoP, &size);
-        }
-    }
-    if (infoP == NULL) {
-        return sts;
-    }
-    if (ret == ERROR_SUCCESS) {
-        /*
-         * Use DomainName if search-list not specified.
-         */
-        if (!IS_SL_FOUND(sts)) {
-            strappend(sl, infoP->DomainName);
-            sts |= STS_SL_FOUND;
-        }
-
-        /*
-         * Use DnsServerList if not statically configured.
-         */
-        if (!IS_NS_FOUND(sts)) {
-            PIP_ADDR_STRING dnsP = &(infoP->DnsServerList);
-            do {
-                strappend(ns, (char *)&(dnsP->IpAddress));
-                dnsP = dnsP->Next;
-            } while (dnsP != NULL);
-            sts |= STS_NS_FOUND;
-        }
-    }
-
-    free(infoP);
-
-    return sts;
-}
-
-
-/*
- * Windows NT
- *
- * Use registry approach based on settings described in "TCP/IP and
- * NBT Configuration Parameters for Windows" - Article Q12062 on
- * Microsoft site.
- *
- * All non-RAS TCP/IP settings are stored in HKEY_LOCAL_MACHINE in
- * the SYSTEM\CurrentControlSet\Services\Tcpip\Parameters key.
- *
- * If SearchList if not provided then return Domain or DhcpDomain.
- * If Domain is specified it overrides DhcpDomain even if DHCP is
- * enabled.
- *
- * DNS name servers based on NameServer or DhcpNameServer settings.
- * NameServer overrides DhcpNameServer even if DHCP is enabled.
- */
-static int loadConfigNT(char *sl, char *ns) {
-    LONG ret;
-    HANDLE hKey;
-    DWORD dwLen;
-    ULONG ulType;
-    char result[MAX_STR_LEN];
-    int sts = STS_NO_CONFIG;
-
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                       "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
-                       0,
-                       KEY_READ,
-                       (PHKEY)&hKey);
-    if (ret != ERROR_SUCCESS) {
-        return sts;
-    }
-
-    /*
-     * Determine search list
-     */
-    result[0] = '\0';
-    dwLen = sizeof(result);
-    ret = RegQueryValueEx(hKey, "SearchList", NULL, &ulType,
-                          (LPBYTE)&result, &dwLen);
-    if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
-        dwLen = sizeof(result);
-        ret = RegQueryValueEx(hKey, "Domain", NULL, &ulType,
-                             (LPBYTE)&result, &dwLen);
-        if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
-            dwLen = sizeof(result);
-            ret = RegQueryValueEx(hKey, "DhcpDomain", NULL, &ulType,
-                                 (LPBYTE)&result, &dwLen);
-        }
-    }
-    if (ret == ERROR_SUCCESS) {
-        assert(ulType == REG_SZ);
-        if (strlen(result) > 0) {
-            strappend(sl, result);
-            sts |= STS_SL_FOUND;
-        }
-    }
-
-    /*
-     * Determine DNS name server(s)
-     */
-    result[0] = '\0';
-    dwLen = sizeof(result);
-    ret = RegQueryValueEx(hKey, "NameServer", NULL, &ulType,
-                          (LPBYTE)&result, &dwLen);
-    if ((ret != ERROR_SUCCESS) || (strlen(result) == 0)) {
-        dwLen = sizeof(result);
-        ret = RegQueryValueEx(hKey, "DhcpNameServer", NULL, &ulType,
-                              (LPBYTE)&result, &dwLen);
-    }
-    if (ret == ERROR_SUCCESS) {
-        assert(ulType == REG_SZ);
-        if (strlen(result) > 0) {
-            strappend(ns, result);
-            sts |= STS_NS_FOUND;
-        }
-    }
-
-    RegCloseKey(hKey);
-
-    return sts;
-}
-
-
 /*
  * Windows 2000/XP
  *
@@ -510,7 +85,7 @@
  * names of each adapter and then query the corresponding registry
  * settings to obtain NameServer/DhcpNameServer and Domain/DhcpDomain.
  */
-static int loadConfig2000(char *sl, char *ns) {
+static int loadConfig(char *sl, char *ns) {
     IP_ADAPTER_INFO *adapterP;
     ULONG size;
     DWORD ret;
@@ -547,10 +122,10 @@
      */
     size = sizeof(IP_ADAPTER_INFO);
     adapterP = (IP_ADAPTER_INFO *)malloc(size);
-    ret = (*GetAdaptersInfo_fn)(adapterP, &size);
+    ret = GetAdaptersInfo(adapterP, &size);
     if (ret == ERROR_BUFFER_OVERFLOW) {
         adapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
-        ret = (*GetAdaptersInfo_fn)(adapterP, &size);
+        ret = GetAdaptersInfo(adapterP, &size);
     }
 
     /*
@@ -648,87 +223,15 @@
 
 
 /*
- * Initialization :-
- *
- * 1. Based on OS version set the function pointer for OS specific load
- *    configuration routine.
- *
- * 2. On 98/2000/XP load the IP helper library.
- *
- * 3. Initialize JNI field IDs.
- *
+ * Initialize JNI field IDs.
  */
 JNIEXPORT void JNICALL
 Java_sun_net_dns_ResolverConfigurationImpl_init0(JNIEnv *env, jclass cls)
 {
-    OSVERSIONINFO ver;
-    jboolean loadHelperLibrary = JNI_TRUE;
-
-    /*
-     * First we figure out which OS is running
-     */
-    ver.dwOSVersionInfoSize = sizeof(ver);
-    GetVersionEx(&ver);
-
-    if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
-        if ((ver.dwMajorVersion == 4) && (ver.dwMinorVersion == 0)) {
-            /*
-             * Windows 95
-             */
-            loadHelperLibrary = JNI_FALSE;
-            loadconfig_fn = loadConfig95;
-        } else {
-            /*
-             * Windows 98/ME
-             */
-            loadHelperLibrary = JNI_TRUE;
-            loadconfig_fn = loadConfig98;
-        }
-    }
-
-    if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-        if (ver.dwMajorVersion <= 4) {
-            /*
-             * Windows NT
-             */
-            loadHelperLibrary = JNI_FALSE;
-            loadconfig_fn = loadConfigNT;
-        } else {
-            /*
-             * Windows 2000/XP
-             */
-            loadHelperLibrary = JNI_TRUE;
-            loadconfig_fn = loadConfig2000;
-        }
-    }
-
-    /*
-     * On 98/2000/XP we load the IP Helper Library.
-     */
-    if (loadHelperLibrary) {
-        HANDLE h = LoadLibrary("iphlpapi.dll");
-
-        if (h != NULL) {
-            GetNetworkParams_fn = (int (PASCAL FAR *)())GetProcAddress(h, "GetNetworkParams");
-            GetAdaptersInfo_fn = (int (PASCAL FAR *)())GetProcAddress(h, "GetAdaptersInfo");
-
-            NotifyAddrChange_fn = (int (PASCAL FAR *)())GetProcAddress(h, "NotifyAddrChange");
-        }
-
-        if (GetNetworkParams_fn == NULL || GetAdaptersInfo_fn == NULL) {
-            JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", "iphlpapi.dll");
-            return;
-        }
-    }
-
-    /*
-     * Get JNI ids
-     */
     searchlistID = (*env)->GetStaticFieldID(env, cls, "os_searchlist",
                                       "Ljava/lang/String;");
     nameserversID = (*env)->GetStaticFieldID(env, cls, "os_nameservers",
                                       "Ljava/lang/String;");
-
 }
 
 /*
@@ -746,8 +249,7 @@
     searchlist[0] = '\0';
     nameservers[0] = '\0';
 
-    /* call OS specific routine */
-    (void)(*loadconfig_fn)(searchlist, nameservers);
+    loadConfig(searchlist, nameservers);
 
     /*
      * Populate static fields in sun.net.DefaultResolverConfiguration
@@ -772,17 +274,15 @@
     HANDLE h;
     DWORD rc, xfer;
 
-    if (NotifyAddrChange_fn != NULL) {
-        ol.hEvent = (HANDLE)0;
-        rc = (*NotifyAddrChange_fn)(&h, &ol);
-        if (rc == ERROR_IO_PENDING) {
-            rc = GetOverlappedResult(h, &ol, &xfer, TRUE);
-            if (rc != 0) {
-                return 0;   /* address changed */
-            }
+    ol.hEvent = (HANDLE)0;
+    rc = NotifyAddrChange(&h, &ol);
+    if (rc == ERROR_IO_PENDING) {
+        rc = GetOverlappedResult(h, &ol, &xfer, TRUE);
+        if (rc != 0) {
+            return 0;   /* address changed */
         }
     }
 
-    /* NotifyAddrChange not support or error */
+    /* error */
     return -1;
 }
--- a/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c	Thu Mar 31 22:07:32 2011 -0700
@@ -41,18 +41,6 @@
 #define SECURITY_WIN32
 #include "sspi.h"
 
-
-/*
- * OS calls loaded from DLL on intialization
- */
-
-static FREE_CREDENTIALS_HANDLE_FN pFreeCredentialsHandle;
-static ACQUIRE_CREDENTIALS_HANDLE_FN pAcquireCredentialsHandle;
-static FREE_CONTEXT_BUFFER_FN pFreeContextBuffer;
-static INITIALIZE_SECURITY_CONTEXT_FN pInitializeSecurityContext;
-static COMPLETE_AUTH_TOKEN_FN pCompleteAuthToken;
-static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext;
-
 static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle);
 
 static jfieldID ntlm_ctxHandleID;
@@ -63,48 +51,8 @@
 JNIEXPORT void JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_initFirst
 (JNIEnv *env, jclass clazz)
 {
-    OSVERSIONINFO   version;
-    UCHAR libName[MAX_PATH];
-
     ntlm_ctxHandleID = (*env)->GetFieldID(env, clazz, "ctxHandle", "J");
     ntlm_crdHandleID = (*env)->GetFieldID(env, clazz, "crdHandle", "J");
-
-    version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-    GetVersionEx (&version);
-
-    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-        strcpy (libName, "security.dll" );
-    }
-    else if (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
-        strcpy (libName, "secur32.dll" );
-    }
-
-    lib = LoadLibrary (libName);
-
-    pFreeCredentialsHandle
-        = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress(
-        lib, "FreeCredentialsHandle" );
-
-    pAcquireCredentialsHandle
-        = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress(
-        lib, "AcquireCredentialsHandleA" );
-
-    pFreeContextBuffer
-        = (FREE_CONTEXT_BUFFER_FN) GetProcAddress(
-        lib, "FreeContextBuffer" );
-
-    pInitializeSecurityContext
-        = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress(
-        lib, "InitializeSecurityContextA" );
-
-    pCompleteAuthToken
-        = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress(
-        lib, "CompleteAuthToken" );
-
-    pDeleteSecurityContext
-        = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress(
-        lib, "DeleteSecurityContext" );
-
 }
 
 /*
@@ -158,17 +106,17 @@
 
         if ( pUser != NULL ) {
             AuthId.User       = (unsigned char *) pUser;
-            AuthId.UserLength = strlen( pUser );
+            AuthId.UserLength = (unsigned long) strlen( pUser );
         }
 
         if ( pPassword != NULL ) {
             AuthId.Password       = (unsigned char *) pPassword;
-            AuthId.PasswordLength = strlen( pPassword );
+            AuthId.PasswordLength = (unsigned long) strlen( pPassword );
         }
 
         if ( pDomain != NULL ) {
             AuthId.Domain       = (unsigned char *) pDomain;
-            AuthId.DomainLength = strlen( pDomain );
+            AuthId.DomainLength = (unsigned long) strlen( pDomain );
         }
 
         AuthId.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
@@ -176,7 +124,7 @@
         pAuthId = NULL;
     }
 
-    ss = pAcquireCredentialsHandle(
+    ss = AcquireCredentialsHandleA(
         NULL, "NTLM", SECPKG_CRED_OUTBOUND,
         NULL, pAuthId, NULL, NULL,
         pCred, &ltime
@@ -258,7 +206,7 @@
      *  need to send the out buffer if there are bytes to send
      */
 
-    ss = pInitializeSecurityContext(
+    ss = InitializeSecurityContextA(
         pCred, pCtx, NULL, 0, 0, SECURITY_NATIVE_DREP,
         lastToken ? &InBuffDesc : NULL, 0, newContext, &OutBuffDesc,
         &ContextAttributes, &ltime
@@ -274,7 +222,7 @@
     }
 
     if ((ss == SEC_I_COMPLETE_NEEDED) || (ss == SEC_I_COMPLETE_AND_CONTINUE) ) {
-        ss = pCompleteAuthToken( pCtx, &OutBuffDesc );
+        ss = CompleteAuthToken( pCtx, &OutBuffDesc );
 
         if (ss < 0) {
             endSequence (pCred, pCtx);
@@ -300,12 +248,12 @@
 
 static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle) {
     if (credHand != 0) {
-        pFreeCredentialsHandle (credHand);
-        free (credHand);
+        FreeCredentialsHandle(credHand);
+        free(credHand);
     }
 
     if (ctxHandle != 0) {
-        pDeleteSecurityContext(ctxHandle);
-        free (ctxHandle);
+        DeleteSecurityContext(ctxHandle);
+        free(ctxHandle);
     }
 }
--- a/jdk/test/Makefile	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/Makefile	Thu Mar 31 22:07:32 2011 -0700
@@ -261,6 +261,7 @@
 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
 	           && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
+	           && $(CHMOD) -R a+r . \
 	           && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt
 STATS_TXT_NAME = Stats.txt
@@ -312,7 +313,9 @@
   else \
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
   fi; \
-  $(CAT) $(STATS_TXT); \
+  if [ -f $(STATS_TXT) ] ; then \
+    $(CAT) $(STATS_TXT); \
+  fi; \
   $(ZIP_UP_RESULTS) ; \
   $(TESTEXIT) \
 )
@@ -370,10 +373,10 @@
 
 # Create exclude list for this platform and arch
 ifdef NO_EXCLUDES
-$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
+$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
 	@$(ECHO) "NOTHING_EXCLUDED" > $@
 else
-$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
+$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
 	@$(RM) $@ $@.temp1 $@.temp2
 	@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)'          ) ;\
@@ -385,7 +388,7 @@
           ($(ECHO) "#") ;\
         ) | $(SED) -e 's@^[\ ]*@@' \
           | $(EGREP) -v '^#' > $@.temp1
-	@for tdir in $(TESTDIRS) ; do \
+	for tdir in $(TESTDIRS) SOLARIS_10_SH_BUG_NO_EMPTY_FORS ; do \
           ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \
         done
 	@$(ECHO) "# at least one line" >> $@.temp2
@@ -400,11 +403,11 @@
 # Running batches of tests with or without samevm
 define RunSamevmBatch
 $(ECHO) "Running tests in samevm mode: $?"
-$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=true  UNIQUE_DIR=$@ jtreg_tests
+$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_SAMEVM=true  UNIQUE_DIR=$@ jtreg_tests
 endef
 define RunOthervmBatch
 $(ECHO) "Running tests in othervm mode: $?"
-$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
+$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
 endef
 define SummaryInfo
 $(ECHO) "########################################################"
@@ -501,7 +504,7 @@
 # Stable samevm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_nio2
 jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \
-          java/nio/channels java/nio/BufferPoolMXBean java/nio/MappedByteBuffer)
+          java/nio/channels java/nio/MappedByteBuffer)
 	$(call SharedLibraryPermissions,java/nio/channels)
 	$(call RunSamevmBatch)
 
@@ -684,7 +687,7 @@
 
 ################################################################
 
-# perftest to collect statistics  
+# perftest to collect statistics
 
 # Expect JPRT to set JPRT_PACKTEST_HOME.
 PERFTEST_HOME = $(TEST_ROOT)/perf
@@ -706,7 +709,7 @@
 # vmsqe tests
 
 # Expect JPRT to set JPRT_VMSQE_HOME.
-VMSQE_HOME = /java/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
+VMSQE_HOME = $(SLASH_JAVA)/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
 ifdef JPRT_VMSQE_HOME
   VMSQE_HOME = $(JPRT_VMSQE_HOME)
 endif
@@ -718,7 +721,7 @@
 endif
 
 # Expect JPRT to set JPRT_TONGA3_HOME.
-TONGA3_HOME = /java/sqe//tools/gtee/harness/tonga
+TONGA3_HOME = $(SLASH_JAVA)/sqe/tools/gtee/harness/tonga
 ifdef JPRT_TONGA3_HOME
   TONGA3_HOME = $(JPRT_TONGA3_HOME)
 endif
@@ -771,148 +774,84 @@
 
 # jck tests
 
-JCK_WORK_DIR     = $(ABS_TEST_OUTPUT_DIR)/JCKwork
-JCK_REPORT_DIR   = $(ABS_TEST_OUTPUT_DIR)/JCKreport
-JCK_PROPERTIES   = $(ABS_TEST_OUTPUT_DIR)/jck.properties
-JCK_CONFIG       = $(ABS_TEST_OUTPUT_DIR)/jck.config
-
-JCK_JAVA_EXE     = $(PRODUCT_HOME)/bin/java$(EXESUFFIX)
-
-JCK_JAVATEST_JAR = $(JCK_HOME)/lib/javatest.jar
-JCK_JAVATEST     = $(ALT_BOOTDIR)/bin/java -jar $(JCK_JAVATEST_JAR)
-
-$(JCK_CONFIG): $(TEST_ROOT)/JCK-$(JCK_BUNDLE_NAME)-$(JCK_RELEASE)-base.jti
-	$(RM) $@
-	$(MKDIR) -p $(@D)
-	$(CP) $< $@
-
-$(JCK_PROPERTIES): $(PRODUCT_HOME) $(JCK_JAVA_EXE)
-	$(RM) $@
-	$(MKDIR) -p $(@D)
-	$(ECHO) "jck.env.compiler.compRefExecute.cmdAsFile=$(JCK_JAVA_EXE)" >> $@
-	$(ECHO) "jck.env.compiler.compRefExecute.systemRoot=$(SYSTEMROOT)" >> $@
-	$(ECHO) "jck.env.compiler.testCompile.testCompileAPImultiJVM.cmdAsFile=$(JCK_JAVA_EXE)" >> $@
-	$(ECHO) "jck.tests.tests=$(JCK_BUNDLE_TESTDIRS)" >> $@
-
-jck_tests: prep $(JCK_HOME) $(JCK_PROPERTIES) $(JCK_CONFIG) $(JCK_JAVATEST_JAR)
-	$(MKDIR) -p $(JCK_WORK_DIR)
-	( $(JCK_JAVATEST)                            \
-		-verbose:commands,non-pass           \
-		-testSuite    $(JCK_HOME)            \
-		-workDir      $(JCK_WORK_DIR)        \
-		-config       $(JCK_CONFIG)          \
-		-set -file    $(JCK_PROPERTIES)      \
-		-runtests                            \
-		-writeReport  $(JCK_REPORT_DIR)      \
-        ) ; $(BUNDLE_UP_AND_EXIT)
-
-PHONY_LIST += jck_tests
-
-################################################################
-
-# jck6 tests
-
-JCK6_RELEASE = 6b
-JCK6_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK6_RELEASE)/archive/fcs/binaries
-
-# Expect JPRT to set JPRT_JCK6COMPILER_HOME.
-JCK6COMPILER_HOME = $(JCK6_DEFAULT_HOME)/JCK-compiler-$(JCK6_RELEASE)
-ifdef JPRT_JCK6COMPILER_HOME
-  JCK6COMPILER_HOME = $(JPRT_JCK6COMPILER_HOME)
-endif
-
-# Expect JPRT to set JPRT_JCK6RUNTIME_HOME.
-JCK6RUNTIME_HOME = $(JCK6_DEFAULT_HOME)/JCK-runtime-$(JCK6_RELEASE)
-ifdef JPRT_JCK6RUNTIME_HOME
-  JCK6RUNTIME_HOME = $(JPRT_JCK6RUNTIME_HOME)
-endif
-
-# Expect JPRT to set JPRT_JCK6DEVTOOLS_HOME.
-JCK6DEVTOOLS_HOME = $(JCK6_DEFAULT_HOME)/JCK-devtools-$(JCK6_RELEASE)
-ifdef JPRT_JCK6DEVTOOLS_HOME
-  JCK6DEVTOOLS_HOME = $(JPRT_JCK6DEVTOOLS_HOME)
-endif
-
-jck6_tests: JCK_HOME=$(JCK6_HOME)
-jck6_tests: JCK_RELEASE=$(JCK6_RELEASE)
-jck6_tests: jck_tests
-
-jck6compiler: JCK6_HOME=$(JCK6COMPILER_HOME)
-jck6compiler: JCK_BUNDLE_NAME=compiler
-jck6compiler: jck6_tests
-
-jck6compiler_lang: JCK_BUNDLE_TESTDIRS=lang
-jck6compiler_lang: jck6compiler
-
-jck6runtime: JCK6_HOME=$(JCK6RUNTIME_HOME)
-jck6runtime: JCK_BUNDLE_NAME=runtime
-jck6runtime: jck6_tests
-
-jck6runtime_lang: JCK_BUNDLE_TESTDIRS=lang
-jck6runtime_lang: jck6runtime
-
-jck6devtools: JCK6_HOME=$(JCK6DEVTOOLS_HOME)
-jck6devtools: JCK_BUNDLE_NAME=devtools
-jck6devtools: jck6_tests
-
-jck6devtools_lang: JCK_BUNDLE_TESTDIRS=lang
-jck6devtools_lang: jck6devtools
-
-PHONY_LIST += jck6compiler jck6runtime jck6devtools jck6_tests \
-	      jck6compiler_lang jck6runtime_lang jck6devtools_lang
-
-################################################################
-
-# jck7 tests
-
-JCK7_RELEASE = 7
-JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK7_RELEASE)/archive/fcs/binaries
+# Default is to use jck 7 from /java/re
+JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
 
 # Expect JPRT to set JPRT_JCK7COMPILER_HOME.
-JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-$(JCK7_RELEASE)
+JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-7
 ifdef JPRT_JCK7COMPILER_HOME
-  JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)
+  JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)/JCK-compiler-7
 endif
 
 # Expect JPRT to set JPRT_JCK7RUNTIME_HOME.
-JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-$(JCK7_RELEASE)
+JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-7
 ifdef JPRT_JCK7RUNTIME_HOME
-  JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)
+  JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)/JCK-runtime-7
 endif
 
 # Expect JPRT to set JPRT_JCK7DEVTOOLS_HOME.
-JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-$(JCK7_RELEASE)
+JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-7
 ifdef JPRT_JCK7DEVTOOLS_HOME
-  JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)
+  JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)/JCK-devtools-7
+endif
+
+# The jtjck.jar utility to use to run the tests
+JTJCK_JAR = $(JCK_HOME)/lib/jtjck.jar
+JTJCK_JAVA_ARGS =  -XX:MaxPermSize=256m -Xmx512m
+JTJCK_OPTIONS = -headless -v 
+
+# Default tests to run
+ifndef JCK_COMPILER_TESTS
+  JCK_COMPILER_TESTS = 
+endif
+ifndef JCK_RUNTIME_TESTS
+  JCK_RUNTIME_TESTS  = 
+endif
+ifndef JCK_DEVTOOLS_TESTS
+  JCK_DEVTOOLS_TESTS = 
 endif
 
-jck7_tests: JCK_HOME=$(JCK7_HOME)
-jck7_tests: JCK_RELEASE=$(JCK7_RELEASE)
-jck7_tests: jck_tests
-
-jck7compiler: JCK7_HOME=$(JCK7COMPILER_HOME)
-jck7compiler: JCK_BUNDLE_NAME=compiler
-jck7compiler: jck7_tests
-
-jck7compiler_lang: JCK_BUNDLE_TESTDIRS=lang
-jck7compiler_lang: jck7compiler
+# Generic rule used to run jck tests
+_generic_jck_tests: prep $(PRODUCT_HOME) $(EXCLUDELIST)
+	@$(EXPAND) $(EXCLUDELIST) \
+            | $(CUT) -d' ' -f1 \
+            | $(SED) -e 's@^@Excluding: @'
+	( $(CD) $(ABS_TEST_OUTPUT_DIR) &&          			   \
+	  $(PRODUCT_HOME)/bin/java $(JTJCK_JAVA_ARGS) 			   \
+	    -jar "$(JTJCK_JAR)" 					   \
+	    $(JTJCK_OPTIONS) 						   \
+            -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
+            -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \
+            -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
+	    $(TESTDIRS) 						   \
+        ) ; $(BUNDLE_UP_AND_EXIT)
 
-jck7runtime: JCK7_HOME=$(JCK7RUNTIME_HOME)
-jck7runtime: JCK_BUNDLE_NAME=runtime
-jck7runtime: jck7_tests
-
-jck7runtime_lang: JCK_BUNDLE_TESTDIRS=lang
-jck7runtime_lang: jck7runtime
+# JCK7 compiler tests
+jck7compiler:
+	$(MAKE) UNIQUE_DIR=$@ \
+	        JCK_HOME=$(JCK7COMPILER_HOME) \
+	        TESTDIRS="$(JCK_COMPILER_TESTS)" \
+                _generic_jck_tests
 
-jck7devtools: JCK7_HOME=$(JCK7DEVTOOLS_HOME)
-jck7devtools: JCK_BUNDLE_NAME=devtools
-jck7devtools: jck7_tests
+# JCK7 runtime tests
+jck7runtime: 
+	$(MAKE) UNIQUE_DIR=$@ \
+	        JCK_HOME=$(JCK7RUNTIME_HOME) \
+	        TESTDIRS="$(JCK_RUNTIME_TESTS)" \
+                _generic_jck_tests
 
-jck7devtools_lang: JCK_BUNDLE_TESTDIRS=lang
-jck7devtools_lang: jck7devtools
+# JCK7 devtools tests
+jck7devtools: 
+	$(MAKE) UNIQUE_DIR=$@ \
+	        JCK_HOME=$(JCK7DEVTOOLS_HOME) \
+                TESTDIRS="$(JCK_DEVTOOLS_TESTS)" \
+                _generic_jck_tests
 
-PHONY_LIST += jck7compiler jck7runtime jck7devtools jck7_tests \
-	      jck7compiler_lang jck7runtime_lang jck7devtools_lang
+# Run all 3 sets of JCK7 tests
+jck_all: jck7runtime jck7devtools jck7compiler
+
+PHONY_LIST += jck_all _generic_jck_tests \
+	      jck7compiler jck7runtime jck7devtools
 
 ################################################################
 
--- a/jdk/test/ProblemList.txt	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/ProblemList.txt	Thu Mar 31 22:07:32 2011 -0700
@@ -690,6 +690,9 @@
 
 # jdk_util
 
+# Filed 7027061
+java/util/Locale/Bug6989440.java				windows-all
+
 # Filed 6933803
 java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	generic-all
 
--- a/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Thu Mar 31 22:07:32 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/ksh -p
 
 #
-# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -99,6 +99,8 @@
 
 libdir=${TESTCLASSES}
 
+is_windows=false
+is_cygwin=false
 case `uname -s` in 
   SunOS)
     libarch=`uname -p`
@@ -126,10 +128,13 @@
     libloc=`dirname ${xx}`
     ;;
   Windows*)
+    is_windows=true
     libloc=${jreloc}/bin
     sep=';'
     ;;
   CYGWIN*)
+    is_windows=true
+    is_cygwin=true
     libloc=${jreloc}/bin
     sep=':'
 
@@ -176,7 +181,18 @@
 #
 CP="-classpath \"${TESTCLASSES}\""
 #
-DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n"
+if [ "$is_windows" = "true" ]; then
+    if [ "$is_cygwin" = "true" ]; then
+        win_fullpath=`cygpath -m "$fullpath" \
+            | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'`
+    else
+        win_fullpath=`echo "$fullpath" \
+            | sed -e 's#/#\\\\\\\\#g' -e 's/\.dll//'`
+    fi
+    DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${win_fullpath},server=y,suspend=n"
+else
+    DEBUGGEEFLAGS="$DEBUGGEEFLAGS -agentlib:jdwp=transport=${private_transport},server=y,suspend=n"
+fi
                
 echo ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS}
 eval ${TESTJAVA}/bin/java ${DEBUGGEEFLAGS} ${CP} ${TARGETCLASS}
--- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @bug     6911258 6962571 6963622 6991528
+ * @bug     6911258 6962571 6963622 6991528 7005628
  * @summary Basic tests of suppressed exceptions
  * @author  Joseph D. Darcy
  */
@@ -50,14 +50,6 @@
         } catch (IllegalArgumentException iae) {
             ; // Expected
         }
-
-        throwable.addSuppressed(null); // Immutable suppression list
-        try {
-            throwable.addSuppressed(throwable);
-            throw new RuntimeException("IllegalArgumentException for self-suppresion not thrown.");
-        } catch (IllegalArgumentException iae) {
-            ; // Expected
-        }
     }
 
     private static void basicSupressionTest() {
@@ -153,19 +145,19 @@
             (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x78, (byte)0x70,
         };
 
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        ObjectInputStream ois = new ObjectInputStream(bais);
+        try(ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+            ObjectInputStream ois = new ObjectInputStream(bais)) {
+            Object o = ois.readObject();
+            Throwable throwable = (Throwable) o;
 
-        Object o = ois.readObject();
-        Throwable throwable = (Throwable) o;
+            System.err.println("TESTING SERIALIZED EXCEPTION");
 
-        System.err.println("TESTING SERIALIZED EXCEPTION");
-
-        Throwable[] t0 = throwable.getSuppressed();
-        if (t0.length != 0) { // Will fail if t0 is null.
-            throw new RuntimeException(message);
+            Throwable[] t0 = throwable.getSuppressed();
+            if (t0.length != 0) { // Will fail if t0 is null.
+                throw new RuntimeException(message);
+            }
+            throwable.printStackTrace();
         }
-        throwable.printStackTrace();
     }
 
     private static void selfReference() {
@@ -183,8 +175,7 @@
     }
 
     private static void noModification() {
-        Throwable t = new Throwable();
-        t.addSuppressed(null);
+        Throwable t = new NoSuppression(false);
 
         Throwable[] t0 = t.getSuppressed();
         if (t0.length != 0)
@@ -196,5 +187,24 @@
         t0 = t.getSuppressed();
         if (t0.length != 0)
             throw new RuntimeException("Bad nonzero length of suppressed exceptions.");
+
+        Throwable suppressed = new ArithmeticException();
+        t = new NoSuppression(true); // Suppression enabled
+        // Make sure addSuppressed(null) throws an NPE
+        try {
+            t.addSuppressed(null);
+        } catch(NullPointerException e) {
+            ; // Expected
+        }
+        t.addSuppressed(suppressed);
+        t0 = t.getSuppressed();
+        if (t0.length != 1 || t0[0] != suppressed)
+            throw new RuntimeException("Expected suppression did not occur.");
+    }
+
+    private static class NoSuppression extends Throwable {
+        public NoSuppression(boolean enableSuppression) {
+            super("The medium.", null, enableSuppression);
+        }
     }
 }
--- a/jdk/test/java/lang/annotation/PackageMain.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/java/lang/annotation/PackageMain.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import java.lang.annotation.Documented;
-
 public class PackageMain {
     public static void main(String[] args) throws Exception {
         Class<?> c = Class.forName("foo.bar.Baz");
@@ -30,7 +28,7 @@
         System.out.println("cl=" + c.getClassLoader());
         Package p = c.getPackage();
         System.out.println("p=" + p);
-        Documented d = p.getAnnotation(Documented.class);
+        Deprecated d = p.getAnnotation(Deprecated.class);
         if (d == null) throw new Error();
     }
 }
--- a/jdk/test/java/lang/annotation/package-info.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/java/lang/annotation/package-info.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  * @run main PackageMain
  */
 
-@java.lang.annotation.Documented
+@Deprecated
 package foo.bar;
 
 class Baz {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,117 @@
+/*
+ * 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
+ * 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 6606598 7024172
+ * @summary Unit test for java.lang.management.BufferPoolMXBean
+ * @run main/othervm Basic
+ */
+
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.file.Path;
+import java.nio.file.Files;
+import static java.nio.file.StandardOpenOption.*;
+import java.nio.channels.FileChannel;
+import java.lang.management.BufferPoolMXBean;
+import java.lang.management.ManagementFactory;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import java.lang.ref.WeakReference;
+import java.util.*;
+
+public class Basic {
+
+    // static fields to ensure buffers aren't GC'ed
+    static List<ByteBuffer> buffers;
+    static MappedByteBuffer mbb;
+
+    // check counters
+    static void check(List<BufferPoolMXBean> pools,
+                      int minBufferCount,
+                      long minTotalCapacity)
+    {
+        int bufferCount = 0;
+        long totalCap = 0;
+        long totalMem = 0;
+        for (BufferPoolMXBean pool: pools) {
+            bufferCount += pool.getCount();
+            totalCap += pool.getTotalCapacity();
+            totalMem += pool.getMemoryUsed();
+        }
+        if (bufferCount < minBufferCount)
+            throw new RuntimeException("Count less than expected");
+        if (totalMem < minTotalCapacity)
+            throw new RuntimeException("Memory usage less than expected");
+        if (totalCap < minTotalCapacity)
+            throw new RuntimeException("Total capacity less than expected");
+    }
+
+    public static void main(String[] args) throws Exception {
+        Random rand = new Random();
+
+        // allocate a few direct buffers
+        int bufferCount = 5 + rand.nextInt(20);
+        buffers = new ArrayList<ByteBuffer>(bufferCount);
+        long totalCapacity = 0L;
+        for (int i=0; i<bufferCount; i++) {
+            int cap = 1024 + rand.nextInt(4096);
+            buffers.add( ByteBuffer.allocateDirect(cap) );
+            totalCapacity += cap;
+        }
+
+        // create a mapped buffer
+        Path tmpfile = Files.createTempFile("blah", null);
+        tmpfile.toFile().deleteOnExit();
+        try (FileChannel fc = FileChannel.open(tmpfile, READ, WRITE)) {
+            mbb = fc.map(FileChannel.MapMode.READ_WRITE, 10, 100);
+            bufferCount++;
+            totalCapacity += mbb.capacity();
+        }
+
+        // use platform MXBeans directly
+        List<BufferPoolMXBean> pools =
+            ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
+        check(pools, bufferCount, totalCapacity);
+
+        // use MBeanServer
+        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+        Set<ObjectName> mbeans = server.queryNames(
+            new ObjectName("java.nio:type=BufferPool,*"), null);
+        pools = new ArrayList<BufferPoolMXBean>();
+        for (ObjectName name: mbeans) {
+            BufferPoolMXBean pool = ManagementFactory
+                .newPlatformMXBeanProxy(server, name.toString(), BufferPoolMXBean.class);
+            pools.add(pool);
+        }
+        check(pools, bufferCount, totalCapacity);
+
+        // attempt to unmap mapped buffer
+        WeakReference<MappedByteBuffer> ref = new WeakReference<>(mbb);
+        mbb = null;
+        do {
+            System.gc();
+            Thread.sleep(250);
+        } while (ref.get() != null);
+    }
+}
--- a/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java	Thu Mar 31 22:07:32 2011 -0700
@@ -23,23 +23,26 @@
 
 /*
  * @test
- * @bug     6610094
- * @summary Basic unit test of ManagementFactory.getPlatformMXBeans()
- *          and also PlatformManagedObject.getObjectName()
+ * @bug     6610094 7024172
+ * @summary Basic unit test of ManagementFactory.getPlatformMXBean(s)
+ *          methods and PlatformManagedObject.getObjectName()
  * @author  Mandy Chung
  *
  * @run main GetPlatformMXBeans
  */
 
 import java.lang.management.*;
-import static java.lang.management.ManagementFactory.*;
+import java.io.IOException;
 import java.util.*;
 import javax.management.*;
 
+import static java.lang.management.ManagementFactory.*;
+
 public class GetPlatformMXBeans {
     private static MBeanServer platformMBeanServer =
             getPlatformMBeanServer();
     public static void main(String[] argv) throws Exception {
+        // singleton platform MXBean
         checkPlatformMXBean(getClassLoadingMXBean(),
                             ClassLoadingMXBean.class,
                             CLASS_LOADING_MXBEAN_NAME);
@@ -58,17 +61,28 @@
         checkPlatformMXBean(getThreadMXBean(),
                             ThreadMXBean.class,
                             THREAD_MXBEAN_NAME);
+
+        // the following MXBean can have more than one instances
         checkGarbageCollectorMXBeans(getGarbageCollectorMXBeans());
         checkMemoryManagerMXBeans(getMemoryManagerMXBeans());
         checkMemoryPoolMXBeans(getMemoryPoolMXBeans());
+
+        // check invalid platform MXBean
+        checkInvalidPlatformMXBean();
     }
 
     private static <T extends PlatformManagedObject>
-        void checkPlatformMXBean(T obj, Class<T> mxbeanInterface,
-                                 String mxbeanName) throws Exception
+            void checkPlatformMXBean(T obj, Class<T> mxbeanInterface,
+                                     String mxbeanName)
+        throws Exception
     {
-        int numElements = (obj != null ? 1 : 0);
-        // verify local list of platform MXBeans
+        // getPlatformMXBean may return null if the mxbean is not implemented
+        PlatformManagedObject mxbean = getPlatformMXBean(mxbeanInterface);
+        if (obj != mxbean) {
+            throw new RuntimeException("Singleton MXBean returned not matched");
+        }
+
+        int numElements = obj == null ? 0 : 1;
         List<? extends PlatformManagedObject> mxbeans =
             getPlatformMXBeans(mxbeanInterface);
         if (mxbeans.size() != numElements) {
@@ -77,24 +91,46 @@
         }
 
         if (obj != null) {
-            PlatformManagedObject pmo = mxbeans.get(0);
-            if (obj != pmo) {
+            if (obj != mxbeans.get(0)) {
                 throw new RuntimeException("The list returned by getPlatformMXBeans"
                     + " not matched");
             }
             ObjectName on = new ObjectName(mxbeanName);
-            if (!on.equals(pmo.getObjectName())) {
+            if (!on.equals(mxbean.getObjectName())) {
                 throw new RuntimeException("Unmatched ObjectName " +
-                    pmo.getObjectName() + " Expected = " + on);
+                    mxbean.getObjectName() + " Expected = " + on);
             }
+            checkRemotePlatformMXBean(obj, platformMBeanServer,
+                                      mxbeanInterface, mxbeanName);
+        }
+    }
+
+    // verify platform MXBeans in the platform MBeanServer
+    private static <T extends PlatformManagedObject>
+            void checkRemotePlatformMXBean(T obj,
+                                           MBeanServerConnection mbs,
+                                           Class<T> mxbeanInterface,
+                                           String mxbeanName)
+        throws Exception
+    {
+        PlatformManagedObject mxbean = getPlatformMXBean(mbs, mxbeanInterface);
+        if ((obj == null && mxbean != null) || (obj != null && mxbean == null)) {
+            throw new RuntimeException("Singleton MXBean returned not matched");
         }
 
-        // verify platform MXBeans in the platform MBeanServer
-        mxbeans = getPlatformMXBeans(platformMBeanServer, mxbeanInterface);
+        int numElements = obj == null ? 0 : 1;
+        List<? extends PlatformManagedObject> mxbeans =
+            getPlatformMXBeans(mbs, mxbeanInterface);
         if (mxbeans.size() != numElements) {
             throw new RuntimeException("Unmatched number of platform MXBeans "
                 + mxbeans.size() + ". Expected = " + numElements);
         }
+
+        ObjectName on = new ObjectName(mxbeanName);
+        if (!on.equals(mxbean.getObjectName())) {
+            throw new RuntimeException("Unmatched ObjectName " +
+                mxbean.getObjectName() + " Expected = " + on);
+        }
     }
 
     private static void checkMemoryManagerMXBeans(List<MemoryManagerMXBean> objs)
@@ -148,6 +184,14 @@
         void checkPlatformMXBeans(List<T> objs, Class<T> mxbeanInterface)
             throws Exception
     {
+        try {
+            getPlatformMXBean(mxbeanInterface);
+            // mxbeanInterface is not a singleton
+            throw new RuntimeException(mxbeanInterface + ": not a singleton MXBean");
+        } catch (IllegalArgumentException e) {
+            // expect IAE
+        }
+
         // verify local list of platform MXBeans
         List<? extends PlatformManagedObject> mxbeans =
             getPlatformMXBeans(mxbeanInterface);
@@ -177,4 +221,40 @@
                 + mxbeans.size() + ". Expected = " + objs.size());
         }
     }
+
+    interface FakeMXBean extends PlatformManagedObject {};
+
+    private static void checkInvalidPlatformMXBean() throws IOException {
+        try {
+            getPlatformMXBean(FakeMXBean.class);
+            // mxbeanInterface is not a singleton
+            throw new RuntimeException("Expect IllegalArgumentException but not thrown");
+        } catch (IllegalArgumentException e) {
+            // expect IAE
+        }
+
+        try {
+            getPlatformMXBeans(FakeMXBean.class);
+            // mxbeanInterface is not a singleton
+            throw new RuntimeException("Expect IllegalArgumentException but not thrown");
+        } catch (IllegalArgumentException e) {
+            // expect IAE
+        }
+
+        try {
+            getPlatformMXBean(platformMBeanServer, FakeMXBean.class);
+            // mxbeanInterface is not a singleton
+            throw new RuntimeException("Expect IllegalArgumentException but not thrown");
+        } catch (IllegalArgumentException e) {
+            // expect IAE
+        }
+
+        try {
+            getPlatformMXBeans(platformMBeanServer, FakeMXBean.class);
+            // mxbeanInterface is not a singleton
+            throw new RuntimeException("Expect IllegalArgumentException but not thrown");
+        } catch (IllegalArgumentException e) {
+            // expect IAE
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7024172
+ * @summary Test if proxy for PlatformLoggingMXBean is equivalent
+ *          to proxy for LoggingMXBean
+ *
+ * @build LoggingMXBeanTest
+ * @run main LoggingMXBeanTest
+ */
+
+import java.lang.management.*;
+import javax.management.MBeanServer;
+import java.util.logging.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class LoggingMXBeanTest
+{
+    static String LOGGER_NAME_1 = "com.sun.management.Logger";
+    static String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2";
+    static String UNKNOWN_LOGGER_NAME = "com.sun.management.Unknown";
+
+    public static void main(String[] argv) throws Exception {
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        LoggingMXBean proxy =
+            ManagementFactory.newPlatformMXBeanProxy(mbs,
+                LogManager.LOGGING_MXBEAN_NAME,
+                LoggingMXBean.class);
+
+        // test LoggingMXBean proxy
+        LoggingMXBeanTest p = new LoggingMXBeanTest(proxy);
+
+        // check if the attributes implemented by PlatformLoggingMXBean
+        // and LoggingMXBean return the same value
+        PlatformLoggingMXBean mxbean =
+            ManagementFactory.getPlatformMXBean(mbs, PlatformLoggingMXBean.class);
+
+        checkAttributes(proxy, mxbean);
+    }
+
+    // same verification as in java/util/logging/LoggingMXBeanTest2
+    public LoggingMXBeanTest(LoggingMXBean mbean) throws Exception {
+
+        Logger logger1 = Logger.getLogger( LOGGER_NAME_1 );
+        logger1.setLevel(Level.FINE);
+        Logger logger2 = Logger.getLogger( LOGGER_NAME_2 );
+        logger2.setLevel(null);
+
+        /*
+         *  Check for the existence of our new Loggers
+         */
+        System.out.println("Test Logger Name retrieval (getLoggerNames)");
+        boolean log1 = false, log2 = false;
+        List<String> loggers = mbean.getLoggerNames();
+        if (loggers == null || loggers.size() < 2) {
+            throw new RuntimeException(
+                "Could not Detect the presense of the new Loggers");
+        }
+
+        for (String logger : loggers) {
+            if (logger.equals(LOGGER_NAME_1)) {
+                log1 = true;
+                System.out.println("  : Found new Logger : " + logger);
+            }
+            if (logger.equals(LOGGER_NAME_2)) {
+                log2 = true;
+                System.out.println("  : Found new Logger : " + logger);
+            }
+        }
+        if ( log1 && log2 )
+            System.out.println("  : PASSED." );
+        else {
+            System.out.println("  : FAILED.  Could not Detect the new Loggers." );
+            throw new RuntimeException(
+                "Could not Detect the presense of the new Loggers");
+        }
+
+        System.out.println("Test getLoggerLevel");
+        String l1 = mbean.getLoggerLevel(LOGGER_NAME_1);
+        System.out.println("  : Level for Logger " + LOGGER_NAME_1 + " : " + l1);
+        if (!l1.equals(Level.FINE.getName())) {
+            throw new RuntimeException(
+                "Expected level for " + LOGGER_NAME_1 + " = " +
+                 Level.FINE.getName() + " but got " + l1);
+        }
+        String l2 = mbean.getLoggerLevel(LOGGER_NAME_2);
+        System.out.println("  : Level for Logger " + LOGGER_NAME_2 + " : " + l2);
+        if (!l2.equals("")) {
+            throw new RuntimeException(
+                "Expected level for " + LOGGER_NAME_2 + " = \"\"" +
+                 " but got " + l2);
+        }
+        String l3 = mbean.getLoggerLevel(UNKNOWN_LOGGER_NAME);
+        System.out.println("  : Level for unknown logger : " + l3);
+        if (l3 != null) {
+            throw new RuntimeException(
+                "Expected level for " + UNKNOWN_LOGGER_NAME + " = null" +
+                 " but got " + l3);
+        }
+
+        System.out.println("Test setLoggerLevel");
+        mbean.setLoggerLevel(LOGGER_NAME_1, "INFO");
+        System.out.println("  : Set Level for Logger " + LOGGER_NAME_1 + " to: INFO");
+        Level l = logger1.getLevel();
+        if (l != Level.INFO) {
+            throw new RuntimeException(
+                "Expected level for " + LOGGER_NAME_1 + " = " +
+                 Level.INFO + " but got " + l);
+        }
+
+        mbean.setLoggerLevel(LOGGER_NAME_2, "SEVERE");
+        System.out.println("  : Set Level for Logger " + LOGGER_NAME_2 + " to: SERVER");
+        l = logger2.getLevel();
+        if (l != Level.SEVERE) {
+            throw new RuntimeException(
+                "Expected level for " + LOGGER_NAME_2 + " = " +
+                 Level.SEVERE+ " but got " + l);
+        }
+
+        mbean.setLoggerLevel(LOGGER_NAME_1, null);
+        System.out.println("  : Set Level for Logger " + LOGGER_NAME_1 + " to: null");
+        l = logger1.getLevel();
+        if (l != null) {
+            throw new RuntimeException(
+                "Expected level for " + LOGGER_NAME_1 + " = null " +
+                 " but got " + l);
+        }
+
+        boolean iaeCaught = false;
+        System.out.println("  : Set Level for unknown Logger to: FINE");
+        try {
+            mbean.setLoggerLevel(UNKNOWN_LOGGER_NAME, "FINE");
+        } catch (IllegalArgumentException e) {
+            // expected
+            iaeCaught = true;
+            System.out.println("      : IllegalArgumentException caught as expected");
+        }
+        if (!iaeCaught) {
+            throw new RuntimeException(
+                "Expected IllegalArgumentException for setting level for " +
+                UNKNOWN_LOGGER_NAME + " not thrown");
+        }
+        iaeCaught = false;
+        System.out.println("  : Set Level for Logger " + LOGGER_NAME_1 + " to: DUMMY");
+        try {
+            mbean.setLoggerLevel(LOGGER_NAME_1, "DUMMY");
+        } catch (IllegalArgumentException e) {
+            // expected
+            iaeCaught = true;
+            System.out.println("      : IllegalArgumentException caught as expected");
+        }
+        if (!iaeCaught) {
+            throw new RuntimeException(
+                "Expected IllegalArgumentException for invalid level.");
+        }
+
+
+        System.out.println("Test getParentLoggerName");
+        String p1 = mbean.getParentLoggerName(LOGGER_NAME_2);
+        System.out.println("  : Parent Logger for " + LOGGER_NAME_2 + " : " + p1);
+        if (!p1.equals(LOGGER_NAME_1)) {
+            throw new RuntimeException(
+                "Expected parent for " + LOGGER_NAME_2 + " = " +
+                LOGGER_NAME_1 + " but got " + p1);
+        }
+        String p2 = mbean.getParentLoggerName("");
+        System.out.println("  : Parent Logger for \"\" : " + p2);
+        if (!p2.equals("")) {
+            throw new RuntimeException(
+                "Expected parent for root logger \"\" = \"\"" +
+                " but got " + p2);
+        }
+        String p3 = mbean.getParentLoggerName(UNKNOWN_LOGGER_NAME);
+        System.out.println("  : Parent Logger for unknown logger : " + p3);
+        if (p3 != null) {
+            throw new RuntimeException(
+                "Expected level for " + UNKNOWN_LOGGER_NAME + " = null" +
+                 " but got " + p3);
+        }
+    }
+
+    private static void checkAttributes(LoggingMXBean mxbean1,
+                                        PlatformLoggingMXBean mxbean2) {
+        // verify logger names
+        List<String> loggers1 = mxbean1.getLoggerNames();
+        List<String> loggers2 = mxbean2.getLoggerNames();
+        if (loggers1.size() != loggers2.size())
+            throw new RuntimeException("LoggerNames: unmatched number of entries");
+        List<String> loggers3 = new ArrayList<>(loggers1);
+        loggers3.removeAll(loggers2);
+        if (loggers3.size() != 0)
+            throw new RuntimeException("LoggerNames: unmatched loggers");
+
+        // verify logger's level  and parent
+        for (String logger : loggers1) {
+            if (!mxbean1.getLoggerLevel(logger)
+                    .equals(mxbean2.getLoggerLevel(logger)))
+                throw new RuntimeException(
+                    "LoggerLevel: unmatched level for " + logger);
+            if (!mxbean1.getParentLoggerName(logger)
+                    .equals(mxbean2.getParentLoggerName(logger)))
+                throw new RuntimeException(
+                    "ParentLoggerName: unmatched parent logger's name for " + logger);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2003, 2004, 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     6876135 7024172
+ *
+ * @summary Test PlatformLoggingMXBean
+ *          This test performs similar testing as
+ *          java/util/logging/LoggingMXBeanTest.
+ *
+ * @build PlatformLoggingMXBeanTest
+ * @run main PlatformLoggingMXBeanTest
+ */
+
+import javax.management.*;
+import java.lang.management.ManagementFactory;
+import java.lang.management.PlatformLoggingMXBean;
+import java.util.logging.*;
+import java.util.List;
+
+public class PlatformLoggingMXBeanTest
+{
+
+    ObjectName objectName = null;
+    static String LOGGER_NAME_1 = "com.sun.management.Logger1";
+    static String LOGGER_NAME_2 = "com.sun.management.Logger2";
+
+    public PlatformLoggingMXBeanTest() throws Exception {
+    }
+
+    private void runTest(PlatformLoggingMXBean mBean) throws Exception {
+
+        /*
+         * Create the MBeanServeri, register the PlatformLoggingMXBean
+         */
+        System.out.println( "***************************************************" );
+        System.out.println( "********** PlatformLoggingMXBean Unit Test **********" );
+        System.out.println( "***************************************************" );
+        System.out.println( "" );
+        System.out.println( "*******************************" );
+        System.out.println( "*********** Phase 1 ***********" );
+        System.out.println( "*******************************" );
+        System.out.println( "    Creating MBeanServer " );
+        System.out.print( "    Register PlatformLoggingMXBean: " );
+        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+        String[] list = new String[0];
+
+        try {
+            objectName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);
+            mbs.registerMBean( mBean, objectName );
+        }
+        catch ( Exception e ) {
+            System.out.println( "FAILED" );
+            throw e;
+        }
+        System.out.println( "PASSED" );
+        System.out.println("");
+
+        /*
+         * Access our MBean to get the current list of Loggers
+         */
+        System.out.println( "*******************************" );
+        System.out.println( "*********** Phase 2 ***********" );
+        System.out.println( "*******************************" );
+        System.out.println( "   Test Logger Name retrieval (getLoggerNames) " );
+        // check that Level object are returned properly
+        try {
+            list = (String[]) mbs.getAttribute( objectName,  "LoggerNames" );
+        }
+        catch ( Exception e ) {
+            System.out.println("    : FAILED" );
+            throw e;
+        }
+
+        /*
+         * Dump the list of Loggers already present, if any
+         */
+        Object[] params =  new Object[1];
+        String[] signature =  new String[1];
+        Level l;
+
+        if ( list == null ) {
+            System.out.println("    : PASSED.  No Standard Loggers Present" );
+            System.out.println("");
+        }
+        else {
+            System.out.println("    : PASSED. There are " + list.length + " Loggers Present" );
+            System.out.println("");
+            System.out.println( "*******************************" );
+            System.out.println( "*********** Phase 2B **********" );
+            System.out.println( "*******************************" );
+            System.out.println( " Examine Existing Loggers" );
+            for ( int i = 0; i < list.length; i++ ) {
+                try {
+                    params[0] = list[i];
+                    signature[0] = "java.lang.String";
+                    String levelName = (String) mbs.invoke(  objectName, "getLoggerLevel", params, signature );
+                    System.out.println("    : Logger #" + i + " = " + list[i] );
+                    System.out.println("    : Level = " + levelName );
+                }
+                catch ( Exception e ) {
+                    System.out.println("    : FAILED" );
+                    throw e;
+                }
+            }
+            System.out.println("    : PASSED" );
+        }
+
+        /*
+         * Create two new loggers to the list of Loggers already present
+         */
+        System.out.println("");
+        System.out.println( "*******************************" );
+        System.out.println( "*********** Phase 3 ***********" );
+        System.out.println( "*******************************" );
+        System.out.println( " Create and test new Loggers" );
+        Logger logger1 = Logger.getLogger( LOGGER_NAME_1 );
+        Logger logger2 = Logger.getLogger( LOGGER_NAME_2 );
+
+        // check that Level object are returned properly
+        try {
+            list = (String[]) mbs.getAttribute( objectName,  "LoggerNames" );
+        }
+        catch ( Exception e ) {
+            System.out.println("    : FAILED" );
+            throw e;
+        }
+
+        /*
+         *  Check for the existence of our new Loggers
+         */
+        boolean log1 = false, log2 = false;
+
+        if ( list == null || list.length < 2 ) {
+            System.out.println("    : FAILED.  Could not Detect the presense of the new Loggers" );
+            throw new RuntimeException(
+                "Could not Detect the presense of the new Loggers");
+        }
+        else {
+            for ( int i = 0; i < list.length; i++ ) {
+                if ( list[i].equals( LOGGER_NAME_1 ) ) {
+                    log1 = true;
+                    System.out.println( "    : Found new Logger : " + list[i] );
+                }
+                if ( list[i].equals( LOGGER_NAME_2 ) ) {
+                    log2 = true;
+                    System.out.println( "    : Found new Logger : " + list[i] );
+                }
+            }
+            if ( log1 && log2 )
+                System.out.println( "    : PASSED." );
+            else {
+                System.out.println( "    : FAILED.  Could not Detect the new Loggers." );
+                throw new RuntimeException(
+                    "Could not Detect the presense of the new Loggers");
+            }
+        }
+
+        /*
+         *  Set a new Logging levels and check that it succeeded
+         */
+        System.out.println("");
+        System.out.println( "*******************************" );
+        System.out.println( "*********** Phase 4 ***********" );
+        System.out.println( "*******************************" );
+        System.out.println( " Set and Check the Logger Level" );
+        log1 = false;
+        log2 = false;
+        try {
+            // Set the level of logger1 to ALL
+            params = new Object[2];
+            signature =  new String[2];
+            params[0] = LOGGER_NAME_1;
+            params[1] = Level.ALL.getName();
+            signature[0] = "java.lang.String";
+            signature[1] = "java.lang.String";
+            mbs.invoke(  objectName, "setLoggerLevel", params, signature );
+
+            // Set the level of logger2 to FINER
+            params[0] = LOGGER_NAME_2;
+            params[1] = Level.FINER.getName();
+            mbs.invoke(  objectName, "setLoggerLevel", params, signature );
+
+            // Okay read back the Level from Logger1. Should be ALL
+            params =  new Object[1];
+            signature =  new String[1];
+            params[0] = LOGGER_NAME_1;
+            signature[0] = "java.lang.String";
+            String levelName = (String) mbs.invoke(  objectName, "getLoggerLevel", params, signature );
+            l = Level.parse(levelName);
+            System.out.print("    Logger1: " );
+            if ( l.equals( l.ALL ) ) {
+                System.out.println("Level Set to ALL: PASSED" );
+                log1 = true;
+            }
+            else {
+                System.out.println("Level Set to ALL: FAILED" );
+                throw new RuntimeException(
+                    "Level Set to ALL but returned " + l.toString());
+            }
+
+            // Okay read back the Level from Logger2. Should be FINER
+            params =  new Object[1];
+            signature =  new String[1];
+            params[0] = LOGGER_NAME_2;
+            signature[0] = "java.lang.String";
+            levelName = (String) mbs.invoke(  objectName, "getLoggerLevel", params, signature );
+            l = Level.parse(levelName);
+            System.out.print("    Logger2: " );
+            if ( l.equals( l.FINER ) ) {
+                System.out.println("Level Set to FINER: PASSED" );
+                log2 = true;
+            }
+            else {
+                System.out.println("Level Set to FINER: FAILED" );
+                throw new RuntimeException(
+                    "Level Set to FINER but returned " + l.toString());
+            }
+        }
+        catch ( Exception e ) {
+            throw e;
+        }
+
+        System.out.println( "" );
+        System.out.println( "***************************************************" );
+        System.out.println( "***************** All Tests Passed ****************" );
+        System.out.println( "***************************************************" );
+    }
+
+    public static void main(String[] argv) throws Exception {
+        PlatformLoggingMXBean mbean =
+            ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
+        ObjectName objname = mbean.getObjectName();
+        if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) {
+            throw new RuntimeException("Invalid ObjectName " + objname);
+        }
+
+        // check if the PlatformLoggingMXBean is registered in the platform MBeanServer
+        MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer();
+        ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);
+
+        // We could call mbs.isRegistered(objName) here.
+        // Calling getMBeanInfo will throw exception if not found.
+        platformMBS.getMBeanInfo(objName);
+
+        if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") ||
+            !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) {
+            throw new RuntimeException(objName + " is of unexpected type");
+        }
+
+        // test if PlatformLoggingMXBean works properly in a MBeanServer
+        PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest();
+        test.runTest(mbean);
+    }
+}
--- a/jdk/test/java/nio/BufferPoolMXBean/Basic.java	Thu Mar 31 18:14:17 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * 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
- * 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 6606598
- * @summary Unit test for java.nio.BufferPoolMXBean
- * @run main/othervm Basic
- */
-
-import java.nio.ByteBuffer;
-import java.nio.MappedByteBuffer;
-import java.nio.BufferPoolMXBean;
-import java.nio.channels.FileChannel;
-import java.io.File;
-import java.io.RandomAccessFile;
-import java.lang.management.ManagementFactory;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.util.*;
-
-public class Basic {
-
-    // static fields to ensure buffers aren't GC'ed
-    static List<ByteBuffer> buffers;
-    static MappedByteBuffer mbb;
-
-    // check counters
-    static void check(List<BufferPoolMXBean> pools,
-                      int minBufferCount,
-                      long minTotalCapacity)
-    {
-        int bufferCount = 0;
-        long totalCap = 0;
-        long totalMem = 0;
-        for (BufferPoolMXBean pool: pools) {
-            bufferCount += pool.getCount();
-            totalCap += pool.getTotalCapacity();
-            totalMem += pool.getMemoryUsed();
-        }
-        if (bufferCount < minBufferCount)
-            throw new RuntimeException("Count less than expected");
-        if (totalMem < minTotalCapacity)
-            throw new RuntimeException("Memory usage less than expected");
-        if (totalCap < minTotalCapacity)
-            throw new RuntimeException("Total capacity less than expected");
-    }
-
-    public static void main(String[] args) throws Exception {
-        Random rand = new Random();
-
-        // allocate a few direct buffers
-        int bufferCount = 5 + rand.nextInt(20);
-        buffers = new ArrayList<ByteBuffer>(bufferCount);
-        long totalCapacity = 0L;
-        for (int i=0; i<bufferCount; i++) {
-            int cap = 1024 + rand.nextInt(4096);
-            buffers.add( ByteBuffer.allocateDirect(cap) );
-            totalCapacity += cap;
-        }
-
-        // map a file
-        File f = File.createTempFile("blah", null);
-        f.deleteOnExit();
-        RandomAccessFile raf = new RandomAccessFile(f, "rw");
-        FileChannel fc = raf.getChannel();
-        mbb = fc.map(FileChannel.MapMode.READ_WRITE, 10, 100);
-        bufferCount++;
-        totalCapacity += mbb.capacity();
-
-        // direct
-        List<BufferPoolMXBean> pools =
-            ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
-        check(pools, bufferCount, totalCapacity);
-
-        // using MBeanServer
-        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-        Set<ObjectName> mbeans = server.queryNames(
-            new ObjectName("java.nio:type=BufferPool,*"), null);
-        pools = new ArrayList<BufferPoolMXBean>();
-        for (ObjectName name: mbeans) {
-            BufferPoolMXBean pool = ManagementFactory
-                .newPlatformMXBeanProxy(server, name.toString(), BufferPoolMXBean.class);
-            pools.add(pool);
-        }
-        check(pools, bufferCount, totalCapacity);
-    }
-}
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java	Thu Mar 31 22:07:32 2011 -0700
@@ -28,12 +28,12 @@
  */
 
 import java.nio.ByteBuffer;
-import java.nio.BufferPoolMXBean;
 import java.nio.channels.*;
 import java.net.*;
 import java.util.List;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadFactory;
+import java.lang.management.BufferPoolMXBean;
 import java.lang.management.ManagementFactory;
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/jar/JarFile/MevNPE.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 7023056
+ * @summary NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
+ */
+import java.io.*;
+import java.util.jar.*;
+
+public class MevNPE {
+    public static void main(String[] args) throws Exception {
+        File f = new File(System.getProperty("test.src", "."), "Signed.jar");
+        try (JarFile jf = new JarFile(f, true)) {
+            try (InputStream s1 = jf.getInputStream(
+                    jf.getJarEntry(JarFile.MANIFEST_NAME))) {
+                s1.read(new byte[10000]);
+            };
+            try (InputStream s2 = jf.getInputStream(
+                    jf.getJarEntry(JarFile.MANIFEST_NAME))) {
+                s2.read(new byte[10000]);
+            };
+        }
+    }
+}
--- a/jdk/test/java/util/logging/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java	Thu Mar 31 18:14:17 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, 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     6876135
- *
- * @summary Test PlatformLoggingMXBean
- *          This test performs similar testing as LoggingMXBeanTest.
- *
- * @build PlatformLoggingMXBeanTest
- * @run main PlatformLoggingMXBeanTest
- */
-
-import javax.management.*;
-import java.lang.management.ManagementFactory;
-import java.util.logging.*;
-import java.util.List;
-
-public class PlatformLoggingMXBeanTest
-{
-
-    ObjectName objectName = null;
-    static String LOGGER_NAME_1 = "com.sun.management.Logger1";
-    static String LOGGER_NAME_2 = "com.sun.management.Logger2";
-
-    public PlatformLoggingMXBeanTest() throws Exception {
-    }
-
-    private void runTest(PlatformLoggingMXBean mBean) throws Exception {
-
-        /*
-         * Create the MBeanServeri, register the PlatformLoggingMXBean
-         */
-        System.out.println( "***************************************************" );
-        System.out.println( "********** PlatformLoggingMXBean Unit Test **********" );
-        System.out.println( "***************************************************" );
-        System.out.println( "" );
-        System.out.println( "*******************************" );
-        System.out.println( "*********** Phase 1 ***********" );
-        System.out.println( "*******************************" );
-        System.out.println( "    Creating MBeanServer " );
-        System.out.print( "    Register PlatformLoggingMXBean: " );
-        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
-        String[] list = new String[0];
-
-        try {
-            objectName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);
-            mbs.registerMBean( mBean, objectName );
-        }
-        catch ( Exception e ) {
-            System.out.println( "FAILED" );
-            throw e;
-        }
-        System.out.println( "PASSED" );
-        System.out.println("");
-
-        /*
-         * Access our MBean to get the current list of Loggers
-         */
-        System.out.println( "*******************************" );
-        System.out.println( "*********** Phase 2 ***********" );
-        System.out.println( "*******************************" );
-        System.out.println( "   Test Logger Name retrieval (getLoggerNames) " );
-        // check that Level object are returned properly
-        try {
-            list = (String[]) mbs.getAttribute( objectName,  "LoggerNames" );
-        }
-        catch ( Exception e ) {
-            System.out.println("    : FAILED" );
-            throw e;
-        }
-
-        /*
-         * Dump the list of Loggers already present, if any
-         */
-        Object[] params =  new Object[1];
-        String[] signature =  new String[1];
-        Level l;
-
-        if ( list == null ) {
-            System.out.println("    : PASSED.  No Standard Loggers Present" );
-            System.out.println("");
-        }
-        else {
-            System.out.println("    : PASSED. There are " + list.length + " Loggers Present" );
-            System.out.println("");
-            System.out.println( "*******************************" );
-            System.out.println( "*********** Phase 2B **********" );
-            System.out.println( "*******************************" );
-            System.out.println( " Examine Existing Loggers" );
-            for ( int i = 0; i < list.length; i++ ) {
-                try {
-                    params[0] = list[i];
-                    signature[0] = "java.lang.String";
-                    String levelName = (String) mbs.invoke(  objectName, "getLoggerLevel", params, signature );
-                    System.out.println("    : Logger #" + i + " = " + list[i] );
-                    System.out.println("    : Level = " + levelName );
-                }
-                catch ( Exception e ) {
-                    System.out.println("    : FAILED" );
-                    throw e;
-                }
-            }
-            System.out.println("    : PASSED" );
-        }
-
-        /*
-         * Create two new loggers to the list of Loggers already present
-         */
-        System.out.println("");
-        System.out.println( "*******************************" );
-        System.out.println( "*********** Phase 3 ***********" );
-        System.out.println( "*******************************" );
-        System.out.println( " Create and test new Loggers" );
-        Logger logger1 = Logger.getLogger( LOGGER_NAME_1 );
-        Logger logger2 = Logger.getLogger( LOGGER_NAME_2 );
-
-        // check that Level object are returned properly
-        try {
-            list = (String[]) mbs.getAttribute( objectName,  "LoggerNames" );
-        }
-        catch ( Exception e ) {
-            System.out.println("    : FAILED" );
-            throw e;
-        }
-
-        /*
-         *  Check for the existence of our new Loggers
-         */
-        boolean log1 = false, log2 = false;
-
-        if ( list == null || list.length < 2 ) {
-            System.out.println("    : FAILED.  Could not Detect the presense of the new Loggers" );
-            throw new RuntimeException(
-                "Could not Detect the presense of the new Loggers");
-        }
-        else {
-            for ( int i = 0; i < list.length; i++ ) {
-                if ( list[i].equals( LOGGER_NAME_1 ) ) {
-                    log1 = true;
-                    System.out.println( "    : Found new Logger : " + list[i] );
-                }
-                if ( list[i].equals( LOGGER_NAME_2 ) ) {
-                    log2 = true;
-                    System.out.println( "    : Found new Logger : " + list[i] );
-                }
-            }
-            if ( log1 && log2 )
-                System.out.println( "    : PASSED." );
-            else {
-                System.out.println( "    : FAILED.  Could not Detect the new Loggers." );
-                throw new RuntimeException(
-                    "Could not Detect the presense of the new Loggers");
-            }
-        }
-
-        /*
-         *  Set a new Logging levels and check that it succeeded
-         */
-        System.out.println("");
-        System.out.println( "*******************************" );
-        System.out.println( "*********** Phase 4 ***********" );
-        System.out.println( "*******************************" );
-        System.out.println( " Set and Check the Logger Level" );
-        log1 = false;
-        log2 = false;
-        try {
-            // Set the level of logger1 to ALL
-            params = new Object[2];
-            signature =  new String[2];
-            params[0] = LOGGER_NAME_1;
-            params[1] = Level.ALL.getName();
-            signature[0] = "java.lang.String";
-            signature[1] = "java.lang.String";
-            mbs.invoke(  objectName, "setLoggerLevel", params, signature );
-
-            // Set the level of logger2 to FINER
-            params[0] = LOGGER_NAME_2;
-            params[1] = Level.FINER.getName();
-            mbs.invoke(  objectName, "setLoggerLevel", params, signature );
-
-            // Okay read back the Level from Logger1. Should be ALL
-            params =  new Object[1];
-            signature =  new String[1];
-            params[0] = LOGGER_NAME_1;
-            signature[0] = "java.lang.String";
-            String levelName = (String) mbs.invoke(  objectName, "getLoggerLevel", params, signature );
-            l = Level.parse(levelName);
-            System.out.print("    Logger1: " );
-            if ( l.equals( l.ALL ) ) {
-                System.out.println("Level Set to ALL: PASSED" );
-                log1 = true;
-            }
-            else {
-                System.out.println("Level Set to ALL: FAILED" );
-                throw new RuntimeException(
-                    "Level Set to ALL but returned " + l.toString());
-            }
-
-            // Okay read back the Level from Logger2. Should be FINER
-            params =  new Object[1];
-            signature =  new String[1];
-            params[0] = LOGGER_NAME_2;
-            signature[0] = "java.lang.String";
-            levelName = (String) mbs.invoke(  objectName, "getLoggerLevel", params, signature );
-            l = Level.parse(levelName);
-            System.out.print("    Logger2: " );
-            if ( l.equals( l.FINER ) ) {
-                System.out.println("Level Set to FINER: PASSED" );
-                log2 = true;
-            }
-            else {
-                System.out.println("Level Set to FINER: FAILED" );
-                throw new RuntimeException(
-                    "Level Set to FINER but returned " + l.toString());
-            }
-        }
-        catch ( Exception e ) {
-            throw e;
-        }
-
-        System.out.println( "" );
-        System.out.println( "***************************************************" );
-        System.out.println( "***************** All Tests Passed ****************" );
-        System.out.println( "***************************************************" );
-    }
-
-    public static void main(String[] argv) throws Exception {
-        List<PlatformLoggingMXBean> result =
-            ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
-        if (result.size() != 1) {
-            throw new RuntimeException("Unexpected number of PlatformLoggingMXBean instances: " +
-                result.size());
-        }
-
-        PlatformLoggingMXBean mbean = result.get(0);
-        ObjectName objname = mbean.getObjectName();
-        if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) {
-            throw new RuntimeException("Invalid ObjectName " + objname);
-        }
-
-        // check if the PlatformLoggingMXBean is registered in the platform MBeanServer
-        MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer();
-        ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);
-        // We could call mbs.isRegistered(objName) here.
-        // Calling getMBeanInfo will throw exception if not found.
-        platformMBS.getMBeanInfo(objName);
-
-        if (!platformMBS.isInstanceOf(objName, "java.util.logging.PlatformLoggingMXBean") ||
-            !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) {
-            throw new RuntimeException(objName + " is of unexpected type");
-        }
-
-        // test if PlatformLoggingMXBean works properly in a MBeanServer
-        PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest();
-        test.runTest(mbean);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/SimpleFormatterFormat.java	Thu Mar 31 22:07:32 2011 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     6381464
+ * @summary Test the custom simple formatter output
+ *
+ * @run main/othervm SimpleFormatterFormat
+ */
+
+import java.io.*;
+import java.util.logging.*;
+import java.util.regex.*;
+
+public class SimpleFormatterFormat {
+    private static final String key = "java.util.logging.SimpleFormatter.format";
+    private static final String origFormat = System.getProperty(key);
+    private static final PrintStream err = System.err;
+    public static void main(String[] args) throws Exception {
+        try {
+            File dir = new File(System.getProperty("user.dir", "."));
+            File log = new File(dir, "simpleformat.txt");
+            java.nio.file.Files.deleteIfExists(log.toPath());
+            PrintStream logps = new PrintStream(log);
+            System.setProperty(key, "%3$s:%4$s: %5$s [%1$tc] source: %2$s%6$s%n");
+            writeLogRecords(logps);
+            checkLogRecords(log);
+        } finally {
+            if (origFormat == null) {
+                System.clearProperty(key);
+            } else {
+                System.setProperty(key, origFormat);
+            }
+            System.setErr(err);
+       }
+    }
+
+    private static String[] loggers = new String[] {
+        "test.foo",
+        "test.foo",
+        "test.bar",
+        "test.bar"
+    };
+    private static String[] messages = new String[] {
+        "severe hello world",
+        "warning lost connection",
+        "info welcome",
+        "warning exception thrown",
+    };
+    private static void writeLogRecords(PrintStream logps) throws Exception {
+        try {
+            System.setErr(logps);
+
+            Logger foo = Logger.getLogger("test.foo");
+            foo.log(Level.SEVERE, "{0} {1} {2}", new Object[] {"severe", "hello", "world"});
+            foo.warning(messages[1]);
+
+            Logger bar = Logger.getLogger("test.bar");
+            bar.finest("Dummy message");
+            bar.info(messages[2]);
+            bar.log(Level.WARNING, messages[3], new IllegalArgumentException());
+
+        } finally {
+            logps.flush();
+            logps.close();
+            System.setErr(err);
+        }
+    }
+
+    private static void checkLogRecords(File log) throws Exception {
+        System.out.println("Checking log records in file: " + log);
+        Pattern p = Pattern.compile("([\\.a-zA-Z:]+) (.*) \\[.*\\] source: (.*)");
+
+        try (FileInputStream in = new FileInputStream(log)) {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+            String line;
+            int i = 0;
+            while (i < messages.length &&
+                      (line = reader.readLine()) != null) {
+                String expectedLogger = loggers[i];
+                String expectedMsg = messages[i];
+                i++;
+
+                line = line.trim();
+                System.out.println(line);
+
+                Matcher m = p.matcher(line);
+                if (!m.matches()) {
+                    throw new RuntimeException("Unexpected output format");
+                }
+                if (m.groupCount() != 3) {
+                    throw new RuntimeException("Unexpected group count = " +
+                        m.groupCount());
+                }
+                // verify logger name and level
+                String[] ss = m.group(1).split(":");
+                int len = ss.length;
+                if (len != 2) {
+                    throw new RuntimeException("Unexpected logger name and level" +
+                        m.group(1));
+                }
+
+                verify(expectedLogger, expectedMsg, ss[0], ss[1], m.group(2), m.group(3));
+            }
+
+            // expect IllegalArgumentException following it
+            line = reader.readLine().trim();
+            if (!line.equals("java.lang.IllegalArgumentException")) {
+                throw new RuntimeException("Invalid line: " + line);
+            }
+        }
+    }
+
+    private static void verify(String expectedLogger, String expectedMsg,
+                               String logger, String level,
+                               String msg, String source) {
+        if (!logger.equals(expectedLogger)) {
+            throw new RuntimeException("Unexpected logger: " + logger);
+        }
+        if (!msg.equals(expectedMsg)) {
+            throw new RuntimeException("Unexpected message: " + msg);
+        }
+
+        String[] ss = expectedMsg.split("\\s+");
+        String expectedLevel = ss[0].toUpperCase();
+        if (!level.equals(expectedLevel)) {
+            throw new RuntimeException("Unexpected level: " + level);
+        }
+
+        ss = source.split("\\s+");
+        int len = ss.length;
+        if (!(len == 2 &&
+              ss[0].equals("SimpleFormatterFormat") &&
+              ss[1].equals("writeLogRecords"))) {
+            throw new RuntimeException("Unexpected source: " + source);
+        }
+    }
+}
--- a/jdk/test/sun/misc/Version/Version.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/misc/Version/Version.java	Thu Mar 31 22:07:32 2011 -0700
@@ -142,15 +142,21 @@
                 // non-product VM will have -debug|-release appended
                 cs = cs.subSequence(1, cs.length());
                 String[] res = cs.toString().split("-");
-                for (String s : res) {
+                for (int i = res.length - 1; i >= 0; i--) {
+                    String s = res[i];
                     if (s.charAt(0) == 'b') {
-                        build =
-                            Integer.valueOf(s.substring(1, s.length())).intValue();
-                        break;
+                        try {
+                            build = Integer.parseInt(s.substring(1, s.length()));
+                            break;
+                        } catch (NumberFormatException nfe) {
+                            // ignore
+                        }
                     }
                 }
             }
         }
-        return new VersionInfo(major, minor, micro, update, special, build);
+        VersionInfo vi = new VersionInfo(major, minor, micro, update, special, build);
+        System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi);
+        return vi;
     }
 }
--- a/jdk/test/sun/security/ec/TestEC.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/ec/TestEC.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
  * @test
  * @bug 6840752
  * @summary  Provide out-of-the-box support for ECC algorithms
- * @ignore JSSE supported cipher suites are changed with CR 6916074,
- *     need to update this test case in JDK 7 soon
  * @library ../pkcs11
  * @library ../pkcs11/ec
  * @library ../pkcs11/sslecc
--- a/jdk/test/sun/security/jgss/GssNPE.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/jgss/GssNPE.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6345338
+ * @run main/othervm GssNPE
  * @summary GSS throws NPE when the JAAS config file does not exist
  */
 
--- a/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6770883
+ * @run main/othervm NoSpnegoAsDefMech
  * @summary Infinite loop if SPNEGO specified as sun.security.jgss.mechanism
  */
 
--- a/jdk/test/sun/security/krb5/ConfPlusProp.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/ConfPlusProp.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @bug 6857795
  * @bug 6858589
  * @bug 6972005
+ * @run main/othervm ConfPlusProp
  * @summary krb5.conf ignored if system properties on realm and kdc are provided
  */
 
--- a/jdk/test/sun/security/krb5/ConfigWithQuotations.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/ConfigWithQuotations.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 /*
  * @test
  * @bug 6714845
+ * @run main/othervm ConfigWithQuotations
  * @summary Quotes in Kerberos configuration file are included in the values
  */
 
--- a/jdk/test/sun/security/krb5/DnsFallback.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/DnsFallback.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  * @test
  * @bug 6673164
  * @bug 6552334
+ * @run main/othervm DnsFallback
  * @summary fix dns_fallback parse error, and use dns by default
  */
 
--- a/jdk/test/sun/security/krb5/IPv6.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/IPv6.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6877357 6885166
+ * @run main/othervm IPv6
  * @summary IPv6 address does not work
  */
 
--- a/jdk/test/sun/security/krb5/ParseCAPaths.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/ParseCAPaths.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 /*
  * @test
  * @bug 6789935
+ * @run main/othervm ParseCAPaths
  * @summary cross-realm capath search error
  */
 
@@ -30,9 +31,10 @@
 import sun.security.krb5.Realm;
 
 public class ParseCAPaths {
-    static boolean failed = false;
+    static Exception failed = null;
     public static void main(String[] args) throws Exception {
-        System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") +"/krb5-capaths.conf");
+        System.setProperty("java.security.krb5.conf",
+                System.getProperty("test.src", ".") +"/krb5-capaths.conf");
         //System.setProperty("sun.security.krb5.debug", "true");
 
         // Standard example
@@ -59,9 +61,13 @@
         check("G1.COM", "G3.COM", "G1.COM", "COM");
         check("H1.COM", "H3.COM", "H1.COM");
         check("I1.COM", "I4.COM", "I1.COM", "I5.COM");
-
-        if (failed) {
-            throw new Exception("Failed somewhere.");
+        // J2=J1 is the same as J2=.
+        check("J1.COM", "J2.COM", "J1.COM");
+        // 7019384
+        check("A9.PRAGUE.XXX.CZ", "SERVIS.XXX.CZ",
+                "A9.PRAGUE.XXX.CZ", "PRAGUE.XXX.CZ", "ROOT.XXX.CZ");
+        if (failed != null) {
+            throw failed;
         }
     }
 
@@ -69,10 +75,10 @@
         try {
             check2(from, to, paths);
         } catch (Exception e) {
-            failed = true;
-            e.printStackTrace();
+            failed = e;
         }
     }
+
     static void check2(String from, String to, String... paths)
             throws Exception {
         System.out.println(from + " -> " + to);
--- a/jdk/test/sun/security/krb5/ParseConfig.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/ParseConfig.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 /*
  * @test
  * @bug 6319046
+ * @run main/othervm ParseConfig
  * @summary Problem with parsing krb5.conf
  */
 
--- a/jdk/test/sun/security/krb5/RFC396xTest.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/RFC396xTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 /*
  * @test
  * @bug 6862679
+ * @run main/othervm RFC396xTest
  * @summary ESC: AD Authentication with user with umlauts fails
  */
 
--- a/jdk/test/sun/security/krb5/TimeInCCache.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/TimeInCCache.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 /*
  * @test
  * @bug 6590930
+ * @run main/othervm TimeInCCache
  * @summary read/write does not match for ccache
  */
 
--- a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java	Thu Mar 31 22:07:32 2011 -0700
@@ -74,11 +74,10 @@
     final static char[] WEB_PASS = "webby".toCharArray();
     final static String PROXY_USER = "pro";
     final static char[] PROXY_PASS = "proxy".toCharArray();
-    final static int WEB_PORT = 17840;
+
 
     final static String WEB_HOST = "host.web.domain";
     final static String PROXY_HOST = "host.proxy.domain";
-    final static int PROXY_PORT = 17841;
 
     // web page content
     final static String CONTENT = "Hello, World!";
@@ -86,18 +85,11 @@
     // For 6829283, count how many times the Authenticator is called.
     static int count = 0;
 
+    static int webPort, proxyPort;
+
     // URLs for web test, proxy test. The proxy server is not a real proxy
     // since it fakes the same content for any URL. :)
-    final static URL webUrl, proxyUrl;
-    static {
-        URL u1 = null, u2 = null;
-        try {
-            u1 = new URL("http://" + WEB_HOST +":" + WEB_PORT + "/a/b/c");
-            u2 = new URL("http://nosuchplace/a/b/c");
-        } catch (Exception e) {
-        }
-        webUrl = u1; proxyUrl = u2;
-    }
+    static URL webUrl, proxyUrl;
 
     /**
      * This Authenticator checks everything:
@@ -127,7 +119,7 @@
                 if (!this.getRequestingHost().equalsIgnoreCase(PROXY_HOST)) {
                     throw new RuntimeException("Bad host");
                 }
-                if (this.getRequestingPort() != PROXY_PORT) {
+                if (this.getRequestingPort() != proxyPort) {
                     throw new RuntimeException("Bad port");
                 }
                 if (!this.getRequestingURL().equals(proxyUrl)) {
@@ -188,10 +180,15 @@
         fos.close();
         f.deleteOnExit();
 
-        HttpServer h1 = httpd(WEB_PORT, "Negotiate", false,
+        HttpServer h1 = httpd("Negotiate", false,
                 "HTTP/" + WEB_HOST + "@" + REALM_WEB, KRB5_TAB);
-        HttpServer h2 = httpd(PROXY_PORT, "Negotiate", true,
+        webPort = h1.getAddress().getPort();
+        HttpServer h2 = httpd("Negotiate", true,
                 "HTTP/" + PROXY_HOST + "@" + REALM_PROXY, KRB5_TAB);
+        proxyPort = h2.getAddress().getPort();
+
+        webUrl = new URL("http://" + WEB_HOST +":" + webPort + "/a/b/c");
+        proxyUrl = new URL("http://nosuchplace/a/b/c");
 
         try {
             Exception e1 = null, e2 = null;
@@ -230,7 +227,7 @@
         reader = new BufferedReader(new InputStreamReader(
                 proxyUrl.openConnection(
                 new Proxy(Proxy.Type.HTTP,
-                    new InetSocketAddress(PROXY_HOST, PROXY_PORT)))
+                    new InetSocketAddress(PROXY_HOST, proxyPort)))
                 .getInputStream()));
         if (!reader.readLine().equals(CONTENT)) {
             throw new RuntimeException("Bad content");
@@ -258,10 +255,10 @@
      * @param principal the krb5 service principal the server runs with
      * @return the server
      */
-    public static HttpServer httpd(int port, String scheme, boolean proxy,
+    public static HttpServer httpd(String scheme, boolean proxy,
             String principal, String ktab) throws Exception {
         MyHttpHandler h = new MyHttpHandler();
-        HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
+        HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
         HttpContext hc = server.createContext("/", h);
         hc.setAuthenticator(new MyServerAuthenticator(
                 proxy, scheme, principal, ktab));
--- a/jdk/test/sun/security/krb5/etype/ETypeOrder.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/etype/ETypeOrder.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 /*
  * @test
  * @bug 6844907
+ * @run main/othervm ETypeOrder
  * @summary krb5 etype order should be from strong to weak
  */
 
--- a/jdk/test/sun/security/krb5/krb5-capaths.conf	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/krb5-capaths.conf	Thu Mar 31 22:07:32 2011 -0700
@@ -85,3 +85,13 @@
     I3.COM = I2.COM
     I4.COM = I2.COM I5.COM
 }
+
+J1.COM = {
+    J2.COM=J1.COM
+}
+
+A9.PRAGUE.XXX.CZ = {
+    PRAGUE.XXX.CZ = .
+    ROOT.XXX.CZ = PRAGUE.XXX.CZ
+    SERVIS.XXX.CZ = ROOT.XXX.CZ
+}
--- a/jdk/test/sun/security/krb5/ktab/HighestKvno.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/krb5/ktab/HighestKvno.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  * @test
  * @bug 6867665
  * @bug 6875033
+ * @run main/othervm HighestKvno
  * @summary Problem with keytabs with multiple kvno's (key versions)
  */
 
--- a/jdk/test/sun/security/pkcs11/fips/CipherTest.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/fips/CipherTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,19 +114,7 @@
         }
 
         boolean isEnabled() {
-            // ignore SCSV
-            if (cipherSuite.equals("TLS_EMPTY_RENEGOTIATION_INFO_SCSV")) {
-                return false;
-            }
-
-            // ignore exportable cipher suite for TLSv1.1
-            if (protocol.equals("TLSv1.1")) {
-                if(cipherSuite.indexOf("_EXPORT_") != -1) {
-                    return false;
-                }
-            }
-
-            return true;
+            return TLSCipherStatus.isEnabled(cipherSuite, protocol);
         }
 
         public String toString() {
@@ -137,6 +125,114 @@
             return s;
         }
 
+        static enum TLSCipherStatus {
+            // cipher suites supported since TLS 1.2
+            CS_01("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF),
+            CS_02("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",   0x0303, 0xFFFF),
+            CS_03("TLS_RSA_WITH_AES_256_CBC_SHA256",         0x0303, 0xFFFF),
+            CS_04("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",  0x0303, 0xFFFF),
+            CS_05("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",    0x0303, 0xFFFF),
+            CS_06("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_07("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+
+            CS_08("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF),
+            CS_09("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",   0x0303, 0xFFFF),
+            CS_10("TLS_RSA_WITH_AES_128_CBC_SHA256",         0x0303, 0xFFFF),
+            CS_11("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",  0x0303, 0xFFFF),
+            CS_12("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",    0x0303, 0xFFFF),
+            CS_13("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_14("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+
+            CS_15("TLS_DH_anon_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_16("TLS_DH_anon_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_17("TLS_RSA_WITH_NULL_SHA256",                0x0303, 0xFFFF),
+
+            // cipher suites obsoleted since TLS 1.2
+            CS_50("SSL_RSA_WITH_DES_CBC_SHA",                0x0000, 0x0303),
+            CS_51("SSL_DHE_RSA_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_52("SSL_DHE_DSS_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_53("SSL_DH_anon_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_54("TLS_KRB5_WITH_DES_CBC_SHA",               0x0000, 0x0303),
+            CS_55("TLS_KRB5_WITH_DES_CBC_MD5",               0x0000, 0x0303),
+
+            // cipher suites obsoleted since TLS 1.1
+            CS_60("SSL_RSA_EXPORT_WITH_RC4_40_MD5",          0x0000, 0x0302),
+            CS_61("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",      0x0000, 0x0302),
+            CS_62("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",       0x0000, 0x0302),
+            CS_63("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_64("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_65("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_66("TLS_KRB5_EXPORT_WITH_RC4_40_SHA",         0x0000, 0x0302),
+            CS_67("TLS_KRB5_EXPORT_WITH_RC4_40_MD5",         0x0000, 0x0302),
+            CS_68("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",     0x0000, 0x0302),
+            CS_69("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",     0x0000, 0x0302),
+
+            // ignore TLS_EMPTY_RENEGOTIATION_INFO_SCSV always
+            CS_99("TLS_EMPTY_RENEGOTIATION_INFO_SCSV",       0xFFFF, 0x0000);
+
+            // the cipher suite name
+            final String cipherSuite;
+
+            // supported since protocol version
+            final int supportedSince;
+
+            // obsoleted since protocol version
+            final int obsoletedSince;
+
+            TLSCipherStatus(String cipherSuite,
+                    int supportedSince, int obsoletedSince) {
+                this.cipherSuite = cipherSuite;
+                this.supportedSince = supportedSince;
+                this.obsoletedSince = obsoletedSince;
+            }
+
+            static boolean isEnabled(String cipherSuite, String protocol) {
+                int versionNumber = toVersionNumber(protocol);
+
+                if (versionNumber < 0) {
+                    return true;  // unlikely to happen
+                }
+
+                for (TLSCipherStatus status : TLSCipherStatus.values()) {
+                    if (cipherSuite.equals(status.cipherSuite)) {
+                        if ((versionNumber < status.supportedSince) ||
+                            (versionNumber >= status.obsoletedSince)) {
+                            return false;
+                        }
+
+                        return true;
+                    }
+                }
+
+                return true;
+            }
+
+            private static int toVersionNumber(String protocol) {
+                int versionNumber = -1;
+
+                switch (protocol) {
+                    case "SSLv2Hello":
+                        versionNumber = 0x0002;
+                        break;
+                    case "SSLv3":
+                        versionNumber = 0x0300;
+                        break;
+                    case "TLSv1":
+                        versionNumber = 0x0301;
+                        break;
+                    case "TLSv1.1":
+                        versionNumber = 0x0302;
+                        break;
+                    case "TLSv1.2":
+                        versionNumber = 0x0303;
+                        break;
+                    default:
+                        // unlikely to happen
+                }
+
+                return versionNumber;
+            }
+        }
     }
 
     private List<TestParameters> tests;
--- a/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,19 +114,7 @@
         }
 
         boolean isEnabled() {
-            // ignore SCSV
-            if (cipherSuite.equals("TLS_EMPTY_RENEGOTIATION_INFO_SCSV")) {
-                return false;
-            }
-
-            // ignore exportable cipher suite for TLSv1.1
-            if (protocol.equals("TLSv1.1")) {
-                if(cipherSuite.indexOf("_EXPORT_") != -1) {
-                    return false;
-                }
-            }
-
-            return true;
+            return TLSCipherStatus.isEnabled(cipherSuite, protocol);
         }
 
         public String toString() {
@@ -137,6 +125,114 @@
             return s;
         }
 
+        static enum TLSCipherStatus {
+            // cipher suites supported since TLS 1.2
+            CS_01("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF),
+            CS_02("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",   0x0303, 0xFFFF),
+            CS_03("TLS_RSA_WITH_AES_256_CBC_SHA256",         0x0303, 0xFFFF),
+            CS_04("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",  0x0303, 0xFFFF),
+            CS_05("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",    0x0303, 0xFFFF),
+            CS_06("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_07("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+
+            CS_08("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF),
+            CS_09("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",   0x0303, 0xFFFF),
+            CS_10("TLS_RSA_WITH_AES_128_CBC_SHA256",         0x0303, 0xFFFF),
+            CS_11("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",  0x0303, 0xFFFF),
+            CS_12("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",    0x0303, 0xFFFF),
+            CS_13("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_14("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+
+            CS_15("TLS_DH_anon_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_16("TLS_DH_anon_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_17("TLS_RSA_WITH_NULL_SHA256",                0x0303, 0xFFFF),
+
+            // cipher suites obsoleted since TLS 1.2
+            CS_50("SSL_RSA_WITH_DES_CBC_SHA",                0x0000, 0x0303),
+            CS_51("SSL_DHE_RSA_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_52("SSL_DHE_DSS_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_53("SSL_DH_anon_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_54("TLS_KRB5_WITH_DES_CBC_SHA",               0x0000, 0x0303),
+            CS_55("TLS_KRB5_WITH_DES_CBC_MD5",               0x0000, 0x0303),
+
+            // cipher suites obsoleted since TLS 1.1
+            CS_60("SSL_RSA_EXPORT_WITH_RC4_40_MD5",          0x0000, 0x0302),
+            CS_61("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",      0x0000, 0x0302),
+            CS_62("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",       0x0000, 0x0302),
+            CS_63("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_64("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_65("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_66("TLS_KRB5_EXPORT_WITH_RC4_40_SHA",         0x0000, 0x0302),
+            CS_67("TLS_KRB5_EXPORT_WITH_RC4_40_MD5",         0x0000, 0x0302),
+            CS_68("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",     0x0000, 0x0302),
+            CS_69("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",     0x0000, 0x0302),
+
+            // ignore TLS_EMPTY_RENEGOTIATION_INFO_SCSV always
+            CS_99("TLS_EMPTY_RENEGOTIATION_INFO_SCSV",       0xFFFF, 0x0000);
+
+            // the cipher suite name
+            final String cipherSuite;
+
+            // supported since protocol version
+            final int supportedSince;
+
+            // obsoleted since protocol version
+            final int obsoletedSince;
+
+            TLSCipherStatus(String cipherSuite,
+                    int supportedSince, int obsoletedSince) {
+                this.cipherSuite = cipherSuite;
+                this.supportedSince = supportedSince;
+                this.obsoletedSince = obsoletedSince;
+            }
+
+            static boolean isEnabled(String cipherSuite, String protocol) {
+                int versionNumber = toVersionNumber(protocol);
+
+                if (versionNumber < 0) {
+                    return true;  // unlikely to happen
+                }
+
+                for (TLSCipherStatus status : TLSCipherStatus.values()) {
+                    if (cipherSuite.equals(status.cipherSuite)) {
+                        if ((versionNumber < status.supportedSince) ||
+                            (versionNumber >= status.obsoletedSince)) {
+                            return false;
+                        }
+
+                        return true;
+                    }
+                }
+
+                return true;
+            }
+
+            private static int toVersionNumber(String protocol) {
+                int versionNumber = -1;
+
+                switch (protocol) {
+                    case "SSLv2Hello":
+                        versionNumber = 0x0002;
+                        break;
+                    case "SSLv3":
+                        versionNumber = 0x0300;
+                        break;
+                    case "TLSv1":
+                        versionNumber = 0x0301;
+                        break;
+                    case "TLSv1.1":
+                        versionNumber = 0x0302;
+                        break;
+                    case "TLSv1.2":
+                        versionNumber = 0x0303;
+                        break;
+                    default:
+                        // unlikely to happen
+                }
+
+                return versionNumber;
+            }
+        }
     }
 
     private List<TestParameters> tests;
@@ -170,11 +266,13 @@
                         // no client with anonymous ciphersuites
                         continue;
                     }
+
                     tests.add(new TestParameters(cipherSuite, protocol,
                         clientAuth));
                 }
             }
         }
+
         testIterator = tests.iterator();
     }
 
--- a/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -115,19 +115,7 @@
         }
 
         boolean isEnabled() {
-            // ignore SCSV
-            if (cipherSuite.equals("TLS_EMPTY_RENEGOTIATION_INFO_SCSV")) {
-                return false;
-            }
-
-            // ignore exportable cipher suite for TLSv1.1
-            if (protocol.equals("TLSv1.1")) {
-                if(cipherSuite.indexOf("_EXPORT_") != -1) {
-                    return false;
-                }
-            }
-
-            return true;
+            return TLSCipherStatus.isEnabled(cipherSuite, protocol);
         }
 
         public String toString() {
@@ -138,6 +126,114 @@
             return s;
         }
 
+        static enum TLSCipherStatus {
+            // cipher suites supported since TLS 1.2
+            CS_01("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", 0x0303, 0xFFFF),
+            CS_02("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",   0x0303, 0xFFFF),
+            CS_03("TLS_RSA_WITH_AES_256_CBC_SHA256",         0x0303, 0xFFFF),
+            CS_04("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",  0x0303, 0xFFFF),
+            CS_05("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",    0x0303, 0xFFFF),
+            CS_06("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_07("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+
+            CS_08("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", 0x0303, 0xFFFF),
+            CS_09("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",   0x0303, 0xFFFF),
+            CS_10("TLS_RSA_WITH_AES_128_CBC_SHA256",         0x0303, 0xFFFF),
+            CS_11("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",  0x0303, 0xFFFF),
+            CS_12("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",    0x0303, 0xFFFF),
+            CS_13("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_14("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+
+            CS_15("TLS_DH_anon_WITH_AES_256_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_16("TLS_DH_anon_WITH_AES_128_CBC_SHA256",     0x0303, 0xFFFF),
+            CS_17("TLS_RSA_WITH_NULL_SHA256",                0x0303, 0xFFFF),
+
+            // cipher suites obsoleted since TLS 1.2
+            CS_50("SSL_RSA_WITH_DES_CBC_SHA",                0x0000, 0x0303),
+            CS_51("SSL_DHE_RSA_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_52("SSL_DHE_DSS_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_53("SSL_DH_anon_WITH_DES_CBC_SHA",            0x0000, 0x0303),
+            CS_54("TLS_KRB5_WITH_DES_CBC_SHA",               0x0000, 0x0303),
+            CS_55("TLS_KRB5_WITH_DES_CBC_MD5",               0x0000, 0x0303),
+
+            // cipher suites obsoleted since TLS 1.1
+            CS_60("SSL_RSA_EXPORT_WITH_RC4_40_MD5",          0x0000, 0x0302),
+            CS_61("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",      0x0000, 0x0302),
+            CS_62("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",       0x0000, 0x0302),
+            CS_63("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_64("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_65("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",   0x0000, 0x0302),
+            CS_66("TLS_KRB5_EXPORT_WITH_RC4_40_SHA",         0x0000, 0x0302),
+            CS_67("TLS_KRB5_EXPORT_WITH_RC4_40_MD5",         0x0000, 0x0302),
+            CS_68("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",     0x0000, 0x0302),
+            CS_69("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",     0x0000, 0x0302),
+
+            // ignore TLS_EMPTY_RENEGOTIATION_INFO_SCSV always
+            CS_99("TLS_EMPTY_RENEGOTIATION_INFO_SCSV",       0xFFFF, 0x0000);
+
+            // the cipher suite name
+            final String cipherSuite;
+
+            // supported since protocol version
+            final int supportedSince;
+
+            // obsoleted since protocol version
+            final int obsoletedSince;
+
+            TLSCipherStatus(String cipherSuite,
+                    int supportedSince, int obsoletedSince) {
+                this.cipherSuite = cipherSuite;
+                this.supportedSince = supportedSince;
+                this.obsoletedSince = obsoletedSince;
+            }
+
+            static boolean isEnabled(String cipherSuite, String protocol) {
+                int versionNumber = toVersionNumber(protocol);
+
+                if (versionNumber < 0) {
+                    return true;  // unlikely to happen
+                }
+
+                for (TLSCipherStatus status : TLSCipherStatus.values()) {
+                    if (cipherSuite.equals(status.cipherSuite)) {
+                        if ((versionNumber < status.supportedSince) ||
+                            (versionNumber >= status.obsoletedSince)) {
+                            return false;
+                        }
+
+                        return true;
+                    }
+                }
+
+                return true;
+            }
+
+            private static int toVersionNumber(String protocol) {
+                int versionNumber = -1;
+
+                switch (protocol) {
+                    case "SSLv2Hello":
+                        versionNumber = 0x0002;
+                        break;
+                    case "SSLv3":
+                        versionNumber = 0x0300;
+                        break;
+                    case "TLSv1":
+                        versionNumber = 0x0301;
+                        break;
+                    case "TLSv1.1":
+                        versionNumber = 0x0302;
+                        break;
+                    case "TLSv1.2":
+                        versionNumber = 0x0303;
+                        break;
+                    default:
+                        // unlikely to happen
+                }
+
+                return versionNumber;
+            }
+        }
     }
 
     private List<TestParameters> tests;
--- a/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java	Thu Mar 31 22:07:32 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
  * @test
  * @bug 4496785
  * @summary Verify that all ciphersuites work in all configurations
- * @ignore JSSE supported cipher suites are changed with CR 6916074,
- *     need to update this test case in JDK 7 soon
  * @author Andreas Sterbenz
  * @run main/othervm/timeout=300 ClientJSSEServerJSSE
  */
--- a/jdk/test/sun/util/logging/PlatformLoggerTest.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java	Thu Mar 31 22:07:32 2011 -0700
@@ -26,10 +26,11 @@
  * @bug     6882376 6985460
  * @summary Test if java.util.logging.Logger is created before and after
  *          logging is enabled.  Also validate some basic PlatformLogger
- *          operations.
+ *          operations.  othervm mode to make sure java.util.logging
+ *          is not initialized.
  *
  * @compile -XDignore.symbol.file PlatformLoggerTest.java
- * @run main PlatformLoggerTest
+ * @run main/othervm PlatformLoggerTest
  */
 
 import java.util.logging.*;
--- a/jdk/test/tools/pack200/CommandLineTests.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/tools/pack200/CommandLineTests.java	Thu Mar 31 22:07:32 2011 -0700
@@ -120,9 +120,9 @@
             // make a backup copy for re-use
             File bakFile = new File(f.getName() + ".bak");
             if (!bakFile.exists()) {  // backup
-                Utils.copyFile(f.getAbsoluteFile(), bakFile.getAbsoluteFile());
+                Utils.copyFile(f, bakFile);
             } else {  // restore
-                Utils.copyFile(bakFile.getAbsoluteFile(), f.getAbsoluteFile());
+                Utils.copyFile(bakFile, f);
             }
             cmdsList.clear();
             cmdsList.add(Utils.getPack200Cmd());
--- a/jdk/test/tools/pack200/TimeStamp.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/tools/pack200/TimeStamp.java	Thu Mar 31 22:07:32 2011 -0700
@@ -56,7 +56,7 @@
         // make a local copy of our test file
         File srcFile = Utils.locateJar("golden.jar");
         File goldenFile = new File("golden.jar");
-        Utils.copyFile(srcFile, goldenFile.getAbsoluteFile());
+        Utils.copyFile(srcFile, goldenFile);
 
         JarFile goldenJarFile = new JarFile(goldenFile);
         File packFile = new File("golden.pack");
--- a/jdk/test/tools/pack200/Utils.java	Thu Mar 31 18:14:17 2011 -0700
+++ b/jdk/test/tools/pack200/Utils.java	Thu Mar 31 22:07:32 2011 -0700
@@ -21,18 +21,18 @@
  * questions.
  */
 
+import java.nio.file.Path;
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileFilter;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
-import java.nio.channels.FileChannel;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -44,6 +44,8 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import static java.nio.file.StandardCopyOption.*;
+
 /**
  *
  * @author ksrini
@@ -180,45 +182,12 @@
         }
     };
 
-    private static void setFileAttributes(File src, File dst) throws IOException {
-        dst.setExecutable(src.canExecute());
-        dst.setReadable(src.canRead());
-        dst.setWritable(src.canWrite());
-        dst.setLastModified(src.lastModified());
-    }
-
     static void copyFile(File src, File dst) throws IOException {
-        if (src.isDirectory()) {
-            dst.mkdirs();
-            setFileAttributes(src, dst);
-            return;
-        } else {
-            File baseDirFile = dst.getParentFile();
-            if (!baseDirFile.exists()) {
-                baseDirFile.mkdirs();
-            }
+        Path parent = dst.toPath().getParent();
+        if (parent != null) {
+            Files.createDirectories(parent);
         }
-        FileInputStream in = null;
-        FileOutputStream out = null;
-        FileChannel srcChannel = null;
-        FileChannel dstChannel = null;
-        try {
-            in = new FileInputStream(src);
-            out = new FileOutputStream(dst);
-            srcChannel = in.getChannel();
-            dstChannel = out.getChannel();
-
-            long retval = srcChannel.transferTo(0, src.length(), dstChannel);
-            if (src.length() != dst.length()) {
-                throw new IOException("file copy failed for " + src);
-            }
-        } finally {
-            close(srcChannel);
-            close(dstChannel);
-            close(in);
-            close(out);
-        }
-        setFileAttributes(src, dst);
+        Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING);
     }
 
     static String baseName(File file, String extension) {