Merge
authorlana
Mon, 04 Apr 2011 17:28:28 -0700
changeset 9030 3de293b4cf4f
parent 8990 7b24333cc9bf (current diff)
parent 9029 e92fcf58f684 (diff)
child 9031 1eb1dd4b5647
Merge
jdk/src/share/classes/java/awt/Toolkit.java
jdk/src/share/classes/java/nio/BufferPoolMXBean.java
jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
jdk/src/windows/native/java/net/NetworkInterface_win9x.c
jdk/test/java/nio/BufferPoolMXBean/Basic.java
jdk/test/java/util/logging/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/common/Defs-embedded.gmk	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/common/Defs.gmk	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/common/Library.gmk	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/common/Release.gmk	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/common/shared/Sanity-Settings.gmk	Mon Apr 04 17:28:28 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/java/Makefile	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/java/java/Makefile	Mon Apr 04 17:28:28 2011 -0700
@@ -198,10 +198,12 @@
 
 #
 # What to link?
+# On Windows, shell32 is not normally required and so it is delay loaded.
 #
 ifeq ($(PLATFORM),windows)
 OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
-		       -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib
+		       -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib \
+		       shell32.lib delayimp.lib /DELAYLOAD:shell32.dll
 else
 OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \
 		-L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
--- a/jdk/make/java/management/Makefile	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/java/management/Makefile	Mon Apr 04 17:28:28 2011 -0700
@@ -86,7 +86,8 @@
   -I$(SHARE_SRC)/native/sun/management 
 
 ifeq ($(PLATFORM),windows)
-  OTHER_LDLIBS += $(JVMLIB)
+  # Need process status helper API (psapi) on Windows
+  OTHER_LDLIBS += $(JVMLIB) psapi.lib
 endif
 
 #
--- a/jdk/make/java/net/Makefile	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/java/net/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/java/zip/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/jprt.properties	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/launchers/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/awt/mawt.gmk	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/jawt/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/jpeg/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/nio/cs/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/security/tools/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/make/sun/xawt/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/ArithmeticException.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/NullPointerException.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/OutOfMemoryError.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/PlatformComponent.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/management/package.html	Mon Apr 04 17:28:28 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/lang/reflect/AccessibleObject.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java	Mon Apr 04 17:28:28 2011 -0700
@@ -26,6 +26,7 @@
 package java.lang.reflect;
 
 import java.security.AccessController;
+import sun.reflect.Reflection;
 import sun.reflect.ReflectionFactory;
 import java.lang.annotation.Annotation;
 
@@ -201,4 +202,73 @@
     public Annotation[] getDeclaredAnnotations()  {
         throw new AssertionError("All subclasses should override this method");
     }
+
+
+    // Shared access checking logic.
+
+    // For non-public members or members in package-private classes,
+    // it is necessary to perform somewhat expensive security checks.
+    // If the security check succeeds for a given class, it will
+    // always succeed (it is not affected by the granting or revoking
+    // of permissions); we speed up the check in the common case by
+    // remembering the last Class for which the check succeeded.
+    //
+    // The simple security check for Constructor is to see if
+    // the caller has already been seen, verified, and cached.
+    // (See also Class.newInstance(), which uses a similar method.)
+    //
+    // A more complicated security check cache is needed for Method and Field
+    // The cache can be either null (empty cache), a 2-array of {caller,target},
+    // or a caller (with target implicitly equal to this.clazz).
+    // In the 2-array case, the target is always different from the clazz.
+    volatile Object securityCheckCache;
+
+    void checkAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers)
+        throws IllegalAccessException
+    {
+        if (caller == clazz) {  // quick check
+            return;             // ACCESS IS OK
+        }
+        Object cache = securityCheckCache;  // read volatile
+        Class<?> targetClass = clazz;
+        if (obj != null
+            && Modifier.isProtected(modifiers)
+            && ((targetClass = obj.getClass()) != clazz)) {
+            // Must match a 2-list of { caller, targetClass }.
+            if (cache instanceof Class[]) {
+                Class<?>[] cache2 = (Class<?>[]) cache;
+                if (cache2[1] == targetClass &&
+                    cache2[0] == caller) {
+                    return;     // ACCESS IS OK
+                }
+                // (Test cache[1] first since range check for [1]
+                // subsumes range check for [0].)
+            }
+        } else if (cache == caller) {
+            // Non-protected case (or obj.class == this.clazz).
+            return;             // ACCESS IS OK
+        }
+
+        // If no return, fall through to the slow path.
+        slowCheckMemberAccess(caller, clazz, obj, modifiers, targetClass);
+    }
+
+    // Keep all this slow stuff out of line:
+    void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers,
+                               Class<?> targetClass)
+        throws IllegalAccessException
+    {
+        Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
+
+        // Success: Update the cache.
+        Object cache = ((targetClass == clazz)
+                        ? caller
+                        : new Class<?>[] { caller, targetClass });
+
+        // Note:  The two cache elements are not volatile,
+        // but they are effectively final.  The Java memory model
+        // guarantees that the initializing stores for the cache
+        // elements will occur before the volatile write.
+        securityCheckCache = cache;         // write volatile
+    }
 }
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Mon Apr 04 17:28:28 2011 -0700
@@ -74,14 +74,6 @@
     private byte[]              annotations;
     private byte[]              parameterAnnotations;
 
-    // For non-public members or members in package-private classes,
-    // it is necessary to perform somewhat expensive security checks.
-    // If the security check succeeds for a given class, it will
-    // always succeed (it is not affected by the granting or revoking
-    // of permissions); we speed up the check in the common case by
-    // remembering the last Class for which the check succeeded.
-    private volatile Class<?> securityCheckCache;
-
     // Generics infrastructure
     // Accessor for factory
     private GenericsFactory getFactory() {
@@ -495,7 +487,7 @@
      * this object represents
      *
      * @exception IllegalAccessException    if this {@code Constructor} object
-     *              enforces Java language access control and the underlying
+     *              is enforcing Java language access control and the underlying
      *              constructor is inaccessible.
      * @exception IllegalArgumentException  if the number of actual
      *              and formal parameters differ; if an unwrapping
@@ -518,16 +510,17 @@
         if (!override) {
             if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
                 Class<?> caller = Reflection.getCallerClass(2);
-                if (securityCheckCache != caller) {
-                    Reflection.ensureMemberAccess(caller, clazz, null, modifiers);
-                    securityCheckCache = caller;
-                }
+
+                checkAccess(caller, clazz, null, modifiers);
             }
         }
         if ((clazz.getModifiers() & Modifier.ENUM) != 0)
             throw new IllegalArgumentException("Cannot reflectively create enum objects");
-        if (constructorAccessor == null) acquireConstructorAccessor();
-        return (T) constructorAccessor.newInstance(initargs);
+        ConstructorAccessor ca = constructorAccessor;   // read volatile
+        if (ca == null) {
+            ca = acquireConstructorAccessor();
+        }
+        return (T) ca.newInstance(initargs);
     }
 
     /**
@@ -560,18 +553,20 @@
     // ConstructorAccessor for a given Constructor. However, avoiding
     // synchronization will probably make the implementation more
     // scalable.
-    private void acquireConstructorAccessor() {
+    private ConstructorAccessor acquireConstructorAccessor() {
         // First check to see if one has been created yet, and take it
         // if so.
         ConstructorAccessor tmp = null;
         if (root != null) tmp = root.getConstructorAccessor();
         if (tmp != null) {
             constructorAccessor = tmp;
-            return;
+        } else {
+            // Otherwise fabricate one and propagate it up to the root
+            tmp = reflectionFactory.newConstructorAccessor(this);
+            setConstructorAccessor(tmp);
         }
-        // Otherwise fabricate one and propagate it up to the root
-        tmp = reflectionFactory.newConstructorAccessor(this);
-        setConstructorAccessor(tmp);
+
+        return tmp;
     }
 
     // Returns ConstructorAccessor for this Constructor object, not
--- a/jdk/src/share/classes/java/lang/reflect/Field.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java	Mon Apr 04 17:28:28 2011 -0700
@@ -79,11 +79,6 @@
     // potentially many Field objects pointing to it.)
     private Field               root;
 
-    // More complicated security check cache needed here than for
-    // Class.newInstance() and Constructor.newInstance()
-    private Class<?> securityCheckCache;
-    private Class<?> securityCheckTargetClassCache;
-
     // Generics infrastructure
 
     private String getGenericSignature() {return signature;}
@@ -340,7 +335,7 @@
      * instance of the class or interface declaring the underlying
      * field, the method throws an {@code IllegalArgumentException}.
      *
-     * <p>If this {@code Field} object enforces Java language access control, and
+     * <p>If this {@code Field} object is enforcing Java language access control, and
      * the underlying field is inaccessible, the method throws an
      * {@code IllegalAccessException}.
      * If the underlying field is static, the class that declared the
@@ -360,8 +355,9 @@
      * {@code obj}; primitive values are wrapped in an appropriate
      * object before being returned
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof).
@@ -383,8 +379,9 @@
      * from
      * @return the value of the {@code boolean} field
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -410,8 +407,9 @@
      * from
      * @return the value of the {@code byte} field
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -439,8 +437,9 @@
      * from
      * @return the value of the field converted to type {@code char}
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -468,8 +467,9 @@
      * from
      * @return the value of the field converted to type {@code short}
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -497,8 +497,9 @@
      * from
      * @return the value of the field converted to type {@code int}
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -526,8 +527,9 @@
      * from
      * @return the value of the field converted to type {@code long}
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -555,8 +557,9 @@
      * from
      * @return the value of the field converted to type {@code float}
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -584,8 +587,9 @@
      * from
      * @return the value of the field converted to type {@code double}
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is inaccessible.
      * @exception IllegalArgumentException  if the specified object is not
      *              an instance of the class or interface declaring the
      *              underlying field (or a subclass or implementor
@@ -621,14 +625,14 @@
      * an instance of the class or interface declaring the underlying
      * field, the method throws an {@code IllegalArgumentException}.
      *
-     * <p>If this {@code Field} object enforces Java language access control, and
+     * <p>If this {@code Field} object is enforcing Java language access control, and
      * the underlying field is inaccessible, the method throws an
      * {@code IllegalAccessException}.
      *
      * <p>If the underlying field is final, the method throws an
-     * {@code IllegalAccessException} unless
-     * {@code setAccessible(true)} has succeeded for this field
-     * and this field is non-static. Setting a final field in this way
+     * {@code IllegalAccessException} unless {@code setAccessible(true)}
+     * has succeeded for this {@code Field} object
+     * and the field is non-static. Setting a final field in this way
      * is meaningful only during deserialization or reconstruction of
      * instances of classes with blank final fields, before they are
      * made available for access by other parts of a program. Use in
@@ -658,8 +662,9 @@
      * @param value the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -686,8 +691,9 @@
      * @param z   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -715,8 +721,9 @@
      * @param b   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -744,8 +751,9 @@
      * @param c   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -773,8 +781,9 @@
      * @param s   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -802,8 +811,9 @@
      * @param i   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -831,8 +841,9 @@
      * @param l   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -860,8 +871,9 @@
      * @param f   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -889,8 +901,9 @@
      * @param d   the new value for the field of {@code obj}
      * being modified
      *
-     * @exception IllegalAccessException    if the underlying field
-     *              is inaccessible.
+     * @exception IllegalAccessException    if this {@code Field} object
+     *              is enforcing Java language access control and the underlying
+     *              field is either inaccessible or final.
      * @exception IllegalArgumentException  if the specified object is not an
      *              instance of the class or interface declaring the underlying
      *              field (or a subclass or implementor thereof),
@@ -936,6 +949,7 @@
             tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
             setFieldAccessor(tmp, overrideFinalCheck);
         }
+
         return tmp;
     }
 
@@ -965,21 +979,8 @@
         if (!override) {
             if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
                 Class<?> caller = Reflection.getCallerClass(4);
-                Class<?> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
-                                        ? clazz
-                                        : obj.getClass());
 
-                synchronized (this) {
-                    if ((securityCheckCache == caller)
-                            && (securityCheckTargetClassCache == targetClass)) {
-                        return;
-                    }
-                }
-                Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
-                synchronized (this) {
-                    securityCheckCache = caller;
-                    securityCheckTargetClassCache = targetClass;
-                }
+                checkAccess(caller, clazz, obj, modifiers);
             }
         }
     }
--- a/jdk/src/share/classes/java/lang/reflect/Method.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Mon Apr 04 17:28:28 2011 -0700
@@ -83,11 +83,6 @@
     // potentially many Method objects pointing to it.)
     private Method              root;
 
-    // More complicated security check cache needed here than for
-    // Class.newInstance() and Constructor.newInstance()
-    private Class<?> securityCheckCache;
-    private Class<?> securityCheckTargetClassCache;
-
    // Generics infrastructure
 
     private String getGenericSignature() {return signature;}
@@ -402,28 +397,28 @@
      */
     public String toString() {
         try {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             int mod = getModifiers() & Modifier.methodModifiers();
             if (mod != 0) {
-                sb.append(Modifier.toString(mod) + " ");
+                sb.append(Modifier.toString(mod)).append(' ');
             }
-            sb.append(Field.getTypeName(getReturnType()) + " ");
-            sb.append(Field.getTypeName(getDeclaringClass()) + ".");
-            sb.append(getName() + "(");
+            sb.append(Field.getTypeName(getReturnType())).append(' ');
+            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+            sb.append(getName()).append('(');
             Class<?>[] params = parameterTypes; // avoid clone
             for (int j = 0; j < params.length; j++) {
                 sb.append(Field.getTypeName(params[j]));
                 if (j < (params.length - 1))
-                    sb.append(",");
+                    sb.append(',');
             }
-            sb.append(")");
+            sb.append(')');
             Class<?>[] exceptions = exceptionTypes; // avoid clone
             if (exceptions.length > 0) {
                 sb.append(" throws ");
                 for (int k = 0; k < exceptions.length; k++) {
                     sb.append(exceptions[k].getName());
                     if (k < (exceptions.length - 1))
-                        sb.append(",");
+                        sb.append(',');
                 }
             }
             return sb.toString();
@@ -475,15 +470,15 @@
             StringBuilder sb = new StringBuilder();
             int mod = getModifiers() & Modifier.methodModifiers();
             if (mod != 0) {
-                sb.append(Modifier.toString(mod) + " ");
+                sb.append(Modifier.toString(mod)).append(' ');
             }
             TypeVariable<?>[] typeparms = getTypeParameters();
             if (typeparms.length > 0) {
                 boolean first = true;
-                sb.append("<");
+                sb.append('<');
                 for(TypeVariable<?> typeparm: typeparms) {
                     if (!first)
-                        sb.append(",");
+                        sb.append(',');
                     // Class objects can't occur here; no need to test
                     // and call Class.getName().
                     sb.append(typeparm.toString());
@@ -494,10 +489,11 @@
 
             Type genRetType = getGenericReturnType();
             sb.append( ((genRetType instanceof Class<?>)?
-                        Field.getTypeName((Class<?>)genRetType):genRetType.toString())  + " ");
+                        Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
+                    .append(' ');
 
-            sb.append(Field.getTypeName(getDeclaringClass()) + ".");
-            sb.append(getName() + "(");
+            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
+            sb.append(getName()).append('(');
             Type[] params = getGenericParameterTypes();
             for (int j = 0; j < params.length; j++) {
                 String param = (params[j] instanceof Class)?
@@ -507,9 +503,9 @@
                     param = param.replaceFirst("\\[\\]$", "...");
                 sb.append(param);
                 if (j < (params.length - 1))
-                    sb.append(",");
+                    sb.append(',');
             }
-            sb.append(")");
+            sb.append(')');
             Type[] exceptions = getGenericExceptionTypes();
             if (exceptions.length > 0) {
                 sb.append(" throws ");
@@ -518,7 +514,7 @@
                               ((Class)exceptions[k]).getName():
                               exceptions[k].toString());
                     if (k < (exceptions.length - 1))
-                        sb.append(",");
+                        sb.append(',');
                 }
             }
             return sb.toString();
@@ -565,7 +561,7 @@
      * {@code args}
      *
      * @exception IllegalAccessException    if this {@code Method} object
-     *              enforces Java language access control and the underlying
+     *              is enforcing Java language access control and the underlying
      *              method is inaccessible.
      * @exception IllegalArgumentException  if the method is an
      *              instance method and the specified object argument
@@ -591,26 +587,15 @@
         if (!override) {
             if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
                 Class<?> caller = Reflection.getCallerClass(1);
-                Class<?> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
-                                        ? clazz
-                                        : obj.getClass());
 
-                boolean cached;
-                synchronized (this) {
-                    cached = (securityCheckCache == caller)
-                            && (securityCheckTargetClassCache == targetClass);
-                }
-                if (!cached) {
-                    Reflection.ensureMemberAccess(caller, clazz, obj, modifiers);
-                    synchronized (this) {
-                        securityCheckCache = caller;
-                        securityCheckTargetClassCache = targetClass;
-                    }
-                }
+                checkAccess(caller, clazz, obj, modifiers);
             }
         }
-        if (methodAccessor == null) acquireMethodAccessor();
-        return methodAccessor.invoke(obj, args);
+        MethodAccessor ma = methodAccessor;             // read volatile
+        if (ma == null) {
+            ma = acquireMethodAccessor();
+        }
+        return ma.invoke(obj, args);
     }
 
     /**
@@ -654,18 +639,20 @@
     // (though not efficient) to generate more than one MethodAccessor
     // for a given Method. However, avoiding synchronization will
     // probably make the implementation more scalable.
-    private void acquireMethodAccessor() {
+    private MethodAccessor acquireMethodAccessor() {
         // First check to see if one has been created yet, and take it
         // if so
         MethodAccessor tmp = null;
         if (root != null) tmp = root.getMethodAccessor();
         if (tmp != null) {
             methodAccessor = tmp;
-            return;
+        } else {
+            // Otherwise fabricate one and propagate it up to the root
+            tmp = reflectionFactory.newMethodAccessor(this);
+            setMethodAccessor(tmp);
         }
-        // Otherwise fabricate one and propagate it up to the root
-        tmp = reflectionFactory.newMethodAccessor(this);
-        setMethodAccessor(tmp);
+
+        return tmp;
     }
 
     // Returns MethodAccessor for this Method object, not looking up
--- a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java	Mon Apr 04 17:20:24 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/nio/file/Files.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/Files.java	Mon Apr 04 17:28:28 2011 -0700
@@ -2067,7 +2067,7 @@
      *
      * @return  {@code true} if the file is a symbolic link; {@code false} if
      *          the file does not exist, is not a symbolic link, or it cannot
-     *          be determined if the file is symbolic link or not.
+     *          be determined if the file is a symbolic link or not.
      *
      * @throws  SecurityException
      *          In the case of the default provider, and a security manager is
@@ -2106,7 +2106,7 @@
      *
      * @return  {@code true} if the file is a directory; {@code false} if
      *          the file does not exist, is not a directory, or it cannot
-     *          be determined if the file is directory or not.
+     *          be determined if the file is a directory or not.
      *
      * @throws  SecurityException
      *          In the case of the default provider, and a security manager is
@@ -2142,8 +2142,8 @@
      *          options indicating how symbolic links are handled
      *
      * @return  {@code true} if the file is a regular file; {@code false} if
-     *          the file does not exist, is not a direcregular filetory, or it
-     *          cannot be determined if the file is regular file or not.
+     *          the file does not exist, is not a regular file, or it
+     *          cannot be determined if the file is a regular file or not.
      *
      * @throws  SecurityException
      *          In the case of the default provider, and a security manager is
--- a/jdk/src/share/classes/java/nio/file/Path.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/Path.java	Mon Apr 04 17:28:28 2011 -0700
@@ -550,18 +550,21 @@
      * <p> If this path is relative then its absolute path is first obtained,
      * as if by invoking the {@link #toAbsolutePath toAbsolutePath} method.
      *
-     * <p> The {@code resolveLinks} parameter specifies if symbolic links
-     * should be resolved. This parameter is ignored when symbolic links are
-     * not supported. Where supported, and the parameter has the value {@code
-     * true} then symbolic links are resolved to their final target. Where the
-     * parameter has the value {@code false} then this method does not resolve
-     * symbolic links. Some implementations allow special names such as
-     * "{@code ..}" to refer to the parent directory. When deriving the <em>real
-     * path</em>, and a "{@code ..}" (or equivalent) is preceded by a
-     * non-"{@code ..}" name then an implementation will typically causes both
-     * names to be removed. When not resolving symbolic links and the preceding
-     * name is a symbolic link then the names are only removed if it guaranteed
-     * that the resulting path will locate the same file as this path.
+     * <p> The {@code options} array may be used to indicate how symbolic links
+     * are handled. By default, symbolic links are resolved to their final
+     * target. If the option {@link LinkOption#NOFOLLOW_LINKS NOFOLLOW_LINKS} is
+     * present then this method does not resolve symbolic links.
+     *
+     * Some implementations allow special names such as "{@code ..}" to refer to
+     * the parent directory. When deriving the <em>real path</em>, and a
+     * "{@code ..}" (or equivalent) is preceded by a non-"{@code ..}" name then
+     * an implementation will typically cause both names to be removed. When
+     * not resolving symbolic links and the preceding name is a symbolic link
+     * then the names are only removed if it guaranteed that the resulting path
+     * will locate the same file as this path.
+     *
+     * @param   options
+     *          options indicating how symbolic links are handled
      *
      * @return  an absolute path represent the <em>real</em> path of the file
      *          located by this object
@@ -576,7 +579,7 @@
      *          checkPropertyAccess} method is invoked to check access to the
      *          system property {@code user.dir}
      */
-    Path toRealPath(boolean resolveLinks) throws IOException;
+    Path toRealPath(LinkOption... options) throws IOException;
 
     /**
      * Returns a {@link File} object representing this path. Where this {@code
--- a/jdk/src/share/classes/java/util/Collections.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/Collections.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/ComparableTimSort.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/SortedMap.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/TimSort.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java	Mon Apr 04 17:28:28 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/java/util/zip/DeflaterOutputStream.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java	Mon Apr 04 17:28:28 2011 -0700
@@ -206,14 +206,9 @@
             return;
         }
         if (!def.finished()) {
-            // Deflate no more than stride bytes at a time.  This avoids
-            // excess copying in deflateBytes (see Deflater.c)
-            int stride = buf.length;
-            for (int i = 0; i < len; i+= stride) {
-                def.setInput(b, off + i, Math.min(stride, len - i));
-                while (!def.needsInput()) {
-                    deflate();
-                }
+            def.setInput(b, off, len);
+            while (!def.needsInput()) {
+                deflate();
             }
         }
     }
--- a/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/Version.java.template	Mon Apr 04 17:28:28 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/nio/fs/Util.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/Util.java	Mon Apr 04 17:28:28 2011 -0700
@@ -26,6 +26,7 @@
 package sun.nio.fs;
 
 import java.util.*;
+import java.nio.file.*;
 
 /**
  * Utility methods
@@ -80,4 +81,21 @@
         }
         return set;
     }
+
+    /**
+     * Returns {@code true} if symbolic links should be followed
+     */
+    static boolean followLinks(LinkOption... options) {
+        boolean followLinks = true;
+        for (LinkOption option: options) {
+            if (option == LinkOption.NOFOLLOW_LINKS) {
+                followLinks = false;
+            } else if (option == null) {
+                throw new NullPointerException();
+            } else {
+                throw new AssertionError("Should not get here");
+            }
+        }
+        return followLinks;
+    }
 }
--- a/jdk/src/share/classes/sun/security/krb5/Realm.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Realm.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/HandshakeMessage.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/JarSignerResources.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/tools/TimestampedSigner.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/AuthResources.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/Resources.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Mon Apr 04 17:28:28 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/calendar/ZoneInfoFile.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Mon Apr 04 17:28:28 2011 -0700
@@ -479,7 +479,7 @@
                 String zi = System.getProperty("java.home") +
                     File.separator + "lib" + File.separator + "zi";
                 try {
-                    zi = FileSystems.getDefault().getPath(zi).toRealPath(true).toString();
+                    zi = FileSystems.getDefault().getPath(zi).toRealPath().toString();
                 } catch(Exception e) {
                 }
                 return zi;
--- a/jdk/src/share/classes/sun/util/logging/LoggingProxy.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/LoggingProxy.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/LoggingSupport.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java	Mon Apr 04 17:28:28 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/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java	Mon Apr 04 17:28:28 2011 -0700
@@ -99,7 +99,7 @@
         synchronized(filesystems) {
             Path realPath = null;
             if (ensureFile(path)) {
-                realPath = path.toRealPath(true);
+                realPath = path.toRealPath();
                 if (filesystems.containsKey(realPath))
                     throw new FileSystemAlreadyExistsException();
             }
@@ -154,7 +154,7 @@
         synchronized (filesystems) {
             ZipFileSystem zipfs = null;
             try {
-                zipfs = filesystems.get(uriToPath(uri).toRealPath(true));
+                zipfs = filesystems.get(uriToPath(uri).toRealPath());
             } catch (IOException x) {
                 // ignore the ioe from toRealPath(), return FSNFE
             }
@@ -310,7 +310,7 @@
     //////////////////////////////////////////////////////////////
     void removeFileSystem(Path zfpath, ZipFileSystem zfs) throws IOException {
         synchronized (filesystems) {
-            zfpath = zfpath.toRealPath(true);
+            zfpath = zfpath.toRealPath();
             if (filesystems.get(zfpath) == zfs)
                 filesystems.remove(zfpath);
         }
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java	Mon Apr 04 17:28:28 2011 -0700
@@ -150,7 +150,7 @@
     }
 
     @Override
-    public ZipPath toRealPath(boolean resolveLinks) throws IOException {
+    public ZipPath toRealPath(LinkOption... options) throws IOException {
         ZipPath realPath = new ZipPath(zfs, getResolvedPath()).toAbsolutePath();
         realPath.checkAccess();
         return realPath;
--- a/jdk/src/share/lib/logging.properties	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/lib/logging.properties	Mon Apr 04 17:28:28 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.
--- a/jdk/src/share/native/java/util/zip/Deflater.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/native/java/util/zip/Deflater.c	Mon Apr 04 17:28:28 2011 -0700
@@ -129,34 +129,28 @@
     if ((*env)->GetBooleanField(env, this, setParamsID)) {
         int level = (*env)->GetIntField(env, this, levelID);
         int strategy = (*env)->GetIntField(env, this, strategyID);
-
-        in_buf = (jbyte *) malloc(this_len);
-        if (in_buf == 0) {
+        in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
+        if (in_buf == NULL) {
             // Throw OOME only when length is not zero
             if (this_len != 0)
                 JNU_ThrowOutOfMemoryError(env, 0);
             return 0;
         }
-        (*env)->GetByteArrayRegion(env, this_buf, this_off, this_len, in_buf);
-        out_buf = (jbyte *) malloc(len);
-        if (out_buf == 0) {
-            free(in_buf);
+        out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
+        if (out_buf == NULL) {
+            (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
             if (len != 0)
                 JNU_ThrowOutOfMemoryError(env, 0);
             return 0;
         }
 
-        strm->next_in = (Bytef *) in_buf;
-        strm->next_out = (Bytef *) out_buf;
+        strm->next_in = (Bytef *) (in_buf + this_off);
+        strm->next_out = (Bytef *) (out_buf + off);
         strm->avail_in = this_len;
         strm->avail_out = len;
         res = deflateParams(strm, level, strategy);
-
-        if (res == Z_OK) {
-            (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf);
-        }
-        free(out_buf);
-        free(in_buf);
+        (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
+        (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
 
         switch (res) {
         case Z_OK:
@@ -174,33 +168,28 @@
         }
     } else {
         jboolean finish = (*env)->GetBooleanField(env, this, finishID);
-        in_buf = (jbyte *) malloc(this_len);
-        if (in_buf == 0) {
+        in_buf = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
+        if (in_buf == NULL) {
             if (this_len != 0)
                 JNU_ThrowOutOfMemoryError(env, 0);
             return 0;
         }
-        (*env)->GetByteArrayRegion(env, this_buf, this_off, this_len, in_buf);
-
-        out_buf = (jbyte *) malloc(len);
-        if (out_buf == 0) {
-            free(in_buf);
+        out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
+        if (out_buf == NULL) {
+            (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
             if (len != 0)
                 JNU_ThrowOutOfMemoryError(env, 0);
+
             return 0;
         }
 
-        strm->next_in = (Bytef *) in_buf;
-        strm->next_out = (Bytef *) out_buf;
+        strm->next_in = (Bytef *) (in_buf + this_off);
+        strm->next_out = (Bytef *) (out_buf + off);
         strm->avail_in = this_len;
         strm->avail_out = len;
         res = deflate(strm, finish ? Z_FINISH : flush);
-
-        if (res == Z_STREAM_END || res == Z_OK) {
-            (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf);
-        }
-        free(out_buf);
-        free(in_buf);
+        (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
+        (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
 
         switch (res) {
         case Z_STREAM_END:
--- a/jdk/src/share/native/java/util/zip/Inflater.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/share/native/java/util/zip/Inflater.c	Mon Apr 04 17:28:28 2011 -0700
@@ -38,8 +38,6 @@
 #include "zlib.h"
 #include "java_util_zip_Inflater.h"
 
-#define MIN2(x, y)  ((x) < (y) ? (x) : (y))
-
 #define ThrowDataFormatException(env, msg) \
         JNU_ThrowByName(env, "java/util/zip/DataFormatException", msg)
 
@@ -111,71 +109,50 @@
                                          jarray b, jint off, jint len)
 {
     z_stream *strm = jlong_to_ptr(addr);
-
     jarray this_buf = (jarray)(*env)->GetObjectField(env, this, bufID);
     jint this_off = (*env)->GetIntField(env, this, offID);
     jint this_len = (*env)->GetIntField(env, this, lenID);
+
     jbyte *in_buf;
     jbyte *out_buf;
     int ret;
-    /*
-     * Avoid excess copying.
-     *   zlib stream usually has a few bytes of overhead for header info
-     *   (depends on the underlying data)
-     *
-     *   (a) 5 bytes per 16KB
-     *   (b) 6 bytes for entire stream
-     *   (c) 4 bytes for gzip header
-     *   (d) 2 bytes for crc
-     *
-     * Use 20 bytes as the "safe cutoff" number.
-     */
-    jint in_len = MIN2(this_len, len + 20);
-    jint consumed;
 
-    in_buf = (jbyte *) malloc(in_len);
-    if (in_buf == 0) {
-        if (in_len != 0)
+    in_buf  = (*env)->GetPrimitiveArrayCritical(env, this_buf, 0);
+    if (in_buf == NULL) {
+        if (this_len != 0)
             JNU_ThrowOutOfMemoryError(env, 0);
         return 0;
     }
-    (*env)->GetByteArrayRegion(env, this_buf, this_off, in_len, in_buf);
-
-    out_buf = (jbyte *) malloc(len);
-    if (out_buf == 0) {
-        free(in_buf);
+    out_buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
+    if (out_buf == NULL) {
+        (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
         if (len != 0)
             JNU_ThrowOutOfMemoryError(env, 0);
         return 0;
     }
-
-    strm->next_in  = (Bytef *) in_buf;
-    strm->next_out = (Bytef *) out_buf;
-    strm->avail_in  = in_len;
+    strm->next_in  = (Bytef *) (in_buf + this_off);
+    strm->next_out = (Bytef *) (out_buf + off);
+    strm->avail_in  = this_len;
     strm->avail_out = len;
     ret = inflate(strm, Z_PARTIAL_FLUSH);
-
-    if (ret == Z_STREAM_END || ret == Z_OK) {
-        (*env)->SetByteArrayRegion(env, b, off, len - strm->avail_out, out_buf);
-    }
-    free(out_buf);
-    free(in_buf);
+    (*env)->ReleasePrimitiveArrayCritical(env, b, out_buf, 0);
+    (*env)->ReleasePrimitiveArrayCritical(env, this_buf, in_buf, 0);
 
     switch (ret) {
     case Z_STREAM_END:
         (*env)->SetBooleanField(env, this, finishedID, JNI_TRUE);
         /* fall through */
     case Z_OK:
-        consumed = in_len - strm->avail_in;
-        (*env)->SetIntField(env, this, offID, this_off + consumed);
-        (*env)->SetIntField(env, this, lenID, this_len - consumed);
+        this_off += this_len - strm->avail_in;
+        (*env)->SetIntField(env, this, offID, this_off);
+        (*env)->SetIntField(env, this, lenID, strm->avail_in);
         return len - strm->avail_out;
     case Z_NEED_DICT:
         (*env)->SetBooleanField(env, this, needDictID, JNI_TRUE);
         /* Might have consumed some input here! */
-        consumed = in_len - strm->avail_in;
-        (*env)->SetIntField(env, this, offID, this_off + consumed);
-        (*env)->SetIntField(env, this, lenID, this_len - consumed);
+        this_off += this_len - strm->avail_in;
+        (*env)->SetIntField(env, this, offID, this_off);
+        (*env)->SetIntField(env, this, lenID, strm->avail_in);
         return 0;
     case Z_BUF_ERROR:
         return 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/bin/arm/jvm.cfg	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Mon Apr 04 17:28:28 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/classes/sun/nio/fs/LinuxFileSystemProvider.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java	Mon Apr 04 17:28:28 2011 -0700
@@ -56,11 +56,11 @@
     {
         if (type == DosFileAttributeView.class) {
             return (V) new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj),
-                                                     followLinks(options));
+                                                     Util.followLinks(options));
         }
         if (type == UserDefinedFileAttributeView.class) {
             return (V) new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
-                                                             followLinks(options));
+                                                             Util.followLinks(options));
         }
         return super.getFileAttributeView(obj, type, options);
     }
@@ -72,11 +72,11 @@
     {
         if (name.equals("dos")) {
             return new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj),
-                                                 followLinks(options));
+                                                 Util.followLinks(options));
         }
         if (name.equals("user")) {
             return new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
-                                                         followLinks(options));
+                                                         Util.followLinks(options));
         }
         return super.getFileAttributeView(obj, name, options);
     }
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java	Mon Apr 04 17:28:28 2011 -0700
@@ -57,11 +57,11 @@
     {
         if (type == AclFileAttributeView.class) {
             return (V) new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj),
-                                                       followLinks(options));
+                                                       Util.followLinks(options));
         }
         if (type == UserDefinedFileAttributeView.class) {
             return(V) new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
-                                                              followLinks(options));
+                                                              Util.followLinks(options));
         }
         return super.getFileAttributeView(obj, type, options);
     }
@@ -73,10 +73,10 @@
     {
         if (name.equals("acl"))
             return new SolarisAclFileAttributeView(UnixPath.toUnixPath(obj),
-                                                   followLinks(options));
+                                                   Util.followLinks(options));
         if (name.equals("user"))
             return new SolarisUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
-                                                           followLinks(options));
+                                                           Util.followLinks(options));
         return super.getFileAttributeView(obj, name, options);
     }
 }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java	Mon Apr 04 17:28:28 2011 -0700
@@ -105,20 +105,6 @@
         return (UnixPath)obj;
     }
 
-    boolean followLinks(LinkOption... options) {
-        boolean followLinks = true;
-        for (LinkOption option: options) {
-            if (option == LinkOption.NOFOLLOW_LINKS) {
-                followLinks = false;
-                continue;
-            }
-            if (option == null)
-                throw new NullPointerException();
-            throw new AssertionError("Should not get here");
-        }
-        return followLinks;
-    }
-
     @Override
     @SuppressWarnings("unchecked")
     public <V extends FileAttributeView> V getFileAttributeView(Path obj,
@@ -126,7 +112,7 @@
                                                                 LinkOption... options)
     {
         UnixPath file = UnixPath.toUnixPath(obj);
-        boolean followLinks =  followLinks(options);
+        boolean followLinks = Util.followLinks(options);
         if (type == BasicFileAttributeView.class)
             return (V) UnixFileAttributeViews.createBasicView(file, followLinks);
         if (type == PosixFileAttributeView.class)
@@ -163,7 +149,7 @@
                                                             LinkOption... options)
     {
         UnixPath file = UnixPath.toUnixPath(obj);
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
         if (name.equals("basic"))
             return UnixFileAttributeViews.createBasicView(file, followLinks);
         if (name.equals("posix"))
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Mon Apr 04 17:28:28 2011 -0700
@@ -819,13 +819,13 @@
     }
 
     @Override
-    public Path toRealPath(boolean resolveLinks) throws IOException {
+    public Path toRealPath(LinkOption... options) throws IOException {
         checkRead();
 
         UnixPath absolute = toAbsolutePath();
 
-        // if resolveLinks is true then use realpath
-        if (resolveLinks) {
+        // if resolving links then use realpath
+        if (Util.followLinks(options)) {
             try {
                 byte[] rp = realpath(absolute);
                 return new UnixPath(getFileSystem(), rp);
@@ -834,7 +834,7 @@
             }
         }
 
-        // if resolveLinks is false then eliminate "." and also ".."
+        // if not resolving links then eliminate "." and also ".."
         // where the previous element is not a link.
         UnixPath result = fs.rootDirectory();
         for (int i=0; i<absolute.getNameCount(); i++) {
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java	Mon Apr 04 17:28:28 2011 -0700
@@ -81,20 +81,6 @@
         return (UnixPath)obj;
     }
 
-    private boolean followLinks(LinkOption... options) {
-        boolean followLinks = true;
-        for (LinkOption option: options) {
-            if (option == LinkOption.NOFOLLOW_LINKS) {
-                followLinks = false;
-                continue;
-            }
-            if (option == null)
-                throw new NullPointerException();
-            throw new AssertionError("Should not get here");
-        }
-        return followLinks;
-    }
-
     /**
      * Opens sub-directory in this directory
      */
@@ -105,7 +91,7 @@
     {
         UnixPath file = getName(obj);
         UnixPath child = ds.directory().resolve(file);
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
 
         // permission check using name resolved against original path of directory
         SecurityManager sm = System.getSecurityManager();
@@ -316,7 +302,7 @@
                                                                 LinkOption... options)
     {
         UnixPath file = getName(obj);
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
         return getFileAttributeViewImpl(file, type, followLinks);
     }
 
--- a/jdk/src/solaris/native/java/lang/java_props_md.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/native/java/lang/java_props_md.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/jawt.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c	Mon Apr 04 17:28:28 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/classes/sun/nio/fs/WindowsFileSystemProvider.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java	Mon Apr 04 17:28:28 2011 -0700
@@ -150,20 +150,6 @@
         }
     }
 
-    private boolean followLinks(LinkOption... options) {
-        boolean followLinks = true;
-        for (LinkOption option: options) {
-            if (option == LinkOption.NOFOLLOW_LINKS) {
-                followLinks = false;
-                continue;
-            }
-            if (option == null)
-                throw new NullPointerException();
-            throw new AssertionError("Should not get here");
-        }
-        return followLinks;
-    }
-
     @Override
     @SuppressWarnings("unchecked")
     public <V extends FileAttributeView> V
@@ -172,7 +158,7 @@
         WindowsPath file = WindowsPath.toWindowsPath(obj);
         if (view == null)
             throw new NullPointerException();
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
         if (view == BasicFileAttributeView.class)
             return (V) WindowsFileAttributeViews.createBasicView(file, followLinks);
         if (view == DosFileAttributeView.class)
@@ -209,7 +195,7 @@
     @Override
     public DynamicFileAttributeView getFileAttributeView(Path obj, String name, LinkOption... options) {
         WindowsPath file = WindowsPath.toWindowsPath(obj);
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
         if (name.equals("basic"))
             return WindowsFileAttributeViews.createBasicView(file, followLinks);
         if (name.equals("dos"))
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java	Mon Apr 04 17:28:28 2011 -0700
@@ -831,9 +831,9 @@
     }
 
     @Override
-    public WindowsPath toRealPath(boolean resolveLinks) throws IOException {
+    public WindowsPath toRealPath(LinkOption... options) throws IOException {
         checkRead();
-        String rp = WindowsLinkSupport.getRealPath(this, resolveLinks);
+        String rp = WindowsLinkSupport.getRealPath(this, Util.followLinks(options));
         return createFromNormalizedPath(getFileSystem(), rp);
     }
 
--- a/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/com/sun/management/OperatingSystem_md.c	Mon Apr 04 17:28:28 2011 -0700
@@ -30,6 +30,7 @@
 #include "management.h"
 #include "com_sun_management_OperatingSystem.h"
 
+#include <psapi.h>
 #include <errno.h>
 #include <stdlib.h>
 
@@ -53,41 +54,12 @@
   return result;
 }
 
-// From psapi.h
-typedef struct _PROCESS_MEMORY_COUNTERS {
-    DWORD cb;
-    DWORD PageFaultCount;
-    SIZE_T PeakWorkingSetSize;
-    SIZE_T WorkingSetSize;
-    SIZE_T QuotaPeakPagedPoolUsage;
-    SIZE_T QuotaPagedPoolUsage;
-    SIZE_T QuotaPeakNonPagedPoolUsage;
-    SIZE_T QuotaNonPagedPoolUsage;
-    SIZE_T PagefileUsage;
-    SIZE_T PeakPagefileUsage;
-} PROCESS_MEMORY_COUNTERS;
-
-static HINSTANCE hInstPsapi = NULL;
-typedef BOOL (WINAPI *LPFNGETPROCESSMEMORYINFO)(HANDLE, PROCESS_MEMORY_COUNTERS*, DWORD);
-
-static jboolean is_nt = JNI_FALSE;
 static HANDLE main_process;
 
 JNIEXPORT void JNICALL
 Java_com_sun_management_OperatingSystem_initialize
   (JNIEnv *env, jclass cls)
 {
-    OSVERSIONINFO oi;
-    oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-    GetVersionEx(&oi);
-    switch(oi.dwPlatformId) {
-        case VER_PLATFORM_WIN32_WINDOWS: is_nt = JNI_FALSE; break;
-        case VER_PLATFORM_WIN32_NT:      is_nt = JNI_TRUE;  break;
-        default:
-            throw_internal_error(env, "Unsupported Platform");
-            return;
-    }
-
     main_process = GetCurrentProcess();
 }
 
@@ -95,31 +67,12 @@
 Java_com_sun_management_OperatingSystem_getCommittedVirtualMemorySize0
   (JNIEnv *env, jobject mbean)
 {
-
-    /*
-     * In bytes.  NT/2000/XP only - using GetProcessMemoryInfo from psapi.dll
-     */
-    static LPFNGETPROCESSMEMORYINFO lpfnGetProcessMemoryInfo = NULL;
-    static volatile jboolean psapi_inited = JNI_FALSE;
     PROCESS_MEMORY_COUNTERS pmc;
-
-    if (!is_nt) return -1;
-
-    if (!psapi_inited) {
-        psapi_inited = JNI_TRUE;
-        if ((hInstPsapi = LoadLibrary("PSAPI.DLL")) == NULL) return -1;
-        if ((lpfnGetProcessMemoryInfo = (LPFNGETPROCESSMEMORYINFO)
-               GetProcAddress( hInstPsapi, "GetProcessMemoryInfo")) == NULL) {
-            FreeLibrary(hInstPsapi);
-            return -1;
-        }
+    if (GetProcessMemoryInfo(main_process, &pmc, sizeof(PROCESS_MEMORY_COUNTERS)) == 0) {
+        return (jlong)-1L;
+    } else {
+        return (jlong) pmc.PagefileUsage;
     }
-
-    if (lpfnGetProcessMemoryInfo == NULL) return -1;
-
-    lpfnGetProcessMemoryInfo(main_process, &pmc,
-                             sizeof(PROCESS_MEMORY_COUNTERS));
-    return (jlong) pmc.PagefileUsage;
 }
 
 JNIEXPORT jlong JNICALL
@@ -148,20 +101,15 @@
     FILETIME process_creation_time, process_exit_time,
              process_user_time, process_kernel_time;
 
-    // Windows NT only
-    if (is_nt) {
-        // Using static variables declared above
-        // Units are 100-ns intervals.  Convert to ns.
-        GetProcessTimes(main_process, &process_creation_time,
-                        &process_exit_time,
-                        &process_kernel_time, &process_user_time);
-        return (jlong_from(process_user_time.dwHighDateTime,
-                           process_user_time.dwLowDateTime) +
-               jlong_from(process_kernel_time.dwHighDateTime,
-                           process_kernel_time.dwLowDateTime)) * 100;
-    } else {
-        return -1;
-    }
+    // Using static variables declared above
+    // Units are 100-ns intervals.  Convert to ns.
+    GetProcessTimes(main_process, &process_creation_time,
+                    &process_exit_time,
+                    &process_kernel_time, &process_user_time);
+    return (jlong_from(process_user_time.dwHighDateTime,
+                        process_user_time.dwLowDateTime) +
+            jlong_from(process_kernel_time.dwHighDateTime,
+                        process_kernel_time.dwLowDateTime)) * 100;
 }
 
 JNIEXPORT jlong JNICALL
--- a/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/io/WinNTFileSystem_md.c	Mon Apr 04 17:28:28 2011 -0700
@@ -23,9 +23,9 @@
  * questions.
  */
 
-/* Access APIs for Win2K and above */
+/* Access APIs for WinXP and above */
 #ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0501
 #endif
 
 #include <assert.h>
@@ -60,13 +60,17 @@
 JNIEXPORT void JNICALL
 Java_java_io_WinNTFileSystem_initIDs(JNIEnv *env, jclass cls)
 {
-    HANDLE handle;
+    HMODULE handle;
     jclass fileClass = (*env)->FindClass(env, "java/io/File");
     if (!fileClass) return;
     ids.path =
              (*env)->GetFieldID(env, fileClass, "path", "Ljava/lang/String;");
-    handle = LoadLibrary("kernel32");
-    if (handle != NULL) {
+
+    // GetFinalPathNameByHandle requires Windows Vista or newer
+    if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+                            GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
+                           (LPCWSTR)&CreateFileW, &handle) != 0)
+    {
         GetFinalPathNameByHandle_func = (GetFinalPathNameByHandleProc)
             GetProcAddress(handle, "GetFinalPathNameByHandleW");
     }
@@ -824,8 +828,6 @@
     return ret;
 }
 
-typedef BOOL (WINAPI* GetVolumePathNameProc) (LPCWSTR, LPWSTR, DWORD);
-
 JNIEXPORT jlong JNICALL
 Java_java_io_WinNTFileSystem_getSpace0(JNIEnv *env, jobject this,
                                        jobject file, jint t)
@@ -834,14 +836,7 @@
     jlong rv = 0L;
     WCHAR *pathbuf = fileToNTPath(env, file, ids.path);
 
-    HMODULE h = LoadLibrary("kernel32");
-    GetVolumePathNameProc getVolumePathNameW = NULL;
-    if (h) {
-        getVolumePathNameW
-            = (GetVolumePathNameProc)GetProcAddress(h, "GetVolumePathNameW");
-    }
-
-    if (getVolumePathNameW(pathbuf, volname, MAX_PATH_LENGTH)) {
+    if (GetVolumePathNameW(pathbuf, volname, MAX_PATH_LENGTH)) {
         ULARGE_INTEGER totalSpace, freeSpace, usableSpace;
         if (GetDiskFreeSpaceExW(volname, &usableSpace, &totalSpace, &freeSpace)) {
             switch(t) {
@@ -860,9 +855,6 @@
         }
     }
 
-    if (h) {
-        FreeLibrary(h);
-    }
     free(pathbuf);
     return rv;
 }
--- a/jdk/src/windows/native/java/lang/java_props_md.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/lang/java_props_md.c	Mon Apr 04 17:28:28 2011 -0700
@@ -196,42 +196,23 @@
 /*
  * Code to figure out the user's home directory using shell32.dll
  */
-typedef HRESULT (WINAPI *GetSpecialFolderType)(HWND, int, LPITEMIDLIST *);
-typedef BOOL (WINAPI *GetPathFromIDListType)(LPCITEMIDLIST, LPSTR);
-
 WCHAR*
 getHomeFromShell32()
 {
-    HMODULE lib = LoadLibraryW(L"SHELL32.DLL");
-    GetSpecialFolderType do_get_folder;
-    GetPathFromIDListType do_get_path;
     HRESULT rc;
     LPITEMIDLIST item_list = 0;
     WCHAR *p;
     WCHAR path[MAX_PATH+1];
     int size = MAX_PATH+1;
 
-    if (lib == 0) {
-        // We can't load the library !!??
-        return NULL;
-    }
-
-    do_get_folder = (GetSpecialFolderType)GetProcAddress(lib, "SHGetSpecialFolderLocation");
-    do_get_path = (GetPathFromIDListType)GetProcAddress(lib, "SHGetPathFromIDListW");
-
-    if (do_get_folder == 0 || do_get_path == 0) {
-        // the library doesn't hold the right functions !!??
-        return NULL;
-    }
-
-    rc = (*do_get_folder)(NULL, CSIDL_DESKTOPDIRECTORY, &item_list);
+    rc = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOPDIRECTORY, &item_list);
     if (!SUCCEEDED(rc)) {
         // we can't find the shell folder.
         return NULL;
     }
 
     path[0] = 0;
-    (*do_get_path)(item_list, (LPSTR)path);
+    SHGetPathFromIDListW(item_list, (LPWSTR)path);
 
     /* Get the parent of Desktop directory */
     p = wcsrchr(path, L'\\');
@@ -253,17 +234,7 @@
 static boolean
 haveMMX(void)
 {
-    boolean mmx = 0;
-    HMODULE lib = LoadLibrary("KERNEL32");
-    if (lib != NULL) {
-        BOOL (WINAPI *isProcessorFeaturePresent)(DWORD) =
-            (BOOL (WINAPI *)(DWORD))
-            GetProcAddress(lib, "IsProcessorFeaturePresent");
-        if (isProcessorFeaturePresent != NULL)
-            mmx = isProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE);
-        FreeLibrary(lib);
-    }
-    return mmx;
+    return IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE);
 }
 
 static const char *
@@ -532,10 +503,19 @@
         if (uname != NULL && wcslen(uname) > 0) {
             sprops.user_name = _wcsdup(uname);
         } else {
-            WCHAR buf[100];
-            int buflen = sizeof(buf);
-            sprops.user_name =
-                GetUserNameW(buf, &buflen) ? _wcsdup(buf) : L"unknown";
+            DWORD buflen = 0;
+            if (GetUserNameW(NULL, &buflen) == 0 &&
+                GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+            {
+                uname = (WCHAR*)malloc(buflen * sizeof(WCHAR));
+                if (uname != NULL && GetUserNameW(uname, &buflen) == 0) {
+                    free(uname);
+                    uname = NULL;
+                }
+            } else {
+                uname = NULL;
+            }
+            sprops.user_name = (uname != NULL) ? uname : L"unknown";
         }
     }
 
@@ -633,8 +613,8 @@
     /* Current directory */
     {
         WCHAR buf[MAX_PATH];
-        GetCurrentDirectoryW(sizeof(buf), buf);
-        sprops.user_dir = _wcsdup(buf);
+        if (GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR), buf) != 0)
+            sprops.user_dir = _wcsdup(buf);
     }
 
     sprops.file_separator = "\\";
--- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.h	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/net/net_util_md.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/java/net/net_util_md.h	Mon Apr 04 17:28:28 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/management/FileSystemImpl.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/sun/management/FileSystemImpl.c	Mon Apr 04 17:28:28 2011 -0700
@@ -37,45 +37,6 @@
 #define ANY_ACCESS (FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE)
 
 /*
- * Function prototypes for security functions - we can't statically
- * link because these functions aren't on Windows 9x.
- */
-typedef BOOL (WINAPI *GetFileSecurityFunc)
-    (LPCTSTR lpFileName, SECURITY_INFORMATION RequestedInformation,
-     PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength,
-     LPDWORD lpnLengthNeeded);
-
-typedef BOOL (WINAPI *GetSecurityDescriptorOwnerFunc)
-    (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner,
-     LPBOOL lpbOwnerDefaulted);
-
-typedef BOOL (WINAPI *GetSecurityDescriptorDaclFunc)
-    (PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent,
-     PACL *pDacl, LPBOOL lpbDaclDefaulted);
-
-typedef BOOL (WINAPI *GetAclInformationFunc)
-    (PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength,
-     ACL_INFORMATION_CLASS dwAclInformationClass);
-
-typedef BOOL (WINAPI *GetAceFunc)
-    (PACL pAcl, DWORD dwAceIndex, LPVOID *pAce);
-
-typedef BOOL (WINAPI *EqualSidFunc)(PSID pSid1, PSID pSid2);
-
-
-/* Addresses of the security functions */
-static GetFileSecurityFunc GetFileSecurity_func;
-static GetSecurityDescriptorOwnerFunc GetSecurityDescriptorOwner_func;
-static GetSecurityDescriptorDaclFunc GetSecurityDescriptorDacl_func;
-static GetAclInformationFunc GetAclInformation_func;
-static GetAceFunc GetAce_func;
-static EqualSidFunc EqualSid_func;
-
-/* True if this OS is NT kernel based (NT/2000/XP) */
-static int isNT;
-
-
-/*
  * Returns JNI_TRUE if the specified file is on a file system that supports
  * persistent ACLs (On NTFS file systems returns true, on FAT32 file systems
  * returns false).
@@ -165,7 +126,7 @@
     SECURITY_INFORMATION info =
         OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
 
-    (*GetFileSecurity_func)(path, info , 0, 0, &len);
+    GetFileSecurityA(path, info , 0, 0, &len);
     if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
         JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
         return NULL;
@@ -174,7 +135,7 @@
     if (sd == NULL) {
         JNU_ThrowOutOfMemoryError(env, 0);
     } else {
-        if (!(*GetFileSecurity_func)(path, info, sd, len, &len)) {
+        if (!(*GetFileSecurityA)(path, info, sd, len, &len)) {
             JNU_ThrowIOExceptionWithLastError(env, "GetFileSecurity failed");
             free(sd);
             return NULL;
@@ -191,7 +152,7 @@
     SID* owner;
     BOOL defaulted;
 
-    if (!(*GetSecurityDescriptorOwner_func)(sd, &owner, &defaulted)) {
+    if (!GetSecurityDescriptorOwner(sd, &owner, &defaulted)) {
         JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorOwner failed");
         return NULL;
     }
@@ -206,7 +167,7 @@
     ACL *acl;
     int defaulted, present;
 
-    if (!(*GetSecurityDescriptorDacl_func)(sd, &present, &acl, &defaulted)) {
+    if (!GetSecurityDescriptorDacl(sd, &present, &acl, &defaulted)) {
         JNU_ThrowIOExceptionWithLastError(env, "GetSecurityDescriptorDacl failed");
         return NULL;
     }
@@ -235,8 +196,8 @@
     /*
      * Get the ACE count
      */
-    if (!(*GetAclInformation_func)(acl, (void *) &acl_size_info, sizeof(acl_size_info),
-                                  AclSizeInformation)) {
+    if (!GetAclInformation(acl, (void *) &acl_size_info, sizeof(acl_size_info),
+                           AclSizeInformation)) {
         JNU_ThrowIOExceptionWithLastError(env, "GetAclInformation failed");
         return JNI_FALSE;
     }
@@ -250,7 +211,7 @@
         ACCESS_ALLOWED_ACE *access;
         SID* sid;
 
-        if (!(*GetAce_func)(acl, i, &ace)) {
+        if (!GetAce(acl, i, &ace)) {
             JNU_ThrowIOExceptionWithLastError(env, "GetAce failed");
             return -1;
         }
@@ -280,51 +241,7 @@
 JNIEXPORT void JNICALL Java_sun_management_FileSystemImpl_init0
   (JNIEnv *env, jclass ignored)
 {
-    OSVERSIONINFO ver;
-    HINSTANCE hInst;
-
-    /*
-     * Get the OS version. If dwPlatformId is VER_PLATFORM_WIN32_NT
-     * it means we're running on a Windows NT, 2000, or XP machine.
-     */
-    ver.dwOSVersionInfoSize = sizeof(ver);
-    GetVersionEx(&ver);
-    isNT = (ver.dwPlatformId == VER_PLATFORM_WIN32_NT);
-    if (!isNT) {
-        return;
-    }
-
-    /*
-     * On NT/2000/XP we need the addresses of the security functions
-     */
-    hInst = LoadLibrary("ADVAPI32.DLL");
-    if (hInst == NULL) {
-        JNU_ThrowIOExceptionWithLastError(env, "Unable to load ADVAPI32.DLL");
-        return;
-    }
-
-
-    GetFileSecurity_func = (GetFileSecurityFunc)GetProcAddress(hInst, "GetFileSecurityA");
-    GetSecurityDescriptorOwner_func =
-        (GetSecurityDescriptorOwnerFunc)GetProcAddress(hInst, "GetSecurityDescriptorOwner");
-    GetSecurityDescriptorDacl_func =
-        (GetSecurityDescriptorDaclFunc)GetProcAddress(hInst, "GetSecurityDescriptorDacl");
-    GetAclInformation_func =
-        (GetAclInformationFunc)GetProcAddress(hInst, "GetAclInformation");
-    GetAce_func = (GetAceFunc)GetProcAddress(hInst, "GetAce");
-    EqualSid_func = (EqualSidFunc)GetProcAddress(hInst, "EqualSid");
-
-    if (GetFileSecurity_func == NULL ||
-        GetSecurityDescriptorDacl_func == NULL ||
-        GetSecurityDescriptorDacl_func == NULL ||
-        GetAclInformation_func == NULL ||
-        GetAce_func == NULL ||
-        EqualSid_func == NULL)
-    {
-        JNU_ThrowIOExceptionWithLastError(env,
-            "Unable to get address of security functions");
-        return;
-    }
+        /* nothing to do */
 }
 
 /*
@@ -339,10 +256,6 @@
     jboolean isCopy;
     const char* path;
 
-    if (!isNT) {
-        return JNI_FALSE;
-    }
-
     path = JNU_GetStringPlatformChars(env, str, &isCopy);
     if (path != NULL) {
         res = isSecuritySupported(env, path);
--- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c	Mon Apr 04 17:28:28 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/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Mon Apr 04 17:28:28 2011 -0700
@@ -24,7 +24,7 @@
  */
 
 #ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0501
 #endif
 
 #include <stdio.h>
@@ -36,6 +36,7 @@
 #include <windows.h>
 #include <aclapi.h>
 #include <winioctl.h>
+#include <Sddl.h>
 
 #include "jni.h"
 #include "jni_util.h"
@@ -77,40 +78,20 @@
 
 
 /**
- * Win32 APIs not defined in Visual Studio 2003 header files
+ * Win32 APIs not available in Windows XP
  */
-
-typedef enum {
-  FindStreamInfoStandard
-} MY_STREAM_INFO_LEVELS;
-
-typedef struct _MY_WIN32_FIND_STREAM_DATA {
-  LARGE_INTEGER StreamSize;
-  WCHAR cStreamName[MAX_PATH + 36];
-} MY_WIN32_FIND_STREAM_DATA;
-
-typedef HANDLE (WINAPI* FindFirstStream_Proc)(LPCWSTR, MY_STREAM_INFO_LEVELS, LPVOID, DWORD);
+typedef HANDLE (WINAPI* FindFirstStream_Proc)(LPCWSTR, STREAM_INFO_LEVELS, LPVOID, DWORD);
 typedef BOOL (WINAPI* FindNextStream_Proc)(HANDLE, LPVOID);
 
 typedef BOOLEAN (WINAPI* CreateSymbolicLinkProc) (LPCWSTR, LPCWSTR, DWORD);
-typedef BOOL (WINAPI* CreateHardLinkProc) (LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
 typedef BOOL (WINAPI* GetFinalPathNameByHandleProc) (HANDLE, LPWSTR, DWORD, DWORD);
 
-typedef BOOL (WINAPI* ConvertSidToStringSidProc) (PSID, LPWSTR*);
-typedef BOOL (WINAPI* ConvertStringSidToSidProc) (LPWSTR, PSID*);
-typedef DWORD (WINAPI* GetLengthSidProc) (PSID);
-
 static FindFirstStream_Proc FindFirstStream_func;
 static FindNextStream_Proc FindNextStream_func;
 
 static CreateSymbolicLinkProc CreateSymbolicLink_func;
-static CreateHardLinkProc CreateHardLink_func;
 static GetFinalPathNameByHandleProc GetFinalPathNameByHandle_func;
 
-static ConvertSidToStringSidProc ConvertSidToStringSid_func;
-static ConvertStringSidToSidProc ConvertStringSidToSid_func;
-static GetLengthSidProc GetLengthSid_func;
-
 static void throwWindowsException(JNIEnv* env, DWORD lastError) {
     jobject x = JNU_NewObjectByName(env, "sun/nio/fs/WindowsException",
         "(I)V", lastError);
@@ -190,33 +171,23 @@
     backupResult_bytesTransferred = (*env)->GetFieldID(env, clazz, "bytesTransferred", "I");
     backupResult_context = (*env)->GetFieldID(env, clazz, "context", "J");
 
-
-    h = LoadLibrary("kernel32");
-    if (h != INVALID_HANDLE_VALUE) {
+    // get handle to kernel32
+    if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+                            GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
+                           (LPCWSTR)&CreateFileW, &h) != 0)
+    {
+        // requires Windows Server 2003 or newer
         FindFirstStream_func =
             (FindFirstStream_Proc)GetProcAddress(h, "FindFirstStreamW");
         FindNextStream_func =
             (FindNextStream_Proc)GetProcAddress(h, "FindNextStreamW");
+
+        // requires Windows Vista or newer
         CreateSymbolicLink_func =
             (CreateSymbolicLinkProc)GetProcAddress(h, "CreateSymbolicLinkW");
-        CreateHardLink_func =
-            (CreateHardLinkProc)GetProcAddress(h, "CreateHardLinkW");
         GetFinalPathNameByHandle_func =
             (GetFinalPathNameByHandleProc)GetProcAddress(h, "GetFinalPathNameByHandleW");
-        FreeLibrary(h);
     }
-
-    h = LoadLibrary("advapi32");
-    if (h != INVALID_HANDLE_VALUE) {
-        ConvertSidToStringSid_func =
-            (ConvertSidToStringSidProc)GetProcAddress(h, "ConvertSidToStringSidW");
-        ConvertStringSidToSid_func =
-            (ConvertStringSidToSidProc)GetProcAddress(h, "ConvertStringSidToSidW");
-        GetLengthSid_func =
-            (GetLengthSidProc)GetProcAddress(h, "GetLengthSid");
-        FreeLibrary(h);
-    }
-
 }
 
 JNIEXPORT jstring JNICALL
@@ -413,7 +384,7 @@
 Java_sun_nio_fs_WindowsNativeDispatcher_FindFirstStream0(JNIEnv* env, jclass this,
     jlong address, jobject obj)
 {
-    MY_WIN32_FIND_STREAM_DATA data;
+    WIN32_FIND_STREAM_DATA data;
     LPCWSTR lpFileName = jlong_to_ptr(address);
     HANDLE handle;
 
@@ -443,7 +414,7 @@
 Java_sun_nio_fs_WindowsNativeDispatcher_FindNextStream(JNIEnv* env, jclass this,
     jlong handle)
 {
-    MY_WIN32_FIND_STREAM_DATA data;
+    WIN32_FIND_STREAM_DATA data;
     HANDLE h = (HANDLE)jlong_to_ptr(handle);
 
     if (FindNextStream_func == NULL) {
@@ -909,12 +880,7 @@
     jclass this, jlong address)
 {
     PSID sid = jlong_to_ptr(address);
-
-    if (GetLengthSid_func == NULL) {
-        JNU_ThrowInternalError(env, "Should not get here");
-        return 0;
-    }
-    return (jint)(*GetLengthSid_func)(sid);
+    return (jint)GetLengthSid(sid);
 }
 
 
@@ -924,13 +890,7 @@
 {
     PSID sid = jlong_to_ptr(address);
     LPWSTR string;
-
-    if (ConvertSidToStringSid_func == NULL) {
-        JNU_ThrowInternalError(env, "Should not get here");
-        return NULL;
-    }
-
-    if ((*ConvertSidToStringSid_func)(sid, &string) == 0) {
+    if (ConvertSidToStringSidW(sid, &string) == 0) {
         throwWindowsException(env, GetLastError());
         return NULL;
     } else {
@@ -947,15 +907,8 @@
 {
     LPWSTR lpStringSid = jlong_to_ptr(address);
     PSID pSid;
-
-    if (ConvertStringSidToSid_func == NULL) {
-        JNU_ThrowInternalError(env, "Should not get here");
-        return (jlong)0;
-    }
-
-    if ((*ConvertStringSidToSid_func)(lpStringSid, &pSid) == 0)
+    if (ConvertStringSidToSidW(lpStringSid, &pSid) == 0)
         throwWindowsException(env, GetLastError());
-
     return ptr_to_jlong(pSid);
 }
 
@@ -1137,11 +1090,7 @@
     LPCWSTR newFile = jlong_to_ptr(newFileAddress);
     LPCWSTR existingFile = jlong_to_ptr(existingFileAddress);
 
-    if (CreateHardLink_func == NULL) {
-        JNU_ThrowInternalError(env, "Should not get here");
-        return;
-    }
-    if ((*CreateHardLink_func)(newFile, existingFile, NULL) == 0)
+    if (CreateHardLinkW(newFile, existingFile, NULL) == 0)
         throwWindowsException(env, GetLastError());
 }
 
--- a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c	Mon Apr 04 17:28:28 2011 -0700
@@ -33,11 +33,6 @@
 #include <jni.h>
 #include "sun_security_provider_NativeSeedGenerator.h"
 
-/* Typedefs for runtime linking. */
-typedef BOOL (WINAPI *CryptAcquireContextType)(HCRYPTPROV*, LPCTSTR, LPCTSTR, DWORD, DWORD);
-typedef BOOL (WINAPI *CryptGenRandomType)(HCRYPTPROV, DWORD, BYTE*);
-typedef BOOL (WINAPI *CryptReleaseContextType)(HCRYPTPROV, DWORD);
-
 /*
  * Get a random seed from the MS CryptoAPI. Return true if successful, false
  * otherwise.
@@ -49,48 +44,27 @@
 JNIEXPORT jboolean JNICALL Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed
   (JNIEnv *env, jclass clazz, jbyteArray randArray)
 {
-    HMODULE lib;
-    CryptAcquireContextType acquireContext;
-    CryptGenRandomType genRandom;
-    CryptReleaseContextType releaseContext;
-
     HCRYPTPROV hCryptProv;
     jboolean result = JNI_FALSE;
     jsize numBytes;
     jbyte* randBytes;
 
-    lib = LoadLibrary("ADVAPI32.DLL");
-    if (lib == NULL) {
-        return result;
-    }
-
-    acquireContext = (CryptAcquireContextType)GetProcAddress(lib, "CryptAcquireContextA");
-    genRandom = (CryptGenRandomType)GetProcAddress(lib, "CryptGenRandom");
-    releaseContext = (CryptReleaseContextType)GetProcAddress(lib, "CryptReleaseContext");
-
-    if (acquireContext == NULL || genRandom == NULL || releaseContext == NULL) {
-        FreeLibrary(lib);
-        return result;
-    }
-
-    if (acquireContext(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, 0) == FALSE) {
+    if (CryptAcquireContextA(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL, 0) == FALSE) {
         /* If CSP context hasn't been created, create one. */
-        if (acquireContext(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL,
+        if (CryptAcquireContextA(&hCryptProv, "J2SE", NULL, PROV_RSA_FULL,
                 CRYPT_NEWKEYSET) == FALSE) {
-            FreeLibrary(lib);
             return result;
         }
     }
 
     numBytes = (*env)->GetArrayLength(env, randArray);
     randBytes = (*env)->GetByteArrayElements(env, randArray, NULL);
-    if (genRandom(hCryptProv, numBytes, randBytes)) {
+    if (CryptGenRandom(hCryptProv, numBytes, randBytes)) {
         result = JNI_TRUE;
     }
     (*env)->ReleaseByteArrayElements(env, randArray, randBytes, 0);
 
-    releaseContext(hCryptProv, 0);
-    FreeLibrary(lib);
+    CryptReleaseContext(hCryptProv, 0);
 
     return result;
 }
--- a/jdk/test/Makefile	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/Makefile	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/ProblemList.txt	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/lang/annotation/PackageMain.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/lang/annotation/package-info.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/lang/management/ManagementFactory/GetPlatformMXBeans.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Leaky.java	Mon Apr 04 17:28:28 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;
 
 /**
--- a/jdk/test/java/nio/file/Files/CheckPermissions.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/nio/file/Files/CheckPermissions.java	Mon Apr 04 17:28:28 2011 -0700
@@ -521,19 +521,19 @@
             // -- toRealPath --
 
             prepare();
-            file.toRealPath(true);
+            file.toRealPath();
             assertCheckRead(file);
 
             prepare();
-            file.toRealPath(false);
+            file.toRealPath(LinkOption.NOFOLLOW_LINKS);
             assertCheckRead(file);
 
             prepare();
-            Paths.get(".").toRealPath(true);
+            Paths.get(".").toRealPath();
             assertCheckPropertyAccess("user.dir");
 
             prepare();
-            Paths.get(".").toRealPath(false);
+            Paths.get(".").toRealPath(LinkOption.NOFOLLOW_LINKS);
             assertCheckPropertyAccess("user.dir");
 
             // -- register --
--- a/jdk/test/java/nio/file/Files/PassThroughFileSystem.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/nio/file/Files/PassThroughFileSystem.java	Mon Apr 04 17:28:28 2011 -0700
@@ -486,8 +486,8 @@
         }
 
         @Override
-        public Path toRealPath(boolean resolveLinks) throws IOException {
-            return wrap(delegate.toRealPath(resolveLinks));
+        public Path toRealPath(LinkOption... options) throws IOException {
+            return wrap(delegate.toRealPath(options));
         }
 
         @Override
--- a/jdk/test/java/nio/file/Path/Misc.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/java/nio/file/Path/Misc.java	Mon Apr 04 17:28:28 2011 -0700
@@ -22,12 +22,13 @@
  */
 
 /* @test
- * @bug 4313887 6838333
+ * @bug 4313887 6838333 7029979
  * @summary Unit test for miscellenous java.nio.file.Path methods
  * @library ..
  */
 
 import java.nio.file.*;
+import static java.nio.file.LinkOption.*;
 import java.io.*;
 
 public class Misc {
@@ -96,65 +97,65 @@
         final Path link = dir.resolve("link");
 
         /**
-         * Test: totRealPath(true) will access same file as toRealPath(false)
+         * Test: totRealPath() will access same file as toRealPath(NOFOLLOW_LINKS)
          */
-        assertTrue(Files.isSameFile(file.toRealPath(true), file.toRealPath(false)));
+        assertTrue(Files.isSameFile(file.toRealPath(), file.toRealPath(NOFOLLOW_LINKS)));
 
         /**
          * Test: toRealPath should fail if file does not exist
          */
         Path doesNotExist = dir.resolve("DoesNotExist");
         try {
-            doesNotExist.toRealPath(true);
+            doesNotExist.toRealPath();
             throw new RuntimeException("IOException expected");
         } catch (IOException expected) {
         }
         try {
-            doesNotExist.toRealPath(false);
+            doesNotExist.toRealPath(NOFOLLOW_LINKS);
             throw new RuntimeException("IOException expected");
         } catch (IOException expected) {
         }
 
         /**
-         * Test: toRealPath(true) should resolve links
+         * Test: toRealPath() should resolve links
          */
         if (supportsLinks) {
             Files.createSymbolicLink(link, file.toAbsolutePath());
-            assertTrue(link.toRealPath(true).equals(file.toRealPath(true)));
+            assertTrue(link.toRealPath().equals(file.toRealPath()));
             Files.delete(link);
         }
 
         /**
-         * Test: toRealPath(false) should not resolve links
+         * Test: toRealPath(NOFOLLOW_LINKS) should not resolve links
          */
         if (supportsLinks) {
             Files.createSymbolicLink(link, file.toAbsolutePath());
-            assertTrue(link.toRealPath(false).getFileName().equals(link.getFileName()));
+            assertTrue(link.toRealPath(NOFOLLOW_LINKS).getFileName().equals(link.getFileName()));
             Files.delete(link);
         }
 
         /**
-         * Test: toRealPath(false) with broken link
+         * Test: toRealPath(NOFOLLOW_LINKS) with broken link
          */
         if (supportsLinks) {
             Path broken = Files.createSymbolicLink(link, doesNotExist);
-            assertTrue(link.toRealPath(false).getFileName().equals(link.getFileName()));
+            assertTrue(link.toRealPath(NOFOLLOW_LINKS).getFileName().equals(link.getFileName()));
             Files.delete(link);
         }
 
         /**
          * Test: toRealPath should eliminate "."
          */
-        assertTrue(dir.resolve(".").toRealPath(true).equals(dir.toRealPath(true)));
-        assertTrue(dir.resolve(".").toRealPath(false).equals(dir.toRealPath(false)));
+        assertTrue(dir.resolve(".").toRealPath().equals(dir.toRealPath()));
+        assertTrue(dir.resolve(".").toRealPath(NOFOLLOW_LINKS).equals(dir.toRealPath(NOFOLLOW_LINKS)));
 
         /**
          * Test: toRealPath should eliminate ".." when it doesn't follow a
          *       symbolic link
          */
         Path subdir = Files.createDirectory(dir.resolve("subdir"));
-        assertTrue(subdir.resolve("..").toRealPath(true).equals(dir.toRealPath(true)));
-        assertTrue(subdir.resolve("..").toRealPath(false).equals(dir.toRealPath(false)));
+        assertTrue(subdir.resolve("..").toRealPath().equals(dir.toRealPath()));
+        assertTrue(subdir.resolve("..").toRealPath(NOFOLLOW_LINKS).equals(dir.toRealPath(NOFOLLOW_LINKS)));
         Files.delete(subdir);
 
         // clean-up
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/jar/JarFile/MevNPE.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 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	Mon Apr 04 17:28:28 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);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/zip/FlaterCriticalArray.java	Mon Apr 04 17:28:28 2011 -0700
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ */
+
+/**
+ * ZIP inflater/deflater performance.
+ */
+
+/*
+ * Run this test on JDK 6 and on later
+ * JDKs to compare results:
+ *     java -server -Xms1024M -Xmx1024M -Ddebug=true FlaterCriticalArray
+ *
+ * The performance issues can be readily seen on JDK 6, and so this code is
+ * written to compile on that platform: it does *not* use any JDK 7 - specific
+ * features.
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.util.*;
+import java.util.zip.*;
+
+public class FlaterCriticalArray {
+    // If true, print information about performance
+    private static final boolean debug = System.getProperty("debug") != null;
+
+    private static void debug(String s) {
+        if (debug) System.out.println(s);
+    }
+
+    private static void debug(String name, String inOut, long time, int length) {
+        debug(name + ": Duration of " + inOut + "(in ms): " + time);
+        debug(name + ": " + inOut + "d data length: " + length + " bytes");
+    }
+
+    private static byte[] grow(byte[] a, int capacity) {
+        while (a.length < capacity) {
+            byte[] a2 = new byte[a.length * 2];
+            System.arraycopy(a, 0, a2, 0, a.length);
+            a = a2;
+        }
+        return a;
+    }
+
+    private static byte[] trim(byte[] a, int length) {
+        byte[] res = new byte[length];
+        System.arraycopy(a, 0, res, 0, length);
+        return res;
+    }
+
+    /*
+     * Base class for individual test cases
+     */
+    abstract static private class TestCase {
+        protected String name;  // For information in debug messages
+        protected byte data[];  // Data to be deflated and subsequently inflated
+        protected int level;    // Compression level for deflater
+
+        protected TestCase(String name, byte data[]) {
+            this(name, data, -1);
+        }
+
+        protected TestCase(String name, byte data[], int level) {
+            this.name = name;
+            this.data = data;
+            this.level = level;
+        }
+
+        public void runTest() throws Throwable {
+            long time0, time1;
+            byte deflated[], inflated[];
+
+            debug("");
+
+            time0 = System.currentTimeMillis();
+            deflated = deflate(data, level);
+            time1 = System.currentTimeMillis();
+            inform("Deflate", time1 - time0, deflated.length);
+
+            time0 = System.currentTimeMillis();
+            inflated = inflate(deflated);
+            time1 = System.currentTimeMillis();
+            inform("Inflate", time1 - time0, inflated.length);
+
+            check(Arrays.equals(data, inflated),
+                  name + ": Inflated and deflated arrays do not match");
+        }
+
+        private void inform(String inOut, long duration, int length) {
+            debug(name, inOut, duration, length);
+        }
+
+        abstract protected byte[] deflate(byte data[], int level) throws Throwable;
+
+        abstract protected byte[] inflate(byte deflated[]) throws Throwable;
+    }
+
+    /*
+     * Following are  the individual test cases
+     */
+
+    private static class StrideTest extends TestCase {
+        static final int STRIDE = 1024;
+
+        public StrideTest(byte data[], int level) {
+            super("STRIDE", data, level);
+        }
+
+        protected byte[] deflate(byte in[], int level) throws Throwable {
+            final int len = in.length;
+            final Deflater deflater = new Deflater(level);
+            final byte[] smallBuffer = new byte[32];
+            byte[] flated = new byte[32];
+            int count = 0;
+            for (int i = 0; i<len; i+= STRIDE) {
+                deflater.setInput(in, i, Math.min(STRIDE, len-i));
+                while (!deflater.needsInput()) {
+                    int n = deflater.deflate(smallBuffer);
+                    flated = grow(flated, count + n);
+                    System.arraycopy(smallBuffer, 0, flated, count, n);
+                    count += n;
+                }
+            }
+            deflater.finish();
+            int n;
+            do {
+                n = deflater.deflate(smallBuffer);
+                flated = grow(flated, count + n);
+                System.arraycopy(smallBuffer, 0, flated, count, n);
+                count += n;
+            } while (n > 0);
+            return trim(flated, count);
+        }
+
+        protected byte[] inflate(byte in[]) throws Throwable {
+            final int len = in.length;
+            final Inflater inflater = new Inflater();
+            final byte[] smallBuffer = new byte[3200];
+
+            byte[] flated = new byte[32];
+            int count = 0;
+
+            for (int i = 0; i<len; i+= STRIDE) {
+                inflater.setInput(in, i, Math.min(STRIDE, len-i));
+                while (!inflater.needsInput()) {
+                    int n;
+                    while ((n = inflater.inflate(smallBuffer)) > 0) {
+                        flated = grow(flated, count + n);
+                        System.arraycopy(smallBuffer, 0, flated, count, n);
+                        count += n;
+                    }
+                }
+            }
+            return trim(flated, count);
+        }
+    }
+
+    private static class NoStrideTest extends TestCase {
+        public NoStrideTest(byte data[], int level) {
+            super("NO STRIDE", data, level);
+        }
+
+        public byte[] deflate(byte in[], int level) throws Throwable {
+            final Deflater flater = new Deflater(level);
+            flater.setInput(in);
+            flater.finish();
+            final byte[] smallBuffer = new byte[32];
+            byte[] flated = new byte[32];
+            int count = 0;
+            int n;
+            while ((n = flater.deflate(smallBuffer)) > 0) {
+                flated = grow(flated, count + n);
+                System.arraycopy(smallBuffer, 0, flated, count, n);
+                count += n;
+            }
+            return trim(flated, count);
+        }
+
+        public byte[] inflate(byte in[]) throws Throwable {
+            final Inflater flater = new Inflater();
+            flater.setInput(in);
+            final byte[] smallBuffer = new byte[32];
+            byte[] flated = new byte[32];
+            int count = 0;
+            int n;
+            while ((n = flater.inflate(smallBuffer)) > 0) {
+                flated = grow(flated, count + n);
+                System.arraycopy(smallBuffer, 0, flated, count, n);
+                count += n;
+            }
+            return trim(flated, count);
+        }
+    }
+
+    /**
+     * Check Deflater{In,Out}putStream by way of GZIP{In,Out}putStream
+     */
+    private static class GZIPTest extends TestCase {
+        public GZIPTest(byte data[]) {
+            super("GZIP", data);
+        }
+
+        public byte[] deflate(byte data[], int ignored) throws Throwable {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            OutputStream gzos = new GZIPOutputStream(baos);
+            gzos.write(data, 0, data.length);
+            gzos.close();
+            return baos.toByteArray();
+        }
+
+        public byte[] inflate(byte deflated[]) throws Throwable {
+            InputStream bais = new ByteArrayInputStream(deflated);
+            GZIPInputStream gzis = new GZIPInputStream(bais);
+            byte[] inflated = new byte[data.length];
+            int numRead = 0;
+            int count = 0;
+            while ((numRead = gzis.read(inflated, count, data.length - count)) > 0) {
+                count += numRead;
+            }
+            check(count == data.length, name + ": Read " + count + "; expected " + data.length);
+            return inflated;
+        }
+    }
+
+    public static void realMain(String[] args) throws Throwable {
+        byte data[];
+        int level = -1;
+        if (args.length > 0) {
+          level = Integer.parseInt(args[0]);
+        }
+        debug("Using level " + level);
+
+        if (args.length > 1) {
+            FileInputStream fis = new FileInputStream(args[1]);
+            int len = fis.available();
+            data = new byte[len];
+            check(fis.read(data, 0, len) == len, "Did not read complete file");
+            debug("Original data from " + args[1]);
+            fis.close();
+        } else {
+            ByteBuffer bb = ByteBuffer.allocate(8);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            for (int i = 0; i < 1024 * 64; i++) { // data length
+                bb.putDouble(0, Math.random());
+                baos.write(bb.array(), 0, 8);
+            }
+            data = baos.toByteArray();
+            debug("Original data from random byte array");
+        }
+        debug("Original data length: " + data.length + " bytes");
+
+        new StrideTest(data, level).runTest();
+        new NoStrideTest(data, level).runTest();
+        new GZIPTest(data).runTest();
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void pass(String msg) {System.out.println(msg); passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String msg) {System.out.println(msg); fail();}
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    static void unexpected(Throwable t, String msg) {
+        System.out.println(msg); failed++; t.printStackTrace();}
+    static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
+    static boolean check(boolean cond, String msg) {if (cond) pass(); else fail(msg); return cond;}
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.println("\nPassed = " + passed + " failed = " + failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/zip/InflaterBufferSize.java	Mon Apr 04 17:28:28 2011 -0700
@@ -0,0 +1,163 @@
+/*
+ * 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 6571338
+ * @summary Inflater should not require a buffer to the inflate() methods
+ * larger than 1 byte.
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.util.*;
+import java.util.zip.*;
+
+public class InflaterBufferSize {
+    private static final int DATA_LEN = 1024 *64;
+    private static byte[] data;
+
+    // If true, print extra info.
+    private static final boolean debug = System.getProperty("debug") != null;
+
+    private static void debug(String s) {
+        if (debug) System.out.println(s);
+    }
+
+    private static void createData() {
+        ByteBuffer bb = ByteBuffer.allocate(8);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        for (int i = 0; i < DATA_LEN; i++) {
+            bb.putDouble(0, Math.random());
+            baos.write(bb.array(), 0, 8);
+        }
+        data = baos.toByteArray();
+    }
+
+    private static byte[] grow(byte[] a, int capacity) {
+        while (a.length < capacity) {
+            byte[] a2 = new byte[a.length * 2];
+            System.arraycopy(a, 0, a2, 0, a.length);
+            a = a2;
+        }
+        return a;
+    }
+
+    private static byte[] trim(byte[] a, int length) {
+        byte[] res = new byte[length];
+        System.arraycopy(a, 0, res, 0, length);
+        return res;
+    }
+
+    private static byte[] deflate(byte[] in, int level) throws Throwable {
+        final Deflater flater = new Deflater(level);
+        flater.setInput(in);
+        flater.finish();
+        final byte[] smallBuffer = new byte[32];
+        byte[] flated = new byte[32];
+        int count = 0;
+        int n;
+        while ((n = flater.deflate(smallBuffer)) > 0) {
+            flated = grow(flated, count + n);
+            System.arraycopy(smallBuffer, 0, flated, count, n);
+            count += n;
+        }
+        return trim(flated, count);
+    }
+
+    private static byte[] inflate(byte[] in) throws Throwable {
+        final Inflater flater = new Inflater();
+        flater.setInput(in);
+        // This is the buffer of interest.  It should be possible to use any
+        // non-zero size.
+        final byte[] smallBuffer = new byte[1];
+        byte[] flated = new byte[32];
+        int count = 0;
+        int n;
+        while ((n = flater.inflate(smallBuffer)) > 0) {
+            flated = grow(flated, count + n);
+            System.arraycopy(smallBuffer, 0, flated, count, n);
+            count += n;
+        }
+        return trim(flated, count);
+    }
+
+    public static void realMain(String[] args) throws Throwable {
+        byte deflated[], inflated[];
+
+        int level = -1;
+        if (args.length > 0) {
+          level = Integer.parseInt(args[0]);
+        }
+        debug("Using level " + level);
+
+        if (args.length > 1) {
+            FileInputStream fis = new FileInputStream(args[1]);
+            int len = fis.available();
+            data = new byte[len];
+            check(fis.read(data, 0, len) == len, "Did not read complete file");
+            debug("Original data from " + args[1]);
+            fis.close();
+        } else {
+            createData();
+            debug("Original data from random byte array");
+        }
+        debug("Original data length: " + data.length + " bytes");
+
+        debug("");
+        deflated = deflate(data, level);
+        debug("Deflated data length: " + deflated.length + " bytes");
+
+        inflated = inflate(deflated);
+        debug("Inflated data length: "+ inflated.length + " bytes" );
+
+        if (!check(Arrays.equals(data, inflated),
+                   "Inflated and deflated arrays do not match")) {
+            OutputStream os = new BufferedOutputStream(new FileOutputStream("deflated.zip"));
+            try {
+                os.write(deflated);
+            } finally {
+                os.close();
+            }
+        }
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() {passed++;}
+    static void pass(String msg) {System.out.println(msg); passed++;}
+    static void fail() {failed++; Thread.dumpStack();}
+    static void fail(String msg) {System.out.println(msg); fail();}
+    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    static void unexpected(Throwable t, String msg) {
+        System.out.println(msg); failed++; t.printStackTrace();}
+    static boolean check(boolean cond) {if (cond) pass(); else fail(); return cond;}
+    static boolean check(boolean cond, String msg) {if (cond) pass(); else fail(msg); return cond;}
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else fail(x + " not equal to " + y);}
+    public static void main(String[] args) throws Throwable {
+        try {realMain(args);} catch (Throwable t) {unexpected(t);}
+        System.out.println("\nPassed = " + passed + " failed = " + failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
--- a/jdk/test/sun/misc/Version/Version.java	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/misc/Version/Version.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/ec/TestEC.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/jgss/GssNPE.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/ConfPlusProp.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/ConfigWithQuotations.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/DnsFallback.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/IPv6.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/ParseCAPaths.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/ParseConfig.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/RFC396xTest.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/TimeInCCache.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/etype/ETypeOrder.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/krb5-capaths.conf	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/krb5/ktab/HighestKvno.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/fips/CipherTest.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/sslecc/CipherTest.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/ssl/sanity/interop/CipherTest.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/tools/pack200/CommandLineTests.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/tools/pack200/TimeStamp.java	Mon Apr 04 17:28:28 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	Mon Apr 04 17:20:24 2011 -0700
+++ b/jdk/test/tools/pack200/Utils.java	Mon Apr 04 17:28:28 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) {