Merge
authorasaha
Thu, 21 Apr 2011 16:42:06 -0700
changeset 9848 1631321017da
parent 9191 b04bab3716ee (current diff)
parent 9847 e68bfaa6e25c (diff)
child 9849 eb437e9fba66
Merge
jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java
--- a/jdk/make/com/sun/java/pack/Makefile	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/com/sun/java/pack/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -56,10 +56,6 @@
 
 vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)
 
-
-
-
-
 ifeq ($(STANDALONE),true)
   ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME)
 
@@ -131,8 +127,9 @@
 pack200-tool:
 	$(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack)
 
+# ignore mapfile for non-product binary 
 unpacker:
-	$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG=
+	$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_DBG=
 
 ifeq ($(PLATFORM), windows)
 IMVERSIONVALUE=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
@@ -147,8 +144,14 @@
 	$(ECHO) "Resource files not required for Unix"
 endif
 
+# Mapfile-vers.gmk, does not copy over the mapfile-vers-unpack200, when
+# the make utiliy is re-invoked, as in this case. In order to workaround
+# this special case, the mapfile required for the unpack200 command, is
+# explicitly copied over to the expected location.
 $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) updatefiles winres
 	$(prep-target)
+	$(RM) $(TEMPDIR)/mapfile-vers
+	$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
 	$(LINKER)  $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
 ifdef MT
 	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/sun/java/pack/mapfile-vers-unpack200	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+	local:
+	    *;
+};
--- a/jdk/make/com/sun/tools/attach/Makefile	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/com/sun/tools/attach/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -48,6 +48,9 @@
 ifeq ($(PLATFORM), solaris)
 OTHER_LDLIBS += -ldoor
 endif
+ifeq ($(PLATFORM), windows)
+EXTRA_LIBS += psapi.lib
+endif
 
 vpath %.c $(PLATFORM_SRC)/native/sun/tools/attach
 
--- a/jdk/make/common/Mapfile-vers.gmk	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/common/Mapfile-vers.gmk	Thu Apr 21 16:42:06 2011 -0700
@@ -52,8 +52,8 @@
   endif
   
   # If we are re-ordering functions in this solaris library, we need to make
-  #   sure that -xF is added to the compile lines. This option is critical and
-  #   enables the functions to be reordered.
+  # sure that -xF is added to the compile lines. This option is critical and
+  # enables the functions to be reordered.
   ifdef FILES_reorder
     CFLAGS_OPT   += -xF
     CXXFLAGS_OPT += -xF
@@ -76,7 +76,6 @@
 
 endif # PLATFORM
 
-
 ifeq ($(PLATFORM), linux)
 
 ifeq ($(VARIANT), OPT)
--- a/jdk/make/common/Program.gmk	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/common/Program.gmk	Thu Apr 21 16:42:06 2011 -0700
@@ -55,6 +55,11 @@
 
 program: $(ACTUAL_PROGRAM)
 
+# reuse the mapfiles in the launcher's directory, the same should
+# be applicable to the tool launchers as well.
+FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH)
+include $(BUILDDIR)/common/Mapfile-vers.gmk
+
 include $(JDK_TOPDIR)/make/common/Rules.gmk
 
 ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE
--- a/jdk/make/common/Release.gmk	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/common/Release.gmk	Thu Apr 21 16:42:06 2011 -0700
@@ -885,12 +885,18 @@
 ABS_DB_PATH  :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
 DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
 
+# Java DB image. Move the Java DB demo directory into the JDK's demo
+# dir and in the process, rename it to db.  Also remove index.html,
+# since it presumes docs are co-located. Also remove register.html (no
+# longer relevant).
 initial-image-jdk-db: $(DB_ZIP_LIST)
 	$(MKDIR) -p $(JDK_IMAGE_DIR)/db
 	for d in $(DB_ZIP_LIST); do \
           ($(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
 	done
-
+	$(RM) -rf $(DEMODIR)/db
+	$(MV) $(JDK_IMAGE_DIR)/db/demo $(DEMODIR)/db
+	$(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/register.html
 endif
 
 # Standard jdk image
--- a/jdk/make/docs/Makefile	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/docs/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -53,7 +53,7 @@
 DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
 
 # Url to Java Language Spec
-JLS3_URL = http://java.sun.com/docs/books/jls/
+#JLS3_URL = http://java.sun.com/docs/books/jls/
 
 # Common Java trademark line
 JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
@@ -293,8 +293,8 @@
 <strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
 
 # Java language specification cite
-TAG_JLS3 = jls3:a:See <cite><a href="$(JLS3_URL)"> \
-The Java Language Specification, Third Edition</a></cite>:
+TAG_JLS = jls:a:See <cite> \
+The Java&trade; Language Specification</cite>:
 
 # Overview file for core apis
 COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html
@@ -329,7 +329,7 @@
 	  $(call OptionPair,-tag,specdefault:X)				; \
 	  $(call OptionPair,-tag,Note:X)				; \
 	  $(call OptionPair,-tag,ToDo:X)				; \
-          $(call OptionPair,-tag,$(TAG_JLS3)) 				; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionOnly,-splitIndex)				; \
 	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW))		; \
 	  $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE))		; \
@@ -1081,6 +1081,7 @@
 	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE))		; \
 	  $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
 	  $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER))	; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
 	  $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
 	  $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
--- a/jdk/make/java/main/java/Makefile	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/java/main/java/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -61,5 +61,4 @@
 
 ifeq ($(PLATFORM), solaris)
 LDFLAGS += -R$(OPENWIN_LIB)
-LDFLAGS += -M mapfile-$(ARCH)
 endif
--- a/jdk/make/java/main/java/mapfile-amd64	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-amd64	Thu Apr 21 16:42:06 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
@@ -27,7 +27,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-i586	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-i586	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2005, 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
@@ -27,7 +27,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-sparc	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-sparc	Thu Apr 21 16:42:06 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
@@ -26,7 +26,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-sparcv9	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-sparcv9	Thu Apr 21 16:42:06 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
@@ -28,7 +28,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/javax/crypto/Defs-jce.gmk	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/javax/crypto/Defs-jce.gmk	Thu Apr 21 16:42:06 2011 -0700
@@ -58,7 +58,7 @@
 SIGNING_KEY_DIR    = /security/ws/JCE-signing/src
 SIGNING_KEYSTORE   = $(SIGNING_KEY_DIR)/KeyStore.jks
 SIGNING_PASSPHRASE = $(SIGNING_KEY_DIR)/passphrase.txt
-SIGNING_ALIAS      = jce_rsa
+SIGNING_ALIAS      = oracle_jce_rsa
 
 #
 # Defines for signing the various jar files.
--- a/jdk/make/jpda/jdwp/jdwp.spec	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/jpda/jdwp/jdwp.spec	Thu Apr 21 16:42:06 2011 -0700
@@ -519,9 +519,8 @@
         "Both the JNI signature and the generic signature are "
         "returned for each class.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
 	(Out 
         )
@@ -623,8 +622,8 @@
             (referenceType refType "The reference type ID.")
         )
         (Reply
-            (int modBits "Modifier bits as defined in the "
-	                 "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>")
+            (int modBits "Modifier bits as defined in Chapter 4 of "
+	                 "<cite>The Java&trade; Virtual Machine Specification</cite>")
         )
         (ErrorSet
             (Error INVALID_CLASS     "refType is not the ID of a reference "
@@ -651,8 +650,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "field declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the field as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -686,8 +685,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "method declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the method as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -773,8 +772,8 @@
     (Command Status=9
         "Returns the current status of the reference type. The status "
 	"indicates the extent to which the reference type has been "
-	"initialized, as described in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec/html/Concepts.doc.html#16491\">VM specification</a>. "
+	"initialized, as described in section 2.1.6 of "
+	"<cite>The Java&trade; Virtual Machine Specification</cite>. "
 	"If the class is linked the PREPARED and VERIFIED bits in the returned status bits "
 	"will be set. If the class is initialized the INITIALIZED bit in the returned "
 	"status bits will be set. If an error occured during initialization then the "
@@ -852,9 +851,8 @@
         "Returns the JNI signature of a reference type along with the "
         "generic signature if there is one.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
 	"<p>
 	(Out
@@ -882,9 +880,8 @@
 	"by the compiler. "
         "Fields are returned in the order they occur in the class file.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The reference type ID.")
@@ -900,8 +897,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "field declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the field as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -925,9 +922,8 @@
 	"if present, and any synthetic methods created by the compiler. "
         "Methods are returned in the order they occur in the class file.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The reference type ID.")
@@ -943,8 +939,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "method declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the method as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -1006,8 +1002,8 @@
     )
     (Command ConstantPool=18
         "Return the raw bytes of the constant pool in the format of the "
-        "constant_pool item of the Class File Format in the "
-        "Java Virtual Machine Specification. "
+        "constant_pool item of the Class File Format in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "<p>Since JDWP version 1.6. Requires canGetConstantPool capability - see "
 	"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>.""
         (Out
@@ -1016,7 +1012,8 @@
         (Reply
             (int count "Total number of constant pool entries plus one. This "
                        "corresponds to the constant_pool_count item of the "
-                       "Class File Format in the Java Virtual Machine Specification. ")
+                       "Class File Format in "
+                       "<cite>The Java&trade; Virtual Machine Specification</cite>. ")
             (Repeat bytes
                 (byte cpbytes "Raw bytes of constant pool")
             )
@@ -1324,7 +1321,8 @@
         )
     )
     (Command Bytecodes=3
-        "Retrieve the method's bytecodes as defined in the JVM Specification."
+        "Retrieve the method's bytecodes as defined in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 	"Requires canGetBytecodes capability - see "
 	"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>."
         (Out
@@ -1379,9 +1377,8 @@
 	"instance methods, the \"this\" reference is included in the "
 	"table. Also, synthetic variables may be present. "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The class.")
@@ -1970,8 +1967,9 @@
 	"<p>"
         "The method which will return early is referred to as the "
         "called method. The called method is the current method (as "
-        "defined by the Frames section in the Java Virtual Machine "
-        "Specification) for the specified thread at the time this command "
+        "defined by the Frames section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>) "
+        "for the specified thread at the time this command "
         "is received. "
 	"<p>"
         "The specified thread must be suspended. "
--- a/jdk/make/mksample/Makefile	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/mksample/Makefile	Thu Apr 21 16:42:06 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
@@ -38,7 +38,7 @@
 endif
 
 SUBDIRS =
-SUBDIRS_misc = nio scripting nbproject
+SUBDIRS_misc = nio scripting nbproject forkjoin
 SUBDIRS_enterprise = $(WEBSERVICES_SUBDIR)
 SUBDIRS_management = jmx
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/forkjoin/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+#
+# Makefile for building all the samples under the forkjoin subdirectory.
+#
+
+BUILDDIR = ../..
+PRODUCT = java
+include $(BUILDDIR)/common/Defs.gmk
+
+SUBDIRS = mergesort
+include $(BUILDDIR)/common/Subdirs.gmk
+
+all build clean clobber::
+	$(SUBDIRS-loop)
+
+clobber clean ::
+	$(RM) -r $(SAMPLEDIR)/forkjoin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/forkjoin/mergesort/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+#
+# Makefile for the forkjoin/mergesort sample code
+#
+
+BUILDDIR = ../../..
+
+PRODUCT = java
+
+include $(BUILDDIR)/common/Defs.gmk
+
+SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/forkjoin/mergesort
+SAMPLE_DST_DIR = $(SAMPLEDIR)/forkjoin/mergesort
+
+SAMPLE_FILES =							\
+	$(SAMPLE_DST_DIR)/MergeDemo.java			\
+	$(SAMPLE_DST_DIR)/MergeSort.java
+
+all build: $(SAMPLE_FILES)
+
+$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
+	$(install-file)
+
+clean clobber:
+	$(RM) -r $(SAMPLE_DST_DIR)
+
+.PHONY: all build clean clobber
--- a/jdk/make/mksample/nio/Makefile	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/make/mksample/nio/Makefile	Thu Apr 21 16:42:06 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
@@ -31,7 +31,7 @@
 PRODUCT = java
 include $(BUILDDIR)/common/Defs.gmk
 
-SUBDIRS = file multicast server
+SUBDIRS = chatserver file multicast server
 include $(BUILDDIR)/common/Subdirs.gmk
 
 all build clean clobber::
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/nio/chatserver/Makefile	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,56 @@
+#
+# 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.
+#
+
+#
+# Makefile for the nio/chatserver sample code
+#
+
+BUILDDIR = ../../..
+
+PRODUCT = java
+
+include $(BUILDDIR)/common/Defs.gmk
+
+SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/nio/chatserver
+SAMPLE_DST_DIR = $(SAMPLEDIR)/nio/chatserver
+
+SAMPLE_FILES =							\
+	$(SAMPLE_DST_DIR)/ChatServer.java			\
+	$(SAMPLE_DST_DIR)/Client.java				\
+	$(SAMPLE_DST_DIR)/ClientReader.java			\
+	$(SAMPLE_DST_DIR)/DataReader.java			\
+	$(SAMPLE_DST_DIR)/MessageReader.java			\
+	$(SAMPLE_DST_DIR)/NameReader.java			\
+	$(SAMPLE_DST_DIR)/README.txt
+
+all build: $(SAMPLE_FILES)
+
+$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
+	$(install-file)
+
+clean clobber:
+	$(RM) -r $(SAMPLE_DST_DIR)
+
+.PHONY: all build clean clobber
--- a/jdk/src/share/bin/jli_util.h	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/bin/jli_util.h	Thu Apr 21 16:42:06 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
@@ -35,7 +35,6 @@
 void  JLI_MemFree(void *ptr);
 int   JLI_StrCCmp(const char *s1, const char* s2);
 
-
 #define JLI_StrLen(p1)          strlen((p1))
 #define JLI_StrChr(p1, p2)      strchr((p1), (p2))
 #define JLI_StrRChr(p1, p2)     strrchr((p1), (p2))
@@ -48,6 +47,7 @@
 #define JLI_StrSpn(p1, p2)      strspn((p1), (p2))
 #define JLI_StrCSpn(p1, p2)     strcspn((p1), (p2))
 #define JLI_StrPBrk(p1, p2)     strpbrk((p1), (p2))
+#define JLI_StrTok(p1, p2)      strtok((p1), (p2))
 
 /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */
 #ifdef _WIN32
--- a/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Thu Apr 21 16:42:06 2011 -0700
@@ -175,8 +175,8 @@
     /**
      * Converts the given {@code type} to the corresponding class.
      * This method implements the concept of type erasure,
-     * that is described in <a href="http://jscstage.sfbay.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.6">section 4.6</a>
-     * of Java Language Specification.
+     * that is described in section 4.6 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param type  the array of types to convert
      * @return a corresponding class
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html	Thu Apr 21 16:42:06 2011 -0700
@@ -88,8 +88,8 @@
 http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html</a></li>
 
 <li>
-Java Virtual Machine Specification : <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html">
-http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html</a></li>
+Class File Specification: Chapter 4 of
+<em>The Java&trade; Virtual Machine Specification</em>
 
 <li>
 Hypertext Transfer Protocol -- HTTP/1.1 : <a href="http://www.ietf.org/rfc/rfc2616.txt">
--- a/jdk/src/share/classes/com/sun/jdi/Accessible.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Accessible.java	Thu Apr 21 16:42:06 2011 -0700
@@ -42,12 +42,9 @@
      * Returns the Java<sup><font size=-2>TM</font></sup>
      * programming language modifiers, encoded in an integer.
      * <p>
-     * The modifier encodings are defined in the
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a>, in the <code>access_flag</code> tables for
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">classes</a>,
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">fields</a>, and
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">methods</a>.
+     * The modifier encodings are defined in
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * in the <code>access_flag</code> tables for classes(section 4.1), fields(section 4.5), and methods(section 4.6).
      */
     public int modifiers();
 
--- a/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Thu Apr 21 16:42:06 2011 -0700
@@ -77,11 +77,9 @@
      * as specified in the array declaration.
      * <P>
      * Note: The component type of a array will always be
-     * created or loaded before the array - see the
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     * Machine Specification</a>, section
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79473">5.3.3
-     * Creating Array Classes</a>.
+     * created or loaded before the array - see
+     * <cite>The Java&trade; Virtual Machine Specification</cite>,
+     * section 5.3.3 - Creating Array Classes.
      * However, although the component type will be loaded it may
      * not yet be prepared, in which case the type will be returned
      * but attempts to perform some operations on the returned type
--- a/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Thu Apr 21 16:42:06 2011 -0700
@@ -71,11 +71,9 @@
      * <p>
      * No ordering of the returned list is guaranteed.
      * <p>
-     * See the revised
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java
-     * Virtual Machine Specification</a> section
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#72007">5.3
-     * Creation and Loading</a>
+     * See
+     * <cite>The Java&trade; Virtual Machine Specification</cite>,
+     * section 5.3 - Creation and Loading
      * for more information on the initiating classloader.
      * <p>
      * Note that unlike {@link #definedClasses()}
--- a/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -60,9 +60,9 @@
  * is visible to the class loader of enclosing class. (That is, the
  * class loader of the enclosing class must be an <i>initiating</i> class
  * loader for the class in question.)
- * See the <a href="http://java.sun.com/docs/books/vmspec/">Java
- * Virtual Machine Specification</a> for
- * more details.
+ * See
+ * <cite>The Java&trade; Virtual Machine Specification</cite>
+ * for more details.
  *
  * @author Gordon Hirsch
  * @since  1.3
--- a/jdk/src/share/classes/com/sun/jdi/ClassType.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassType.java	Thu Apr 21 16:42:06 2011 -0700
@@ -164,10 +164,8 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See Section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, all threads in the target VM are resumed while
@@ -280,10 +278,8 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, all threads in the target VM are resumed while
--- a/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Thu Apr 21 16:42:06 2011 -0700
@@ -102,9 +102,7 @@
     /**
      * Gets the generic signature for this variable if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/jdi/Method.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Method.java	Thu Apr 21 16:42:06 2011 -0700
@@ -164,10 +164,8 @@
 
     /**
      * Determine if this method is a bridge method. Bridge
-     * methods are defined in the
-     * <a href="http://java.sun.com/docs/books/jls">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Language Specification, 3rd Edition.</a>
+     * methods are defined in
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @return <code>true</code> if the method is a bridge method,
      * false otherwise.
--- a/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Thu Apr 21 16:42:06 2011 -0700
@@ -118,10 +118,8 @@
      * enclosing class's class loader). Primitive values must be
      * either assignment compatible with the field type or must be
      * convertible to the field type without loss of information.
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment
      * compatibility.
      *
@@ -182,18 +180,13 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, the method is invoked using dynamic lookup as
-     * documented in the
-     * <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>
-     * second edition, section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#45606">15.12.4.4</a>;
+     * documented in section 15.12.4.4 of
+     * <cite>The Java&trade; Language Specification</cite>
      * in particular, overriding based on the runtime type of the object
      * mirrored by this {@link ObjectReference} will occur. This
      * behavior can be changed by specifying the
--- a/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,9 +30,8 @@
 
 /**
  * The type of an object in a target VM. ReferenceType encompasses
- * classes, interfaces, and array types as defined in the
- * <a href="http://java.sun.com/docs/books/jls/">
- * Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
+ * classes, interfaces, and array types as defined in
+ * <cite>The Java&trade; Language Specification</cite>.
  * All ReferenceType objects belong to one of the following
  * subinterfaces:
  * {@link ClassType} for classes,
@@ -98,9 +97,7 @@
     /**
      * Gets the generic signature for this type if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Thu Apr 21 16:42:06 2011 -0700
@@ -74,9 +74,7 @@
     /**
      * Gets the generic signature for this TypeComponent if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -111,13 +111,13 @@
      */
     private String tableName;
 
-
     /**
      * A <code>Vector</code> object containing the <code>Row</code>
      * objects that comprise  this <code>CachedRowSetImpl</code> object.
      * @serial
      */
-    private Vector rvh;
+    private Vector<Object> rvh;
+
     /**
      * The current postion of the cursor in this <code>CachedRowSetImpl</code>
      * object.
@@ -293,12 +293,12 @@
     /**
      * The Vector holding the Match Columns
      */
-       private Vector iMatchColumns;
+    private Vector<Integer> iMatchColumns;
 
     /**
      * The Vector that will hold the Match Column names.
      */
-       private Vector strMatchColumns;
+    private Vector<String> strMatchColumns;
 
     /**
      * Trigger that indicates whether the active SyncProvider is exposes the
@@ -484,7 +484,7 @@
      */
     private void initContainer() {
 
-        rvh = new Vector(100);
+        rvh = new Vector<Object>(100);
         cursorPos = 0;
         absolutePos = 0;
         numRows = 0;
@@ -523,12 +523,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -622,7 +622,7 @@
         Row currentRow;
         int numCols;
         int i;
-        Map map = getTypeMap();
+        Map<String, Class<?>> map = getTypeMap();
         Object obj;
         int mRows;
 
@@ -939,14 +939,9 @@
      */
     public void acceptChanges(Connection con) throws SyncProviderException{
 
-      try{
-         setConnection(con);
-         acceptChanges();
-      } catch (SyncProviderException spe) {
-          throw spe;
-      } catch(SQLException sqle){
-          throw new SyncProviderException(sqle.getMessage());
-      }
+      setConnection(con);
+      acceptChanges();
+
     }
 
     /**
@@ -1289,14 +1284,7 @@
      */
     public Collection<?> toCollection() throws SQLException {
 
-        TreeMap tMap;
-        int count = 0;
-        Row origRow;
-        Vector newRow;
-
-        int colCount = ((RowSetMetaDataImpl)this.getMetaData()).getColumnCount();
-
-        tMap = new TreeMap();
+        TreeMap<Integer, Object> tMap = new TreeMap<>();
 
         for (int i = 0; i<numRows; i++) {
             tMap.put(Integer.valueOf(i), rvh.get(i));
@@ -1325,10 +1313,8 @@
      */
     public Collection<?> toCollection(int column) throws SQLException {
 
-        Vector vec;
-        Row origRow;
         int nRows = numRows;
-        vec = new Vector(nRows);
+        Vector<Object> vec = new Vector<>(nRows);
 
         // create a copy
         CachedRowSetImpl crsTemp;
@@ -2953,7 +2939,7 @@
      */
     public Object getObject(int columnIndex) throws SQLException {
         Object value;
-        java.util.Map map;
+        Map<String, Class<?>> map;
 
         // sanity check.
         checkIndex(columnIndex);
@@ -7257,7 +7243,7 @@
         Row currentRow;
         int numCols;
         int i;
-        Map map = getTypeMap();
+        Map<String, Class<?>> map = getTypeMap();
         Object obj;
         int mRows;
 
@@ -7304,11 +7290,11 @@
             resultSet.absolute(start -1);
         }
         if( pageSize == 0) {
-           rvh = new Vector(getMaxRows());
+           rvh = new Vector<Object>(getMaxRows());
 
         }
         else{
-            rvh = new Vector(getPageSize());
+            rvh = new Vector<Object>(getPageSize());
         }
 
         if (data == null) {
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -93,12 +93,12 @@
     /**
      * The Vector holding the Match Columns
      */
-    private Vector iMatchColumns;
+    private Vector<Integer> iMatchColumns;
 
     /**
      * The Vector that will hold the Match Column names.
      */
-    private Vector strMatchColumns;
+    private Vector<String> strMatchColumns;
 
 
     protected transient JdbcRowSetResourceBundle resBundle;
@@ -213,12 +213,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -286,12 +286,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -373,12 +373,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -463,12 +463,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -675,7 +675,7 @@
 
         try {
 
-            Map aMap = getTypeMap();
+            Map<String, Class<?>> aMap = getTypeMap();
             if( aMap != null) {
                 conn.setTypeMap(aMap);
             }
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -59,8 +59,8 @@
     /**
      * A <code>Vector</code> object that contains the <code>RowSet</code> objects
      * that have been added to this <code>JoinRowSet</code> object.
-         */
-    private Vector vecRowSetsInJOIN;
+     */
+    private Vector<CachedRowSetImpl> vecRowSetsInJOIN;
 
     /**
      * The <code>CachedRowSet</code> object that encapsulates this
@@ -78,13 +78,13 @@
      * for this <code>JoinRowSet</code> object.
      * The last join type set forms the basis of succeeding joins.
      */
-    private Vector vecJoinType;
+    private Vector<Integer> vecJoinType;
 
     /**
      * A <code>Vector</code> object containing the names of all the tables entering
      * the join.
      */
-    private Vector vecTableNames;
+    private Vector<String> vecTableNames;
 
     /**
      * An <code>int</code> that indicates the column index of the match column.
@@ -121,10 +121,10 @@
      */
     public JoinRowSetImpl() throws SQLException {
 
-        vecRowSetsInJOIN = new Vector();
+        vecRowSetsInJOIN = new Vector<CachedRowSetImpl>();
         crsInternal = new CachedRowSetImpl();
-        vecJoinType = new Vector();
-        vecTableNames = new Vector();
+        vecJoinType = new Vector<Integer>();
+        vecTableNames = new Vector<String>();
         iMatchKey = -1;
         strMatchKey = null;
         supportedJOINs =
@@ -222,7 +222,7 @@
            // either of the setter methods have been set.
            if(boolColId){
               //
-              ArrayList indices = new ArrayList();
+              ArrayList<Integer> indices = new ArrayList<>();
               for(int i=0;i<cRowset.getMatchColumnNames().length;i++) {
                   if( (strMatchKey = (cRowset.getMatchColumnNames())[i]) != null) {
                       iMatchKey = cRowset.findColumn(strMatchKey);
--- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Thu Apr 21 16:42:06 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
@@ -395,7 +395,13 @@
     private boolean succeeded = false;
     private boolean commitSucceeded = false;
     private String username;
+
+    // Encryption keys calculated from password. Assigned when storekey == true
+    // and useKeyTab == false (or true but not found)
     private EncryptionKey[] encKeys = null;
+
+    KeyTab ktab = null;
+
     private Credentials cred = null;
 
     private PrincipalName principal = null;
@@ -663,28 +669,49 @@
                         (krb5PrincName.toString(),
                          PrincipalName.KRB_NT_PRINCIPAL);
                 }
+
+                /*
+                 * Before dynamic KeyTab support (6894072), here we check if
+                 * the keytab contains keys for the principal. If no, keytab
+                 * will not be used and password is prompted for.
+                 *
+                 * After 6894072, we normally don't check it, and expect the
+                 * keys can be populated until a real connection is made. The
+                 * check is still done when isInitiator == true, where the keys
+                 * will be used right now.
+                 *
+                 * Probably tricky relations:
+                 *
+                 * useKeyTab is config flag, but when it's true but the ktab
+                 * does not contains keys for principal, we would use password
+                 * and keep the flag unchanged (for reuse?). In this method,
+                 * we use (ktab != null) to check whether keytab is used.
+                 * After this method (and when storeKey == true), we use
+                 * (encKeys == null) to check.
+                 */
                 if (useKeyTab) {
-                    encKeys =
-                        EncryptionKey.acquireSecretKeys(principal, keyTabName);
-
-                    if (debug) {
-                        if (encKeys != null)
-                            System.out.println
-                                ("principal's key obtained from the keytab");
-                        else
-                            System.out.println
-                                ("Key for the principal " +
-                                 principal  +
-                                 " not available in " +
-                                 ((keyTabName == null) ?
-                                  "default key tab" : keyTabName));
+                    ktab = (keyTabName == null)
+                                ? KeyTab.getInstance()
+                                : KeyTab.getInstance(new File(keyTabName));
+                    if (isInitiator) {
+                        if (Krb5Util.keysFromJavaxKeyTab(ktab, principal).length
+                                == 0) {
+                            ktab = null;
+                            if (debug) {
+                                System.out.println
+                                    ("Key for the principal " +
+                                     principal  +
+                                     " not available in " +
+                                     ((keyTabName == null) ?
+                                      "default key tab" : keyTabName));
+                            }
+                        }
                     }
-
                 }
 
                 KrbAsReqBuilder builder;
-                // We can't get the key from the keytab so prompt
-                if (encKeys == null) {
+
+                if (ktab == null) {
                     promptForPass(getPasswdFromSharedState);
                     builder = new KrbAsReqBuilder(principal, password);
                     if (isInitiator) {
@@ -693,9 +720,13 @@
                         // updated with PA info
                         cred = builder.action().getCreds();
                     }
-                    encKeys = builder.getKeys();
+                    if (storeKey) {
+                        encKeys = builder.getKeys();
+                        // When encKeys is empty, the login actually fails.
+                        // For compatibility, exception is thrown in commit().
+                    }
                 } else {
-                    builder = new KrbAsReqBuilder(principal, encKeys);
+                    builder = new KrbAsReqBuilder(principal, ktab);
                     if (isInitiator) {
                         cred = builder.action().getCreds();
                     }
@@ -705,10 +736,15 @@
                 if (debug) {
                     System.out.println("principal is " + principal);
                     HexDumpEncoder hd = new HexDumpEncoder();
-                    for (int i = 0; i < encKeys.length; i++) {
-                        System.out.println("EncryptionKey: keyType=" +
-                            encKeys[i].getEType() + " keyBytes (hex dump)=" +
-                            hd.encodeBuffer(encKeys[i].getBytes()));
+                    if (ktab != null) {
+                        System.out.println("Will use keytab");
+                    } else if (storeKey) {
+                        for (int i = 0; i < encKeys.length; i++) {
+                            System.out.println("EncryptionKey: keyType=" +
+                                encKeys[i].getEType() +
+                                " keyBytes (hex dump)=" +
+                                hd.encodeBuffer(encKeys[i].getBytes()));
+                        }
                     }
                 }
 
@@ -989,8 +1025,8 @@
                 kerbTicket = Krb5Util.credsToTicket(cred);
             }
 
-            if (storeKey) {
-                if (encKeys == null || encKeys.length <= 0) {
+            if (storeKey && encKeys != null) {
+                if (encKeys.length == 0) {
                     succeeded = false;
                     throw new LoginException("Null Server Key ");
                 }
@@ -1006,10 +1042,11 @@
                 }
 
             }
-            // Let us add the kerbClientPrinc,kerbTicket and kerbKey (if
+            // Let us add the kerbClientPrinc,kerbTicket and KeyTab/KerbKey (if
             // storeKey is true)
-            if (!princSet.contains(kerbClientPrinc))
+            if (!princSet.contains(kerbClientPrinc)) {
                 princSet.add(kerbClientPrinc);
+            }
 
             // add the TGT
             if (kerbTicket != null) {
@@ -1018,19 +1055,29 @@
             }
 
             if (storeKey) {
-                for (int i = 0; i < kerbKeys.length; i++) {
-                    if (!privCredSet.contains(kerbKeys[i])) {
-                        privCredSet.add(kerbKeys[i]);
+                if (encKeys == null) {
+                    if (!privCredSet.contains(ktab)) {
+                        privCredSet.add(ktab);
+                        // Compatibility; also add keys to privCredSet
+                        for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) {
+                            privCredSet.add(new Krb5Util.KeysFromKeyTab(key));
+                        }
                     }
-                    encKeys[i].destroy();
-                    encKeys[i] = null;
-                    if (debug) {
-                        System.out.println("Added server's key"
-                                        + kerbKeys[i]);
-                        System.out.println("\t\t[Krb5LoginModule] " +
-                                       "added Krb5Principal  " +
-                                       kerbClientPrinc.toString()
-                                       + " to Subject");
+                } else {
+                    for (int i = 0; i < kerbKeys.length; i ++) {
+                        if (!privCredSet.contains(kerbKeys[i])) {
+                            privCredSet.add(kerbKeys[i]);
+                        }
+                        encKeys[i].destroy();
+                        encKeys[i] = null;
+                        if (debug) {
+                            System.out.println("Added server's key"
+                                            + kerbKeys[i]);
+                            System.out.println("\t\t[Krb5LoginModule] " +
+                                           "added Krb5Principal  " +
+                                           kerbClientPrinc.toString()
+                                           + " to Subject");
+                        }
                     }
                 }
             }
@@ -1106,7 +1153,8 @@
         while (it.hasNext()) {
             Object o = it.next();
             if (o instanceof KerberosTicket ||
-                o instanceof KerberosKey) {
+                    o instanceof KerberosKey ||
+                    o instanceof KeyTab) {
                 it.remove();
             }
         }
@@ -1161,6 +1209,7 @@
         } else {
             // remove temp results for the next try
             encKeys = null;
+            ktab = null;
             principal = null;
         }
         username = null;
--- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Thu Apr 21 16:42:06 2011 -0700
@@ -40,10 +40,9 @@
 <a name="Autoshutdown"></a>
 <h2>Auto-shutdown</h2>
 
-According to <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The 
-Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification,
-Second edition</i></a> (see <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19152">§2.17.9</a>
-and <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33308">§2.19</a>),
+According to
+<cite>The Java&trade; Virtual Machine Specification</cite>,
+sections 2.17.9 and 2.19,
 the Java virtual machine (JVM) initially starts up with a single non-daemon
 thread, which typically calls the <code>main</code> method of some class.
 The virtual machine terminates all its activity and exits when
@@ -183,7 +182,8 @@
         <...>
 </pre>
 
-The Java Virtual Machine Specification guarantees
+<cite>The Java&trade; Virtual Machine Specification</cite>
+ guarantees
 that the JVM doesn't exit until this thread terminates.
 </body>
 </html>
--- a/jdk/src/share/classes/java/io/Console.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/io/Console.java	Thu Apr 21 16:42:06 2011 -0700
@@ -148,8 +148,8 @@
     *         extra arguments are ignored.  The number of arguments is
     *         variable and may be zero.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.  The behaviour on a
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+    *         The behaviour on a
     *         <tt>null</tt> argument depends on the <a
     *         href="../util/Formatter.html#syntax">conversion</a>.
     *
@@ -187,8 +187,8 @@
     *         extra arguments are ignored.  The number of arguments is
     *         variable and may be zero.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.  The behaviour on a
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+    *         The behaviour on a
     *         <tt>null</tt> argument depends on the <a
     *         href="../util/Formatter.html#syntax">conversion</a>.
     *
@@ -220,8 +220,7 @@
     *         string.  If there are more arguments than format specifiers, the
     *         extra arguments are ignored.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
     *
     * @throws  IllegalFormatException
     *          If a format string contains an illegal syntax, a format
@@ -285,8 +284,7 @@
     *         string.  If there are more arguments than format specifiers, the
     *         extra arguments are ignored.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
     *
     * @throws  IllegalFormatException
     *          If a format string contains an illegal syntax, a format
--- a/jdk/src/share/classes/java/io/PrintStream.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/io/PrintStream.java	Thu Apr 21 16:42:06 2011 -0700
@@ -846,8 +846,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -896,8 +896,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -939,8 +939,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -996,8 +996,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
--- a/jdk/src/share/classes/java/io/PrintWriter.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/io/PrintWriter.java	Thu Apr 21 16:42:06 2011 -0700
@@ -779,8 +779,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -830,8 +830,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -874,8 +874,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -934,8 +934,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
--- a/jdk/src/share/classes/java/lang/AssertionError.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/AssertionError.java	Thu Apr 21 16:42:06 2011 -0700
@@ -34,11 +34,9 @@
  *     new AssertionError(<i>expression</i>)
  * </pre>
  * has as its detail message the <i>string conversion</i> of
- * <i>expression</i> (as defined in <a
- * href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html">
- * <i>The Java Language Specification, Second Edition</i></a>,
- * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#40220">
- * Section  15.18.1.1</a>), regardless of the type of <i>expression</i>.
+ * <i>expression</i> (as defined in section 15.18.1.1 of
+ * <cite>The Java&trade; Language Specification</cite>),
+ * regardless of the type of <i>expression</i>.
  *
  * @since   1.4
  */
@@ -63,8 +61,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified object, which is converted to a string as
-     * defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *<p>
      * If the specified object is an instance of {@code Throwable}, it
      * becomes the <i>cause</i> of the newly constructed assertion error.
@@ -81,8 +79,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>boolean</code>, which is converted to
-     * a string as defined in <i>The Java Language Specification,
-     * Second Edition</i>, Section 15.18.1.1.
+     * a string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -93,8 +91,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>char</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -105,8 +103,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>int</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -117,8 +115,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>long</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -129,8 +127,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>float</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -141,8 +139,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>double</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
--- a/jdk/src/share/classes/java/lang/Byte.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Byte.java	Thu Apr 21 16:42:06 2011 -0700
@@ -251,9 +251,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Character.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Character.java	Thu Apr 21 16:42:06 2011 -0700
@@ -4182,9 +4182,11 @@
             aliases.put("AVST", AVESTAN);
             aliases.put("BALI", BALINESE);
             aliases.put("BAMU", BAMUM);
+            aliases.put("BATK", BATAK);
             aliases.put("BENG", BENGALI);
             aliases.put("BOPO", BOPOMOFO);
             aliases.put("BRAI", BRAILLE);
+            aliases.put("BRAH", BRAHMI);
             aliases.put("BUGI", BUGINESE);
             aliases.put("BUHD", BUHID);
             aliases.put("CANS", CANADIAN_ABORIGINAL);
@@ -4228,6 +4230,7 @@
             aliases.put("LISU", LISU);
             aliases.put("LYCI", LYCIAN);
             aliases.put("LYDI", LYDIAN);
+            aliases.put("MAND", MANDAIC);
             aliases.put("MLYM", MALAYALAM);
             aliases.put("MONG", MONGOLIAN);
             aliases.put("MTEI", MEETEI_MAYEK);
--- a/jdk/src/share/classes/java/lang/Class.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java	Thu Apr 21 16:42:06 2011 -0700
@@ -95,8 +95,8 @@
  * </pre></blockquote>
  *
  * <p> It is also possible to get the {@code Class} object for a named
- * type (or for void) using a class literal
- * (JLS Section <A HREF="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530">15.8.2</A>).
+ * type (or for void) using a class literal.  See Section 15.8.2 of
+ * <cite>The Java&trade; Language Specification</cite>.
  * For example:
  *
  * <p> <blockquote>
@@ -521,7 +521,8 @@
      *
      * <p> If this class object represents a reference type that is not an
      * array type then the binary name of the class is returned, as specified
-     * by the Java Language Specification, Second Edition.
+     * by
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * <p> If this class object represents a primitive type or void, then the
      * name returned is a {@code String} equal to the Java language
@@ -630,8 +631,8 @@
      *     the type variables declared by this generic declaration
      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Class<T>>[] getTypeParameters() {
@@ -675,8 +676,8 @@
      * returned.
      *
      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
-     *     class signature does not conform to the format specified in the
-     *     Java Virtual Machine Specification, 3rd edition
+     *     class signature does not conform to the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the generic superclass
      *     refers to a non-existent type declaration
      * @throws java.lang.reflect.MalformedParameterizedTypeException if the
@@ -798,7 +799,8 @@
      *
      * @throws java.lang.reflect.GenericSignatureFormatError
      *     if the generic class signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the generic
      *     superinterfaces refers to a non-existent type declaration
      * @throws java.lang.reflect.MalformedParameterizedTypeException
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Thu Apr 21 16:42:06 2011 -0700
@@ -160,8 +160,8 @@
  * <h4> <a name="name">Binary names</a> </h4>
  *
  * <p> Any class name provided as a {@link String} parameter to methods in
- * <tt>ClassLoader</tt> must be a binary name as defined by the <a
- * href="http://java.sun.com/docs/books/jls/">Java Language Specification</a>.
+ * <tt>ClassLoader</tt> must be a binary name as defined by
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <p> Examples of valid class names include:
  * <blockquote><pre>
@@ -531,9 +531,8 @@
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -597,9 +596,8 @@
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -748,9 +746,8 @@
      * @param  b
      *         The bytes that make up the class data. The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -838,8 +835,7 @@
      *         The bytes that make up the class data. The bytes from positions
      *         <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
      *         </tt> should have the format of a valid class file as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  protectionDomain
      *         The ProtectionDomain of the class, or <tt>null</tt>.
@@ -998,9 +994,8 @@
      * Links the specified class.  This (misleadingly named) method may be
      * used by a class loader to link a class.  If the class <tt>c</tt> has
      * already been linked, then this method simply returns. Otherwise, the
-     * class is linked as described in the "Execution" chapter of the <a
-     * href="http://java.sun.com/docs/books/jls/">Java Language
-     * Specification</a>.
+     * class is linked as described in the "Execution" chapter of
+     * <cite>The Java&trade; Language Specification</cite>.
      * </p>
      *
      * @param  c
@@ -2034,8 +2029,8 @@
      *         The name of the package whose package default assertion status
      *         is to be set. A <tt>null</tt> value indicates the unnamed
      *         package that is "current"
-     *         (<a href="http://java.sun.com/docs/books/jls/">Java Language
-     *         Specification</a>, section 7.4.2).
+     *         (see section 7.4.2 of
+     *         <cite>The Java&trade; Language Specification</cite>.)
      *
      * @param  enabled
      *         <tt>true</tt> if classes loaded by this classloader and
--- a/jdk/src/share/classes/java/lang/Double.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Double.java	Thu Apr 21 16:42:06 2011 -0700
@@ -392,9 +392,10 @@
      * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
      * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
      * <i>FloatTypeSuffix</i> are as defined in the lexical structure
-     * sections of the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>. If {@code s} does not have the form of
+     * sections of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
+     * If {@code s} does not have the form of
      * a <i>FloatValue</i>, then a {@code NumberFormatException}
      * is thrown. Otherwise, {@code s} is regarded as
      * representing an exact decimal value in the usual
@@ -464,8 +465,8 @@
      *       // Since this method allows integer-only strings as input
      *       // in addition to strings of floating-point literals, the
      *       // two sub-patterns below are simplifications of the grammar
-     *       // productions from the Java Language Specification, 2nd
-     *       // edition, section 3.10.2.
+     *       // productions from section 3.10.2 of
+     *       // <cite>The Java&trade; Language Specification</cite>.
      *
      *       // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
      *       "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
--- a/jdk/src/share/classes/java/lang/Enum.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Enum.java	Thu Apr 21 16:42:06 2011 -0700
@@ -36,9 +36,8 @@
  *
  * More information about enums, including descriptions of the
  * implicitly declared methods synthesized by the compiler, can be
- * found in <i>The Java&trade; Language Specification, Third
- * Edition</i>, <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9">&sect;8.9</a>.
+ * found in section 8.9 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <p> Note that when using an enumeration type as the type of a set
  * or as the type of the keys in a map, specialized and efficient
--- a/jdk/src/share/classes/java/lang/Error.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Error.java	Thu Apr 21 16:42:06 2011 -0700
@@ -43,7 +43,7 @@
  *
  * @author  Frank Yellin
  * @see     java.lang.ThreadDeath
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class Error extends Throwable {
--- a/jdk/src/share/classes/java/lang/Exception.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Exception.java	Thu Apr 21 16:42:06 2011 -0700
@@ -39,7 +39,7 @@
  *
  * @author  Frank Yellin
  * @see     java.lang.Error
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class Exception extends Throwable {
--- a/jdk/src/share/classes/java/lang/Float.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Float.java	Thu Apr 21 16:42:06 2011 -0700
@@ -353,9 +353,10 @@
      * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
      * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
      * <i>FloatTypeSuffix</i> are as defined in the lexical structure
-     * sections of the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>. If {@code s} does not have the form of
+     * sections of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
+     * If {@code s} does not have the form of
      * a <i>FloatValue</i>, then a {@code NumberFormatException}
      * is thrown. Otherwise, {@code s} is regarded as
      * representing an exact decimal value in the usual
--- a/jdk/src/share/classes/java/lang/Integer.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Integer.java	Thu Apr 21 16:42:06 2011 -0700
@@ -918,9 +918,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Long.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Long.java	Thu Apr 21 16:42:06 2011 -0700
@@ -598,9 +598,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Math.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Math.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2010, 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
@@ -627,11 +627,9 @@
     }
 
     /**
-     * Returns the closest {@code int} to the argument. The
-     * result is rounded to an integer by adding 1/2, taking the
-     * floor of the result, and casting the result to type {@code int}.
-     * In other words, the result is equal to the value of the expression:
-     * <p>{@code (int)Math.floor(a + 0.5f)}
+     * Returns the closest {@code int} to the argument, with ties
+     * rounding up.
+     *
      * <p>
      * Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -649,17 +647,17 @@
      * @see     java.lang.Integer#MIN_VALUE
      */
     public static int round(float a) {
-        return (int)floor(a + 0.5f);
+        if (a != 0x1.fffffep-2f) // greatest float value less than 0.5
+            return (int)floor(a + 0.5f);
+        else
+            return 0;
     }
 
     /**
-     * Returns the closest {@code long} to the argument. The result
-     * is rounded to an integer by adding 1/2, taking the floor of the
-     * result, and casting the result to type {@code long}. In other
-     * words, the result is equal to the value of the expression:
-     * <p>{@code (long)Math.floor(a + 0.5d)}
-     * <p>
-     * Special cases:
+     * Returns the closest {@code long} to the argument, with ties
+     * rounding up.
+     *
+     * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
      * <li>If the argument is negative infinity or any value less than or
      * equal to the value of {@code Long.MIN_VALUE}, the result is
@@ -676,7 +674,10 @@
      * @see     java.lang.Long#MIN_VALUE
      */
     public static long round(double a) {
-        return (long)floor(a + 0.5d);
+        if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5
+            return (long)floor(a + 0.5d);
+        else
+            return 0;
     }
 
     private static Random randomNumberGenerator;
--- a/jdk/src/share/classes/java/lang/Object.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Object.java	Thu Apr 21 16:42:06 2011 -0700
@@ -58,9 +58,8 @@
      *
      * @return The {@code Class} object that represents the runtime
      *         class of this object.
-     * @see    <a href="http://java.sun.com/docs/books/jls/">The Java
-     *         Language Specification, Third Edition (15.8.2 Class
-     *         Literals)</a>
+     * @see    Class Literals, section 15.8.2 of
+     *         <cite>The Java&trade; Language Specification</cite>.
      */
     public final native Class<?> getClass();
 
--- a/jdk/src/share/classes/java/lang/Override.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Override.java	Thu Apr 21 16:42:06 2011 -0700
@@ -43,7 +43,7 @@
  *
  * @author  Peter von der Ah&eacute;
  * @author  Joshua Bloch
- * @jls3 9.6.1.4 Override
+ * @jls 9.6.1.4 Override
  * @since 1.5
  */
 @Target(ElementType.METHOD)
--- a/jdk/src/share/classes/java/lang/Package.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Package.java	Thu Apr 21 16:42:06 2011 -0700
@@ -109,10 +109,9 @@
     /**
      * Return the name of this package.
      *
-     * @return  The fully-qualified name of this package as defined in the
-     *          <em>Java Language Specification, Third Edition</em>
-     *          <a href="http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.5.3">
-     *          &sect;6.5.3</a>, for example, {@code java.lang}
+     * @return  The fully-qualified name of this package as defined in section 6.5.3 of
+     *          <cite>The Java&trade; Language Specification</cite>,
+     *          for example, {@code java.lang}
      */
     public String getName() {
         return pkgName;
--- a/jdk/src/share/classes/java/lang/ProcessBuilder.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/ProcessBuilder.java	Thu Apr 21 16:42:06 2011 -0700
@@ -938,6 +938,11 @@
      * but at the very least the command must be a non-empty list of
      * non-null strings.
      *
+     * <p>A minimal set of system dependent environment variables may
+     * be required to start a process on some operating systems.
+     * As a result, the subprocess may inherit additional environment variable
+     * settings beyond those in the process builder's {@link #environment()}.
+     *
      * <p>If there is a security manager, its
      * {@link SecurityManager#checkExec checkExec}
      * method is called with the first component of this object's
--- a/jdk/src/share/classes/java/lang/Runtime.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Runtime.java	Thu Apr 21 16:42:06 2011 -0700
@@ -544,6 +544,11 @@
      * <p>If <tt>envp</tt> is <tt>null</tt>, the subprocess inherits the
      * environment settings of the current process.
      *
+     * <p>A minimal set of system dependent environment variables may
+     * be required to start a process on some operating systems.
+     * As a result, the subprocess may inherit additional environment variable
+     * settings beyond those in the specified environment.
+     *
      * <p>{@link ProcessBuilder#start()} is now the preferred way to
      * start a process with a modified environment.
      *
--- a/jdk/src/share/classes/java/lang/RuntimeException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/RuntimeException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -37,7 +37,7 @@
  * propagate outside the method or constructor boundary.
  *
  * @author  Frank Yellin
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class RuntimeException extends Exception {
--- a/jdk/src/share/classes/java/lang/SafeVarargs.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/SafeVarargs.java	Thu Apr 21 16:42:06 2011 -0700
@@ -70,8 +70,8 @@
  *
  * </ul>
  *
- * @jls3 4.7 Reifiable Types
- * @jls3 8.4.1 Formal Parameters
+ * @jls 4.7 Reifiable Types
+ * @jls 8.4.1 Formal Parameters
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
--- a/jdk/src/share/classes/java/lang/Short.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Short.java	Thu Apr 21 16:42:06 2011 -0700
@@ -256,9 +256,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/StrictMath.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/StrictMath.java	Thu Apr 21 16:42:06 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
@@ -613,11 +613,8 @@
     public static native double pow(double a, double b);
 
     /**
-     * Returns the closest {@code int} to the argument. The
-     * result is rounded to an integer by adding 1/2, taking the
-     * floor of the result, and casting the result to type {@code int}.
-     * In other words, the result is equal to the value of the expression:
-     * <p>{@code (int)Math.floor(a + 0.5f)}
+     * Returns the closest {@code int} to the argument, with ties
+     * rounding up.
      *
      * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -635,15 +632,12 @@
      * @see     java.lang.Integer#MIN_VALUE
      */
     public static int round(float a) {
-        return (int)floor(a + 0.5f);
+        return Math.round(a);
     }
 
     /**
-     * Returns the closest {@code long} to the argument. The result
-     * is rounded to an integer by adding 1/2, taking the floor of the
-     * result, and casting the result to type {@code long}. In other
-     * words, the result is equal to the value of the expression:
-     * <p>{@code (long)Math.floor(a + 0.5d)}
+     * Returns the closest {@code long} to the argument, with ties
+     * rounding up.
      *
      * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -662,7 +656,7 @@
      * @see     java.lang.Long#MIN_VALUE
      */
     public static long round(double a) {
-        return (long)floor(a + 0.5d);
+        return Math.round(a);
     }
 
     private static Random randomNumberGenerator;
--- a/jdk/src/share/classes/java/lang/String.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/String.java	Thu Apr 21 16:42:06 2011 -0700
@@ -2819,8 +2819,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -2863,8 +2863,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -3066,9 +3066,8 @@
      * if and only if <code>s.equals(t)</code> is <code>true</code>.
      * <p>
      * All literal strings and string-valued constant expressions are
-     * interned. String literals are defined in &sect;3.10.5 of the
-     * <a href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>
+     * interned. String literals are defined in section 3.10.5 of the
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @return  a string that has the same contents as this string, but is
      *          guaranteed to be from a pool of unique strings.
--- a/jdk/src/share/classes/java/lang/Throwable.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Thu Apr 21 16:42:06 2011 -0700
@@ -108,7 +108,7 @@
  * @author  unascribed
  * @author  Josh Bloch (Added exception chaining and programmatic access to
  *          stack trace in 1.4.)
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since JDK1.0
  */
 public class Throwable implements Serializable {
--- a/jdk/src/share/classes/java/lang/annotation/Annotation.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java	Thu Apr 21 16:42:06 2011 -0700
@@ -31,9 +31,8 @@
  * an annotation type.  Also note that this interface does not itself
  * define an annotation type.
  *
- * More information about annotation types can be found in <i>The
- * Java&trade; Language Specification, Third Edition</i>, <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6">&sect;9.6</a>.
+ * More information about annotation types can be found in section 9.6 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * @author  Josh Bloch
  * @since   1.5
--- a/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Thu Apr 21 16:42:06 2011 -0700
@@ -36,9 +36,9 @@
  * to transform class files.
  * The transformation occurs before the class is defined by the JVM.
  * <P>
- * Note the term <i>class file</i> is used as defined in the chapter
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#80959">The class File Format</a>
- * of <i>The Java Virtual Machine Specification</i>, to mean a sequence
+ * Note the term <i>class file</i> is used as defined in section 3.1 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>,
+ * to mean a sequence
  * of bytes in class file format, whether or not they reside in a file.
  *
  * @see     java.lang.instrument.Instrumentation
--- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Thu Apr 21 16:42:06 2011 -0700
@@ -434,8 +434,9 @@
      * avoiding these types of issues, is to use a unique package name for the
      * instrumentation classes.
      *
-     * <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a> specifies that a subsequent attempt to resolve a symbolic
+     * <p>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * specifies that a subsequent attempt to resolve a symbolic
      * reference that the Java virtual machine has previously unsuccessfully attempted
      * to resolve always fails with the same error that was thrown as a result of the
      * initial resolution attempt. Consequently, if the JAR file contains an entry
@@ -487,8 +488,9 @@
      * getName()} method on the <code>jarfile</code> and this is provided as the
      * parameter to the <code>appendToClassPathForInstrumentation</code> method.
      *
-     * <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a> specifies that a subsequent attempt to resolve a symbolic
+     * <p>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * specifies that a subsequent attempt to resolve a symbolic
      * reference that the Java virtual machine has previously unsuccessfully attempted
      * to resolve always fails with the same error that was thrown as a result of the
      * initial resolution attempt. Consequently, if the JAR file contains an entry
--- a/jdk/src/share/classes/java/lang/invoke/package-info.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/package-info.java	Thu Apr 21 16:42:06 2011 -0700
@@ -194,8 +194,8 @@
  * Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic}
  * may force class initialization on their first invocation, just like the corresponding bytecodes.
  * <p>
- * The rules of section 5.4.3 of the
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73492">JVM Specification</a>
+ * The rules of section 5.4.3 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>
  * apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle},
  * and {@code CONSTANT_InvokeDynamic} constants,
  * by the execution of {@code invokedynamic} and {@code ldc} instructions.
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Thu Apr 21 16:42:06 2011 -0700
@@ -186,8 +186,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
@@ -229,7 +229,8 @@
      *     parameter types of the underlying method, in declaration order
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the parameter
      *     types of the underlying method refers to a non-existent type
      *     declaration
@@ -273,7 +274,8 @@
      *     thrown by the underlying method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     {@code throws} clause refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if
@@ -468,8 +470,8 @@
      *
      * <p>If the constructor's declaring class is an inner class in a
      * non-static context, the first argument to the constructor needs
-     * to be the enclosing instance; see <i>The Java Language
-     * Specification</i>, section 15.9.3.
+     * to be the enclosing instance; see section 15.9.3 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * <p>If the required access and argument checks succeed and the
      * instantiation will proceed, the constructor's declaring class
@@ -541,7 +543,8 @@
      * constructor; returns {@code false} otherwise.
      *
      * @return true if and only if this constructor is a synthetic
-     * constructor as defined by the Java Language Specification.
+     * constructor as defined by
+     * <cite>The Java&trade; Language Specification</cite>.
      * @since 1.5
      */
     public boolean isSynthetic() {
--- a/jdk/src/share/classes/java/lang/reflect/Field.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java	Thu Apr 21 16:42:06 2011 -0700
@@ -221,8 +221,8 @@
      * @return a {@code Type} object that represents the declared type for
      *     the field represented by this {@code Field} object
      * @throws GenericSignatureFormatError if the generic field
-     *     signature does not conform to the format specified in the Java
-     *     Virtual Machine Specification, 3rd edition
+     *     signature does not conform to the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the generic type
      *     signature of the underlying field refers to a non-existent
      *     type declaration
--- a/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java	Thu Apr 21 16:42:06 2011 -0700
@@ -42,8 +42,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      */
     public TypeVariable<?>[] getTypeParameters();
 }
--- a/jdk/src/share/classes/java/lang/reflect/Method.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Thu Apr 21 16:42:06 2011 -0700
@@ -194,8 +194,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Method>[] getTypeParameters() {
@@ -230,7 +230,8 @@
      *     type of the underlying  method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     return type refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if the
@@ -275,7 +276,8 @@
      *     parameter types of the underlying method, in declaration order
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the parameter
      *     types of the underlying method refers to a non-existent type
      *     declaration
@@ -319,7 +321,8 @@
      *     thrown by the underlying method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     {@code throws} clause refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if
--- a/jdk/src/share/classes/java/lang/reflect/Modifier.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Modifier.java	Thu Apr 21 16:42:06 2011 -0700
@@ -34,14 +34,8 @@
  * constants to decode class and member access modifiers.  The sets of
  * modifiers are represented as integers with distinct bit positions
  * representing different modifiers.  The values for the constants
- * representing the modifiers are taken from <a
- * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The
- * Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification, Second
- * edition</i></a> tables
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">4.1</a>,
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">4.4</a>,
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">4.5</a>, and
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88478">4.7</a>.
+ * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>.
  *
  * @see Class#getModifiers()
  * @see Member#getModifiers()
@@ -214,14 +208,8 @@
      *    public final synchronized strictfp
      * </pre></blockquote>
      * The modifier names are returned in an order consistent with the
-     * suggested modifier orderings given in <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html"><em>The
-     * Java Language Specification, Second Edition</em></a> sections
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#21613">&sect;8.1.1</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78091">&sect;8.3.1</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78188">&sect;8.4.3</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#42018">&sect;8.8.3</a>, and
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#235947">&sect;9.1.1</a>.
+     * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      * The full modifier ordering used by this method is:
      * <blockquote> {@code
      * public protected private abstract static final transient
@@ -269,9 +257,8 @@
     }
 
     /*
-     * Access modifier flag constants from <em>The Java Virtual
-     * Machine Specification, Second Edition</em>, tables 4.1, 4.4,
-     * 4.5, and 4.7.
+     * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
      */
 
     /**
@@ -403,7 +390,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a class.
      *
-     * @jls3 8.1.1 Class Modifiers
+     * @jls 8.1.1 Class Modifiers
      * @since 1.7
      */
     public static int classModifiers() {
@@ -416,7 +403,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to an inteface.
      *
-     * @jls3 9.1.1 Interface Modifiers
+     * @jls 9.1.1 Interface Modifiers
      * @since 1.7
      */
     public static int interfaceModifiers() {
@@ -429,7 +416,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a constructor.
      *
-     * @jls3 8.8.3 Constructor Modifiers
+     * @jls 8.8.3 Constructor Modifiers
      * @since 1.7
      */
     public static int constructorModifiers() {
@@ -442,7 +429,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a method.
      *
-     * @jls3 8.4.3 Method Modifiers
+     * @jls 8.4.3 Method Modifiers
      * @since 1.7
      */
     public static int methodModifiers() {
@@ -456,7 +443,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a field.
      *
-     * @jls3 8.3.1 Field Modifiers
+     * @jls 8.3.1 Field Modifiers
      * @since 1.7
      */
     public static int fieldModifiers() {
--- a/jdk/src/share/classes/java/math/BigDecimal.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/math/BigDecimal.java	Thu Apr 21 16:42:06 2011 -0700
@@ -2905,12 +2905,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code BigInteger}.
-     * This conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code long} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code long} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded.  Note that this
      * conversion can lose information about the precision of the
      * {@code BigDecimal} value.
@@ -2942,13 +2941,12 @@
     }
 
     /**
-     * Converts this {@code BigDecimal} to a {@code long}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code short} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * Converts this {@code BigDecimal} to a {@code long}.
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code short} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
      * "{@code BigInteger}" is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
@@ -3011,13 +3009,12 @@
     }
 
     /**
-     * Converts this {@code BigDecimal} to an {@code int}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code short} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * Converts this {@code BigDecimal} to an {@code int}.
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code short} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
      * "{@code BigInteger}" is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
@@ -3095,12 +3092,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code float}.
-     * This conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this {@code BigDecimal} has too great a
+     * This conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this {@code BigDecimal} has too great a
      * magnitude to represent as a {@code float}, it will be
      * converted to {@link Float#NEGATIVE_INFINITY} or {@link
      * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
@@ -3119,12 +3115,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code double}.
-     * This conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this {@code BigDecimal} has too great a
+     * This conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this {@code BigDecimal} has too great a
      * magnitude represent as a {@code double}, it will be
      * converted to {@link Double#NEGATIVE_INFINITY} or {@link
      * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
--- a/jdk/src/share/classes/java/math/BigInteger.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Thu Apr 21 16:42:06 2011 -0700
@@ -2719,12 +2719,11 @@
 
     /**
      * Converts this BigInteger to an {@code int}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code long} to
-     * {@code int} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger is too big to fit in an
+     * conversion is analogous to a
+     * <i>narrowing primitive conversion</i> from {@code long} to
+     * {@code int} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
      * Note that this conversion can lose information about the
      * overall magnitude of the BigInteger value as well as return a
@@ -2740,12 +2739,11 @@
 
     /**
      * Converts this BigInteger to a {@code long}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code long} to
-     * {@code int} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger is too big to fit in a
+     * conversion is analogous to a
+     * <i>narrowing primitive conversion</i> from {@code long} to
+     * {@code int} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
      * Note that this conversion can lose information about the
      * overall magnitude of the BigInteger value as well as return a
@@ -2763,12 +2761,11 @@
 
     /**
      * Converts this BigInteger to a {@code float}.  This
-     * conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger has too great a magnitude
+     * conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger has too great a magnitude
      * to represent as a {@code float}, it will be converted to
      * {@link Float#NEGATIVE_INFINITY} or {@link
      * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
@@ -2784,12 +2781,11 @@
 
     /**
      * Converts this BigInteger to a {@code double}.  This
-     * conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger has too great a magnitude
+     * conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger has too great a magnitude
      * to represent as a {@code double}, it will be converted to
      * {@link Double#NEGATIVE_INFINITY} or {@link
      * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
--- a/jdk/src/share/classes/java/net/NetworkInterface.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/net/NetworkInterface.java	Thu Apr 21 16:42:06 2011 -0700
@@ -547,13 +547,8 @@
         if (displayName != null) {
             result += " (" + displayName + ")";
         }
-        result += " index: "+index+" addresses:\n";
-        for (Enumeration e = getInetAddresses(); e.hasMoreElements(); ) {
-            InetAddress addr = (InetAddress)e.nextElement();
-            result += addr+";\n";
-        }
         return result;
     }
+
     private static native void init();
-
 }
--- a/jdk/src/share/classes/java/nio/file/FileSystem.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/nio/file/FileSystem.java	Thu Apr 21 16:42:06 2011 -0700
@@ -391,6 +391,13 @@
      *   character is used to separate the subpatterns. Groups cannot be nested.
      *   </p></li>
      *
+     *   <li><p> Leading period<tt>&#47;</tt>dot characters in file name are
+     *   treated as regular characters in match operations. For example,
+     *   the {@code "*"} glob pattern matches file name {@code ".login"}.
+     *   The {@link Files#isHidden} method may be used to test whether a file
+     *   is considered hidden.
+     *   </p></li>
+     *
      *   <li><p> All other characters match themselves in an implementation
      *   dependent manner. This includes characters representing any {@link
      *   FileSystem#getSeparator name-separators}. </p></li>
--- a/jdk/src/share/classes/java/security/SecureClassLoader.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/security/SecureClassLoader.java	Thu Apr 21 16:42:06 2011 -0700
@@ -118,10 +118,8 @@
      *                  and without a trailing ".class" suffix.
      * @param      b    the bytes that make up the class data. The bytes in
      *             positions <code>off</code> through <code>off+len-1</code>
-     *             should have the format of a valid class file as defined
-     *             by the
-     *             <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *             Virtual Machine Specification</a>.
+     *             should have the format of a valid class file as defined by
+     *             <cite>The Java&trade; Virtual Machine Specification</cite>.
      * @param      off  the start offset in <code>b</code> of the class data
      * @param      len  the length of the class data
      * @param      cs   the associated CodeSource, or <code>null</code> if none
@@ -157,9 +155,8 @@
      *                  and without a trailing ".class" suffix.
      * @param      b    the bytes that make up the class data.  The bytes from positions
      *                  <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt>
-     *                  should have the format of a valid class file as defined by the
-     *                  <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *                  Machine Specification</a>.
+     *                  should have the format of a valid class file as defined by
+     *                  <cite>The Java&trade; Virtual Machine Specification</cite>.
      * @param      cs   the associated CodeSource, or <code>null</code> if none
      * @return the <code>Class</code> object created from the data,
      *         and optional CodeSource.
--- a/jdk/src/share/classes/java/security/SignedObject.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/security/SignedObject.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, 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
@@ -249,10 +249,10 @@
      * a stream.
      */
     private void readObject(java.io.ObjectInputStream s)
-         throws java.io.IOException, ClassNotFoundException
-    {
-        s.defaultReadObject();
-        content = content.clone();
-        signature = signature.clone();
+        throws java.io.IOException, ClassNotFoundException {
+            java.io.ObjectInputStream.GetField fields = s.readFields();
+            content = ((byte[])fields.get("content", null)).clone();
+            signature = ((byte[])fields.get("signature", null)).clone();
+            thealgorithm = (String)fields.get("thealgorithm", null);
     }
 }
--- a/jdk/src/share/classes/java/sql/DriverManager.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/sql/DriverManager.java	Thu Apr 21 16:42:06 2011 -0700
@@ -80,7 +80,7 @@
 
 
     // List of registered JDBC drivers
-    private final static CopyOnWriteArrayList<Driver> registeredDrivers = new CopyOnWriteArrayList<Driver>();
+    private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<DriverInfo>();
     private static volatile int loginTimeout = 0;
     private static volatile java.io.PrintWriter logWriter = null;
     private static volatile java.io.PrintStream logStream = null;
@@ -265,22 +265,22 @@
 
         // Walk through the loaded registeredDrivers attempting to locate someone
         // who understands the given URL.
-        for (Driver aDriver : registeredDrivers) {
+        for (DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
-                    if(aDriver.acceptsURL(url)) {
+                    if(aDriver.driver.acceptsURL(url)) {
                         // Success!
-                        println("getDriver returning " + aDriver.getClass().getName());
-                    return (aDriver);
+                        println("getDriver returning " + aDriver.driver.getClass().getName());
+                    return (aDriver.driver);
                     }
 
                 } catch(SQLException sqe) {
                     // Drop through and try the next driver.
                 }
             } else {
-                println("    skipping: " + aDriver.getClass().getName());
+                println("    skipping: " + aDriver.driver.getClass().getName());
             }
 
         }
@@ -305,7 +305,7 @@
 
         /* Register the driver if it has not already been added to our list */
         if(driver != null) {
-            registeredDrivers.addIfAbsent(driver);
+            registeredDrivers.addIfAbsent(new DriverInfo(driver));
         } else {
             // This is for compatibility with the original DriverManager
             throw new NullPointerException();
@@ -333,9 +333,10 @@
         ClassLoader callerCL = DriverManager.getCallerClassLoader();
         println("DriverManager.deregisterDriver: " + driver);
 
-        if(registeredDrivers.contains(driver)) {
+        DriverInfo aDriver = new DriverInfo(driver);
+        if(registeredDrivers.contains(aDriver)) {
             if (isDriverAllowed(driver, callerCL)) {
-                 registeredDrivers.remove(driver);
+                 registeredDrivers.remove(aDriver);
             } else {
                 // If the caller does not have permission to load the driver then
                 // throw a SecurityException.
@@ -363,11 +364,11 @@
         ClassLoader callerCL = DriverManager.getCallerClassLoader();
 
         // Walk through the loaded registeredDrivers.
-        for(Driver aDriver : registeredDrivers) {
+        for(DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
-                result.addElement(aDriver);
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
+                result.addElement(aDriver.driver);
             } else {
                 println("    skipping: " + aDriver.getClass().getName());
             }
@@ -482,8 +483,8 @@
     private static void loadInitialDrivers() {
         String drivers;
         try {
-            drivers = (String)  AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
+                public String run() {
                     return System.getProperty("jdbc.drivers");
                 }
             });
@@ -495,8 +496,8 @@
         // exposed as a java.sql.Driver.class service.
         // ServiceLoader.load() replaces the sun.misc.Providers()
 
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
 
                 ServiceLoader<Driver> loadedDrivers = ServiceLoader.load(Driver.class);
                 Iterator driversIterator = loadedDrivers.iterator();
@@ -569,16 +570,16 @@
         // Remember the first exception that gets raised so we can reraise it.
         SQLException reason = null;
 
-        for(Driver aDriver : registeredDrivers) {
+        for(DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
-                    println("    trying " + aDriver.getClass().getName());
-                    Connection con = aDriver.connect(url, info);
+                    println("    trying " + aDriver.driver.getClass().getName());
+                    Connection con = aDriver.driver.connect(url, info);
                     if (con != null) {
                         // Success!
-                        println("getConnection returning " + aDriver.getClass().getName());
+                        println("getConnection returning " + aDriver.driver.getClass().getName());
                         return (con);
                     }
                 } catch (SQLException ex) {
@@ -607,3 +608,29 @@
     private static native ClassLoader getCallerClassLoader();
 
 }
+
+/*
+ * Wrapper class for registered Drivers in order to not expose Driver.equals()
+ * to avoid the capture of the Driver it being compared to as it might not
+ * normally have access.
+ */
+class DriverInfo {
+
+    final Driver driver;
+    DriverInfo(Driver driver) {
+        this.driver = driver;
+    }
+
+    public boolean equals(Object other) {
+        return (other instanceof DriverInfo)
+                && this.driver == ((DriverInfo) other).driver;
+    }
+
+    public int hashCode() {
+        return driver.hashCode();
+    }
+
+    public String toString() {
+        return ("driver[className="  + driver + "]");
+    }
+}
--- a/jdk/src/share/classes/java/sql/ResultSet.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/sql/ResultSet.java	Thu Apr 21 16:42:06 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
@@ -137,7 +137,7 @@
  * to retrieve the next result from a sequence of multiple results.
  *
  * <P>The number, types and properties of a <code>ResultSet</code>
- * object's columns are provided by the <code>ResulSetMetaData</code>
+ * object's columns are provided by the <code>ResultSetMetaData</code>
  * object returned by the <code>ResultSet.getMetaData</code> method.
  *
  * @see Statement#executeQuery
@@ -422,7 +422,7 @@
      * of this <code>ResultSet</code> object as
      * a stream of ASCII characters. The value can then be read in chunks from the
      * stream. This method is particularly
-     * suitable for retrieving large <char>LONGVARCHAR</char> values.
+     * suitable for retrieving large <code>LONGVARCHAR</code> values.
      * The JDBC driver will
      * do any necessary conversion from the database format into ASCII.
      *
--- a/jdk/src/share/classes/java/sql/SQLPermission.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java	Thu Apr 21 16:42:06 2011 -0700
@@ -116,11 +116,11 @@
 
     /**
      * Creates a new <code>SQLPermission</code> object with the specified name.
-     * The name is the symbolic name of the <code>SQLPermission</code>; currently,
-     * the only name allowed is "setLog".
+     * The name is the symbolic name of the <code>SQLPermission</code>.
      *
      * @param name the name of this <code>SQLPermission</code> object, which must
-         *             be <code>setLog</code>
+     * be either {@code  setLog}, {@code callAbort}, {@code setSyncFactory},
+     *  or {@code setNetworkTimeout}
      * @throws NullPointerException if <code>name</code> is <code>null</code>.
      * @throws IllegalArgumentException if <code>name</code> is empty.
 
@@ -134,10 +134,11 @@
      * Creates a new <code>SQLPermission</code> object with the specified name.
      * The name is the symbolic name of the <code>SQLPermission</code>; the
      * actions <code>String</code> is currently unused and should be
-         * <code>null</code>.
+     * <code>null</code>.
      *
      * @param name the name of this <code>SQLPermission</code> object, which must
-     *             be <code>setLog</code>
+     * be either {@code  setLog}, {@code callAbort}, {@code setSyncFactory},
+     *  or {@code setNetworkTimeout}
      * @param actions should be <code>null</code>
      * @throws NullPointerException if <code>name</code> is <code>null</code>.
      * @throws IllegalArgumentException if <code>name</code> is empty.
--- a/jdk/src/share/classes/java/sql/Timestamp.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/sql/Timestamp.java	Thu Apr 21 16:42:06 2011 -0700
@@ -54,7 +54,7 @@
  * As a result, the <code>Timestamp.equals(Object)</code>
  * method is not symmetric with respect to the
  * <code>java.util.Date.equals(Object)</code>
- * method.  Also, the <code>hashcode</code> method uses the underlying
+ * method.  Also, the <code>hashCode</code> method uses the underlying
  * <code>java.util.Date</code>
  * implementation and therefore does not include nanos in its computation.
  * <P>
@@ -515,6 +515,18 @@
       }
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * The {@code hashCode} method uses the underlying {@code java.util.Date}
+     * implementation and therefore does not include nanos in its computation.
+     *
+     */
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
     static final long serialVersionUID = 2745179027874758501L;
 
 }
--- a/jdk/src/share/classes/java/util/AbstractQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/AbstractQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/AbstractSet.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/AbstractSet.java	Thu Apr 21 16:42:06 2011 -0700
@@ -156,9 +156,11 @@
      * @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
      *         is not supported by this set
      * @throws ClassCastException if the class of an element of this set
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this set contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
--- a/jdk/src/share/classes/java/util/ArrayDeque.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java	Thu Apr 21 16:42:06 2011 -0700
@@ -29,7 +29,7 @@
  * file:
  *
  * Written by Josh Bloch of Google Inc. and released to the public domain,
- * as explained at http://creativecommons.org/licenses/publicdomain.
+ * as explained at http://creativecommons.org/publicdomain/zero/1.0/.
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/ArrayList.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/ArrayList.java	Thu Apr 21 16:42:06 2011 -0700
@@ -628,9 +628,11 @@
      * @param c collection containing elements to be removed from this list
      * @return {@code true} if this list changed as a result of the call
      * @throws ClassCastException if the class of an element of this list
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this list contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see Collection#contains(Object)
      */
@@ -646,9 +648,11 @@
      * @param c collection containing elements to be retained in this list
      * @return {@code true} if this list changed as a result of the call
      * @throws ClassCastException if the class of an element of this list
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this list contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see Collection#contains(Object)
      */
--- a/jdk/src/share/classes/java/util/Collection.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Collection.java	Thu Apr 21 16:42:06 2011 -0700
@@ -60,7 +60,8 @@
  * but is not required to, throw the exception if the collection to be added
  * is empty.
  *
- * <p>Some collection implementations have restrictions on the elements that
+ * <p><a name="optional-restrictions"/>
+ * Some collection implementations have restrictions on the elements that
  * they may contain.  For example, some implementations prohibit null elements,
  * and some have restrictions on the types of their elements.  Attempting to
  * add an ineligible element throws an unchecked exception, typically
@@ -152,9 +153,11 @@
      * @return <tt>true</tt> if this collection contains the specified
      *         element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this collection (optional)
+     *         is incompatible with this collection
+     *         (<a href="#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         collection does not permit null elements (optional)
+     *         collection does not permit null elements
+     *         (<a href="#optional-restrictions">optional</a>)
      */
     boolean contains(Object o);
 
@@ -279,9 +282,11 @@
      * @param o element to be removed from this collection, if present
      * @return <tt>true</tt> if an element was removed as a result of this call
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this collection (optional)
+     *         is incompatible with this collection
+     *         (<a href="#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         collection does not permit null elements (optional)
+     *         collection does not permit null elements
+     *         (<a href="#optional-restrictions">optional</a>)
      * @throws UnsupportedOperationException if the <tt>remove</tt> operation
      *         is not supported by this collection
      */
@@ -299,10 +304,13 @@
      *         in the specified collection
      * @throws ClassCastException if the types of one or more elements
      *         in the specified collection are incompatible with this
-     *         collection (optional)
+     *         collection
+     *         (<a href="#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified collection contains one
      *         or more null elements and this collection does not permit null
-     *         elements (optional), or if the specified collection is null
+     *         elements
+     *         (<a href="#optional-restrictions">optional</a>),
+     *         or if the specified collection is null.
      * @see    #contains(Object)
      */
     boolean containsAll(Collection<?> c);
@@ -346,10 +354,13 @@
      *         is not supported by this collection
      * @throws ClassCastException if the types of one or more elements
      *         in this collection are incompatible with the specified
-     *         collection (optional)
+     *         collection
+     *         (<a href="#optional-restrictions">optional</a>)
      * @throws NullPointerException if this collection contains one or more
      *         null elements and the specified collection does not support
-     *         null elements (optional), or if the specified collection is null
+     *         null elements
+     *         (<a href="#optional-restrictions">optional</a>),
+     *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
      */
@@ -367,10 +378,13 @@
      *         is not supported by this collection
      * @throws ClassCastException if the types of one or more elements
      *         in this collection are incompatible with the specified
-     *         collection (optional)
+     *         collection
+     *         (<a href="#optional-restrictions">optional</a>)
      * @throws NullPointerException if this collection contains one or more
      *         null elements and the specified collection does not permit null
-     *         elements (optional), or if the specified collection is null
+     *         elements
+     *         (<a href="#optional-restrictions">optional</a>),
+     *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
      */
--- a/jdk/src/share/classes/java/util/Collections.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Collections.java	Thu Apr 21 16:42:06 2011 -0700
@@ -3746,9 +3746,10 @@
      * @throws NullPointerException if either collection is {@code null}.
      * @throws NullPointerException if one collection contains a {@code null}
      * element and {@code null} is not an eligible element for the other collection.
-     * (optional)
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws ClassCastException if one collection contains an element that is
-     * of a type which is ineligible for the other collection. (optional)
+     * of a type which is ineligible for the other collection.
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @since 1.5
      */
     public static boolean disjoint(Collection<?> c1, Collection<?> c2) {
--- a/jdk/src/share/classes/java/util/Deque.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Deque.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
@@ -351,9 +351,11 @@
      * @param o element to be removed from this deque, if present
      * @return <tt>true</tt> if an element was removed as a result of this call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
+     *         is incompatible with this deque
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         deque does not permit null elements (optional)
+     *         deque does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean removeFirstOccurrence(Object o);
 
@@ -369,9 +371,11 @@
      * @param o element to be removed from this deque, if present
      * @return <tt>true</tt> if an element was removed as a result of this call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
+     *         is incompatible with this deque
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         deque does not permit null elements (optional)
+     *         deque does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean removeLastOccurrence(Object o);
 
@@ -527,9 +531,11 @@
      * @param o element to be removed from this deque, if present
      * @return <tt>true</tt> if an element was removed as a result of this call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
+     *         is incompatible with this deque
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         deque does not permit null elements (optional)
+     *         deque does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean remove(Object o);
 
@@ -542,9 +548,11 @@
      * @param o element whose presence in this deque is to be tested
      * @return <tt>true</tt> if this deque contains the specified element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this deque (optional)
+     *         is incompatible with this deque
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         deque does not permit null elements (optional)
+     *         deque does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean contains(Object o);
 
--- a/jdk/src/share/classes/java/util/EnumMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/EnumMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -106,7 +106,7 @@
     /**
      * Distinguished non-null value for representing null values.
      */
-    private static final Object NULL = new Object();
+    private static final Object NULL = new Integer(0);
 
     private Object maskNull(Object value) {
         return (value == null ? NULL : value);
@@ -116,7 +116,7 @@
         return (V) (value == NULL ? null : value);
     }
 
-    private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
+    private static final Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
 
     /**
      * Creates an empty enum map with the specified key type.
@@ -464,6 +464,7 @@
         public Iterator<Map.Entry<K,V>> iterator() {
             return new EntryIterator();
         }
+
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
@@ -552,70 +553,82 @@
         }
     }
 
-    /**
-     * Since we don't use Entry objects, we use the Iterator itself as entry.
-     */
-    private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>>
-        implements Map.Entry<K,V>
-    {
+    private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>> {
+        private Entry lastReturnedEntry = null;
+
         public Map.Entry<K,V> next() {
             if (!hasNext())
                 throw new NoSuchElementException();
-            lastReturnedIndex = index++;
-            return this;
-        }
-
-        public K getKey() {
-            checkLastReturnedIndexForEntryUse();
-            return keyUniverse[lastReturnedIndex];
+            lastReturnedEntry = new Entry(index++);
+            return lastReturnedEntry;
         }
 
-        public V getValue() {
-            checkLastReturnedIndexForEntryUse();
-            return unmaskNull(vals[lastReturnedIndex]);
-        }
-
-        public V setValue(V value) {
-            checkLastReturnedIndexForEntryUse();
-            V oldValue = unmaskNull(vals[lastReturnedIndex]);
-            vals[lastReturnedIndex] = maskNull(value);
-            return oldValue;
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return o == this;
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
+
+            private Entry(int index) {
+                this.index = index;
+            }
+
+            public K getKey() {
+                checkIndexForEntryUse();
+                return keyUniverse[index];
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            V ourValue = unmaskNull(vals[lastReturnedIndex]);
-            Object hisValue = e.getValue();
-            return e.getKey() == keyUniverse[lastReturnedIndex] &&
-                (ourValue == hisValue ||
-                 (ourValue != null && ourValue.equals(hisValue)));
-        }
+            public V getValue() {
+                checkIndexForEntryUse();
+                return unmaskNull(vals[index]);
+            }
+
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = unmaskNull(vals[index]);
+                vals[index] = maskNull(value);
+                return oldValue;
+            }
+
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return o == this;
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+                if (!(o instanceof Map.Entry))
+                    return false;
 
-            Object value = vals[lastReturnedIndex];
-            return keyUniverse[lastReturnedIndex].hashCode()
-                ^ (value == NULL ? 0 : value.hashCode());
-        }
+                Map.Entry e = (Map.Entry)o;
+                V ourValue = unmaskNull(vals[index]);
+                Object hisValue = e.getValue();
+                return (e.getKey() == keyUniverse[index] &&
+                        (ourValue == hisValue ||
+                         (ourValue != null && ourValue.equals(hisValue))));
+            }
+
+            public int hashCode() {
+                if (index < 0)
+                    return super.hashCode();
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
+                return entryHashCode(index);
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
 
-            return keyUniverse[lastReturnedIndex] + "="
-                + unmaskNull(vals[lastReturnedIndex]);
-        }
+                return keyUniverse[index] + "="
+                    + unmaskNull(vals[index]);
+            }
 
-        private void checkLastReturnedIndexForEntryUse() {
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
@@ -631,10 +644,35 @@
      * @return <tt>true</tt> if the specified object is equal to this map
      */
     public boolean equals(Object o) {
-        if (!(o instanceof EnumMap))
-            return super.equals(o);
+        if (this == o)
+            return true;
+        if (o instanceof EnumMap)
+            return equals((EnumMap)o);
+        if (!(o instanceof Map))
+            return false;
+
+        Map<K,V> m = (Map<K,V>)o;
+        if (size != m.size())
+            return false;
 
-        EnumMap em = (EnumMap)o;
+        for (int i = 0; i < keyUniverse.length; i++) {
+            if (null != vals[i]) {
+                K key = keyUniverse[i];
+                V value = unmaskNull(vals[i]);
+                if (null == value) {
+                    if (!((null == m.get(key)) && m.containsKey(key)))
+                       return false;
+                } else {
+                   if (!value.equals(m.get(key)))
+                      return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    private boolean equals(EnumMap em) {
         if (em.keyType != keyType)
             return size == 0 && em.size == 0;
 
@@ -650,6 +688,26 @@
     }
 
     /**
+     * Returns the hash code value for this map.  The hash code of a map is
+     * defined to be the sum of the hash codes of each entry in the map.
+     */
+    public int hashCode() {
+        int h = 0;
+
+        for (int i = 0; i < keyUniverse.length; i++) {
+            if (null != vals[i]) {
+                h += entryHashCode(i);
+            }
+        }
+
+        return h;
+    }
+
+    private int entryHashCode(int index) {
+        return (keyUniverse[index].hashCode() ^ vals[index].hashCode());
+    }
+
+    /**
      * Returns a shallow copy of this enum map.  (The values themselves
      * are not cloned.
      *
@@ -705,9 +763,13 @@
         s.writeInt(size);
 
         // Write out keys and values (alternating)
-        for (Map.Entry<K,V> e :  entrySet()) {
-            s.writeObject(e.getKey());
-            s.writeObject(e.getValue());
+        int entriesToBeWritten = size;
+        for (int i = 0; entriesToBeWritten > 0; i++) {
+            if (null != vals[i]) {
+                s.writeObject(keyUniverse[i]);
+                s.writeObject(unmaskNull(vals[i]));
+                entriesToBeWritten--;
+            }
         }
     }
 
--- a/jdk/src/share/classes/java/util/Formatter.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Formatter.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1818,9 +1818,9 @@
  * </pre></blockquote>
  *
  * <p> The maximum number of arguments is limited by the maximum dimension of a
- * Java array as defined by the <a
- * href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
- * Specification</a>.  If the argument index is does not correspond to an
+ * Java array as defined by
+ * <cite>The Java&trade; Virtual Machine Specification</cite>.
+ * If the argument index is does not correspond to an
  * available argument, then a {@link MissingFormatArgumentException} is thrown.
  *
  * <p> If there are more arguments than format specifiers, the extra arguments
@@ -2403,8 +2403,7 @@
      *         string.  If there are more arguments than format specifiers, the
      *         extra arguments are ignored.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @throws  IllegalFormatException
      *          If a format string contains an illegal syntax, a format
@@ -2443,8 +2442,7 @@
      *         string.  If there are more arguments than format specifiers, the
      *         extra arguments are ignored.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @throws  IllegalFormatException
      *          If a format string contains an illegal syntax, a format
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Thu Apr 21 16:42:06 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
@@ -829,71 +829,82 @@
         }
     }
 
-    /**
-     * Since we don't use Entry objects, we use the Iterator
-     * itself as an entry.
-     */
     private class EntryIterator
         extends IdentityHashMapIterator<Map.Entry<K,V>>
-        implements Map.Entry<K,V>
     {
+        private Entry lastReturnedEntry = null;
+
         public Map.Entry<K,V> next() {
-            nextIndex();
-            return this;
+            lastReturnedEntry = new Entry(nextIndex());
+            return lastReturnedEntry;
         }
 
-        public K getKey() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-
-            return (K) unmaskNull(traversalTable[lastReturnedIndex]);
-        }
-
-        public V getValue() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-
-            return (V) traversalTable[lastReturnedIndex+1];
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public V setValue(V value) {
-            // It would be mean-spirited to proceed here if remove() called
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-            V oldValue = (V) traversalTable[lastReturnedIndex+1];
-            traversalTable[lastReturnedIndex+1] = value;
-            // if shadowing, force into main table
-            if (traversalTable != IdentityHashMap.this.table)
-                put((K) traversalTable[lastReturnedIndex], value);
-            return oldValue;
-        }
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
+
+            private Entry(int index) {
+                this.index = index;
+            }
+
+            public K getKey() {
+                checkIndexForEntryUse();
+                return (K) unmaskNull(traversalTable[index]);
+            }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return super.equals(o);
+            public V getValue() {
+                checkIndexForEntryUse();
+                return (V) traversalTable[index+1];
+            }
+
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = (V) traversalTable[index+1];
+                traversalTable[index+1] = value;
+                // if shadowing, force into main table
+                if (traversalTable != IdentityHashMap.this.table)
+                    put((K) traversalTable[index], value);
+                return oldValue;
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            return e.getKey()   == getKey() &&
-                   e.getValue() == getValue();
-        }
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return super.equals(o);
+
+                if (!(o instanceof Map.Entry))
+                    return false;
+                Map.Entry e = (Map.Entry)o;
+                return (e.getKey() == unmaskNull(traversalTable[index]) &&
+                       e.getValue() == traversalTable[index+1]);
+            }
+
+            public int hashCode() {
+                if (lastReturnedIndex < 0)
+                    return super.hashCode();
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+                return (System.identityHashCode(unmaskNull(traversalTable[index])) ^
+                       System.identityHashCode(traversalTable[index+1]));
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
 
-            return System.identityHashCode(getKey()) ^
-                   System.identityHashCode(getValue());
-        }
+                return (unmaskNull(traversalTable[index]) + "="
+                        + traversalTable[index+1]);
+            }
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
-
-            return getKey() + "=" + getValue();
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
--- a/jdk/src/share/classes/java/util/List.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/List.java	Thu Apr 21 16:42:06 2011 -0700
@@ -134,9 +134,11 @@
      * @param o element whose presence in this list is to be tested
      * @return <tt>true</tt> if this list contains the specified element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this list (optional)
+     *         is incompatible with this list
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         list does not permit null elements (optional)
+     *         list does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean contains(Object o);
 
@@ -245,9 +247,11 @@
      * @param o element to be removed from this list, if present
      * @return <tt>true</tt> if this list contained the specified element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this list (optional)
+     *         is incompatible with this list
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         list does not permit null elements (optional)
+     *         list does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws UnsupportedOperationException if the <tt>remove</tt> operation
      *         is not supported by this list
      */
@@ -265,10 +269,13 @@
      *         specified collection
      * @throws ClassCastException if the types of one or more elements
      *         in the specified collection are incompatible with this
-     *         list (optional)
+     *         list
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified collection contains one
      *         or more null elements and this list does not permit null
-     *         elements (optional), or if the specified collection is null
+     *         elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>),
+     *         or if the specified collection is null
      * @see #contains(Object)
      */
     boolean containsAll(Collection<?> c);
@@ -334,9 +341,11 @@
      * @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
      *         is not supported by this list
      * @throws ClassCastException if the class of an element of this list
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this list contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
@@ -354,9 +363,11 @@
      * @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
      *         is not supported by this list
      * @throws ClassCastException if the class of an element of this list
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this list contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
@@ -493,9 +504,11 @@
      * @return the index of the first occurrence of the specified element in
      *         this list, or -1 if this list does not contain the element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this list (optional)
+     *         is incompatible with this list
+     *         (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         list does not permit null elements (optional)
+     *         list does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     int indexOf(Object o);
 
@@ -510,9 +523,11 @@
      * @return the index of the last occurrence of the specified element in
      *         this list, or -1 if this list does not contain the element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this list (optional)
+     *         is incompatible with this list
+     *         (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         list does not permit null elements (optional)
+     *         list does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     int lastIndexOf(Object o);
 
--- a/jdk/src/share/classes/java/util/ListIterator.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/ListIterator.java	Thu Apr 21 16:42:06 2011 -0700
@@ -173,9 +173,9 @@
 
     /**
      * Inserts the specified element into the list (optional operation).
-     * The element is inserted immediately before the next element that
-     * would be returned by {@link #next}, if any, and after the next
-     * element that would be returned by {@link #previous}, if any.  (If the
+     * The element is inserted immediately before the element that
+     * would be returned by {@link #next}, if any, and after the element
+     * that would be returned by {@link #previous}, if any.  (If the
      * list contains no elements, the new element becomes the sole element
      * on the list.)  The new element is inserted before the implicit
      * cursor: a subsequent call to {@code next} would be unaffected, and a
--- a/jdk/src/share/classes/java/util/Map.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Map.java	Thu Apr 21 16:42:06 2011 -0700
@@ -144,9 +144,11 @@
      * @return <tt>true</tt> if this map contains a mapping for the specified
      *         key
      * @throws ClassCastException if the key is of an inappropriate type for
-     *         this map (optional)
+     *         this map
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified key is null and this map
-     *         does not permit null keys (optional)
+     *         does not permit null keys
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean containsKey(Object key);
 
@@ -162,9 +164,11 @@
      * @return <tt>true</tt> if this map maps one or more keys to the
      *         specified value
      * @throws ClassCastException if the value is of an inappropriate type for
-     *         this map (optional)
+     *         this map
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified value is null and this
-     *         map does not permit null values (optional)
+     *         map does not permit null values
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean containsValue(Object value);
 
@@ -187,9 +191,11 @@
      * @return the value to which the specified key is mapped, or
      *         {@code null} if this map contains no mapping for the key
      * @throws ClassCastException if the key is of an inappropriate type for
-     *         this map (optional)
+     *         this map
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified key is null and this map
-     *         does not permit null keys (optional)
+     *         does not permit null keys
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     V get(Object key);
 
@@ -245,9 +251,11 @@
      * @throws UnsupportedOperationException if the <tt>remove</tt> operation
      *         is not supported by this map
      * @throws ClassCastException if the key is of an inappropriate type for
-     *         this map (optional)
+     *         this map
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified key is null and this
-     *         map does not permit null keys (optional)
+     *         map does not permit null keys
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     V remove(Object key);
 
@@ -466,4 +474,5 @@
      * @see #equals(Object)
      */
     int hashCode();
+
 }
--- a/jdk/src/share/classes/java/util/NavigableMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/NavigableMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of JCP
  * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/NavigableSet.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/NavigableSet.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of JCP
  * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/Properties.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java	Thu Apr 21 16:42:06 2011 -0700
@@ -68,8 +68,9 @@
  * methods work the same way as the load(Reader)/store(Writer, String) pair, except
  * the input/output stream is encoded in ISO 8859-1 character encoding.
  * Characters that cannot be directly represented in this encoding can be written using
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>
- * ; only a single 'u' character is allowed in an escape
+ * Unicode escapes as defined in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>;
+ * only a single 'u' character is allowed in an escape
  * sequence. The native2ascii tool can be used to convert property files to and
  * from other character encodings.
  *
@@ -272,11 +273,8 @@
      * <a name="unicodeescapes"></a>
      * Characters in keys and elements can be represented in escape
      * sequences similar to those used for character and string literals
-     * (see <a
-     * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">&sect;3.3</a>
-     * and <a
-     * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6">&sect;3.10.6</a>
-     * of the <i>Java Language Specification</i>).
+     * (see sections 3.3 and 3.10.6 of
+     * <cite>The Java&trade; Language Specification</cite>).
      *
      * The differences from the character escape sequences and Unicode
      * escapes used for characters and strings are:
@@ -326,8 +324,9 @@
      * {@link #load(java.io.Reader) load(Reader)} and is assumed to use
      * the ISO 8859-1 character encoding; that is each byte is one Latin1
      * character. Characters not in Latin1, and certain special characters,
-     * are represented in keys and elements using
-     * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>.
+     * are represented in keys and elements using Unicode escapes as defined in
+     * section 3.3 of
+     * <cite>The Java&trade; Language Specification</cite>.
      * <p>
      * The specified stream remains open after this method returns.
      *
--- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java	Thu Apr 21 16:42:06 2011 -0700
@@ -104,8 +104,9 @@
  * from an InputStream or a Reader, which represents a property file.
  * Constructing a PropertyResourceBundle instance from an InputStream requires
  * that the input stream be encoded in ISO-8859-1.  In that case, characters
- * that cannot be represented in ISO-8859-1 encoding must be represented by
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode Escapes</a>,
+ * that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes
+ * as defined in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>
  * whereas the other constructor which takes a Reader does not have that limitation.
  *
  * @see ResourceBundle
--- a/jdk/src/share/classes/java/util/Queue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Queue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/Set.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Set.java	Thu Apr 21 16:42:06 2011 -0700
@@ -110,9 +110,11 @@
      * @param o element whose presence in this set is to be tested
      * @return <tt>true</tt> if this set contains the specified element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this set (optional)
+     *         is incompatible with this set
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         set does not permit null elements (optional)
+     *         set does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      */
     boolean contains(Object o);
 
@@ -236,9 +238,11 @@
      * @param o object to be removed from this set, if present
      * @return <tt>true</tt> if this set contained the specified element
      * @throws ClassCastException if the type of the specified element
-     *         is incompatible with this set (optional)
+     *         is incompatible with this set
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified element is null and this
-     *         set does not permit null elements (optional)
+     *         set does not permit null elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws UnsupportedOperationException if the <tt>remove</tt> operation
      *         is not supported by this set
      */
@@ -257,10 +261,13 @@
      *         specified collection
      * @throws ClassCastException if the types of one or more elements
      *         in the specified collection are incompatible with this
-     *         set (optional)
+     *         set
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified collection contains one
      *         or more null elements and this set does not permit null
-     *         elements (optional), or if the specified collection is null
+     *         elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>),
+     *         or if the specified collection is null
      * @see    #contains(Object)
      */
     boolean containsAll(Collection<?> c);
@@ -302,9 +309,11 @@
      * @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
      *         is not supported by this set
      * @throws ClassCastException if the class of an element of this set
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this set contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      */
@@ -322,9 +331,11 @@
      * @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
      *         is not supported by this set
      * @throws ClassCastException if the class of an element of this set
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this set contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      * @see #contains(Object)
--- a/jdk/src/share/classes/java/util/Vector.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/Vector.java	Thu Apr 21 16:42:06 2011 -0700
@@ -893,10 +893,13 @@
      * @return true if this Vector changed as a result of the call
      * @throws ClassCastException if the types of one or more elements
      *         in this vector are incompatible with the specified
-     *         collection (optional)
+     *         collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this vector contains one or more null
      *         elements and the specified collection does not support null
-     *         elements (optional), or if the specified collection is null
+     *         elements
+     * (<a href="Collection.html#optional-restrictions">optional</a>),
+     *         or if the specified collection is null
      * @since 1.2
      */
     public synchronized boolean removeAll(Collection<?> c) {
@@ -913,10 +916,13 @@
      * @return true if this Vector changed as a result of the call
      * @throws ClassCastException if the types of one or more elements
      *         in this vector are incompatible with the specified
-     *         collection (optional)
+     *         collection
+     * (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this vector contains one or more null
      *         elements and the specified collection does not support null
-     *         elements (optional), or if the specified collection is null
+     *         elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>),
+     *         or if the specified collection is null
      * @since 1.2
      */
     public synchronized boolean retainAll(Collection<?> c) {
--- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -400,8 +400,10 @@
      * @param o element to be removed from this deque, if present
      * @return <tt>true</tt> if an element was removed as a result of this call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
-     * @throws NullPointerException if the specified element is null (optional)
+     *         is incompatible with this deque
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
+     * @throws NullPointerException if the specified element is null
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     boolean removeFirstOccurrence(Object o);
 
@@ -416,8 +418,10 @@
      * @param o element to be removed from this deque, if present
      * @return <tt>true</tt> if an element was removed as a result of this call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
-     * @throws NullPointerException if the specified element is null (optional)
+     *         is incompatible with this deque
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
+     * @throws NullPointerException if the specified element is null
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     boolean removeLastOccurrence(Object o);
 
@@ -591,8 +595,10 @@
      * @param o element to be removed from this deque, if present
      * @return <tt>true</tt> if this deque changed as a result of the call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
-     * @throws NullPointerException if the specified element is null (optional)
+     *         is incompatible with this deque
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
+     * @throws NullPointerException if the specified element is null
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     boolean remove(Object o);
 
@@ -604,8 +610,10 @@
      * @param o object to be checked for containment in this deque
      * @return <tt>true</tt> if this deque contains the specified element
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this deque (optional)
-     * @throws NullPointerException if the specified element is null (optional)
+     *         is incompatible with this deque
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
+     * @throws NullPointerException if the specified element is null
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     public boolean contains(Object o);
 
--- a/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -303,8 +303,10 @@
      * @param o element to be removed from this queue, if present
      * @return <tt>true</tt> if this queue changed as a result of the call
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this queue (optional)
-     * @throws NullPointerException if the specified element is null (optional)
+     *         is incompatible with this queue
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
+     * @throws NullPointerException if the specified element is null
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     boolean remove(Object o);
 
@@ -316,8 +318,10 @@
      * @param o object to be checked for containment in this queue
      * @return <tt>true</tt> if this queue contains the specified element
      * @throws ClassCastException if the class of the specified element
-     *         is incompatible with this queue (optional)
-     * @throws NullPointerException if the specified element is null (optional)
+     *         is incompatible with this queue
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
+     * @throws NullPointerException if the specified element is null
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     public boolean contains(Object o);
 
--- a/jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Callable.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Callable.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CancellationException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CancellationException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CompletionService.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CompletionService.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -105,7 +105,25 @@
 
     /*
      * The basic strategy is to subdivide the table among Segments,
-     * each of which itself is a concurrently readable hash table.
+     * each of which itself is a concurrently readable hash table.  To
+     * reduce footprint, all but one segments are constructed only
+     * when first needed (see ensureSegment). To maintain visibility
+     * in the presence of lazy construction, accesses to segments as
+     * well as elements of segment's table must use volatile access,
+     * which is done via Unsafe within methods segmentAt etc
+     * below. These provide the functionality of AtomicReferenceArrays
+     * but reduce the levels of indirection. Additionally,
+     * volatile-writes of table elements and entry "next" fields
+     * within locked operations use the cheaper "lazySet" forms of
+     * writes (via putOrderedObject) because these writes are always
+     * followed by lock releases that maintain sequential consistency
+     * of table updates.
+     *
+     * Historical note: The previous version of this class relied
+     * heavily on "final" fields, which avoided some volatile reads at
+     * the expense of a large initial footprint.  Some remnants of
+     * that design (including forced construction of segment 0) exist
+     * to ensure serialization compatibility.
      */
 
     /* ---------------- Constants -------------- */
@@ -137,8 +155,15 @@
     static final int MAXIMUM_CAPACITY = 1 << 30;
 
     /**
+     * The minimum capacity for per-segment tables.  Must be a power
+     * of two, at least two to avoid immediate resizing on next use
+     * after lazy construction.
+     */
+    static final int MIN_SEGMENT_TABLE_CAPACITY = 2;
+
+    /**
      * The maximum number of segments to allow; used to bound
-     * constructor arguments.
+     * constructor arguments. Must be power of two less than 1 << 24.
      */
     static final int MAX_SEGMENTS = 1 << 16; // slightly conservative
 
@@ -164,7 +189,7 @@
     final int segmentShift;
 
     /**
-     * The segments, each of which is a specialized hash table
+     * The segments, each of which is a specialized hash table.
      */
     final Segment<K,V>[] segments;
 
@@ -172,7 +197,65 @@
     transient Set<Map.Entry<K,V>> entrySet;
     transient Collection<V> values;
 
-    /* ---------------- Small Utilities -------------- */
+    /**
+     * ConcurrentHashMap list entry. Note that this is never exported
+     * out as a user-visible Map.Entry.
+     */
+    static final class HashEntry<K,V> {
+        final int hash;
+        final K key;
+        volatile V value;
+        volatile HashEntry<K,V> next;
+
+        HashEntry(int hash, K key, V value, HashEntry<K,V> next) {
+            this.hash = hash;
+            this.key = key;
+            this.value = value;
+            this.next = next;
+        }
+
+        /**
+         * Sets next field with volatile write semantics.  (See above
+         * about use of putOrderedObject.)
+         */
+        final void setNext(HashEntry<K,V> n) {
+            UNSAFE.putOrderedObject(this, nextOffset, n);
+        }
+
+        // Unsafe mechanics
+        static final sun.misc.Unsafe UNSAFE;
+        static final long nextOffset;
+        static {
+            try {
+                UNSAFE = sun.misc.Unsafe.getUnsafe();
+                Class k = HashEntry.class;
+                nextOffset = UNSAFE.objectFieldOffset
+                    (k.getDeclaredField("next"));
+            } catch (Exception e) {
+                throw new Error(e);
+            }
+        }
+    }
+
+    /**
+     * Gets the ith element of given table (if nonnull) with volatile
+     * read semantics.
+     */
+    @SuppressWarnings("unchecked")
+    static final <K,V> HashEntry<K,V> entryAt(HashEntry<K,V>[] tab, int i) {
+        return (tab == null) ? null :
+            (HashEntry<K,V>) UNSAFE.getObjectVolatile
+            (tab, ((long)i << TSHIFT) + TBASE);
+    }
+
+    /**
+     * Sets the ith element of given table, with volatile write
+     * semantics. (See above about use of putOrderedObject.)
+     */
+    static final <K,V> void setEntryAt(HashEntry<K,V>[] tab, int i,
+                                       HashEntry<K,V> e) {
+        UNSAFE.putOrderedObject(tab, ((long)i << TSHIFT) + TBASE, e);
+    }
 
     /**
      * Applies a supplemental hash function to a given hashCode, which
@@ -193,104 +276,67 @@
     }
 
     /**
-     * Returns the segment that should be used for key with given hash
-     * @param hash the hash code for the key
-     * @return the segment
-     */
-    final Segment<K,V> segmentFor(int hash) {
-        return segments[(hash >>> segmentShift) & segmentMask];
-    }
-
-    /* ---------------- Inner Classes -------------- */
-
-    /**
-     * ConcurrentHashMap list entry. Note that this is never exported
-     * out as a user-visible Map.Entry.
-     *
-     * Because the value field is volatile, not final, it is legal wrt
-     * the Java Memory Model for an unsynchronized reader to see null
-     * instead of initial value when read via a data race.  Although a
-     * reordering leading to this is not likely to ever actually
-     * occur, the Segment.readValueUnderLock method is used as a
-     * backup in case a null (pre-initialized) value is ever seen in
-     * an unsynchronized access method.
-     */
-    static final class HashEntry<K,V> {
-        final K key;
-        final int hash;
-        volatile V value;
-        final HashEntry<K,V> next;
-
-        HashEntry(K key, int hash, HashEntry<K,V> next, V value) {
-            this.key = key;
-            this.hash = hash;
-            this.next = next;
-            this.value = value;
-        }
-
-        @SuppressWarnings("unchecked")
-        static final <K,V> HashEntry<K,V>[] newArray(int i) {
-            return new HashEntry[i];
-        }
-    }
-
-    /**
      * Segments are specialized versions of hash tables.  This
      * subclasses from ReentrantLock opportunistically, just to
      * simplify some locking and avoid separate construction.
      */
     static final class Segment<K,V> extends ReentrantLock implements Serializable {
         /*
-         * Segments maintain a table of entry lists that are ALWAYS
-         * kept in a consistent state, so can be read without locking.
-         * Next fields of nodes are immutable (final).  All list
-         * additions are performed at the front of each bin. This
-         * makes it easy to check changes, and also fast to traverse.
-         * When nodes would otherwise be changed, new nodes are
-         * created to replace them. This works well for hash tables
-         * since the bin lists tend to be short. (The average length
-         * is less than two for the default load factor threshold.)
+         * Segments maintain a table of entry lists that are always
+         * kept in a consistent state, so can be read (via volatile
+         * reads of segments and tables) without locking.  This
+         * requires replicating nodes when necessary during table
+         * resizing, so the old lists can be traversed by readers
+         * still using old version of table.
          *
-         * Read operations can thus proceed without locking, but rely
-         * on selected uses of volatiles to ensure that completed
-         * write operations performed by other threads are
-         * noticed. For most purposes, the "count" field, tracking the
-         * number of elements, serves as that volatile variable
-         * ensuring visibility.  This is convenient because this field
-         * needs to be read in many read operations anyway:
-         *
-         *   - All (unsynchronized) read operations must first read the
-         *     "count" field, and should not look at table entries if
-         *     it is 0.
-         *
-         *   - All (synchronized) write operations should write to
-         *     the "count" field after structurally changing any bin.
-         *     The operations must not take any action that could even
-         *     momentarily cause a concurrent read operation to see
-         *     inconsistent data. This is made easier by the nature of
-         *     the read operations in Map. For example, no operation
-         *     can reveal that the table has grown but the threshold
-         *     has not yet been updated, so there are no atomicity
-         *     requirements for this with respect to reads.
-         *
-         * As a guide, all critical volatile reads and writes to the
-         * count field are marked in code comments.
+         * This class defines only mutative methods requiring locking.
+         * Except as noted, the methods of this class perform the
+         * per-segment versions of ConcurrentHashMap methods.  (Other
+         * methods are integrated directly into ConcurrentHashMap
+         * methods.) These mutative methods use a form of controlled
+         * spinning on contention via methods scanAndLock and
+         * scanAndLockForPut. These intersperse tryLocks with
+         * traversals to locate nodes.  The main benefit is to absorb
+         * cache misses (which are very common for hash tables) while
+         * obtaining locks so that traversal is faster once
+         * acquired. We do not actually use the found nodes since they
+         * must be re-acquired under lock anyway to ensure sequential
+         * consistency of updates (and in any case may be undetectably
+         * stale), but they will normally be much faster to re-locate.
+         * Also, scanAndLockForPut speculatively creates a fresh node
+         * to use in put if no node is found.
          */
 
         private static final long serialVersionUID = 2249069246763182397L;
 
         /**
-         * The number of elements in this segment's region.
+         * The maximum number of times to tryLock in a prescan before
+         * possibly blocking on acquire in preparation for a locked
+         * segment operation. On multiprocessors, using a bounded
+         * number of retries maintains cache acquired while locating
+         * nodes.
          */
-        transient volatile int count;
+        static final int MAX_SCAN_RETRIES =
+            Runtime.getRuntime().availableProcessors() > 1 ? 64 : 1;
 
         /**
-         * Number of updates that alter the size of the table. This is
-         * used during bulk-read methods to make sure they see a
-         * consistent snapshot: If modCounts change during a traversal
-         * of segments computing size or checking containsValue, then
-         * we might have an inconsistent view of state so (usually)
-         * must retry.
+         * The per-segment table. Elements are accessed via
+         * entryAt/setEntryAt providing volatile semantics.
+         */
+        transient volatile HashEntry<K,V>[] table;
+
+        /**
+         * The number of elements. Accessed only either within locks
+         * or among other volatile reads that maintain visibility.
+         */
+        transient int count;
+
+        /**
+         * The total number of mutative operations in this segment.
+         * Even though this may overflows 32 bits, it provides
+         * sufficient accuracy for stability checks in CHM isEmpty()
+         * and size() methods.  Accessed only either within locks or
+         * among other volatile reads that maintain visibility.
          */
         transient int modCount;
 
@@ -302,11 +348,6 @@
         transient int threshold;
 
         /**
-         * The per-segment table.
-         */
-        transient volatile HashEntry<K,V>[] table;
-
-        /**
          * The load factor for the hash table.  Even though this value
          * is same for all segments, it is replicated to avoid needing
          * links to outer object.
@@ -314,202 +355,94 @@
          */
         final float loadFactor;
 
-        Segment(int initialCapacity, float lf) {
-            loadFactor = lf;
-            setTable(HashEntry.<K,V>newArray(initialCapacity));
-        }
-
-        @SuppressWarnings("unchecked")
-        static final <K,V> Segment<K,V>[] newArray(int i) {
-            return new Segment[i];
-        }
-
-        /**
-         * Sets table to new HashEntry array.
-         * Call only while holding lock or in constructor.
-         */
-        void setTable(HashEntry<K,V>[] newTable) {
-            threshold = (int)(newTable.length * loadFactor);
-            table = newTable;
+        Segment(float lf, int threshold, HashEntry<K,V>[] tab) {
+            this.loadFactor = lf;
+            this.threshold = threshold;
+            this.table = tab;
         }
 
-        /**
-         * Returns properly casted first entry of bin for given hash.
-         */
-        HashEntry<K,V> getFirst(int hash) {
-            HashEntry<K,V>[] tab = table;
-            return tab[hash & (tab.length - 1)];
-        }
-
-        /**
-         * Reads value field of an entry under lock. Called if value
-         * field ever appears to be null. This is possible only if a
-         * compiler happens to reorder a HashEntry initialization with
-         * its table assignment, which is legal under memory model
-         * but is not known to ever occur.
-         */
-        V readValueUnderLock(HashEntry<K,V> e) {
-            lock();
+        final V put(K key, int hash, V value, boolean onlyIfAbsent) {
+            HashEntry<K,V> node = tryLock() ? null :
+                scanAndLockForPut(key, hash, value);
+            V oldValue;
             try {
-                return e.value;
+                HashEntry<K,V>[] tab = table;
+                int index = (tab.length - 1) & hash;
+                HashEntry<K,V> first = entryAt(tab, index);
+                for (HashEntry<K,V> e = first;;) {
+                    if (e != null) {
+                        K k;
+                        if ((k = e.key) == key ||
+                            (e.hash == hash && key.equals(k))) {
+                            oldValue = e.value;
+                            if (!onlyIfAbsent) {
+                                e.value = value;
+                                ++modCount;
+                            }
+                            break;
+                        }
+                        e = e.next;
+                    }
+                    else {
+                        if (node != null)
+                            node.setNext(first);
+                        else
+                            node = new HashEntry<K,V>(hash, key, value, first);
+                        int c = count + 1;
+                        if (c > threshold && first != null &&
+                            tab.length < MAXIMUM_CAPACITY)
+                            rehash(node);
+                        else
+                            setEntryAt(tab, index, node);
+                        ++modCount;
+                        count = c;
+                        oldValue = null;
+                        break;
+                    }
+                }
             } finally {
                 unlock();
             }
-        }
-
-        /* Specialized implementations of map methods */
-
-        V get(Object key, int hash) {
-            if (count != 0) { // read-volatile
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null) {
-                    if (e.hash == hash && key.equals(e.key)) {
-                        V v = e.value;
-                        if (v != null)
-                            return v;
-                        return readValueUnderLock(e); // recheck
-                    }
-                    e = e.next;
-                }
-            }
-            return null;
-        }
-
-        boolean containsKey(Object key, int hash) {
-            if (count != 0) { // read-volatile
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null) {
-                    if (e.hash == hash && key.equals(e.key))
-                        return true;
-                    e = e.next;
-                }
-            }
-            return false;
-        }
-
-        boolean containsValue(Object value) {
-            if (count != 0) { // read-volatile
-                HashEntry<K,V>[] tab = table;
-                int len = tab.length;
-                for (int i = 0 ; i < len; i++) {
-                    for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) {
-                        V v = e.value;
-                        if (v == null) // recheck
-                            v = readValueUnderLock(e);
-                        if (value.equals(v))
-                            return true;
-                    }
-                }
-            }
-            return false;
-        }
-
-        boolean replace(K key, int hash, V oldValue, V newValue) {
-            lock();
-            try {
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                boolean replaced = false;
-                if (e != null && oldValue.equals(e.value)) {
-                    replaced = true;
-                    e.value = newValue;
-                }
-                return replaced;
-            } finally {
-                unlock();
-            }
+            return oldValue;
         }
 
-        V replace(K key, int hash, V newValue) {
-            lock();
-            try {
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                V oldValue = null;
-                if (e != null) {
-                    oldValue = e.value;
-                    e.value = newValue;
-                }
-                return oldValue;
-            } finally {
-                unlock();
-            }
-        }
-
-
-        V put(K key, int hash, V value, boolean onlyIfAbsent) {
-            lock();
-            try {
-                int c = count;
-                if (c++ > threshold) // ensure capacity
-                    rehash();
-                HashEntry<K,V>[] tab = table;
-                int index = hash & (tab.length - 1);
-                HashEntry<K,V> first = tab[index];
-                HashEntry<K,V> e = first;
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                V oldValue;
-                if (e != null) {
-                    oldValue = e.value;
-                    if (!onlyIfAbsent)
-                        e.value = value;
-                }
-                else {
-                    oldValue = null;
-                    ++modCount;
-                    tab[index] = new HashEntry<K,V>(key, hash, first, value);
-                    count = c; // write-volatile
-                }
-                return oldValue;
-            } finally {
-                unlock();
-            }
-        }
-
-        void rehash() {
+        /**
+         * Doubles size of table and repacks entries, also adding the
+         * given node to new table
+         */
+        @SuppressWarnings("unchecked")
+        private void rehash(HashEntry<K,V> node) {
+            /*
+             * Reclassify nodes in each list to new table.  Because we
+             * are using power-of-two expansion, the elements from
+             * each bin must either stay at same index, or move with a
+             * power of two offset. We eliminate unnecessary node
+             * creation by catching cases where old nodes can be
+             * reused because their next fields won't change.
+             * Statistically, at the default threshold, only about
+             * one-sixth of them need cloning when a table
+             * doubles. The nodes they replace will be garbage
+             * collectable as soon as they are no longer referenced by
+             * any reader thread that may be in the midst of
+             * concurrently traversing table. Entry accesses use plain
+             * array indexing because they are followed by volatile
+             * table write.
+             */
             HashEntry<K,V>[] oldTable = table;
             int oldCapacity = oldTable.length;
-            if (oldCapacity >= MAXIMUM_CAPACITY)
-                return;
-
-            /*
-             * Reclassify nodes in each list to new Map.  Because we are
-             * using power-of-two expansion, the elements from each bin
-             * must either stay at same index, or move with a power of two
-             * offset. We eliminate unnecessary node creation by catching
-             * cases where old nodes can be reused because their next
-             * fields won't change. Statistically, at the default
-             * threshold, only about one-sixth of them need cloning when
-             * a table doubles. The nodes they replace will be garbage
-             * collectable as soon as they are no longer referenced by any
-             * reader thread that may be in the midst of traversing table
-             * right now.
-             */
-
-            HashEntry<K,V>[] newTable = HashEntry.newArray(oldCapacity<<1);
-            threshold = (int)(newTable.length * loadFactor);
-            int sizeMask = newTable.length - 1;
+            int newCapacity = oldCapacity << 1;
+            threshold = (int)(newCapacity * loadFactor);
+            HashEntry<K,V>[] newTable =
+                (HashEntry<K,V>[]) new HashEntry[newCapacity];
+            int sizeMask = newCapacity - 1;
             for (int i = 0; i < oldCapacity ; i++) {
-                // We need to guarantee that any existing reads of old Map can
-                //  proceed. So we cannot yet null out each bin.
                 HashEntry<K,V> e = oldTable[i];
-
                 if (e != null) {
                     HashEntry<K,V> next = e.next;
                     int idx = e.hash & sizeMask;
-
-                    //  Single node on list
-                    if (next == null)
+                    if (next == null)   //  Single node on list
                         newTable[idx] = e;
-
-                    else {
-                        // Reuse trailing consecutive sequence at same slot
+                    else { // Reuse consecutive sequence at same slot
                         HashEntry<K,V> lastRun = e;
                         int lastIdx = idx;
                         for (HashEntry<K,V> last = next;
@@ -522,74 +455,259 @@
                             }
                         }
                         newTable[lastIdx] = lastRun;
-
-                        // Clone all remaining nodes
+                        // Clone remaining nodes
                         for (HashEntry<K,V> p = e; p != lastRun; p = p.next) {
-                            int k = p.hash & sizeMask;
+                            V v = p.value;
+                            int h = p.hash;
+                            int k = h & sizeMask;
                             HashEntry<K,V> n = newTable[k];
-                            newTable[k] = new HashEntry<K,V>(p.key, p.hash,
-                                                             n, p.value);
+                            newTable[k] = new HashEntry<K,V>(h, p.key, v, n);
                         }
                     }
                 }
             }
+            int nodeIndex = node.hash & sizeMask; // add the new node
+            node.setNext(newTable[nodeIndex]);
+            newTable[nodeIndex] = node;
             table = newTable;
         }
 
         /**
+         * Scans for a node containing given key while trying to
+         * acquire lock, creating and returning one if not found. Upon
+         * return, guarantees that lock is held. UNlike in most
+         * methods, calls to method equals are not screened: Since
+         * traversal speed doesn't matter, we might as well help warm
+         * up the associated code and accesses as well.
+         *
+         * @return a new node if key not found, else null
+         */
+        private HashEntry<K,V> scanAndLockForPut(K key, int hash, V value) {
+            HashEntry<K,V> first = entryForHash(this, hash);
+            HashEntry<K,V> e = first;
+            HashEntry<K,V> node = null;
+            int retries = -1; // negative while locating node
+            while (!tryLock()) {
+                HashEntry<K,V> f; // to recheck first below
+                if (retries < 0) {
+                    if (e == null) {
+                        if (node == null) // speculatively create node
+                            node = new HashEntry<K,V>(hash, key, value, null);
+                        retries = 0;
+                    }
+                    else if (key.equals(e.key))
+                        retries = 0;
+                    else
+                        e = e.next;
+                }
+                else if (++retries > MAX_SCAN_RETRIES) {
+                    lock();
+                    break;
+                }
+                else if ((retries & 1) == 0 &&
+                         (f = entryForHash(this, hash)) != first) {
+                    e = first = f; // re-traverse if entry changed
+                    retries = -1;
+                }
+            }
+            return node;
+        }
+
+        /**
+         * Scans for a node containing the given key while trying to
+         * acquire lock for a remove or replace operation. Upon
+         * return, guarantees that lock is held.  Note that we must
+         * lock even if the key is not found, to ensure sequential
+         * consistency of updates.
+         */
+        private void scanAndLock(Object key, int hash) {
+            // similar to but simpler than scanAndLockForPut
+            HashEntry<K,V> first = entryForHash(this, hash);
+            HashEntry<K,V> e = first;
+            int retries = -1;
+            while (!tryLock()) {
+                HashEntry<K,V> f;
+                if (retries < 0) {
+                    if (e == null || key.equals(e.key))
+                        retries = 0;
+                    else
+                        e = e.next;
+                }
+                else if (++retries > MAX_SCAN_RETRIES) {
+                    lock();
+                    break;
+                }
+                else if ((retries & 1) == 0 &&
+                         (f = entryForHash(this, hash)) != first) {
+                    e = first = f;
+                    retries = -1;
+                }
+            }
+        }
+
+        /**
          * Remove; match on key only if value null, else match both.
          */
-        V remove(Object key, int hash, Object value) {
+        final V remove(Object key, int hash, Object value) {
+            if (!tryLock())
+                scanAndLock(key, hash);
+            V oldValue = null;
+            try {
+                HashEntry<K,V>[] tab = table;
+                int index = (tab.length - 1) & hash;
+                HashEntry<K,V> e = entryAt(tab, index);
+                HashEntry<K,V> pred = null;
+                while (e != null) {
+                    K k;
+                    HashEntry<K,V> next = e.next;
+                    if ((k = e.key) == key ||
+                        (e.hash == hash && key.equals(k))) {
+                        V v = e.value;
+                        if (value == null || value == v || value.equals(v)) {
+                            if (pred == null)
+                                setEntryAt(tab, index, next);
+                            else
+                                pred.setNext(next);
+                            ++modCount;
+                            --count;
+                            oldValue = v;
+                        }
+                        break;
+                    }
+                    pred = e;
+                    e = next;
+                }
+            } finally {
+                unlock();
+            }
+            return oldValue;
+        }
+
+        final boolean replace(K key, int hash, V oldValue, V newValue) {
+            if (!tryLock())
+                scanAndLock(key, hash);
+            boolean replaced = false;
+            try {
+                HashEntry<K,V> e;
+                for (e = entryForHash(this, hash); e != null; e = e.next) {
+                    K k;
+                    if ((k = e.key) == key ||
+                        (e.hash == hash && key.equals(k))) {
+                        if (oldValue.equals(e.value)) {
+                            e.value = newValue;
+                            ++modCount;
+                            replaced = true;
+                        }
+                        break;
+                    }
+                }
+            } finally {
+                unlock();
+            }
+            return replaced;
+        }
+
+        final V replace(K key, int hash, V value) {
+            if (!tryLock())
+                scanAndLock(key, hash);
+            V oldValue = null;
+            try {
+                HashEntry<K,V> e;
+                for (e = entryForHash(this, hash); e != null; e = e.next) {
+                    K k;
+                    if ((k = e.key) == key ||
+                        (e.hash == hash && key.equals(k))) {
+                        oldValue = e.value;
+                        e.value = value;
+                        ++modCount;
+                        break;
+                    }
+                }
+            } finally {
+                unlock();
+            }
+            return oldValue;
+        }
+
+        final void clear() {
             lock();
             try {
-                int c = count - 1;
                 HashEntry<K,V>[] tab = table;
-                int index = hash & (tab.length - 1);
-                HashEntry<K,V> first = tab[index];
-                HashEntry<K,V> e = first;
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                V oldValue = null;
-                if (e != null) {
-                    V v = e.value;
-                    if (value == null || value.equals(v)) {
-                        oldValue = v;
-                        // All entries following removed node can stay
-                        // in list, but all preceding ones need to be
-                        // cloned.
-                        ++modCount;
-                        HashEntry<K,V> newFirst = e.next;
-                        for (HashEntry<K,V> p = first; p != e; p = p.next)
-                            newFirst = new HashEntry<K,V>(p.key, p.hash,
-                                                          newFirst, p.value);
-                        tab[index] = newFirst;
-                        count = c; // write-volatile
-                    }
-                }
-                return oldValue;
+                for (int i = 0; i < tab.length ; i++)
+                    setEntryAt(tab, i, null);
+                ++modCount;
+                count = 0;
             } finally {
                 unlock();
             }
         }
+    }
 
-        void clear() {
-            if (count != 0) {
-                lock();
-                try {
-                    HashEntry<K,V>[] tab = table;
-                    for (int i = 0; i < tab.length ; i++)
-                        tab[i] = null;
-                    ++modCount;
-                    count = 0; // write-volatile
-                } finally {
-                    unlock();
+    // Accessing segments
+
+    /**
+     * Gets the jth element of given segment array (if nonnull) with
+     * volatile element access semantics via Unsafe.
+     */
+    @SuppressWarnings("unchecked")
+    static final <K,V> Segment<K,V> segmentAt(Segment<K,V>[] ss, int j) {
+        long u = (j << SSHIFT) + SBASE;
+        return ss == null ? null :
+            (Segment<K,V>) UNSAFE.getObjectVolatile(ss, u);
+    }
+
+    /**
+     * Returns the segment for the given index, creating it and
+     * recording in segment table (via CAS) if not already present.
+     *
+     * @param k the index
+     * @return the segment
+     */
+    @SuppressWarnings("unchecked")
+    private Segment<K,V> ensureSegment(int k) {
+        final Segment<K,V>[] ss = this.segments;
+        long u = (k << SSHIFT) + SBASE; // raw offset
+        Segment<K,V> seg;
+        if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u)) == null) {
+            Segment<K,V> proto = ss[0]; // use segment 0 as prototype
+            int cap = proto.table.length;
+            float lf = proto.loadFactor;
+            int threshold = (int)(cap * lf);
+            HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry[cap];
+            if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
+                == null) { // recheck
+                Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
+                while ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
+                       == null) {
+                    if (UNSAFE.compareAndSwapObject(ss, u, null, seg = s))
+                        break;
                 }
             }
         }
+        return seg;
     }
 
+    // Hash-based segment and entry accesses
 
+    /**
+     * Get the segment for the given hash
+     */
+    @SuppressWarnings("unchecked")
+    private Segment<K,V> segmentForHash(int h) {
+        long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE;
+        return (Segment<K,V>) UNSAFE.getObjectVolatile(segments, u);
+    }
+
+    /**
+     * Gets the table entry for the given segment and hash
+     */
+    @SuppressWarnings("unchecked")
+    static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) {
+        HashEntry<K,V>[] tab;
+        return (seg == null || (tab = seg.table) == null) ? null :
+            (HashEntry<K,V>) UNSAFE.getObjectVolatile
+            (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE);
+    }
 
     /* ---------------- Public operations -------------- */
 
@@ -609,14 +727,13 @@
      * negative or the load factor or concurrencyLevel are
      * nonpositive.
      */
+    @SuppressWarnings("unchecked")
     public ConcurrentHashMap(int initialCapacity,
                              float loadFactor, int concurrencyLevel) {
         if (!(loadFactor > 0) || initialCapacity < 0 || concurrencyLevel <= 0)
             throw new IllegalArgumentException();
-
         if (concurrencyLevel > MAX_SEGMENTS)
             concurrencyLevel = MAX_SEGMENTS;
-
         // Find power-of-two sizes best matching arguments
         int sshift = 0;
         int ssize = 1;
@@ -624,21 +741,23 @@
             ++sshift;
             ssize <<= 1;
         }
-        segmentShift = 32 - sshift;
-        segmentMask = ssize - 1;
-        this.segments = Segment.newArray(ssize);
-
+        this.segmentShift = 32 - sshift;
+        this.segmentMask = ssize - 1;
         if (initialCapacity > MAXIMUM_CAPACITY)
             initialCapacity = MAXIMUM_CAPACITY;
         int c = initialCapacity / ssize;
         if (c * ssize < initialCapacity)
             ++c;
-        int cap = 1;
+        int cap = MIN_SEGMENT_TABLE_CAPACITY;
         while (cap < c)
             cap <<= 1;
-
-        for (int i = 0; i < this.segments.length; ++i)
-            this.segments[i] = new Segment<K,V>(cap, loadFactor);
+        // create segments and segments[0]
+        Segment<K,V> s0 =
+            new Segment<K,V>(loadFactor, (int)(cap * loadFactor),
+                             (HashEntry<K,V>[])new HashEntry[cap]);
+        Segment<K,V>[] ss = (Segment<K,V>[])new Segment[ssize];
+        UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0]
+        this.segments = ss;
     }
 
     /**
@@ -701,33 +820,36 @@
      * @return <tt>true</tt> if this map contains no key-value mappings
      */
     public boolean isEmpty() {
-        final Segment<K,V>[] segments = this.segments;
         /*
-         * We keep track of per-segment modCounts to avoid ABA
-         * problems in which an element in one segment was added and
-         * in another removed during traversal, in which case the
-         * table was never actually empty at any point. Note the
-         * similar use of modCounts in the size() and containsValue()
-         * methods, which are the only other methods also susceptible
-         * to ABA problems.
+         * Sum per-segment modCounts to avoid mis-reporting when
+         * elements are concurrently added and removed in one segment
+         * while checking another, in which case the table was never
+         * actually empty at any point. (The sum ensures accuracy up
+         * through at least 1<<31 per-segment modifications before
+         * recheck.)  Methods size() and containsValue() use similar
+         * constructions for stability checks.
          */
-        int[] mc = new int[segments.length];
-        int mcsum = 0;
-        for (int i = 0; i < segments.length; ++i) {
-            if (segments[i].count != 0)
-                return false;
-            else
-                mcsum += mc[i] = segments[i].modCount;
+        long sum = 0L;
+        final Segment<K,V>[] segments = this.segments;
+        for (int j = 0; j < segments.length; ++j) {
+            Segment<K,V> seg = segmentAt(segments, j);
+            if (seg != null) {
+                if (seg.count != 0)
+                    return false;
+                sum += seg.modCount;
+            }
         }
-        // If mcsum happens to be zero, then we know we got a snapshot
-        // before any modifications at all were made.  This is
-        // probably common enough to bother tracking.
-        if (mcsum != 0) {
-            for (int i = 0; i < segments.length; ++i) {
-                if (segments[i].count != 0 ||
-                    mc[i] != segments[i].modCount)
-                    return false;
+        if (sum != 0L) { // recheck unless no modifications
+            for (int j = 0; j < segments.length; ++j) {
+                Segment<K,V> seg = segmentAt(segments, j);
+                if (seg != null) {
+                    if (seg.count != 0)
+                        return false;
+                    sum -= seg.modCount;
+                }
             }
+            if (sum != 0L)
+                return false;
         }
         return true;
     }
@@ -740,45 +862,43 @@
      * @return the number of key-value mappings in this map
      */
     public int size() {
-        final Segment<K,V>[] segments = this.segments;
-        long sum = 0;
-        long check = 0;
-        int[] mc = new int[segments.length];
         // Try a few times to get accurate count. On failure due to
         // continuous async changes in table, resort to locking.
-        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
-            check = 0;
-            sum = 0;
-            int mcsum = 0;
-            for (int i = 0; i < segments.length; ++i) {
-                sum += segments[i].count;
-                mcsum += mc[i] = segments[i].modCount;
-            }
-            if (mcsum != 0) {
-                for (int i = 0; i < segments.length; ++i) {
-                    check += segments[i].count;
-                    if (mc[i] != segments[i].modCount) {
-                        check = -1; // force retry
-                        break;
+        final Segment<K,V>[] segments = this.segments;
+        int size;
+        boolean overflow; // true if size overflows 32 bits
+        long sum;         // sum of modCounts
+        long last = 0L;   // previous sum
+        int retries = -1; // first iteration isn't retry
+        try {
+            for (;;) {
+                if (retries++ == RETRIES_BEFORE_LOCK) {
+                    for (int j = 0; j < segments.length; ++j)
+                        ensureSegment(j).lock(); // force creation
+                }
+                sum = 0L;
+                size = 0;
+                overflow = false;
+                for (int j = 0; j < segments.length; ++j) {
+                    Segment<K,V> seg = segmentAt(segments, j);
+                    if (seg != null) {
+                        sum += seg.modCount;
+                        int c = seg.count;
+                        if (c < 0 || (size += c) < 0)
+                            overflow = true;
                     }
                 }
+                if (sum == last)
+                    break;
+                last = sum;
             }
-            if (check == sum)
-                break;
+        } finally {
+            if (retries > RETRIES_BEFORE_LOCK) {
+                for (int j = 0; j < segments.length; ++j)
+                    segmentAt(segments, j).unlock();
+            }
         }
-        if (check != sum) { // Resort to locking all segments
-            sum = 0;
-            for (int i = 0; i < segments.length; ++i)
-                segments[i].lock();
-            for (int i = 0; i < segments.length; ++i)
-                sum += segments[i].count;
-            for (int i = 0; i < segments.length; ++i)
-                segments[i].unlock();
-        }
-        if (sum > Integer.MAX_VALUE)
-            return Integer.MAX_VALUE;
-        else
-            return (int)sum;
+        return overflow ? Integer.MAX_VALUE : size;
     }
 
     /**
@@ -794,7 +914,13 @@
      */
     public V get(Object key) {
         int hash = hash(key.hashCode());
-        return segmentFor(hash).get(key, hash);
+        for (HashEntry<K,V> e = entryForHash(segmentForHash(hash), hash);
+             e != null; e = e.next) {
+            K k;
+            if ((k = e.key) == key || (e.hash == hash && key.equals(k)))
+                return e.value;
+        }
+        return null;
     }
 
     /**
@@ -808,7 +934,13 @@
      */
     public boolean containsKey(Object key) {
         int hash = hash(key.hashCode());
-        return segmentFor(hash).containsKey(key, hash);
+        for (HashEntry<K,V> e = entryForHash(segmentForHash(hash), hash);
+             e != null; e = e.next) {
+            K k;
+            if ((k = e.key) == key || (e.hash == hash && key.equals(k)))
+                return true;
+        }
+        return false;
     }
 
     /**
@@ -823,51 +955,47 @@
      * @throws NullPointerException if the specified value is null
      */
     public boolean containsValue(Object value) {
+        // Same idea as size()
         if (value == null)
             throw new NullPointerException();
-
-        // See explanation of modCount use above
-
         final Segment<K,V>[] segments = this.segments;
-        int[] mc = new int[segments.length];
-
-        // Try a few times without locking
-        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
-            int sum = 0;
-            int mcsum = 0;
-            for (int i = 0; i < segments.length; ++i) {
-                int c = segments[i].count;
-                mcsum += mc[i] = segments[i].modCount;
-                if (segments[i].containsValue(value))
-                    return true;
-            }
-            boolean cleanSweep = true;
-            if (mcsum != 0) {
-                for (int i = 0; i < segments.length; ++i) {
-                    int c = segments[i].count;
-                    if (mc[i] != segments[i].modCount) {
-                        cleanSweep = false;
-                        break;
+        boolean found = false;
+        long last = 0;
+        int retries = -1;
+        try {
+            outer: for (;;) {
+                if (retries++ == RETRIES_BEFORE_LOCK) {
+                    for (int j = 0; j < segments.length; ++j)
+                        ensureSegment(j).lock(); // force creation
+                }
+                long hashSum = 0L;
+                int sum = 0;
+                for (int j = 0; j < segments.length; ++j) {
+                    HashEntry<K,V>[] tab;
+                    Segment<K,V> seg = segmentAt(segments, j);
+                    if (seg != null && (tab = seg.table) != null) {
+                        for (int i = 0 ; i < tab.length; i++) {
+                            HashEntry<K,V> e;
+                            for (e = entryAt(tab, i); e != null; e = e.next) {
+                                V v = e.value;
+                                if (v != null && value.equals(v)) {
+                                    found = true;
+                                    break outer;
+                                }
+                            }
+                        }
+                        sum += seg.modCount;
                     }
                 }
-            }
-            if (cleanSweep)
-                return false;
-        }
-        // Resort to locking all segments
-        for (int i = 0; i < segments.length; ++i)
-            segments[i].lock();
-        boolean found = false;
-        try {
-            for (int i = 0; i < segments.length; ++i) {
-                if (segments[i].containsValue(value)) {
-                    found = true;
+                if (retries > 0 && sum == last)
                     break;
-                }
+                last = sum;
             }
         } finally {
-            for (int i = 0; i < segments.length; ++i)
-                segments[i].unlock();
+            if (retries > RETRIES_BEFORE_LOCK) {
+                for (int j = 0; j < segments.length; ++j)
+                    segmentAt(segments, j).unlock();
+            }
         }
         return found;
     }
@@ -908,7 +1036,11 @@
         if (value == null)
             throw new NullPointerException();
         int hash = hash(key.hashCode());
-        return segmentFor(hash).put(key, hash, value, false);
+        int j = (hash >>> segmentShift) & segmentMask;
+        Segment<K,V> s = segmentAt(segments, j);
+        if (s == null)
+            s = ensureSegment(j);
+        return s.put(key, hash, value, false);
     }
 
     /**
@@ -922,7 +1054,11 @@
         if (value == null)
             throw new NullPointerException();
         int hash = hash(key.hashCode());
-        return segmentFor(hash).put(key, hash, value, true);
+        int j = (hash >>> segmentShift) & segmentMask;
+        Segment<K,V> s = segmentAt(segments, j);
+        if (s == null)
+            s = ensureSegment(j);
+        return s.put(key, hash, value, true);
     }
 
     /**
@@ -948,7 +1084,8 @@
      */
     public V remove(Object key) {
         int hash = hash(key.hashCode());
-        return segmentFor(hash).remove(key, hash, null);
+        Segment<K,V> s = segmentForHash(hash);
+        return s == null ? null : s.remove(key, hash, null);
     }
 
     /**
@@ -958,9 +1095,9 @@
      */
     public boolean remove(Object key, Object value) {
         int hash = hash(key.hashCode());
-        if (value == null)
-            return false;
-        return segmentFor(hash).remove(key, hash, value) != null;
+        Segment<K,V> s;
+        return value != null && (s = segmentForHash(hash)) != null &&
+            s.remove(key, hash, value) != null;
     }
 
     /**
@@ -969,10 +1106,11 @@
      * @throws NullPointerException if any of the arguments are null
      */
     public boolean replace(K key, V oldValue, V newValue) {
+        int hash = hash(key.hashCode());
         if (oldValue == null || newValue == null)
             throw new NullPointerException();
-        int hash = hash(key.hashCode());
-        return segmentFor(hash).replace(key, hash, oldValue, newValue);
+        Segment<K,V> s = segmentForHash(hash);
+        return s != null && s.replace(key, hash, oldValue, newValue);
     }
 
     /**
@@ -983,18 +1121,23 @@
      * @throws NullPointerException if the specified key or value is null
      */
     public V replace(K key, V value) {
+        int hash = hash(key.hashCode());
         if (value == null)
             throw new NullPointerException();
-        int hash = hash(key.hashCode());
-        return segmentFor(hash).replace(key, hash, value);
+        Segment<K,V> s = segmentForHash(hash);
+        return s == null ? null : s.replace(key, hash, value);
     }
 
     /**
      * Removes all of the mappings from this map.
      */
     public void clear() {
-        for (int i = 0; i < segments.length; ++i)
-            segments[i].clear();
+        final Segment<K,V>[] segments = this.segments;
+        for (int j = 0; j < segments.length; ++j) {
+            Segment<K,V> s = segmentAt(segments, j);
+            if (s != null)
+                s.clear();
+        }
     }
 
     /**
@@ -1095,42 +1238,41 @@
             advance();
         }
 
-        public boolean hasMoreElements() { return hasNext(); }
-
+        /**
+         * Set nextEntry to first node of next non-empty table
+         * (in backwards order, to simplify checks).
+         */
         final void advance() {
-            if (nextEntry != null && (nextEntry = nextEntry.next) != null)
-                return;
-
-            while (nextTableIndex >= 0) {
-                if ( (nextEntry = currentTable[nextTableIndex--]) != null)
-                    return;
-            }
-
-            while (nextSegmentIndex >= 0) {
-                Segment<K,V> seg = segments[nextSegmentIndex--];
-                if (seg.count != 0) {
-                    currentTable = seg.table;
-                    for (int j = currentTable.length - 1; j >= 0; --j) {
-                        if ( (nextEntry = currentTable[j]) != null) {
-                            nextTableIndex = j - 1;
-                            return;
-                        }
-                    }
+            for (;;) {
+                if (nextTableIndex >= 0) {
+                    if ((nextEntry = entryAt(currentTable,
+                                             nextTableIndex--)) != null)
+                        break;
                 }
+                else if (nextSegmentIndex >= 0) {
+                    Segment<K,V> seg = segmentAt(segments, nextSegmentIndex--);
+                    if (seg != null && (currentTable = seg.table) != null)
+                        nextTableIndex = currentTable.length - 1;
+                }
+                else
+                    break;
             }
         }
 
-        public boolean hasNext() { return nextEntry != null; }
-
-        HashEntry<K,V> nextEntry() {
-            if (nextEntry == null)
+        final HashEntry<K,V> nextEntry() {
+            HashEntry<K,V> e = nextEntry;
+            if (e == null)
                 throw new NoSuchElementException();
-            lastReturned = nextEntry;
-            advance();
-            return lastReturned;
+            lastReturned = e; // cannot assign until after null check
+            if ((nextEntry = e.next) == null)
+                advance();
+            return e;
         }
 
-        public void remove() {
+        public final boolean hasNext() { return nextEntry != null; }
+        public final boolean hasMoreElements() { return nextEntry != null; }
+
+        public final void remove() {
             if (lastReturned == null)
                 throw new IllegalStateException();
             ConcurrentHashMap.this.remove(lastReturned.key);
@@ -1142,16 +1284,16 @@
         extends HashIterator
         implements Iterator<K>, Enumeration<K>
     {
-        public K next()        { return super.nextEntry().key; }
-        public K nextElement() { return super.nextEntry().key; }
+        public final K next()        { return super.nextEntry().key; }
+        public final K nextElement() { return super.nextEntry().key; }
     }
 
     final class ValueIterator
         extends HashIterator
         implements Iterator<V>, Enumeration<V>
     {
-        public V next()        { return super.nextEntry().value; }
-        public V nextElement() { return super.nextEntry().value; }
+        public final V next()        { return super.nextEntry().value; }
+        public final V nextElement() { return super.nextEntry().value; }
     }
 
     /**
@@ -1271,15 +1413,20 @@
      * The key-value mappings are emitted in no particular order.
      */
     private void writeObject(java.io.ObjectOutputStream s) throws IOException {
+        // force all segments for serialization compatibility
+        for (int k = 0; k < segments.length; ++k)
+            ensureSegment(k);
         s.defaultWriteObject();
 
+        final Segment<K,V>[] segments = this.segments;
         for (int k = 0; k < segments.length; ++k) {
-            Segment<K,V> seg = segments[k];
+            Segment<K,V> seg = segmentAt(segments, k);
             seg.lock();
             try {
                 HashEntry<K,V>[] tab = seg.table;
                 for (int i = 0; i < tab.length; ++i) {
-                    for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) {
+                    HashEntry<K,V> e;
+                    for (e = entryAt(tab, i); e != null; e = e.next) {
                         s.writeObject(e.key);
                         s.writeObject(e.value);
                     }
@@ -1297,13 +1444,20 @@
      * stream (i.e., deserialize it).
      * @param s the stream
      */
+    @SuppressWarnings("unchecked")
     private void readObject(java.io.ObjectInputStream s)
         throws IOException, ClassNotFoundException {
         s.defaultReadObject();
 
-        // Initialize each segment to be minimally sized, and let grow.
-        for (int i = 0; i < segments.length; ++i) {
-            segments[i].setTable(new HashEntry[1]);
+        // Re-initialize segments to be minimally sized, and let grow.
+        int cap = MIN_SEGMENT_TABLE_CAPACITY;
+        final Segment<K,V>[] segments = this.segments;
+        for (int k = 0; k < segments.length; ++k) {
+            Segment<K,V> seg = segments[k];
+            if (seg != null) {
+                seg.threshold = (int)(cap * seg.loadFactor);
+                seg.table = (HashEntry<K,V>[]) new HashEntry[cap];
+            }
         }
 
         // Read the keys and values, and put the mappings in the table
@@ -1315,4 +1469,31 @@
             put(key, value);
         }
     }
+
+    // Unsafe mechanics
+    private static final sun.misc.Unsafe UNSAFE;
+    private static final long SBASE;
+    private static final int SSHIFT;
+    private static final long TBASE;
+    private static final int TSHIFT;
+
+    static {
+        int ss, ts;
+        try {
+            UNSAFE = sun.misc.Unsafe.getUnsafe();
+            Class tc = HashEntry[].class;
+            Class sc = Segment[].class;
+            TBASE = UNSAFE.arrayBaseOffset(tc);
+            SBASE = UNSAFE.arrayBaseOffset(sc);
+            ts = UNSAFE.arrayIndexScale(tc);
+            ss = UNSAFE.arrayIndexScale(sc);
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+        if ((ss & (ss-1)) != 0 || (ts & (ts-1)) != 0)
+            throw new Error("data type scale not a power of two");
+        SSHIFT = 31 - Integer.numberOfLeadingZeros(ss);
+        TSHIFT = 31 - Integer.numberOfLeadingZeros(ts);
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Martin Buchholz with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Martin Buchholz with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -103,9 +103,11 @@
      * @throws UnsupportedOperationException if the <tt>remove</tt> operation
      *         is not supported by this map
      * @throws ClassCastException if the key or value is of an inappropriate
-     *         type for this map (optional)
+     *         type for this map
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified key or value is null,
-     *         and this map does not permit null keys or values (optional)
+     *         and this map does not permit null keys or values
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      */
     boolean remove(Object key, Object value);
 
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Thu Apr 21 16:42:06 2011 -0700
@@ -631,9 +631,11 @@
      * @param c collection containing elements to be removed from this list
      * @return <tt>true</tt> if this list changed as a result of the call
      * @throws ClassCastException if the class of an element of this list
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this list contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      */
@@ -671,9 +673,11 @@
      * @param c collection containing elements to be retained in this list
      * @return <tt>true</tt> if this list changed as a result of the call
      * @throws ClassCastException if the class of an element of this list
-     *         is incompatible with the specified collection (optional)
+     *         is incompatible with the specified collection
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if this list contains a null element and the
-     *         specified collection does not permit null elements (optional),
+     *         specified collection does not permit null elements
+     *         (<a href="../Collection.html#optional-restrictions">optional</a>),
      *         or if the specified collection is null
      * @see #remove(Object)
      */
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/DelayQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/DelayQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 
--- a/jdk/src/share/classes/java/util/concurrent/Delayed.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Delayed.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Exchanger.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Exchanger.java	Thu Apr 21 16:42:06 2011 -0700
@@ -31,7 +31,7 @@
  * Written by Doug Lea, Bill Scherer, and Michael Scott with
  * assistance from members of JCP JSR-166 Expert Group and released to
  * the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ExecutionException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutionException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Executor.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Executor.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorService.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorService.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Executors.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Executors.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -791,18 +791,19 @@
 
     /**
      * Tries to enqueue worker w in wait queue and await change in
-     * worker's eventCount.  If the pool is quiescent, possibly
-     * terminates worker upon exit.  Otherwise, before blocking,
-     * rescans queues to avoid missed signals.  Upon finding work,
-     * releases at least one worker (which may be the current
-     * worker). Rescans restart upon detected staleness or failure to
-     * release due to contention. Note the unusual conventions about
-     * Thread.interrupt here and elsewhere: Because interrupts are
-     * used solely to alert threads to check termination, which is
-     * checked here anyway, we clear status (using Thread.interrupted)
-     * before any call to park, so that park does not immediately
-     * return due to status being set via some other unrelated call to
-     * interrupt in user code.
+     * worker's eventCount.  If the pool is quiescent and there is
+     * more than one worker, possibly terminates worker upon exit.
+     * Otherwise, before blocking, rescans queues to avoid missed
+     * signals.  Upon finding work, releases at least one worker
+     * (which may be the current worker). Rescans restart upon
+     * detected staleness or failure to release due to
+     * contention. Note the unusual conventions about Thread.interrupt
+     * here and elsewhere: Because interrupts are used solely to alert
+     * threads to check termination, which is checked here anyway, we
+     * clear status (using Thread.interrupted) before any call to
+     * park, so that park does not immediately return due to status
+     * being set via some other unrelated call to interrupt in user
+     * code.
      *
      * @param w the calling worker
      * @param c the ctl value on entry
@@ -823,7 +824,8 @@
             else if (w.eventCount != v)
                 return true;                      // update next time
         }
-        if (parallelism + (int)(nc >> AC_SHIFT) == 0 &&
+        if ((!shutdown || !tryTerminate(false)) &&
+            (int)c != 0 && parallelism + (int)(nc >> AC_SHIFT) == 0 &&
             blockedCount == 0 && quiescerCount == 0)
             idleAwaitWork(w, nc, c, v);           // quiescent
         for (boolean rescanned = false;;) {
@@ -893,7 +895,8 @@
                 w.parked = false;
                 if (w.eventCount != v)
                     break;
-                else if (System.nanoTime() - startTime < SHRINK_RATE)
+                else if (System.nanoTime() - startTime <
+                         SHRINK_RATE - (SHRINK_RATE / 10)) // timing slop
                     Thread.interrupted();          // spurious wakeup
                 else if (UNSAFE.compareAndSwapLong(this, ctlOffset,
                                                    currentCtl, prevCtl)) {
@@ -1022,8 +1025,8 @@
         do {} while (!UNSAFE.compareAndSwapLong(this, ctlOffset,  // no mask
                                                 c = ctl, c + AC_UNIT));
         int b;
-        do {} while(!UNSAFE.compareAndSwapInt(this, blockedCountOffset,
-                                              b = blockedCount, b - 1));
+        do {} while (!UNSAFE.compareAndSwapInt(this, blockedCountOffset,
+                                               b = blockedCount, b - 1));
     }
 
     /**
@@ -1175,7 +1178,7 @@
                         ws[k] = w;
                         nextWorkerIndex = k + 1;
                         int m = g & SMASK;
-                        g = k >= m? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1);
+                        g = (k > m) ? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1);
                     }
                 } finally {
                     scanGuard = g;
@@ -1358,8 +1361,8 @@
      */
     final void addQuiescerCount(int delta) {
         int c;
-        do {} while(!UNSAFE.compareAndSwapInt(this, quiescerCountOffset,
-                                              c = quiescerCount, c + delta));
+        do {} while (!UNSAFE.compareAndSwapInt(this, quiescerCountOffset,
+                                               c = quiescerCount, c + delta));
     }
 
     /**
@@ -1712,7 +1715,7 @@
      */
     public int getRunningThreadCount() {
         int r = parallelism + (int)(ctl >> AC_SHIFT);
-        return r <= 0? 0 : r; // suppress momentarily negative values
+        return (r <= 0) ? 0 : r; // suppress momentarily negative values
     }
 
     /**
@@ -1724,7 +1727,7 @@
      */
     public int getActiveThreadCount() {
         int r = parallelism + (int)(ctl >> AC_SHIFT) + blockedCount;
-        return r <= 0? 0 : r; // suppress momentarily negative values
+        return (r <= 0) ? 0 : r; // suppress momentarily negative values
     }
 
     /**
@@ -1879,9 +1882,9 @@
         int ac = rc + blockedCount;
         String level;
         if ((c & STOP_BIT) != 0)
-            level = (tc == 0)? "Terminated" : "Terminating";
+            level = (tc == 0) ? "Terminated" : "Terminating";
         else
-            level = shutdown? "Shutting down" : "Running";
+            level = shutdown ? "Shutting down" : "Running";
         return super.toString() +
             "[" + level +
             ", parallelism = " + pc +
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -361,7 +361,7 @@
     protected void onStart() {
         queue = new ForkJoinTask<?>[INITIAL_QUEUE_CAPACITY];
         int r = pool.workerSeedGenerator.nextInt();
-        seed = (r == 0)? 1 : r; //  must be nonzero
+        seed = (r == 0) ? 1 : r; //  must be nonzero
     }
 
     /**
@@ -724,7 +724,7 @@
                         Thread.yield();        // for politeness
                 }
                 else
-                    retries = helpJoinTask(joinMe)? MAX_HELP : retries - 1;
+                    retries = helpJoinTask(joinMe) ? MAX_HELP : retries - 1;
             }
             else {
                 retries = MAX_HELP;           // restart if not done
@@ -955,7 +955,7 @@
                     p.addActiveCount(1);
                 }
                 if ((t = (v != this) ? v.deqTask() :
-                     locallyFifo? locallyDeqTask() : popTask()) != null) {
+                     locallyFifo ? locallyDeqTask() : popTask()) != null) {
                     currentSteal = t;
                     t.doExec();
                     currentSteal = ps;
--- a/jdk/src/share/classes/java/util/concurrent/Future.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Future.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/FutureTask.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/FutureTask.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Phaser.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Phaser.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RecursiveTask.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RecursiveTask.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RunnableFuture.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RunnableFuture.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Semaphore.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Semaphore.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -31,7 +31,7 @@
  * Written by Doug Lea, Bill Scherer, and Michael Scott with
  * assistance from members of JCP JSR-166 Expert Group and released to
  * the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ThreadFactory.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadFactory.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/TimeoutException.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/TimeoutException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/TransferQueue.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/TransferQueue.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
@@ -80,9 +80,8 @@
  * </pre>
  *
  * <p>The memory effects for accesses and updates of atomics generally
- * follow the rules for volatiles, as stated in
- * <a href="http://java.sun.com/docs/books/jls/"> The Java Language
- * Specification, Third Edition (17.4 Memory Model)</a>:
+ * follow the rules for volatiles, as stated in section 17.4 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <ul>
  *
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/Condition.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Condition.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/Lock.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Lock.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
@@ -120,8 +120,8 @@
  *
  * <p>All {@code Lock} implementations <em>must</em> enforce the same
  * memory synchronization semantics as provided by the built-in monitor
- * lock, as described in <a href="http://java.sun.com/docs/books/jls/">
- * The Java Language Specification, Third Edition (17.4 Memory Model)</a>:
+ * lock, as described in section 17.4 of
+ * <cite>The Java&trade; Language Specification</cite>:
  * <ul>
  * <li>A successful {@code lock} operation has the same memory
  * synchronization effects as a successful <em>Lock</em> action.
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/package-info.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/package-info.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/src/share/classes/java/util/concurrent/package-info.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/package-info.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
@@ -218,8 +218,9 @@
  *
  * <h2><a name="MemoryVisibility">Memory Consistency Properties</a></h2>
  *
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html">
- * Chapter 17 of the Java Language Specification</a> defines the
+ * Chapter 17 of
+ * <cite>The Java&trade; Language Specification</cite>
+ * defines the
  * <i>happens-before</i> relation on memory operations such as reads and
  * writes of shared variables.  The results of a write by one thread are
  * guaranteed to be visible to a read by another thread only if the write
--- a/jdk/src/share/classes/java/util/jar/JarFile.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarFile.java	Thu Apr 21 16:42:06 2011 -0700
@@ -37,6 +37,7 @@
 import sun.security.action.GetPropertyAction;
 import sun.security.util.ManifestEntryVerifier;
 import sun.misc.SharedSecrets;
+import sun.security.util.SignatureFileVerifier;
 
 /**
  * The <code>JarFile</code> class is used to read the contents of a jar file
@@ -178,7 +179,7 @@
                     byte[] b = getBytes(manEntry);
                     man = new Manifest(new ByteArrayInputStream(b));
                     if (!jvInitialized) {
-                        jv = new JarVerifier(b);
+                        jv = new JarVerifier(b, man);
                     }
                 } else {
                     man = new Manifest(super.getInputStream(manEntry));
@@ -297,10 +298,7 @@
             if (names != null) {
                 for (int i = 0; i < names.length; i++) {
                     String name = names[i].toUpperCase(Locale.ENGLISH);
-                    if (name.endsWith(".DSA") ||
-                        name.endsWith(".RSA") ||
-                        name.endsWith(".EC") ||
-                        name.endsWith(".SF")) {
+                    if (SignatureFileVerifier.isBlockOrSF(name)) {
                         // Assume since we found a signature-related file
                         // that the jar is signed and that we therefore
                         // need a JarVerifier and Manifest
@@ -329,17 +327,17 @@
             if (names != null) {
                 for (int i = 0; i < names.length; i++) {
                     JarEntry e = getJarEntry(names[i]);
-                    if (!e.isDirectory()) {
+                    if (!e.isDirectory() &&
+                            SignatureFileVerifier.isBlock(names[i])) {
                         if (mev == null) {
                             mev = new ManifestEntryVerifier
                                 (getManifestFromReference());
                         }
-                        byte[] b = getBytes(e);
-                        if (b != null && b.length > 0) {
-                            jv.beginEntry(e, mev);
-                            jv.update(b.length, b, 0, b.length, mev);
-                            jv.update(-1, null, 0, 0, mev);
-                        }
+                        String key = names[i].substring(
+                                0, names[i].lastIndexOf("."));
+                        jv.verifyBlock(names[i],
+                                getBytes(e),
+                                super.getInputStream(getJarEntry(key + ".SF")));
                     }
                 }
             }
--- a/jdk/src/share/classes/java/util/jar/JarInputStream.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarInputStream.java	Thu Apr 21 16:42:06 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
@@ -95,7 +95,7 @@
             man.read(new ByteArrayInputStream(bytes));
             closeEntry();
             if (doVerify) {
-                jv = new JarVerifier(bytes);
+                jv = new JarVerifier(bytes, man);
                 mev = new ManifestEntryVerifier(man);
             }
             return (JarEntry)super.getNextEntry();
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Thu Apr 21 16:42:06 2011 -0700
@@ -48,35 +48,18 @@
 
     /* a table mapping names to code signers, for jar entries that have
        had their actual hashes verified */
-    private Hashtable verifiedSigners;
+    private Map verifiedSigners;
 
     /* a table mapping names to code signers, for jar entries that have
        passed the .SF/.DSA/.EC -> MANIFEST check */
-    private Hashtable sigFileSigners;
-
-    /* a hash table to hold .SF bytes */
-    private Hashtable sigFileData;
-
-    /** "queue" of pending PKCS7 blocks that we couldn't parse
-     *  until we parsed the .SF file */
-    private ArrayList pendingBlocks;
+    private Map sigFileSigners;
 
     /* cache of CodeSigner objects */
     private ArrayList signerCache;
 
-    /* Are we parsing a block? */
-    private boolean parsingBlockOrSF = false;
-
-    /* Are we done parsing META-INF entries? */
-    private boolean parsingMeta = true;
-
     /* Are there are files to verify? */
     private boolean anyToVerify = true;
 
-    /* The output stream to use when keeping track of files we are interested
-       in */
-    private ByteArrayOutputStream baos;
-
     /** The ManifestDigester object */
     private volatile ManifestDigester manDig;
 
@@ -92,20 +75,20 @@
     /** collect -DIGEST-MANIFEST values for blacklist */
     private List manifestDigests;
 
-    public JarVerifier(byte rawBytes[]) {
+    /** The manifest object */
+    Manifest man = null;
+
+    public JarVerifier(byte rawBytes[], Manifest man) {
+        this.man = man;
         manifestRawBytes = rawBytes;
-        sigFileSigners = new Hashtable();
-        verifiedSigners = new Hashtable();
-        sigFileData = new Hashtable(11);
-        pendingBlocks = new ArrayList();
-        baos = new ByteArrayOutputStream();
+        sigFileSigners = new HashMap();
+        verifiedSigners = new HashMap();
         manifestDigests = new ArrayList();
     }
 
     /**
-     * This method scans to see which entry we're parsing and
-     * keeps various state information depending on what type of
-     * file is being parsed.
+     * This method scans to see which entry we're parsing and keeps
+     * various state information depending on the file being parsed.
      */
     public void beginEntry(JarEntry je, ManifestEntryVerifier mev)
         throws IOException
@@ -129,30 +112,6 @@
          *    b. digest mismatch between the actual jar entry and the manifest
          */
 
-        if (parsingMeta) {
-            String uname = name.toUpperCase(Locale.ENGLISH);
-            if ((uname.startsWith("META-INF/") ||
-                 uname.startsWith("/META-INF/"))) {
-
-                if (je.isDirectory()) {
-                    mev.setEntry(null, je);
-                    return;
-                }
-
-                if (SignatureFileVerifier.isBlockOrSF(uname)) {
-                    /* We parse only DSA, RSA or EC PKCS7 blocks. */
-                    parsingBlockOrSF = true;
-                    baos.reset();
-                    mev.setEntry(null, je);
-                }
-                return;
-            }
-        }
-
-        if (parsingMeta) {
-            doneWithMeta();
-        }
-
         if (je.isDirectory()) {
             mev.setEntry(null, je);
             return;
@@ -188,11 +147,7 @@
         throws IOException
     {
         if (b != -1) {
-            if (parsingBlockOrSF) {
-                baos.write(b);
-            } else {
-                mev.update((byte)b);
-            }
+            mev.update((byte)b);
         } else {
             processEntry(mev);
         }
@@ -207,11 +162,7 @@
         throws IOException
     {
         if (n != -1) {
-            if (parsingBlockOrSF) {
-                baos.write(b, off, n);
-            } else {
-                mev.update(b, off, n);
-            }
+            mev.update(b, off, n);
         } else {
             processEntry(mev);
         }
@@ -223,101 +174,10 @@
     private void processEntry(ManifestEntryVerifier mev)
         throws IOException
     {
-        if (!parsingBlockOrSF) {
-            JarEntry je = mev.getEntry();
-            if ((je != null) && (je.signers == null)) {
-                je.signers = mev.verify(verifiedSigners, sigFileSigners);
-                je.certs = mapSignersToCertArray(je.signers);
-            }
-        } else {
-
-            try {
-                parsingBlockOrSF = false;
-
-                if (debug != null) {
-                    debug.println("processEntry: processing block");
-                }
-
-                String uname = mev.getEntry().getName()
-                                             .toUpperCase(Locale.ENGLISH);
-
-                if (uname.endsWith(".SF")) {
-                    String key = uname.substring(0, uname.length()-3);
-                    byte bytes[] = baos.toByteArray();
-                    // add to sigFileData in case future blocks need it
-                    sigFileData.put(key, bytes);
-                    // check pending blocks, we can now process
-                    // anyone waiting for this .SF file
-                    Iterator it = pendingBlocks.iterator();
-                    while (it.hasNext()) {
-                        SignatureFileVerifier sfv =
-                            (SignatureFileVerifier) it.next();
-                        if (sfv.needSignatureFile(key)) {
-                            if (debug != null) {
-                                debug.println(
-                                 "processEntry: processing pending block");
-                            }
-
-                            sfv.setSignatureFile(bytes);
-                            sfv.process(sigFileSigners, manifestDigests);
-                        }
-                    }
-                    return;
-                }
-
-                // now we are parsing a signature block file
-
-                String key = uname.substring(0, uname.lastIndexOf("."));
-
-                if (signerCache == null)
-                    signerCache = new ArrayList();
-
-                if (manDig == null) {
-                    synchronized(manifestRawBytes) {
-                        if (manDig == null) {
-                            manDig = new ManifestDigester(manifestRawBytes);
-                            manifestRawBytes = null;
-                        }
-                    }
-                }
-
-                SignatureFileVerifier sfv =
-                  new SignatureFileVerifier(signerCache,
-                                            manDig, uname, baos.toByteArray());
-
-                if (sfv.needSignatureFileBytes()) {
-                    // see if we have already parsed an external .SF file
-                    byte[] bytes = (byte[]) sigFileData.get(key);
-
-                    if (bytes == null) {
-                        // put this block on queue for later processing
-                        // since we don't have the .SF bytes yet
-                        // (uname, block);
-                        if (debug != null) {
-                            debug.println("adding pending block");
-                        }
-                        pendingBlocks.add(sfv);
-                        return;
-                    } else {
-                        sfv.setSignatureFile(bytes);
-                    }
-                }
-                sfv.process(sigFileSigners, manifestDigests);
-
-            } catch (IOException ioe) {
-                // e.g. sun.security.pkcs.ParsingException
-                if (debug != null) debug.println("processEntry caught: "+ioe);
-                // ignore and treat as unsigned
-            } catch (SignatureException se) {
-                if (debug != null) debug.println("processEntry caught: "+se);
-                // ignore and treat as unsigned
-            } catch (NoSuchAlgorithmException nsae) {
-                if (debug != null) debug.println("processEntry caught: "+nsae);
-                // ignore and treat as unsigned
-            } catch (CertificateException ce) {
-                if (debug != null) debug.println("processEntry caught: "+ce);
-                // ignore and treat as unsigned
-            }
+        JarEntry je = mev.getEntry();
+        if ((je != null) && (je.signers == null)) {
+            je.signers = mev.verify(verifiedSigners, sigFileSigners);
+            je.certs = mapSignersToCertArray(je.signers);
         }
     }
 
@@ -354,15 +214,15 @@
              * Force a read of the entry data to generate the
              * verification hash.
              */
-            try {
-                InputStream s = jar.getInputStream(entry);
+            try (InputStream s = jar.getInputStream(entry)) {
                 byte[] buffer = new byte[1024];
                 int n = buffer.length;
                 while (n != -1) {
                     n = s.read(buffer, 0, buffer.length);
                 }
-                s.close();
             } catch (IOException e) {
+                // Ignore. When an exception is thrown, code signer
+                // will not be assigned.
             }
         }
         return getCodeSigners(name);
@@ -408,11 +268,7 @@
      */
     void doneWithMeta()
     {
-        parsingMeta = false;
         anyToVerify = !sigFileSigners.isEmpty();
-        baos = null;
-        sigFileData = null;
-        pendingBlocks = null;
         signerCache = null;
         manDig = null;
         // MANIFEST.MF is always treated as signed and verified,
@@ -423,6 +279,41 @@
         }
     }
 
+    /**
+     * Verifies a PKCS7 SignedData block
+     * @param key name of block
+     * @param block the pkcs7 file
+     * @param ins the clear data
+     */
+    void verifyBlock(String key, byte[] block, InputStream ins) {
+        try {
+            if (signerCache == null)
+                signerCache = new ArrayList();
+
+            if (manDig == null) {
+                synchronized(manifestRawBytes) {
+                    if (manDig == null) {
+                        manDig = new ManifestDigester(manifestRawBytes);
+                        manifestRawBytes = null;
+                    }
+                }
+            }
+            SignatureFileVerifier sfv =
+                    new SignatureFileVerifier(signerCache, man,
+                                        manDig, key, block);
+
+            if (sfv.needSignatureFile()) {
+                // see if we have already parsed an external .SF file
+                sfv.setSignatureFile(ins);
+            }
+            sfv.process(sigFileSigners, manifestDigests);
+        } catch (Exception e) {
+            if (debug != null) {
+                e.printStackTrace();
+            }
+        }
+    }
+
     static class VerifierStream extends java.io.InputStream {
 
         private InputStream is;
@@ -553,10 +444,7 @@
          * but this handles a CodeSource of any type, just in case.
          */
         CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
-        List sourceList = new ArrayList();
-        for (int i = 0; i < sources.length; i++) {
-            sourceList.add(sources[i]);
-        }
+        List sourceList = Arrays.asList(sources);
         int j = sourceList.indexOf(cs);
         if (j != -1) {
             CodeSigner[] match;
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Thu Apr 21 16:42:06 2011 -0700
@@ -181,8 +181,8 @@
      * The class files will not contain identical bytes, since the unpacker
      * is free to change minor class file features such as constant pool order.
      * However, the class files will be semantically identical,
-     * as specified in the Java Virtual Machine Specification
-     * <a href="http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html">http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html</a>.
+     * as specified in
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      * <p>
      * By default, the packer does not change the order of JAR elements.
      * Also, the modification time and deflation hint of each
--- a/jdk/src/share/classes/java/util/logging/FileHandler.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/FileHandler.java	Thu Apr 21 16:42:06 2011 -0700
@@ -409,22 +409,25 @@
                     // Try the next file.
                     continue;
                 }
+                boolean available;
                 try {
-                    FileLock fl = fc.tryLock();
-                    if (fl == null) {
-                        // We failed to get the lock.  Try next file.
-                        continue;
-                    }
+                    available = fc.tryLock() != null;
                     // We got the lock OK.
                 } catch (IOException ix) {
                     // We got an IOException while trying to get the lock.
                     // This normally indicates that locking is not supported
                     // on the target directory.  We have to proceed without
                     // getting a lock.   Drop through.
+                    available = true;
                 }
-                // We got the lock.  Remember it.
-                locks.put(lockFileName, lockFileName);
-                break;
+                if (available) {
+                    // We got the lock.  Remember it.
+                    locks.put(lockFileName, lockFileName);
+                    break;
+                }
+
+                // We failed to get the lock.  Try next file.
+                fc.close();
             }
         }
 
--- a/jdk/src/share/classes/java/util/regex/Pattern.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Thu Apr 21 16:42:06 2011 -0700
@@ -369,13 +369,10 @@
  * part of an unescaped construct.
  *
  * <p> Backslashes within string literals in Java source code are interpreted
- * as required by the <a
- * href="http://java.sun.com/docs/books/jls">Java Language
- * Specification</a> as either <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850">Unicode
- * escapes</a> or other <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089">character
- * escapes</a>.  It is therefore necessary to double backslashes in string
+ * as required by
+ * <cite>The Java&trade; Language Specification</cite>
+ * as either Unicode escapes (section 3.3) or other character escapes (section 3.10.6)
+ * It is therefore necessary to double backslashes in string
  * literals that represent regular expressions to protect them from
  * interpretation by the Java bytecode compiler.  The string literal
  * <tt>"&#92;b"</tt>, for example, matches a single backspace character when
@@ -525,9 +522,9 @@
  * Canonical Equivalents.
  *
  * <p> Unicode escape sequences such as <tt>&#92;u2014</tt> in Java source code
- * are processed as described in <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850">\u00A73.3</a>
- * of the Java Language Specification.  Such escape sequences are also
+ * are processed as described in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>.
+ * Such escape sequences are also
  * implemented directly by the regular-expression parser so that Unicode
  * escapes can be used in expressions that are read from files or from the
  * keyboard.  Thus the strings <tt>"&#92;u2014"</tt> and <tt>"\\u2014"</tt>,
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java	Thu Apr 21 16:42:06 2011 -0700
@@ -31,11 +31,13 @@
 import java.io.EOFException;
 import java.io.File;
 import java.nio.charset.Charset;
-import java.util.Vector;
+import java.util.ArrayDeque;
+import java.util.Deque;
 import java.util.Enumeration;
-import java.util.Set;
-import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.NoSuchElementException;
+import java.util.WeakHashMap;
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
 import static java.util.zip.ZipConstants64.*;
@@ -54,7 +56,7 @@
     private long jzfile;  // address of jzfile data
     private String name;  // zip file name
     private int total;    // total number of entries
-    private boolean closeRequested;
+    private volatile boolean closeRequested = false;
 
     private static final int STORED = ZipEntry.STORED;
     private static final int DEFLATED = ZipEntry.DEFLATED;
@@ -314,8 +316,9 @@
     // freeEntry releases the C jzentry struct.
     private static native void freeEntry(long jzfile, long jzentry);
 
-    // the outstanding inputstreams that need to be closed.
-    private Set<InputStream> streams = new HashSet<>();
+    // the outstanding inputstreams that need to be closed,
+    // mapped to the inflater objects they use.
+    private final Map<InputStream, Inflater> streams = new WeakHashMap<>();
 
     /**
      * Returns an input stream for reading the contents of the specified
@@ -351,51 +354,21 @@
 
             switch (getEntryMethod(jzentry)) {
             case STORED:
-                streams.add(in);
+                synchronized (streams) {
+                    streams.put(in, null);
+                }
                 return in;
             case DEFLATED:
-                final ZipFileInputStream zfin = in;
                 // MORE: Compute good size for inflater stream:
                 long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
                 if (size > 65536) size = 8192;
                 if (size <= 0) size = 4096;
-                InputStream is = new InflaterInputStream(zfin, getInflater(), (int)size) {
-                    private boolean isClosed = false;
-
-                    public void close() throws IOException {
-                        if (!isClosed) {
-                            super.close();
-                            releaseInflater(inf);
-                            isClosed = true;
-                        }
-                    }
-                    // Override fill() method to provide an extra "dummy" byte
-                    // at the end of the input stream. This is required when
-                    // using the "nowrap" Inflater option.
-                    protected void fill() throws IOException {
-                        if (eof) {
-                            throw new EOFException(
-                                "Unexpected end of ZLIB input stream");
-                        }
-                        len = this.in.read(buf, 0, buf.length);
-                        if (len == -1) {
-                            buf[0] = 0;
-                            len = 1;
-                            eof = true;
-                        }
-                        inf.setInput(buf, 0, len);
-                    }
-                    private boolean eof;
-
-                    public int available() throws IOException {
-                        if (isClosed)
-                            return 0;
-                        long avail = zfin.size() - inf.getBytesWritten();
-                        return avail > (long) Integer.MAX_VALUE ?
-                            Integer.MAX_VALUE : (int) avail;
-                    }
-                };
-                streams.add(is);
+                Inflater inf = getInflater();
+                InputStream is =
+                    new ZipFileInflaterInputStream(in, inf, (int)size);
+                synchronized (streams) {
+                    streams.put(is, inf);
+                }
                 return is;
             default:
                 throw new ZipException("invalid compression method");
@@ -403,36 +376,91 @@
         }
     }
 
+    private class ZipFileInflaterInputStream extends InflaterInputStream {
+        private volatile boolean closeRequested = false;
+        private boolean eof = false;
+        private final ZipFileInputStream zfin;
+
+        ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
+                int size) {
+            super(zfin, inf, size);
+            this.zfin = zfin;
+        }
+
+        public void close() throws IOException {
+            if (closeRequested)
+                return;
+            closeRequested = true;
+
+            super.close();
+            Inflater inf;
+            synchronized (streams) {
+                inf = streams.remove(this);
+            }
+            if (inf != null) {
+                releaseInflater(inf);
+            }
+        }
+
+        // Override fill() method to provide an extra "dummy" byte
+        // at the end of the input stream. This is required when
+        // using the "nowrap" Inflater option.
+        protected void fill() throws IOException {
+            if (eof) {
+                throw new EOFException("Unexpected end of ZLIB input stream");
+            }
+            len = in.read(buf, 0, buf.length);
+            if (len == -1) {
+                buf[0] = 0;
+                len = 1;
+                eof = true;
+            }
+            inf.setInput(buf, 0, len);
+        }
+
+        public int available() throws IOException {
+            if (closeRequested)
+                return 0;
+            long avail = zfin.size() - inf.getBytesWritten();
+            return (avail > (long) Integer.MAX_VALUE ?
+                    Integer.MAX_VALUE : (int) avail);
+        }
+
+        protected void finalize() throws Throwable {
+            close();
+        }
+    }
+
     /*
      * Gets an inflater from the list of available inflaters or allocates
      * a new one.
      */
     private Inflater getInflater() {
-        synchronized (inflaters) {
-            int size = inflaters.size();
-            if (size > 0) {
-                Inflater inf = (Inflater)inflaters.remove(size - 1);
-                return inf;
-            } else {
-                return new Inflater(true);
+        Inflater inf;
+        synchronized (inflaterCache) {
+            while (null != (inf = inflaterCache.poll())) {
+                if (false == inf.ended()) {
+                    return inf;
+                }
             }
         }
+        return new Inflater(true);
     }
 
     /*
      * Releases the specified inflater to the list of available inflaters.
      */
     private void releaseInflater(Inflater inf) {
-        synchronized (inflaters) {
-            if (inf.ended())
-                return;
+        if (false == inf.ended()) {
             inf.reset();
-            inflaters.add(inf);
+            synchronized (inflaterCache) {
+                inflaterCache.add(inf);
+            }
         }
     }
 
     // List of available Inflater objects for decompression
-    private Vector inflaters = new Vector();
+    private Deque<Inflater> inflaterCache = new ArrayDeque<>();
 
     /**
      * Returns the path name of the ZIP file.
@@ -540,14 +568,32 @@
      * @throws IOException if an I/O error has occurred
      */
     public void close() throws IOException {
-        synchronized (this) {
-            closeRequested = true;
+        if (closeRequested)
+            return;
+        closeRequested = true;
 
-            if (streams.size() !=0) {
-                Set<InputStream> copy = streams;
-                streams = new HashSet<>();
-                for (InputStream is: copy)
-                    is.close();
+        synchronized (this) {
+            // Close streams, release their inflaters
+            synchronized (streams) {
+                if (false == streams.isEmpty()) {
+                    Map<InputStream, Inflater> copy = new HashMap<>(streams);
+                    streams.clear();
+                    for (Map.Entry<InputStream, Inflater> e : copy.entrySet()) {
+                        e.getKey().close();
+                        Inflater inf = e.getValue();
+                        if (inf != null) {
+                            inf.end();
+                        }
+                    }
+                }
+            }
+
+            // Release cached inflaters
+            Inflater inf;
+            synchronized (inflaterCache) {
+                while (null != (inf = inflaterCache.poll())) {
+                    inf.end();
+                }
             }
 
             if (jzfile != 0) {
@@ -556,23 +602,13 @@
                 jzfile = 0;
 
                 close(zf);
-
-                // Release inflaters
-                synchronized (inflaters) {
-                    int size = inflaters.size();
-                    for (int i = 0; i < size; i++) {
-                        Inflater inf = (Inflater)inflaters.get(i);
-                        inf.end();
-                    }
-                }
             }
         }
     }
 
-
     /**
-     * Ensures that the <code>close</code> method of this ZIP file is
-     * called when there are no more references to it.
+     * Ensures that the system resources held by this ZipFile object are
+     * released when there are no more references to it.
      *
      * <p>
      * Since the time when GC would invoke this method is undetermined,
@@ -611,6 +647,7 @@
      * (possibly compressed) zip file entry.
      */
    private class ZipFileInputStream extends InputStream {
+        private volatile boolean closeRequested = false;
         protected long jzentry; // address of jzentry data
         private   long pos;     // current position within entry data
         protected long rem;     // number of remaining bytes within entry
@@ -678,15 +715,25 @@
         }
 
         public void close() {
+            if (closeRequested)
+                return;
+            closeRequested = true;
+
             rem = 0;
             synchronized (ZipFile.this) {
                 if (jzentry != 0 && ZipFile.this.jzfile != 0) {
                     freeEntry(ZipFile.this.jzfile, jzentry);
                     jzentry = 0;
                 }
+            }
+            synchronized (streams) {
                 streams.remove(this);
             }
         }
+
+        protected void finalize() {
+            close();
+        }
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/crypto/AEADBadTagException.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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 javax.crypto;
+
+/**
+ * This exception is thrown when a {@link Cipher} operating in
+ * an AEAD mode (such as GCM/CCM) is unable to verify the supplied
+ * authentication tag.
+ *
+ * @since 1.7
+ */
+public class AEADBadTagException extends BadPaddingException {
+
+    private static final long serialVersionUID = -488059093241685509L;
+
+    /**
+     * Constructs a AEADBadTagException with no detail message.
+     */
+    public AEADBadTagException() {
+        super();
+    }
+
+    /**
+     * Constructs a AEADBadTagException with the specified
+     * detail message.
+     *
+     * @param msg the detail message.
+     */
+    public AEADBadTagException(String msg) {
+        super(msg);
+    }
+}
--- a/jdk/src/share/classes/javax/crypto/Cipher.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/crypto/Cipher.java	Thu Apr 21 16:42:06 2011 -0700
@@ -88,8 +88,35 @@
  * example, the SunJCE provider uses a default of 64 bits for DES.)
  * Thus, block ciphers can be turned into byte-oriented stream ciphers by
  * using an 8 bit mode such as CFB8 or OFB8.
+ * <p>
+ * Modes such as Authenticated Encryption with Associated Data (AEAD)
+ * provide authenticity assurances for both confidential data and
+ * Additional Associated Data (AAD) that is not encrypted.  (Please see
+ * <a href="http://www.ietf.org/rfc/rfc5116.txt"> RFC 5116 </a> for more
+ * information on AEAD and AEAD algorithms such as GCM/CCM.) Both
+ * confidential and AAD data can be used when calculating the
+ * authentication tag (similar to a {@link Mac}).  This tag is appended
+ * to the ciphertext during encryption, and is verified on decryption.
+ * <p>
+ * AEAD modes such as GCM/CCM perform all AAD authenticity calculations
+ * before starting the ciphertext authenticity calculations.  To avoid
+ * implementations having to internally buffer ciphertext, all AAD data
+ * must be supplied to GCM/CCM implementations (via the {@code
+ * updateAAD} methods) <b>before</b> the ciphertext is processed (via
+ * the {@code update} and {@code doFinal} methods).
  *
- * <p> Every implementation of the Java platform is required to support
+ * <pre>
+ *     GCMParameterSpec s = new GCMParameterSpec(...);
+ *     cipher.init(..., s);
+ *
+ *     // If the GCMParameterSpec is needed again
+ *     cipher.getParameters().getParameterSpec(GCMParameterSpec.class));
+ *
+ *     cipher.updateAAD(...);  // AAD
+ *     cipher.update(...);     // Multi-part update
+ *     cipher.doFinal(...);    // conclusion of operation
+ * </pre>
+ * Every implementation of the Java platform is required to support
  * the following standard <code>Cipher</code> transformations with the keysizes
  * in parentheses:
  * <ul>
@@ -894,7 +921,7 @@
      * <code>inputLen</code> (in bytes).
      *
      * <p>This call takes into account any unprocessed (buffered) data from a
-     * previous <code>update</code> call, and padding.
+     * previous <code>update</code> call, padding, and AEAD tagging.
      *
      * <p>The actual output length of the next <code>update</code> or
      * <code>doFinal</code> call may be smaller than the length returned by
@@ -1090,6 +1117,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the {@link SecureRandom <code>SecureRandom</code>}
@@ -1110,8 +1142,8 @@
      * @param key the key
      *
      * @exception InvalidKeyException if the given key is inappropriate for
-     * initializing this cipher, or if this cipher is being initialized for
-     * decryption and requires algorithm parameters that cannot be
+     * initializing this cipher, or requires
+     * algorithm parameters that cannot be
      * determined from the given key, or if the given key has a keysize that
      * exceeds the maximum allowable keysize (as determined from the
      * configured jurisdiction policy files).
@@ -1138,6 +1170,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1155,8 +1192,8 @@
      * @param random the source of randomness
      *
      * @exception InvalidKeyException if the given key is inappropriate for
-     * initializing this cipher, or if this cipher is being initialized for
-     * decryption and requires algorithm parameters that cannot be
+     * initializing this cipher, or requires
+     * algorithm parameters that cannot be
      * determined from the given key, or if the given key has a keysize that
      * exceeds the maximum allowable keysize (as determined from the
      * configured jurisdiction policy files).
@@ -1202,6 +1239,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the {@link SecureRandom <code>SecureRandom</code>}
@@ -1227,7 +1269,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1258,6 +1300,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1280,7 +1327,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1323,6 +1370,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the {@link SecureRandom <code>SecureRandom</code>}
@@ -1348,7 +1400,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1379,6 +1431,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1401,7 +1458,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1444,7 +1501,7 @@
      * derived from the public key in the given certificate, the underlying
      * cipher
      * implementation is supposed to generate the required parameters itself
-     * (using provider-specific default or ramdom values) if it is being
+     * (using provider-specific default or random values) if it is being
      * initialized for encryption or key wrapping, and raise an <code>
      * InvalidKeyException</code> if it is being initialized for decryption or
      * key unwrapping.
@@ -1452,6 +1509,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the
@@ -1474,8 +1536,7 @@
      *
      * @exception InvalidKeyException if the public key in the given
      * certificate is inappropriate for initializing this cipher, or this
-     * cipher is being initialized for decryption or unwrapping keys and
-     * requires algorithm parameters that cannot be determined from the
+     * cipher requires algorithm parameters that cannot be determined from the
      * public key in the given certificate, or the keysize of the public key
      * in the given certificate has a keysize that exceeds the maximum
      * allowable keysize (as determined by the configured jurisdiction policy
@@ -1518,6 +1579,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1536,7 +1602,7 @@
      *
      * @exception InvalidKeyException if the public key in the given
      * certificate is inappropriate for initializing this cipher, or this
-     * cipher is being initialized for decryption or unwrapping keys and
+     * cipher
      * requires algorithm parameters that cannot be determined from the
      * public key in the given certificate, or the keysize of the public key
      * in the given certificate has a keysize that exceeds the maximum
@@ -1865,6 +1931,9 @@
      * <p>Input data that may have been buffered during a previous
      * <code>update</code> operation is processed, with padding (if requested)
      * being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -1888,6 +1957,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final byte[] doFinal()
             throws IllegalBlockSizeException, BadPaddingException {
@@ -1904,6 +1976,9 @@
      * <p>Input data that may have been buffered during a previous
      * <code>update</code> operation is processed, with padding (if requested)
      * being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer, starting at
      * <code>outputOffset</code> inclusive.
      *
@@ -1940,6 +2015,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final int doFinal(byte[] output, int outputOffset)
             throws IllegalBlockSizeException, ShortBufferException,
@@ -1963,6 +2041,9 @@
      * <p>The bytes in the <code>input</code> buffer, and any input bytes that
      * may have been buffered during a previous <code>update</code> operation,
      * are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -1988,6 +2069,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final byte[] doFinal(byte[] input)
             throws IllegalBlockSizeException, BadPaddingException {
@@ -2011,6 +2095,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -2039,6 +2126,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final byte[] doFinal(byte[] input, int inputOffset, int inputLen)
             throws IllegalBlockSizeException, BadPaddingException {
@@ -2063,6 +2153,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer.
      *
      * <p>If the <code>output</code> buffer is too small to hold the result,
@@ -2105,6 +2198,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final int doFinal(byte[] input, int inputOffset, int inputLen,
                              byte[] output)
@@ -2133,6 +2229,9 @@
      * bytes that may have been buffered during a previous
      * <code>update</code> operation, are processed, with padding
      * (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer, starting at
      * <code>outputOffset</code> inclusive.
      *
@@ -2178,6 +2277,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final int doFinal(byte[] input, int inputOffset, int inputLen,
                              byte[] output, int outputOffset)
@@ -2203,8 +2305,11 @@
      * depending on how this cipher was initialized.
      *
      * <p>All <code>input.remaining()</code> bytes starting at
-     * <code>input.position()</code> are processed. The result is stored
-     * in the output buffer.
+     * <code>input.position()</code> are processed.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
+     * The result is stored in the output buffer.
      * Upon return, the input buffer's position will be equal
      * to its limit; its limit will not have changed. The output buffer's
      * position will have advanced by n, where n is the value returned
@@ -2250,6 +2355,10 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
+     *
      * @since 1.5
      */
     public final int doFinal(ByteBuffer input, ByteBuffer output)
@@ -2441,4 +2550,128 @@
         CryptoPermission cp = getConfiguredPermission(transformation);
         return cp.getAlgorithmParameterSpec();
     }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD).
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     *
+     * @param src the buffer containing the Additional Authentication Data
+     *
+     * @throws IllegalArgumentException if the {@code src}
+     * byte array is null
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if the corresponding method
+     * in the {@code CipherSpi} has not been overridden by an
+     * implementation
+     *
+     * @since 1.7
+     */
+    public final void updateAAD(byte[] src) {
+        if (src == null) {
+            throw new IllegalArgumentException("src buffer is null");
+        }
+
+        updateAAD(src, 0, src.length);
+    }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD), using a subset of the provided buffer.
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     *
+     * @param src the buffer containing the AAD
+     * @param offset the offset in {@code src} where the AAD input starts
+     * @param len the number of AAD bytes
+     *
+     * @throws IllegalArgumentException if the {@code src}
+     * byte array is null, or the {@code offset} or {@code length}
+     * is less than 0, or the sum of the {@code offset} and
+     * {@code len} is greater than the length of the
+     * {@code src} byte array
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if the corresponding method
+     * in the {@code CipherSpi} has not been overridden by an
+     * implementation
+     *
+     * @since 1.7
+     */
+    public final void updateAAD(byte[] src, int offset, int len) {
+        checkCipherState();
+
+        // Input sanity check
+        if ((src == null) || (offset < 0) || (len < 0)
+                || ((len + offset) > src.length)) {
+            throw new IllegalArgumentException("Bad arguments");
+        }
+
+        chooseFirstProvider();
+        if (len == 0) {
+            return;
+        }
+        spi.engineUpdateAAD(src, offset, len);
+    }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD).
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     * <p>
+     * All {@code src.remaining()} bytes starting at
+     * {@code src.position()} are processed.
+     * Upon return, the input buffer's position will be equal
+     * to its limit; its limit will not have changed.
+     *
+     * @param src the buffer containing the AAD
+     *
+     * @throws IllegalArgumentException if the {@code src ByteBuffer}
+     * is null
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if the corresponding method
+     * in the {@code CipherSpi} has not been overridden by an
+     * implementation
+     *
+     * @since 1.7
+     */
+    public final void updateAAD(ByteBuffer src) {
+        checkCipherState();
+
+        // Input sanity check
+        if (src == null) {
+            throw new IllegalArgumentException("src ByteBuffer is null");
+        }
+
+        chooseFirstProvider();
+        if (src.remaining() == 0) {
+            return;
+        }
+        spi.engineUpdateAAD(src);
+    }
 }
--- a/jdk/src/share/classes/javax/crypto/CipherSpi.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/crypto/CipherSpi.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -266,7 +266,7 @@
      * <code>inputLen</code> (in bytes).
      *
      * <p>This call takes into account any unprocessed (buffered) data from a
-     * previous <code>update</code> call, and padding.
+     * previous <code>update</code> call, padding, and AEAD tagging.
      *
      * <p>The actual output length of the next <code>update</code> or
      * <code>doFinal</code> call may be smaller than the length returned by
@@ -322,6 +322,11 @@
      * {@link #engineGetParameters() engineGetParameters} or
      * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -339,8 +344,8 @@
      * @param random the source of randomness
      *
      * @exception InvalidKeyException if the given key is inappropriate for
-     * initializing this cipher, or if this cipher is being initialized for
-     * decryption and requires algorithm parameters that cannot be
+     * initializing this cipher, or requires
+     * algorithm parameters that cannot be
      * determined from the given key.
      */
     protected abstract void engineInit(int opmode, Key key,
@@ -366,6 +371,11 @@
      * {@link #engineGetParameters() engineGetParameters} or
      * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -387,7 +397,7 @@
      * initializing this cipher
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or if this cipher is being initialized for decryption and requires
+     * or if this cipher requires
      * algorithm parameters and <code>params</code> is null.
      */
     protected abstract void engineInit(int opmode, Key key,
@@ -414,6 +424,11 @@
      * {@link #engineGetParameters() engineGetParameters} or
      * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -435,7 +450,7 @@
      * initializing this cipher
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or if this cipher is being initialized for decryption and requires
+     * or if this cipher requires
      * algorithm parameters and <code>params</code> is null.
      */
     protected abstract void engineInit(int opmode, Key key,
@@ -548,6 +563,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -575,6 +593,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     protected abstract byte[] engineDoFinal(byte[] input, int inputOffset,
                                             int inputLen)
@@ -590,6 +611,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer, starting at
      * <code>outputOffset</code> inclusive.
      *
@@ -626,6 +650,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     protected abstract int engineDoFinal(byte[] input, int inputOffset,
                                          int inputLen, byte[] output,
@@ -640,8 +667,11 @@
      * initialized.
      *
      * <p>All <code>input.remaining()</code> bytes starting at
-     * <code>input.position()</code> are processed. The result is stored
-     * in the output buffer.
+     * <code>input.position()</code> are processed.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
+     * The result is stored in the output buffer.
      * Upon return, the input buffer's position will be equal
      * to its limit; its limit will not have changed. The output buffer's
      * position will have advanced by n, where n is the value returned
@@ -678,6 +708,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      *
      * @throws NullPointerException if either parameter is <CODE>null</CODE>
      * @since 1.5
@@ -892,4 +925,67 @@
     {
         throw new UnsupportedOperationException();
     }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD), using a subset of the provided buffer.
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     *
+     * @param src the buffer containing the AAD
+     * @param offset the offset in {@code src} where the AAD input starts
+     * @param len the number of AAD bytes
+     *
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if this method
+     * has not been overridden by an implementation
+     *
+     * @since 1.7
+     */
+    protected void engineUpdateAAD(byte[] src, int offset, int len) {
+        throw new UnsupportedOperationException(
+            "The underlying Cipher implementation "
+            +  "does not support this method");
+    }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD).
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     * <p>
+     * All {@code src.remaining()} bytes starting at
+     * {@code src.position()} are processed.
+     * Upon return, the input buffer's position will be equal
+     * to its limit; its limit will not have changed.
+     *
+     * @param src the buffer containing the AAD
+     *
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if this method
+     * has not been overridden by an implementation
+     *
+     * @since 1.7
+     */
+    protected void engineUpdateAAD(ByteBuffer src) {
+        throw new UnsupportedOperationException(
+            "The underlying Cipher implementation "
+            +  "does not support this method");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/crypto/spec/GCMParameterSpec.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,149 @@
+/*
+ * 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 javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * Specifies the set of parameters required by a {@link
+ * javax.crypto.Cipher} using the Galois/Counter Mode (GCM) mode.
+ * <p>
+ * Simple block cipher modes (such as CBC) generally require only an
+ * initialization vector (such as {@code IvParameterSpec}),
+ * but GCM needs these parameters:
+ * <ul>
+ * <li>{@code IV}: Initialization Vector (IV) </li>
+ * <li>{@code tLen}: length (in bits) of authentication tag T</li>
+ * </ul>
+ * <p>
+ * In addition to the parameters described here, other GCM inputs/output
+ * (Additional Authenticated Data (AAD), Keys, block ciphers,
+ * plain/ciphertext and authentication tags) are handled in the {@code
+ * Cipher} class.
+  <p>
+ * Please see <a href="http://www.ietf.org/rfc/rfc5116.txt"> RFC 5116
+ * </a> for more information on the Authenticated Encryption with
+ * Associated Data (AEAD) algorithm, and <a href=
+ * "http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf">
+ * NIST Special Publication 800-38D</a>, "NIST Recommendation for Block
+ * Cipher Modes of Operation:  Galois/Counter Mode (GCM) and GMAC."
+ * <p>
+ * The GCM specification states that {@code tLen} may only have the
+ * values {128, 120, 112, 104, 96}, or {64, 32} for certain
+ * applications.  Other values can be specified for this class, but not
+ * all CSP implementations will support them.
+ *
+ * @see javax.crypto.Cipher
+ *
+ * @since 1.7
+ */
+public class GCMParameterSpec implements AlgorithmParameterSpec {
+
+    // Initialization Vector.  Could use IvParameterSpec, but that
+    // would add extra copies.
+    private byte[] iv;
+
+    // Required Tag length (in bits).
+    private int tLen;
+
+    /**
+     * Constructs a GCMParameterSpec using the specified authentication
+     * tag bit-length and IV buffer.
+     *
+     * @param tLen the authentication tag length (in bits)
+     * @param src the IV source buffer.  The contents of the buffer are
+     * copied to protect against subsequent modification.
+     *
+     * @throws IllegalArgumentException if {@code tLen} is negative,
+     * or {@code src} is null.
+     */
+    public GCMParameterSpec(int tLen, byte[] src) {
+        if (src == null) {
+            throw new IllegalArgumentException("src array is null");
+        }
+
+        init(tLen, src, 0, src.length);
+    }
+
+    /**
+     * Constructs a GCMParameterSpec object using the specified
+     * authentication tag bit-length and a subset of the specified
+     * buffer as the IV.
+     *
+     * @param tLen the authentication tag length (in bits)
+     * @param src the IV source buffer.  The contents of the
+     * buffer are copied to protect against subsequent modification.
+     * @param offset the offset in {@code src} where the IV starts
+     * @param len the number of IV bytes
+     *
+     * @throws IllegalArgumentException if {@code tLen} is negative,
+     * {@code src} is null, {@code len} or {@code offset} is negative,
+     * or the sum of {@code offset} and {@code len} is greater than the
+     * length of the {@code src} byte array.
+     */
+    public GCMParameterSpec(int tLen, byte[] src, int offset, int len) {
+        init(tLen, src, offset, len);
+    }
+
+    /*
+     * Check input parameters.
+     */
+    private void init(int tLen, byte[] src, int offset, int len) {
+        if (tLen < 0) {
+            throw new IllegalArgumentException(
+                "Length argument is negative");
+        }
+        this.tLen = tLen;
+
+        // Input sanity check
+        if ((src == null) ||(len < 0) || (offset < 0)
+                || ((len + offset) > src.length)) {
+            throw new IllegalArgumentException("Invalid buffer arguments");
+        }
+
+        iv = new byte[len];
+        System.arraycopy(src, offset, iv, 0, len);
+    }
+
+    /**
+     * Returns the authentication tag length.
+     *
+     * @return the authentication tag length (in bits)
+     */
+    public int getTLen() {
+        return tLen;
+    }
+
+    /**
+     * Returns the Initialization Vector (IV).
+     *
+     * @return the IV.  Creates a new array each time this method
+     * is called.
+     */
+    public byte[] getIV() {
+        return iv.clone();
+    }
+}
--- a/jdk/src/share/classes/javax/management/remote/package.html	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/management/remote/package.html	Thu Apr 21 16:42:06 2011 -0700
@@ -154,11 +154,8 @@
       </pre>
 
       <p>The formal grammar for connection ids that follow this
-	convention is as follows (using the <a
-	href="http://java.sun.com/docs/books/jls/second_edition/html/grammars.doc.html#90767">grammar
-	notation</a> from <em>The Java Language Specification, Second
-	Edition</em>):</p>
-
+         convention is as follows (using the grammar notation from section 2.4 of 
+         <em>The Java&trade; Language Specification</em>):</p>
       <pre>
 <em>ConnectionId:</em>
     <em>Protocol</em> : <em>ClientAddress<sub>opt</sub></em> Space <em>ClientId<sub>opt</sub></em> Space <em>ArbitraryText</em>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java	Thu Apr 21 16:42:06 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.
+ */
+
+package javax.security.auth.kerberos;
+
+import sun.misc.JavaxSecurityAuthKerberosAccess;
+import sun.security.krb5.EncryptionKey;
+import sun.security.krb5.PrincipalName;
+
+class JavaxSecurityAuthKerberosAccessImpl
+        implements JavaxSecurityAuthKerberosAccess {
+    public EncryptionKey[] keyTabGetEncryptionKeys(
+            KeyTab ktab, PrincipalName principal) {
+        return ktab.getEncryptionKeys(principal);
+    }
+}
--- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, 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
@@ -35,14 +35,16 @@
  * principal.<p>
  *
  * All Kerberos JAAS login modules that obtain a principal's password and
- * generate the secret key from it should use this class. Where available,
- * the login module might even read this secret key directly from a
- * Kerberos "keytab". Sometimes, such as when authenticating a server in
+ * generate the secret key from it should use this class.
+ * Sometimes, such as when authenticating a server in
  * the absence of user-to-user authentication, the login module will store
  * an instance of this class in the private credential set of a
  * {@link javax.security.auth.Subject Subject} during the commit phase of the
  * authentication process.<p>
  *
+ * A Kerberos service using a keytab to read secret keys should use
+ * the {@link KeyTab} class, where latest keys can be read when needed.<p>
+ *
  * It might be necessary for the application to be granted a
  * {@link javax.security.auth.PrivateCredentialPermission
  * PrivateCredentialPermission} if it needs to access the KerberosKey
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/security/auth/kerberos/KeyTab.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,230 @@
+/*
+ * 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 javax.security.auth.kerberos;
+
+import java.io.File;
+import java.util.Objects;
+import sun.misc.SharedSecrets;
+import sun.security.krb5.EncryptionKey;
+import sun.security.krb5.PrincipalName;
+import sun.security.krb5.RealmException;
+
+/**
+ * This class encapsulates a keytab file.
+ * <p>
+ * A Kerberos JAAS login module that obtains long term secret keys from a
+ * keytab file should use this class. The login module will store
+ * an instance of this class in the private credential set of a
+ * {@link javax.security.auth.Subject Subject} during the commit phase of the
+ * authentication process.
+ * <p>
+ * It might be necessary for the application to be granted a
+ * {@link javax.security.auth.PrivateCredentialPermission
+ * PrivateCredentialPermission} if it needs to access the KeyTab
+ * instance from a Subject. This permission is not needed when the
+ * application depends on the default JGSS Kerberos mechanism to access the
+ * KeyTab. In that case, however, the application will need an appropriate
+ * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
+ * <p>
+ * The keytab file format is described at
+ * <a href="http://www.ioplex.com/utilities/keytab.txt">
+ * http://www.ioplex.com/utilities/keytab.txt</a>.
+ *
+ * @since 1.7
+ */
+public final class KeyTab {
+
+    /*
+     * Impl notes:
+     *
+     * This class is only a name, a permanent link to the keytab source
+     * (can be missing). Itself has no content. In order to read content,
+     * take a snapshot and read from it.
+     *
+     * The snapshot is of type sun.security.krb5.internal.ktab.KeyTab, which
+     * contains the content of the keytab file when the snapshot is taken.
+     * Itself has no refresh function and mostly an immutable class (except
+     * for the create/add/save methods only used by the ktab command).
+     */
+
+    // Source, null if using the default one. Note that the default name
+    // is maintained in snapshot, this field is never "resolved".
+    private final File file;
+
+    // Set up JavaxSecurityAuthKerberosAccess in SharedSecrets
+    static {
+        SharedSecrets.setJavaxSecurityAuthKerberosAccess(
+                new JavaxSecurityAuthKerberosAccessImpl());
+    }
+
+    private KeyTab(File file) {
+        this.file = file;
+    }
+
+    /**
+     * Returns a {@code KeyTab} instance from a {@code File} object.
+     * <p>
+     * The result of this method is never null. This method only associates
+     * the returned {@code KeyTab} object with the file and does not read it.
+     * @param file the keytab {@code File} object, must not be null
+     * @return the keytab instance
+     * @throws NullPointerException if the {@code file} argument is null
+     */
+    public static KeyTab getInstance(File file) {
+        if (file == null) {
+            throw new NullPointerException("file must be non null");
+        }
+        return new KeyTab(file);
+    }
+
+    /**
+     * Returns the default {@code KeyTab} instance.
+     * <p>
+     * The result of this method is never null. This method only associates
+     * the returned {@code KeyTab} object with the default keytab file and
+     * does not read it.
+     * @return the default keytab instance.
+     */
+    public static KeyTab getInstance() {
+        return new KeyTab(null);
+    }
+
+    //Takes a snapshot of the keytab content
+    private sun.security.krb5.internal.ktab.KeyTab takeSnapshot() {
+        return sun.security.krb5.internal.ktab.KeyTab.getInstance(file);
+    }
+
+    /**
+     * Returns fresh keys for the given Kerberos principal.
+     * <p>
+     * Implementation of this method should make sure the returned keys match
+     * the latest content of the keytab file. The result is a newly created
+     * copy that can be modified by the caller without modifying the keytab
+     * object. The caller should {@link KerberosKey#destroy() destroy} the
+     * result keys after they are used.
+     * <p>
+     * Please note that the keytab file can be created after the
+     * {@code KeyTab} object is instantiated and its content may change over
+     * time. Therefore, an application should call this method only when it
+     * needs to use the keys. Any previous result from an earlier invocation
+     * could potentially be expired.
+     * <p>
+     * If there is any error (say, I/O error or format error)
+     * during the reading process of the KeyTab file, a saved result should be
+     * returned. If there is no saved result (say, this is the first time this
+     * method is called, or, all previous read attempts failed), an empty array
+     * should be returned. This can make sure the result is not drastically
+     * changed during the (probably slow) update of the keytab file.
+     * <p>
+     * Each time this method is called and the reading of the file succeeds
+     * with no exception (say, I/O error or file format error),
+     * the result should be saved for {@code principal}. The implementation can
+     * also save keys for other principals having keys in the same keytab object
+     * if convenient.
+     * <p>
+     * Any unsupported key read from the keytab is ignored and not included
+     * in the result.
+     *
+     * @param principal the Kerberos principal, must not be null.
+     * @return the keys (never null, may be empty)
+     * @throws NullPointerException if the {@code principal}
+     * argument is null
+     * @throws SecurityException if a security manager exists and the read
+     * access to the keytab file is not permitted
+     */
+    public KerberosKey[] getKeys(KerberosPrincipal principal) {
+        try {
+            EncryptionKey[] keys = takeSnapshot().readServiceKeys(
+                    new PrincipalName(principal.getName()));
+            KerberosKey[] kks = new KerberosKey[keys.length];
+            for (int i=0; i<kks.length; i++) {
+                Integer tmp = keys[i].getKeyVersionNumber();
+                kks[i] = new KerberosKey(
+                        principal,
+                        keys[i].getBytes(),
+                        keys[i].getEType(),
+                        tmp == null ? 0 : tmp.intValue());
+                keys[i].destroy();
+            }
+            return kks;
+        } catch (RealmException re) {
+            return new KerberosKey[0];
+        }
+    }
+
+    EncryptionKey[] getEncryptionKeys(PrincipalName principal) {
+        return takeSnapshot().readServiceKeys(principal);
+    }
+
+    /**
+     * Checks if the keytab file exists. Implementation of this method
+     * should make sure that the result matches the latest status of the
+     * keytab file.
+     * <p>
+     * The caller can use the result to determine if it should fallback to
+     * another mechanism to read the keys.
+     * @return true if the keytab file exists; false otherwise.
+     * @throws SecurityException if a security manager exists and the read
+     * access to the keytab file is not permitted
+     */
+    public boolean exists() {
+        return !takeSnapshot().isMissing();
+    }
+
+    public String toString() {
+        return file == null ? "Default keytab" : file.toString();
+    }
+
+    /**
+     * Returns a hashcode for this KeyTab.
+     *
+     * @return a hashCode() for the <code>KeyTab</code>
+     */
+    public int hashCode() {
+        return Objects.hash(file);
+    }
+
+    /**
+     * Compares the specified Object with this KeyTab for equality.
+     * Returns true if the given object is also a
+     * <code>KeyTab</code> and the two
+     * <code>KeyTab</code> instances are equivalent.
+     *
+     * @param other the Object to compare to
+     * @return true if the specified object is equal to this KeyTab
+     */
+    public boolean equals(Object other) {
+        if (other == this)
+            return true;
+
+        if (! (other instanceof KeyTab)) {
+            return false;
+        }
+
+        KeyTab otherKtab = (KeyTab) other;
+        return Objects.equals(otherKtab.file, file);
+    }
+}
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Thu Apr 21 16:42:06 2011 -0700
@@ -296,32 +296,32 @@
 
 public abstract class BaseRowSet implements Serializable, Cloneable {
 
-/**
- * A constant indicating to a <code>RowSetReaderImpl</code> object
- * that a given parameter is a Unicode stream. This
- * <code>RowSetReaderImpl</code> object is provided as an extension of the
- * <code>SyncProvider</code> abstract class defined in the
- * <code>SyncFactory</code> static factory SPI mechanism.
- */
-public static final int UNICODE_STREAM_PARAM = 0;
-
-/**
- * A constant indicating to a <code>RowSetReaderImpl</code> object
- * that a given parameter is a binary stream. A
- * <code>RowSetReaderImpl</code> object is provided as an extension of the
- * <code>SyncProvider</code> abstract class defined in the
- * <code>SyncFactory</code> static factory SPI mechanism.
- */
-public static final int BINARY_STREAM_PARAM = 1;
-
-/**
- * A constant indicating to a <code>RowSetReaderImpl</code> object
- * that a given parameter is an ASCII stream. A
- * <code>RowSetReaderImpl</code> object is provided as an extension of the
- * <code>SyncProvider</code> abstract class defined in the
- * <code>SyncFactory</code> static factory SPI mechanism.
- */
-public static final int ASCII_STREAM_PARAM = 2;
+    /**
+     * A constant indicating to a <code>RowSetReaderImpl</code> object
+     * that a given parameter is a Unicode stream. This
+     * <code>RowSetReaderImpl</code> object is provided as an extension of the
+     * <code>SyncProvider</code> abstract class defined in the
+     * <code>SyncFactory</code> static factory SPI mechanism.
+     */
+    public static final int UNICODE_STREAM_PARAM = 0;
+
+    /**
+     * A constant indicating to a <code>RowSetReaderImpl</code> object
+     * that a given parameter is a binary stream. A
+     * <code>RowSetReaderImpl</code> object is provided as an extension of the
+     * <code>SyncProvider</code> abstract class defined in the
+     * <code>SyncFactory</code> static factory SPI mechanism.
+     */
+    public static final int BINARY_STREAM_PARAM = 1;
+
+    /**
+     * A constant indicating to a <code>RowSetReaderImpl</code> object
+     * that a given parameter is an ASCII stream. A
+     * <code>RowSetReaderImpl</code> object is provided as an extension of the
+     * <code>SyncProvider</code> abstract class defined in the
+     * <code>SyncFactory</code> static factory SPI mechanism.
+     */
+    public static final int ASCII_STREAM_PARAM = 2;
 
     /**
      * The <code>InputStream</code> object that will be
@@ -505,21 +505,21 @@
      * custom mapping of user-defined types.
      * @serial
      */
-    private Map map;
+    private Map<String, Class<?>> map;
 
     /**
      * A <code>Vector</code> object that holds the list of listeners
      * that have registered with this <code>RowSet</code> object.
      * @serial
      */
-    private Vector listeners;
+    private Vector<RowSetListener> listeners;
 
     /**
      * A <code>Vector</code> object that holds the parameters set
      * for this <code>RowSet</code> object's current command.
      * @serial
      */
-    private Hashtable params; // could be transient?
+    private Hashtable<Integer, Object> params; // could be transient?
 
     /**
      * Constructs a new <code>BaseRowSet</code> object initialized with
@@ -529,7 +529,7 @@
      */
     public BaseRowSet() {
         // allocate the listeners collection
-        listeners = new Vector();
+        listeners = new Vector<RowSetListener>();
     }
 
     /**
@@ -542,7 +542,7 @@
      * a <code>RowSet</code> implementation extending this class.
      */
     protected void initParams() {
-        params = new Hashtable();
+        params = new Hashtable<Integer, Object>();
     }
 
     //--------------------------------------------------------------------
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -912,7 +912,12 @@
      * @since 1.6
      */
     public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
-        return (T)this;
+
+        if(isWrapperFor(iface)) {
+            return iface.cast(this);
+        } else {
+            throw new SQLException("unwrap failed for:"+ iface);
+        }
     }
 
     /**
@@ -929,8 +934,9 @@
      * @throws java.sql.SQLException  if an error occurs while determining whether this is a wrapper
      * for an object with the given interface.
      * @since 1.6
-     */    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
-        return false;
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
     }
 
     static final long serialVersionUID = 6893806403181801867L;
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java	Thu Apr 21 16:42:06 2011 -0700
@@ -204,9 +204,9 @@
      *
      */
     static private ClassLoader getContextClassLoader() throws SecurityException {
-        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
 
-            public Object run() {
+            public ClassLoader run() {
                 ClassLoader cl = null;
 
                 cl = Thread.currentThread().getContextClassLoader();
@@ -284,9 +284,9 @@
     static private String getSystemProperty(final String propName) {
         String property = null;
         try {
-            property = (String) AccessController.doPrivileged(new PrivilegedAction() {
+            property = AccessController.doPrivileged(new PrivilegedAction<String>() {
 
-                public Object run() {
+                public String run() {
                     return System.getProperty(propName);
                 }
             });
--- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java	Thu Apr 21 16:42:06 2011 -0700
@@ -708,8 +708,8 @@
      *
      * @param x  the x value of the region to be painted
      * @param y  the y value of the region to be painted
-     * @param w  the width of the region to be painted
-     * @param h  the height of the region to be painted
+     * @param width  the width of the region to be painted
+     * @param height  the height of the region to be painted
      *
      * @see JComponent#paintImmediately(int, int, int, int)
      */
--- a/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java	Thu Apr 21 16:42:06 2011 -0700
@@ -509,6 +509,9 @@
          * edges thus has to be h*2+2 in length
          */
         int edges[] = new int[(dy2-dy1)*2+2];
+        // It is important that edges[0]=edges[1]=0 when we call
+        // Transform in case it must return early and we would
+        // not want to render anything on an error condition.
         helper.Transform(tmpmaskblit, srcData, tmpData,
                          AlphaComposite.Src, null,
                          itx, interpType,
--- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,7 +30,7 @@
 import sun.misc.FloatConsts;
 import java.util.regex.*;
 
-public class FloatingDecimal{
+public strictfp class FloatingDecimal{
     boolean     isExceptional;
     boolean     isNegative;
     int         decExponent;
--- a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, 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
@@ -30,7 +30,7 @@
 import sun.misc.FloatConsts;
 import java.util.regex.*;
 
-public class FormattedFloatingDecimal{
+public strictfp class FormattedFloatingDecimal{
     boolean     isExceptional;
     boolean     isNegative;
     int         decExponent;  // value set at construction, then immutable
--- a/jdk/src/share/classes/sun/misc/FpUtils.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/FpUtils.java	Thu Apr 21 16:42:06 2011 -0700
@@ -531,10 +531,9 @@
      * Return {@code d} &times;
      * 2<sup>{@code scale_factor}</sup> rounded as if performed
      * by a single correctly rounded floating-point multiply to a
-     * member of the double value set.  See <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#9208">&sect;4.2.3</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a> for a discussion of floating-point
+     * member of the double value set.  See section 4.2.3 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for a discussion of floating-point
      * value sets.  If the exponent of the result is between the
      * {@code double}'s minimum exponent and maximum exponent,
      * the answer is calculated exactly.  If the exponent of the
@@ -641,11 +640,10 @@
      * Return {@code f} &times;
      * 2<sup>{@code scale_factor}</sup> rounded as if performed
      * by a single correctly rounded floating-point multiply to a
-     * member of the float value set.  See <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#9208">&sect;4.2.3</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a> for a discussion of floating-point
-     * value set. If the exponent of the result is between the
+     * member of the float value set.  See section 4.2.3 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for a discussion of floating-point
+     * value sets. If the exponent of the result is between the
      * {@code float}'s minimum exponent and maximum exponent, the
      * answer is calculated exactly.  If the exponent of the result
      * would be larger than {@code float}'s maximum exponent, an
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,43 @@
+/*
+ * 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.misc;
+
+import javax.security.auth.kerberos.KeyTab;
+import sun.security.krb5.EncryptionKey;
+import sun.security.krb5.PrincipalName;
+
+/**
+ * An unsafe tunnel to get non-public access to classes in the
+ * javax.security.auth.kerberos package.
+ */
+public interface JavaxSecurityAuthKerberosAccess {
+    /**
+     * Returns keys for a principal in a keytab.
+     * @return the keys, never null, can be empty.
+     */
+    public EncryptionKey[] keyTabGetEncryptionKeys(
+            KeyTab ktab, PrincipalName principal);
+}
--- a/jdk/src/share/classes/sun/misc/SharedSecrets.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/SharedSecrets.java	Thu Apr 21 16:42:06 2011 -0700
@@ -29,6 +29,7 @@
 import java.io.Console;
 import java.io.FileDescriptor;
 import java.security.ProtectionDomain;
+import javax.security.auth.kerberos.KeyTab;
 
 import java.security.AccessController;
 
@@ -51,6 +52,7 @@
     private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
     private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
     private static JavaSecurityAccess javaSecurityAccess;
+    private static JavaxSecurityAuthKerberosAccess javaxSecurityAuthKerberosAccess;
 
     public static JavaUtilJarAccess javaUtilJarAccess() {
         if (javaUtilJarAccess == null) {
@@ -139,4 +141,16 @@
         }
         return javaSecurityAccess;
     }
+
+    public static void setJavaxSecurityAuthKerberosAccess
+            (JavaxSecurityAuthKerberosAccess jsaka) {
+        javaxSecurityAuthKerberosAccess = jsaka;
+    }
+
+    public static JavaxSecurityAuthKerberosAccess
+            getJavaxSecurityAuthKerberosAccess() {
+        if (javaxSecurityAuthKerberosAccess == null)
+            unsafe.ensureClassInitialized(KeyTab.class);
+        return javaxSecurityAuthKerberosAccess;
+    }
 }
--- a/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, 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
@@ -25,9 +25,8 @@
 
 package sun.net.www.protocol.jar;
 
-import java.io.*;
+import java.io.IOException;
 import java.net.*;
-import java.util.*;
 import sun.net.www.ParseUtil;
 
 /*
@@ -42,7 +41,7 @@
         return new JarURLConnection(u, this);
     }
 
-    private int indexOfBangSlash(String spec) {
+    private static int indexOfBangSlash(String spec) {
         int indexOfBang = spec.length();
         while((indexOfBang = spec.lastIndexOf('!', indexOfBang)) != -1) {
             if ((indexOfBang != (spec.length() - 1)) &&
@@ -55,6 +54,75 @@
         return -1;
     }
 
+    /**
+     * Compare two jar URLs
+     */
+    @Override
+    protected boolean sameFile(URL u1, URL u2) {
+        if (!u1.getProtocol().equals("jar") || !u2.getProtocol().equals("jar"))
+            return false;
+
+        String file1 = u1.getFile();
+        String file2 = u2.getFile();
+        int sep1 = file1.indexOf(separator);
+        int sep2 = file2.indexOf(separator);
+
+        if (sep1 == -1 || sep2 == -1) {
+            return super.sameFile(u1, u2);
+        }
+
+        String entry1 = file1.substring(sep1 + 2);
+        String entry2 = file2.substring(sep2 + 2);
+
+        if (!entry1.equals(entry2))
+            return false;
+
+        URL enclosedURL1 = null, enclosedURL2 = null;
+        try {
+            enclosedURL1 = new URL(file1.substring(0, sep1));
+            enclosedURL2 = new URL(file2.substring(0, sep2));
+        } catch (MalformedURLException unused) {
+            return super.sameFile(u1, u2);
+        }
+
+        if (!super.sameFile(enclosedURL1, enclosedURL2)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected int hashCode(URL u) {
+        int h = 0;
+
+        String protocol = u.getProtocol();
+        if (protocol != null)
+            h += protocol.hashCode();
+
+        String file = u.getFile();
+        int sep = file.indexOf(separator);
+
+        if (sep == -1)
+            return h + file.hashCode();
+
+        URL enclosedURL = null;
+        String fileWithoutEntry = file.substring(0, sep);
+        try {
+            enclosedURL = new URL(fileWithoutEntry);
+            h += enclosedURL.hashCode();
+        } catch (MalformedURLException unused) {
+            h += fileWithoutEntry.hashCode();
+        }
+
+        String entry = file.substring(sep + 2);
+        h += entry.hashCode();
+
+        return h;
+    }
+
+
+    @Override
     protected void parseURL(URL url, String spec,
                             int start, int limit) {
         String file = null;
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -388,9 +388,8 @@
         // we must instead use a nonempty buffer, otherwise the call
         // will not block waiting for a datagram on some platforms.
         int newSize = Math.max(rem, 1);
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize);
         try {
-            bb = Util.getTemporaryDirectBuffer(newSize);
             int n = receiveIntoNativeBuffer(fd, bb, newSize, 0);
             bb.flip();
             if (n > 0 && rem > 0)
@@ -482,9 +481,8 @@
         assert (pos <= lim);
         int rem = (pos <= lim ? lim - pos : 0);
 
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
         try {
-            bb = Util.getTemporaryDirectBuffer(rem);
             bb.put(src);
             bb.flip();
             // Do not update src until we see how many bytes were written
@@ -766,10 +764,10 @@
         // check multicast address is compatible with this socket
         if (group instanceof Inet4Address) {
             if (family == StandardProtocolFamily.INET6 && !Net.canIPv6SocketJoinIPv4Group())
-                throw new IllegalArgumentException("Group is not IPv4 multicast address");
+                throw new IllegalArgumentException("IPv6 socket cannot join IPv4 multicast group");
         } else if (group instanceof Inet6Address) {
             if (family != StandardProtocolFamily.INET6)
-                throw new IllegalArgumentException("Group is not IPv6 multicast address");
+                throw new IllegalArgumentException("Only IPv6 sockets can join IPv6 multicast group");
         } else {
             throw new IllegalArgumentException("Address type not supported");
         }
--- a/jdk/src/share/classes/sun/nio/ch/IOUtil.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/IOUtil.java	Thu Apr 21 16:42:06 2011 -0700
@@ -50,9 +50,8 @@
         int lim = src.limit();
         assert (pos <= lim);
         int rem = (pos <= lim ? lim - pos : 0);
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
         try {
-            bb = Util.getTemporaryDirectBuffer(rem);
             bb.put(src);
             bb.flip();
             // Do not update src until we see how many bytes were written
@@ -187,9 +186,8 @@
             return readIntoNativeBuffer(fd, dst, position, nd, lock);
 
         // Substitute a native buffer
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(dst.remaining());
         try {
-            bb = Util.getTemporaryDirectBuffer(dst.remaining());
             int n = readIntoNativeBuffer(fd, bb, position, nd, lock);
             bb.flip();
             if (n > 0)
--- a/jdk/src/share/classes/sun/rmi/log/ReliableLog.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/rmi/log/ReliableLog.java	Thu Apr 21 16:42:06 2011 -0700
@@ -380,9 +380,7 @@
             } catch (IOException e) {
                 throw e;
             } catch (Exception e) {
-                throw new IOException("snapshot failed with exception of type: " +
-                                      e.getClass().getName() +
-                                      ", message was: " + e.getMessage());
+                throw new IOException("snapshot failed", e);
             }
             lastSnapshot = System.currentTimeMillis();
         } finally {
--- a/jdk/src/share/classes/sun/rmi/server/Activation.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/Activation.java	Thu Apr 21 16:42:06 2011 -0700
@@ -30,6 +30,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.ObjectInputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.io.PrintWriter;
@@ -98,6 +99,7 @@
 import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import sun.rmi.log.LogHandler;
 import sun.rmi.log.ReliableLog;
 import sun.rmi.registry.RegistryImpl;
@@ -147,10 +149,10 @@
 
     /** maps activation id to its respective group id */
     private Map<ActivationID,ActivationGroupID> idTable =
-        new HashMap<ActivationID,ActivationGroupID>();
+        new ConcurrentHashMap<>();
     /** maps group id to its GroupEntry groups */
     private Map<ActivationGroupID,GroupEntry> groupTable =
-        new HashMap<ActivationGroupID,GroupEntry>();
+        new ConcurrentHashMap<>();
 
     private byte majorVersion = MAJOR_VERSION;
     private byte minorVersion = MINOR_VERSION;
@@ -236,9 +238,11 @@
         groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
         groupCounter = 0;
         Runtime.getRuntime().addShutdownHook(shutdownHook);
+
+        // Use array size of 0, since the value from calling size()
+        // may be out of date by the time toArray() is called.
         ActivationGroupID[] gids =
-            groupTable.keySet().toArray(
-                new ActivationGroupID[groupTable.size()]);
+            groupTable.keySet().toArray(new ActivationGroupID[0]);
 
         synchronized (startupLock = new Object()) {
             // all the remote methods briefly synchronize on startupLock
@@ -274,6 +278,23 @@
         }
     }
 
+    /**
+     * Previous versions used HashMap instead of ConcurrentHashMap.
+     * Replace any HashMaps found during deserialization with
+     * ConcurrentHashMaps.
+     */
+    private void readObject(ObjectInputStream ois)
+        throws IOException, ClassNotFoundException
+    {
+        ois.defaultReadObject();
+        if (! (groupTable instanceof ConcurrentHashMap)) {
+            groupTable = new ConcurrentHashMap<>(groupTable);
+        }
+        if (! (idTable instanceof ConcurrentHashMap)) {
+            idTable = new ConcurrentHashMap<>(idTable);
+        }
+    }
+
     private static class SystemRegistryImpl extends RegistryImpl {
 
         private static final String NAME = ActivationSystem.class.getName();
@@ -488,9 +509,7 @@
             ActivationGroupID id = new ActivationGroupID(systemStub);
             GroupEntry entry = new GroupEntry(id, desc);
             // table insertion must take place before log update
-            synchronized (groupTable) {
-                groupTable.put(id, entry);
-            }
+            groupTable.put(id, entry);
             addLogRecord(new LogRegisterGroup(id, desc));
             return id;
         }
@@ -515,11 +534,7 @@
 
             // remove entry before unregister so state is updated before
             // logged
-            synchronized (groupTable) {
-                GroupEntry entry = getGroupEntry(id);
-                groupTable.remove(id);
-                entry.unregisterGroup(true);
-            }
+            removeGroupEntry(id).unregisterGroup(true);
         }
 
         public ActivationDesc setActivationDesc(ActivationID id,
@@ -637,12 +652,7 @@
                 unexport(system);
 
                 // destroy all child processes (groups)
-                GroupEntry[] groupEntries;
-                synchronized (groupTable) {
-                    groupEntries = groupTable.values().
-                        toArray(new GroupEntry[groupTable.size()]);
-                }
-                for (GroupEntry groupEntry : groupEntries) {
+                for (GroupEntry groupEntry : groupTable.values()) {
                     groupEntry.shutdown();
                 }
 
@@ -693,10 +703,8 @@
             }
 
             // destroy all child processes (groups) quickly
-            synchronized (groupTable) {
-                for (GroupEntry groupEntry : groupTable.values()) {
-                    groupEntry.shutdownFast();
-                }
+            for (GroupEntry groupEntry : groupTable.values()) {
+                groupEntry.shutdownFast();
             }
         }
     }
@@ -708,13 +716,32 @@
     private ActivationGroupID getGroupID(ActivationID id)
         throws UnknownObjectException
     {
-        synchronized (idTable) {
-            ActivationGroupID groupID = idTable.get(id);
-            if (groupID != null) {
-                return groupID;
+        ActivationGroupID groupID = idTable.get(id);
+        if (groupID != null) {
+            return groupID;
+        }
+        throw new UnknownObjectException("unknown object: " + id);
+    }
+
+    /**
+     * Returns the group entry for the group id, optionally removing it.
+     * Throws UnknownGroupException if the group is not registered.
+     */
+    private GroupEntry getGroupEntry(ActivationGroupID id, boolean rm)
+        throws UnknownGroupException
+    {
+        if (id.getClass() == ActivationGroupID.class) {
+            GroupEntry entry;
+            if (rm) {
+                entry = groupTable.remove(id);
+            } else {
+                entry = groupTable.get(id);
+            }
+            if (entry != null && !entry.removed) {
+                return entry;
             }
         }
-        throw new UnknownObjectException("unknown object: " + id);
+        throw new UnknownGroupException("group unknown");
     }
 
     /**
@@ -724,15 +751,17 @@
     private GroupEntry getGroupEntry(ActivationGroupID id)
         throws UnknownGroupException
     {
-        if (id.getClass() == ActivationGroupID.class) {
-            synchronized (groupTable) {
-                GroupEntry entry = groupTable.get(id);
-                if (entry != null && !entry.removed) {
-                    return entry;
-                }
-            }
-        }
-        throw new UnknownGroupException("group unknown");
+        return getGroupEntry(id, false);
+    }
+
+    /**
+     * Removes and returns the group entry for the group id. Throws
+     * UnknownGroupException if the group is not registered.
+     */
+    private GroupEntry removeGroupEntry(ActivationGroupID id)
+        throws UnknownGroupException
+    {
+        return getGroupEntry(id, true);
     }
 
     /**
@@ -744,11 +773,9 @@
         throws UnknownObjectException
     {
         ActivationGroupID gid = getGroupID(id);
-        synchronized (groupTable) {
-            GroupEntry entry = groupTable.get(gid);
-            if (entry != null) {
-                return entry;
-            }
+        GroupEntry entry = groupTable.get(gid);
+        if (entry != null && !entry.removed) {
+            return entry;
         }
         throw new UnknownObjectException("object's group removed");
     }
@@ -882,9 +909,7 @@
             }
 
             // table insertion must take place before log update
-            synchronized (idTable) {
-                idTable.put(id, groupID);
-            }
+            idTable.put(id, groupID);
 
             if (addRecord) {
                 addLogRecord(new LogRegisterObject(id, desc));
@@ -901,10 +926,8 @@
                 restartSet.remove(id);
             }
 
-            // table insertion must take place before log update
-            synchronized (idTable) {
-                idTable.remove(id);
-            }
+            // table removal must take place before log update
+            idTable.remove(id);
             if (addRecord) {
                 addLogRecord(new LogUnregisterObject(id));
             }
@@ -919,9 +942,7 @@
                      objects.entrySet())
             {
                 ActivationID id = entry.getKey();
-                synchronized (idTable) {
-                    idTable.remove(id);
-                }
+                idTable.remove(id);
                 ObjectEntry objEntry = entry.getValue();
                 objEntry.removed = true;
             }
--- a/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Thu Apr 21 16:42:06 2011 -0700
@@ -175,25 +175,26 @@
             DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe);
         }
 
-        Remote impl = target.getImpl();
-        if (impl == null) {
-            throw new ExportException(
-                "internal error: attempt to export collected object");
-        }
+        synchronized (tableLock) {
+            /**
+             * Do nothing if impl has already been collected (see 6597112). Check while
+             * holding tableLock to ensure that Reaper cannot process weakImpl in between
+             * null check and put/increment effects.
+             */
+            if (target.getImpl() != null) {
+                if (objTable.containsKey(oe)) {
+                    throw new ExportException(
+                        "internal error: ObjID already in use");
+                } else if (implTable.containsKey(weakImpl)) {
+                    throw new ExportException("object already exported");
+                }
 
-        synchronized (tableLock) {
-            if (objTable.containsKey(oe)) {
-                throw new ExportException(
-                    "internal error: ObjID already in use");
-            } else if (implTable.containsKey(weakImpl)) {
-                throw new ExportException("object already exported");
-            }
+                objTable.put(oe, target);
+                implTable.put(weakImpl, target);
 
-            objTable.put(oe, target);
-            implTable.put(weakImpl, target);
-
-            if (!target.isPermanent()) {
-                incrementKeepAliveCount();
+                if (!target.isPermanent()) {
+                    incrementKeepAliveCount();
+                }
             }
         }
     }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java	Thu Apr 21 16:42:06 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
@@ -127,8 +127,8 @@
             //System.out.println("Sub-Session Key Missing in Authenticator.\n");
         }
 
-        OverloadedChecksum gssChecksum =
-            new OverloadedChecksum(context, apReq.getChecksum(), sessionKey);
+        OverloadedChecksum gssChecksum = new OverloadedChecksum(
+                context, apReq.getChecksum(), sessionKey, subKey);
         gssChecksum.setContextFlags(context);
         Credentials delegCred = gssChecksum.getDelegatedCreds();
         if (delegCred != null) {
--- a/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Thu Apr 21 16:42:06 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
@@ -210,8 +210,8 @@
         // be passed in if this checksum type denotes a
         // raw_checksum. In that case, make Checksum class krb5
         // internal.
-        public OverloadedChecksum(Krb5Context context,
-                                  Checksum checksum, EncryptionKey key)
+        public OverloadedChecksum(Krb5Context context, Checksum checksum,
+                                  EncryptionKey key, EncryptionKey subKey)
             throws GSSException, KrbException, IOException {
 
             int pos = 0;
@@ -283,9 +283,17 @@
                         new KrbCred(credBytes, EncryptionKey.NULL_KEY).
                         getDelegatedCreds()[0];
                 } else {
-                    delegCreds =
-                        new KrbCred(credBytes, key).
-                        getDelegatedCreds()[0];
+                    KrbCred cred;
+                    try {
+                        cred = new KrbCred(credBytes, key);
+                    } catch (KrbException e) {
+                        if (subKey != null) {
+                            cred = new KrbCred(credBytes, subKey);
+                        } else {
+                            throw e;
+                        }
+                    }
+                    delegCreds = cred.getDelegatedCreds()[0];
                 }
             }
         }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java	Thu Apr 21 16:42:06 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
@@ -29,7 +29,6 @@
 import sun.security.jgss.GSSCaller;
 import sun.security.jgss.spi.*;
 import sun.security.krb5.*;
-import javax.security.auth.kerberos.*;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.security.AccessController;
@@ -43,40 +42,23 @@
  * @since 1.4
  */
 public class Krb5AcceptCredential
-    extends KerberosKey
     implements Krb5CredElement {
 
     private static final long serialVersionUID = 7714332137352567952L;
 
     private Krb5NameElement name;
 
-    /**
-     * We cache an EncryptionKey representation of this key because many
-     * Krb5 operation require a key in that form. At some point we might do
-     * away with EncryptionKey altogether and use the base class
-     * KerberosKey everywhere.
-     */
-    private EncryptionKey[] krb5EncryptionKeys;
+    private Krb5Util.ServiceCreds screds;
 
-    private Krb5AcceptCredential(Krb5NameElement name, KerberosKey[] keys) {
+    private Krb5AcceptCredential(Krb5NameElement name, Krb5Util.ServiceCreds creds) {
         /*
          * Initialize this instance with the data from the acquired
          * KerberosKey. This class needs to be a KerberosKey too
          * hence we can't just store a reference.
          */
-        super(keys[0].getPrincipal(),
-              keys[0].getEncoded(),
-              keys[0].getKeyType(),
-              keys[0].getVersionNumber());
 
         this.name = name;
-        // Cache this for later use by the sun.security.krb5 package.
-        krb5EncryptionKeys = new EncryptionKey[keys.length];
-        for (int i = 0; i < keys.length; i++) {
-            krb5EncryptionKeys[i] = new EncryptionKey(keys[i].getEncoded(),
-                                    keys[i].getKeyType(),
-                                    new Integer(keys[i].getVersionNumber()));
-        }
+        this.screds = creds;
     }
 
     static Krb5AcceptCredential getInstance(final GSSCaller caller, Krb5NameElement name)
@@ -86,12 +68,12 @@
             name.getKrb5PrincipalName().getName());
         final AccessControlContext acc = AccessController.getContext();
 
-        KerberosKey[] keys;
+        Krb5Util.ServiceCreds creds = null;
         try {
-            keys = AccessController.doPrivileged(
-                        new PrivilegedExceptionAction<KerberosKey[]>() {
-                public KerberosKey[] run() throws Exception {
-                    return Krb5Util.getKeys(
+            creds = AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Krb5Util.ServiceCreds>() {
+                public Krb5Util.ServiceCreds run() throws Exception {
+                    return Krb5Util.getServiceCreds(
                         caller == GSSCaller.CALLER_UNKNOWN ? GSSCaller.CALLER_ACCEPT: caller,
                         serverPrinc, acc);
                 }});
@@ -103,17 +85,17 @@
             throw ge;
         }
 
-        if (keys == null || keys.length == 0)
+        if (creds == null)
             throw new GSSException(GSSException.NO_CRED, -1,
-                                   "Failed to find any Kerberos Key");
+                                   "Failed to find any Kerberos credentails");
 
         if (name == null) {
-            String fullName = keys[0].getPrincipal().getName();
+            String fullName = creds.getName();
             name = Krb5NameElement.getInstance(fullName,
                                        Krb5MechFactory.NT_GSS_KRB5_PRINCIPAL);
         }
 
-        return new Krb5AcceptCredential(name, keys);
+        return new Krb5AcceptCredential(name, creds);
     }
 
     /**
@@ -171,7 +153,7 @@
     }
 
     EncryptionKey[] getKrb5EncryptionKeys() {
-        return krb5EncryptionKeys;
+        return screds.getEKeys();
     }
 
     /**
@@ -193,13 +175,6 @@
      * destroy in the base class.
      */
     public void destroy() throws DestroyFailedException {
-        if (krb5EncryptionKeys != null) {
-            for (int i = 0; i < krb5EncryptionKeys.length; i++) {
-                krb5EncryptionKeys[i].destroy();
-            }
-            krb5EncryptionKeys = null;
-        }
-
-        super.destroy();
+        screds.destroy();
     }
 }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2009, 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
@@ -28,6 +28,7 @@
 import javax.security.auth.kerberos.KerberosTicket;
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.kerberos.KeyTab;
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginException;
 import java.security.AccessControlContext;
@@ -38,7 +39,13 @@
 import sun.security.krb5.EncryptionKey;
 import sun.security.krb5.KrbException;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import sun.misc.SharedSecrets;
+import sun.security.krb5.PrincipalName;
 /**
  * Utilities for obtaining and converting Kerberos tickets.
  *
@@ -75,7 +82,7 @@
 
         // 1. Try to find service ticket in acc subject
         Subject accSubj = Subject.getSubject(acc);
-        KerberosTicket ticket = (KerberosTicket) SubjectComber.find(accSubj,
+        KerberosTicket ticket = SubjectComber.find(accSubj,
             serverPrincipal, clientPrincipal, KerberosTicket.class);
 
         if (ticket != null) {
@@ -87,7 +94,7 @@
             // 2. Try to get ticket from login
             try {
                 loginSubj = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID);
-                ticket = (KerberosTicket) SubjectComber.find(loginSubj,
+                ticket = SubjectComber.find(loginSubj,
                     serverPrincipal, clientPrincipal, KerberosTicket.class);
                 if (ticket != null) {
                     return ticket; // found it
@@ -102,13 +109,13 @@
         // Try to get TGT to acquire service ticket
 
         // 3. Try to get TGT from acc subject
-        KerberosTicket tgt = (KerberosTicket) SubjectComber.find(accSubj,
+        KerberosTicket tgt = SubjectComber.find(accSubj,
             tgsPrincipal, clientPrincipal, KerberosTicket.class);
 
         boolean fromAcc;
         if (tgt == null && loginSubj != null) {
             // 4. Try to get TGT from login subject
-            tgt = (KerberosTicket) SubjectComber.find(loginSubj,
+            tgt = SubjectComber.find(loginSubj,
                 tgsPrincipal, clientPrincipal, KerberosTicket.class);
             fromAcc = false;
         } else {
@@ -145,14 +152,14 @@
 
         // Try to get ticket from acc's Subject
         Subject accSubj = Subject.getSubject(acc);
-        KerberosTicket ticket = (KerberosTicket)
+        KerberosTicket ticket =
             SubjectComber.find(accSubj, serverPrincipal, clientPrincipal,
                   KerberosTicket.class);
 
         // Try to get ticket from Subject obtained from GSSUtil
         if (ticket == null && !GSSUtil.useSubjectCredsOnly(caller)) {
             Subject subject = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID);
-            ticket = (KerberosTicket) SubjectComber.find(subject,
+            ticket = SubjectComber.find(subject,
                 serverPrincipal, clientPrincipal, KerberosTicket.class);
         }
         return ticket;
@@ -182,37 +189,152 @@
         return subject;
     }
 
+    // A special KerberosKey, used as keys read from a KeyTab object.
+    // Each time new keys are read from KeyTab objects in the private
+    // credentials set, old ones are removed and new ones added.
+    public static class KeysFromKeyTab extends KerberosKey {
+        public KeysFromKeyTab(KerberosKey key) {
+            super(key.getPrincipal(), key.getEncoded(),
+                    key.getKeyType(), key.getVersionNumber());
+        }
+    }
+
     /**
-     * Retrieves the keys for the specified server principal from
-     * the Subject in the specified AccessControlContext.
-     * If the ticket can not be found in the Subject, and if
-     * useSubjectCredsOnly is false, then obtain keys from
-     * a LoginContext.
+     * Credentials of a service, the private secret to authenticate its
+     * identity, which can be:
+     *   1. Some KerberosKeys (generated from password)
+     *   2. A KeyTab (for a typical service)
+     *   3. A TGT (for a user2user service. Not supported yet)
      *
-     * NOTE: This method is used by JSSE Kerberos Cipher Suites
+     * Note that some creds can coexist. For example, a user2user service
+     * can use its keytab (or keys) if the client can successfully obtain a
+     * normal service ticket, otherwise, it can uses the TGT (actually, the
+     * session key of the TGT) if the client can only acquire a service ticket
+     * of ENC-TKT-IN-SKEY style.
      */
-    public static KerberosKey[] getKeys(GSSCaller caller,
+    public static class ServiceCreds {
+        private KerberosPrincipal kp;
+        private List<KeyTab> ktabs;
+        private List<KerberosKey> kk;
+        private Subject subj;
+        //private KerberosTicket tgt;   // user2user, not supported yet
+
+        private static ServiceCreds getInstance(
+                Subject subj, String serverPrincipal) {
+
+            ServiceCreds sc = new ServiceCreds();
+            sc.subj = subj;
+
+            for (KerberosPrincipal p: subj.getPrincipals(KerberosPrincipal.class)) {
+                if (serverPrincipal == null ||
+                        p.getName().equals(serverPrincipal)) {
+                    sc.kp = p;
+                    serverPrincipal = p.getName();
+                    break;
+                }
+            }
+            if (sc.kp == null) {
+                // Compatibility with old behavior: even when there is no
+                // KerberosPrincipal, we can find one from KerberosKeys
+                List<KerberosKey> keys = SubjectComber.findMany(
+                        subj, null, null, KerberosKey.class);
+                if (!keys.isEmpty()) {
+                    sc.kp = keys.get(0).getPrincipal();
+                    serverPrincipal = sc.kp.getName();
+                    if (DEBUG) {
+                        System.out.println(">>> ServiceCreds: no kp?"
+                                + " find one from kk: " + serverPrincipal);
+                    }
+                } else {
+                    return null;
+                }
+            }
+            sc.ktabs = SubjectComber.findMany(
+                        subj, null, null, KeyTab.class);
+            sc.kk = SubjectComber.findMany(
+                        subj, serverPrincipal, null, KerberosKey.class);
+            if (sc.ktabs.isEmpty() && sc.kk.isEmpty()) {
+                return null;
+            }
+            return sc;
+        }
+
+        public String getName() {
+            return kp.getName();
+        }
+
+        public KerberosKey[] getKKeys() {
+            if (ktabs.isEmpty()) {
+                return kk.toArray(new KerberosKey[kk.size()]);
+            } else {
+                List<KerberosKey> keys = new ArrayList<>();
+                for (KeyTab ktab: ktabs) {
+                    for (KerberosKey k: ktab.getKeys(kp)) {
+                        keys.add(k);
+                    }
+                }
+                // Compatibility: also add keys to privCredSet. Remove old
+                // ones first, only remove those from keytab.
+                if (!subj.isReadOnly()) {
+                    Set<Object> pcs = subj.getPrivateCredentials();
+                    synchronized (pcs) {
+                        Iterator<Object> iterator = pcs.iterator();
+                        while (iterator.hasNext()) {
+                            Object obj = iterator.next();
+                            if (obj instanceof KeysFromKeyTab) {
+                                KerberosKey key = (KerberosKey)obj;
+                                if (Objects.equals(key.getPrincipal(), kp)) {
+                                    iterator.remove();
+                                }
+                            }
+                        }
+                    }
+                    for (KerberosKey key: keys) {
+                        subj.getPrivateCredentials().add(new KeysFromKeyTab(key));
+                    }
+                }
+                return keys.toArray(new KerberosKey[keys.size()]);
+            }
+        }
+
+        public EncryptionKey[] getEKeys() {
+            KerberosKey[] kkeys = getKKeys();
+            EncryptionKey[] ekeys = new EncryptionKey[kkeys.length];
+            for (int i=0; i<ekeys.length; i++) {
+                ekeys[i] =  new EncryptionKey(
+                            kkeys[i].getEncoded(), kkeys[i].getKeyType(),
+                            new Integer(kkeys[i].getVersionNumber()));
+            }
+            return ekeys;
+        }
+
+        public void destroy() {
+            kp = null;
+            ktabs = null;
+            kk = null;
+        }
+    }
+    /**
+     * Retrieves the ServiceCreds for the specified server principal from
+     * the Subject in the specified AccessControlContext. If not found, and if
+     * useSubjectCredsOnly is false, then obtain from a LoginContext.
+     *
+     * NOTE: This method is also used by JSSE Kerberos Cipher Suites
+     */
+    public static ServiceCreds getServiceCreds(GSSCaller caller,
         String serverPrincipal, AccessControlContext acc)
                 throws LoginException {
 
         Subject accSubj = Subject.getSubject(acc);
-        List<KerberosKey> kkeys = (List<KerberosKey>)SubjectComber.findMany(
-                accSubj, serverPrincipal, null, KerberosKey.class);
-
-        if (kkeys == null && !GSSUtil.useSubjectCredsOnly(caller)) {
-            Subject subject = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID);
-            kkeys = (List<KerberosKey>) SubjectComber.findMany(subject,
-                serverPrincipal, null, KerberosKey.class);
+        ServiceCreds sc = null;
+        if (accSubj != null) {
+            sc = ServiceCreds.getInstance(accSubj, serverPrincipal);
         }
-
-        int len;
-        if (kkeys != null && (len = kkeys.size()) > 0) {
-            KerberosKey[] keys = new KerberosKey[len];
-            kkeys.toArray(keys);
-            return keys;
-        } else {
-            return null;
+        if (sc == null && !GSSUtil.useSubjectCredsOnly(caller)) {
+            Subject subject = GSSUtil.login(caller, GSSUtil.GSS_KRB5_MECH_OID);
+            sc = ServiceCreds.getInstance(subject, serverPrincipal);
         }
+        return sc;
     }
 
     public static KerberosTicket credsToTicket(Credentials serviceCreds) {
@@ -247,4 +369,17 @@
             kerbTicket.getRenewTill(),
             kerbTicket.getClientAddresses());
     }
+
+    /**
+     * A helper method to get EncryptionKeys from a javax..KeyTab
+     * @param ktab the javax..KeyTab class
+     * @param cname the PrincipalName
+     * @return the EKeys, never null, might be empty
+     */
+    public static EncryptionKey[] keysFromJavaxKeyTab(
+            KeyTab ktab, PrincipalName cname) {
+        return SharedSecrets.getJavaxSecurityAuthKerberosAccess().
+                keyTabGetEncryptionKeys(ktab, cname);
+    }
+
 }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/SubjectComber.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/SubjectComber.java	Thu Apr 21 16:42:06 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
@@ -33,10 +33,11 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
+import javax.security.auth.kerberos.KeyTab;
 
 /**
- * This utility looks through the current Subject and retrieves a ticket or key
- * for the desired client/server principals.
+ * This utility looks through the current Subject and retrieves private
+ * credentials for the desired client/server principals.
  *
  * @author Ram Marti
  * @since 1.4.2
@@ -52,58 +53,70 @@
     private SubjectComber() {  // Cannot create one of these
     }
 
-    static Object find(Subject subject, String serverPrincipal,
-        String clientPrincipal, Class credClass) {
+    static <T> T find(Subject subject, String serverPrincipal,
+        String clientPrincipal, Class<T> credClass) {
 
-        return findAux(subject, serverPrincipal, clientPrincipal, credClass,
+        return (T)findAux(subject, serverPrincipal, clientPrincipal, credClass,
             true);
     }
 
-    static Object findMany(Subject subject, String serverPrincipal,
-        String clientPrincipal, Class credClass) {
+    static <T> List<T> findMany(Subject subject, String serverPrincipal,
+        String clientPrincipal, Class<T> credClass) {
 
-        return findAux(subject, serverPrincipal, clientPrincipal, credClass,
+        return (List<T>)findAux(subject, serverPrincipal, clientPrincipal, credClass,
             false);
     }
 
     /**
-     * Find the ticket or key for the specified client/server principals
+     * Find private credentials for the specified client/server principals
      * in the subject. Returns null if the subject is null.
      *
-     * @return the ticket or key
+     * @return the private credentials
      */
-    private static Object findAux(Subject subject, String serverPrincipal,
-        String clientPrincipal, Class credClass, boolean oneOnly) {
+    private static <T> Object findAux(Subject subject, String serverPrincipal,
+        String clientPrincipal, Class<T> credClass, boolean oneOnly) {
 
         if (subject == null) {
             return null;
         } else {
-            List<Object> answer = (oneOnly ? null : new ArrayList<Object>());
+            List<T> answer = (oneOnly ? null : new ArrayList<T>());
 
-            if (credClass == KerberosKey.class) {
-                // We are looking for a KerberosKey credentials for the
-                // serverPrincipal
-                Iterator<KerberosKey> iterator =
-                    subject.getPrivateCredentials(KerberosKey.class).iterator();
+            if (credClass == KeyTab.class) {    // Principal un-related
+                // We are looking for credentials unrelated to serverPrincipal
+                Iterator<T> iterator =
+                    subject.getPrivateCredentials(credClass).iterator();
                 while (iterator.hasNext()) {
-                    KerberosKey key = iterator.next();
-                    if (serverPrincipal == null ||
-                        serverPrincipal.equals(key.getPrincipal().getName())) {
+                    T t = iterator.next();
+                    if (DEBUG) {
+                        System.out.println("Found " + credClass.getSimpleName());
+                    }
+                    if (oneOnly) {
+                        return t;
+                    } else {
+                        answer.add(t);
+                    }
+                }
+            } else if (credClass == KerberosKey.class) {
+                // We are looking for credentials for the serverPrincipal
+                Iterator<T> iterator =
+                    subject.getPrivateCredentials(credClass).iterator();
+                while (iterator.hasNext()) {
+                    T t = iterator.next();
+                    String name = ((KerberosKey)t).getPrincipal().getName();
+                    if (serverPrincipal == null || serverPrincipal.equals(name)) {
                          if (DEBUG) {
-                             System.out.println("Found key for "
-                                 + key.getPrincipal() + "(" +
-                                 key.getKeyType() + ")");
+                             System.out.println("Found " +
+                                     credClass.getSimpleName() + " for " + name);
                          }
                          if (oneOnly) {
-                             return key;
+                             return t;
                          } else {
                              if (serverPrincipal == null) {
                                  // Record name so that keys returned will all
                                  // belong to the same principal
-                                 serverPrincipal =
-                                     key.getPrincipal().getName();
+                                 serverPrincipal = name;
                              }
-                             answer.add(key);
+                             answer.add(t);
                          }
                     }
                 }
@@ -167,7 +180,7 @@
                                                 serverPrincipal =
                                                 ticket.getServer().getName();
                                             }
-                                            answer.add(ticket);
+                                            answer.add((T)ticket);
                                         }
                                     }
                                 }
--- a/jdk/src/share/classes/sun/security/krb5/Config.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java	Thu Apr 21 16:42:06 2011 -0700
@@ -110,7 +110,6 @@
 
     public static synchronized void refresh() throws KrbException {
         singleton = new Config();
-        KeyTab.refresh();
         KdcComm.initStatic();
     }
 
--- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java	Thu Apr 21 16:42:06 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
@@ -138,8 +138,7 @@
      * @returns an array of secret keys or null if none were found.
      */
     public static EncryptionKey[] acquireSecretKeys(PrincipalName princ,
-                                                    String keytab)
-        throws KrbException, IOException {
+                                                    String keytab) {
 
         if (princ == null)
             throw new IllegalArgumentException(
@@ -148,11 +147,6 @@
         // KeyTab getInstance(keytab) will call KeyTab.getInstance()
         // if keytab is null
         KeyTab ktab = KeyTab.getInstance(keytab);
-
-        if (ktab == null) {
-            return null;
-        }
-
         return ktab.readServiceKeys(princ);
     }
 
--- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Thu Apr 21 16:42:06 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
@@ -37,6 +37,7 @@
 import java.net.InetAddress;
 import sun.security.util.*;
 import java.io.IOException;
+import java.util.Arrays;
 
 /**
  * This class encapsulates a KRB-AP-REQ that a client sends to a
@@ -54,9 +55,6 @@
     private static CacheTable table = new CacheTable();
     private static boolean DEBUG = Krb5.DEBUG;
 
-    // default is address-less tickets
-    private boolean KDC_EMPTY_ADDRESSES_ALLOWED = true;
-
     /**
      * Contructs a AP-REQ message to send to the peer.
      * @param tgsCred the <code>Credentials</code> to be used to construct the
@@ -312,23 +310,19 @@
             table.put(client, time, currTime.getTime());
         }
 
-        // check to use addresses in tickets
-        if (Config.getInstance().useAddresses()) {
-            KDC_EMPTY_ADDRESSES_ALLOWED = false;
-        }
-
-        // sender host address
-        HostAddress sender = null;
         if (initiator != null) {
-            sender = new HostAddress(initiator);
-        }
-
-        if (sender != null || !KDC_EMPTY_ADDRESSES_ALLOWED) {
-            if (enc_ticketPart.caddr != null) {
-                if (sender == null)
-                    throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR);
-                if (!enc_ticketPart.caddr.inList(sender))
-                    throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR);
+            // sender host address
+            HostAddress sender = new HostAddress(initiator);
+            if (enc_ticketPart.caddr != null
+                    && !enc_ticketPart.caddr.inList(sender)) {
+                if (DEBUG) {
+                    System.out.println(">>> KrbApReq: initiator is "
+                            + sender.getInetAddress()
+                            + ", but caddr is "
+                            + Arrays.toString(
+                                enc_ticketPart.caddr.getInetAddresses()));
+                }
+                throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR);
             }
         }
 
--- a/jdk/src/share/classes/sun/security/krb5/KrbAsRep.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbAsRep.java	Thu Apr 21 16:42:06 2011 -0700
@@ -37,6 +37,8 @@
 import sun.security.util.*;
 import java.io.IOException;
 import java.util.Objects;
+import javax.security.auth.kerberos.KeyTab;
+import sun.security.jgss.krb5.Krb5Util;
 
 /**
  * This class encapsulates a AS-REP message that the KDC sends to the
@@ -90,29 +92,32 @@
     }
 
     /**
-     * Called by KrbAsReqBuilder to resolve a AS-REP message using keys.
-     * @param keys user provided keys, not null
+     * Called by KrbAsReqBuilder to resolve a AS-REP message using a keytab.
+     * @param ktab the keytab, not null
      * @param asReq the original AS-REQ sent, used to validate AS-REP
+     * @param cname the user principal name, used to locate keys in ktab
      */
-    void decryptUsingKeys(EncryptionKey[] keys, KrbAsReq asReq)
+    void decryptUsingKeyTab(KeyTab ktab, KrbAsReq asReq, PrincipalName cname)
             throws KrbException, Asn1Exception, IOException {
         EncryptionKey dkey = null;
         int encPartKeyType = rep.encPart.getEType();
         Integer encPartKvno = rep.encPart.kvno;
-        try {
-            dkey = EncryptionKey.findKey(encPartKeyType, encPartKvno, keys);
-        } catch (KrbException ke) {
-            if (ke.returnCode() == Krb5.KRB_AP_ERR_BADKEYVER) {
-                // Fallback to no kvno. In some cases, keytab is generated
-                // not by sysadmin but Java's ktab command
-                dkey = EncryptionKey.findKey(encPartKeyType, keys);
+            try {
+                dkey = EncryptionKey.findKey(encPartKeyType, encPartKvno,
+                        Krb5Util.keysFromJavaxKeyTab(ktab, cname));
+            } catch (KrbException ke) {
+                if (ke.returnCode() == Krb5.KRB_AP_ERR_BADKEYVER) {
+                    // Fallback to no kvno. In some cases, keytab is generated
+                    // not by sysadmin but Java's ktab command
+                    dkey = EncryptionKey.findKey(encPartKeyType,
+                            Krb5Util.keysFromJavaxKeyTab(ktab, cname));
+                }
             }
-        }
-        if (dkey == null) {
-            throw new KrbException(Krb5.API_INVALID_ARG,
-                "Cannot find key for type/kvno to decrypt AS REP - " +
-                EType.toString(encPartKeyType) + "/" + encPartKvno);
-        }
+            if (dkey == null) {
+                throw new KrbException(Krb5.API_INVALID_ARG,
+                    "Cannot find key for type/kvno to decrypt AS REP - " +
+                    EType.toString(encPartKeyType) + "/" + encPartKvno);
+            }
         decrypt(dkey, asReq);
     }
 
--- a/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReqBuilder.java	Thu Apr 21 16:42:06 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
@@ -27,6 +27,8 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import javax.security.auth.kerberos.KeyTab;
+import sun.security.jgss.krb5.Krb5Util;
 import sun.security.krb5.internal.HostAddresses;
 import sun.security.krb5.internal.KDCOptions;
 import sun.security.krb5.internal.KRBError;
@@ -42,13 +44,16 @@
  * 1. Gather information to create AS-REQ
  * 2. Create and send AS-REQ
  * 3. Receive AS-REP and KRB-ERROR (-KRB_ERR_RESPONSE_TOO_BIG) and parse them
- * 4. Emit credentials and secret keys (for JAAS storeKey=true)
+ * 4. Emit credentials and secret keys (for JAAS storeKey=true with password)
  *
  * This class does not:
  * 1. Deal with real communications (KdcComm does it, and TGS-REQ)
  *    a. Name of KDCs for a realm
  *    b. Server availability, timeout, UDP or TCP
  *    d. KRB_ERR_RESPONSE_TOO_BIG
+ * 2. Stores its own copy of password, this means:
+ *    a. Do not change/wipe it before Builder finish
+ *    b. Builder will not wipe it for you
  *
  * With this class:
  * 1. KrbAsReq has only one constructor
@@ -70,19 +75,17 @@
     private HostAddresses addresses;
 
     // Secret source: can't be changed once assigned, only one (of the two
-    // sources) can be set and should be non-null
-    private EncryptionKey[] keys;
-    private char[] password;
+    // sources) can be set to non-null
+    private final char[] password;
+    private final KeyTab ktab;
 
     // Used to create a ENC-TIMESTAMP in the 2nd AS-REQ
-    private EncryptionKey pakey;
     private PAData[] paList;        // PA-DATA from both KRB-ERROR and AS-REP.
                                     // Used by getKeys() only.
                                     // Only AS-REP should be enough per RFC,
                                     // combined in case etypes are different.
 
     // The generated and received:
-    int[] eTypes;
     private KrbAsReq req;
     private KrbAsRep rep;
 
@@ -94,7 +97,7 @@
     private State state;
 
     // Called by other constructors
-    private KrbAsReqBuilder(PrincipalName cname)
+    private void init(PrincipalName cname)
             throws KrbException {
         if (cname.getRealm() == null) {
             cname.setRealm(Config.getInstance().getDefaultRealm());
@@ -114,14 +117,11 @@
      * This argument will neither be modified nor stored by the method.
      * @throws KrbException
      */
-    public KrbAsReqBuilder(PrincipalName cname, EncryptionKey[] keys)
+    public KrbAsReqBuilder(PrincipalName cname, KeyTab ktab)
             throws KrbException {
-        this(cname);
-        this.keys = new EncryptionKey[keys.length];
-        for (int i=0; i<keys.length; i++) {
-            this.keys[i] = (EncryptionKey)keys[i].clone();
-        }
-        eTypes = EType.getDefaults("default_tkt_enctypes", keys);
+        init(cname);
+        this.ktab = ktab;
+        this.password = null;
     }
 
     /**
@@ -137,30 +137,24 @@
      */
     public KrbAsReqBuilder(PrincipalName cname, char[] pass)
             throws KrbException {
-        this(cname);
+        init(cname);
         this.password = pass.clone();
-        eTypes = EType.getDefaults("default_tkt_enctypes");
+        this.ktab = null;
     }
 
     /**
-     * Retrieves an array of secret keys for the client. This is useful if
+     * Retrieves an array of secret keys for the client. This is used when
      * the client supplies password but need keys to act as an acceptor
      * (in JAAS words, isInitiator=true and storeKey=true)
-     * @return original keys if initiated with keys, or generated keys if
-     * password. In latter case, PA-DATA from server might be used to
-     * generate keys. All "default_tkt_enctypes" keys will be generated,
-     * Never null.
+     * @return generated keys from password. PA-DATA from server might be used.
+     * All "default_tkt_enctypes" keys will be generated, Never null.
+     * @throws IllegalStateException if not constructed from a password
      * @throws KrbException
      */
     public EncryptionKey[] getKeys() throws KrbException {
         checkState(State.REQ_OK, "Cannot get keys");
-        if (keys != null) {
-            EncryptionKey[] result = new EncryptionKey[keys.length];
-            for (int i=0; i<keys.length; i++) {
-                result[i] = (EncryptionKey)keys[i].clone();
-            }
-            return result;
-        } else {
+        if (password != null) {
+            int[] eTypes = EType.getDefaults("default_tkt_enctypes");
             EncryptionKey[] result = new EncryptionKey[eTypes.length];
 
             /*
@@ -205,6 +199,8 @@
                 }
             }
             return result;
+        } else {
+            throw new IllegalStateException("Required password not provided");
         }
     }
 
@@ -241,12 +237,22 @@
     /**
      * Build a KrbAsReq object from all info fed above. Normally this method
      * will be called twice: initial AS-REQ and second with pakey
+     * @param key null (initial AS-REQ) or pakey (with preauth)
      * @return the KrbAsReq object
      * @throws KrbException
      * @throws IOException
      */
-    private KrbAsReq build() throws KrbException, IOException {
-        return new KrbAsReq(pakey,
+    private KrbAsReq build(EncryptionKey key) throws KrbException, IOException {
+        int[] eTypes;
+        if (password != null) {
+            eTypes = EType.getDefaults("default_tkt_enctypes");
+        } else {
+            EncryptionKey[] ks = Krb5Util.keysFromJavaxKeyTab(ktab, cname);
+            eTypes = EType.getDefaults("default_tkt_enctypes",
+                    ks);
+            for (EncryptionKey k: ks) k.destroy();
+        }
+        return new KrbAsReq(key,
             options,
             cname,
             sname,
@@ -263,9 +269,10 @@
      * @throws Asn1Exception
      * @throws IOException
      */
-    private KrbAsReqBuilder resolve() throws KrbException, Asn1Exception, IOException {
-        if (keys != null) {
-            rep.decryptUsingKeys(keys, req);
+    private KrbAsReqBuilder resolve()
+            throws KrbException, Asn1Exception, IOException {
+        if (ktab != null) {
+            rep.decryptUsingKeyTab(ktab, req, cname);
         } else {
             rep.decryptUsingPassword(password, req, cname);
         }
@@ -292,9 +299,10 @@
     private KrbAsReqBuilder send() throws KrbException, IOException {
         boolean preAuthFailedOnce = false;
         KdcComm comm = new KdcComm(cname.getRealmAsString());
+        EncryptionKey pakey = null;
         while (true) {
             try {
-                req = build();
+                req = build(pakey);
                 rep = new KrbAsRep(comm.send(req.encoding()));
                 return this;
             } catch (KrbException ke) {
@@ -308,7 +316,10 @@
                     preAuthFailedOnce = true;
                     KRBError kerr = ke.getError();
                     if (password == null) {
-                        pakey = EncryptionKey.findKey(kerr.getEType(), keys);
+                        EncryptionKey[] ks = Krb5Util.keysFromJavaxKeyTab(ktab, cname);
+                        pakey = EncryptionKey.findKey(kerr.getEType(), ks);
+                        if (pakey != null) pakey = (EncryptionKey)pakey.clone();
+                        for (EncryptionKey k: ks) k.destroy();
                     } else {
                         PAData.SaltAndParams snp = PAData.getSaltAndParams(
                                 kerr.getEType(), kerr.getPA());
@@ -317,7 +328,7 @@
                             // does not recommend this
                             pakey = EncryptionKey.acquireSecretKey(password,
                                     snp.salt == null ? cname.getSalt() : snp.salt,
-                                    eTypes[0],
+                                    EType.getDefaults("default_tkt_enctypes")[0],
                                     null);
                         } else {
                             pakey = EncryptionKey.acquireSecretKey(password,
@@ -369,15 +380,8 @@
      */
     public void destroy() {
         state = State.DESTROYED;
-        if (keys != null) {
-            for (EncryptionKey k: keys) {
-                k.destroy();
-            }
-            keys = null;
-        }
         if (password != null) {
             Arrays.fill(password, (char)0);
-            password = null;
         }
     }
 
--- a/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java	Thu Apr 21 16:42:06 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
@@ -59,7 +59,8 @@
 
     TCPClient(String hostname, int port, int timeout)
             throws IOException {
-        tcpSocket = new Socket(hostname, port);
+        tcpSocket = new Socket();
+        tcpSocket.connect(new InetSocketAddress(hostname, port), timeout);
         out = new BufferedOutputStream(tcpSocket.getOutputStream());
         in = new BufferedInputStream(tcpSocket.getInputStream());
         tcpSocket.setSoTimeout(timeout);
--- a/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Thu Apr 21 16:42:06 2011 -0700
@@ -40,6 +40,7 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
@@ -50,92 +51,138 @@
  * This class represents key table. The key table functions deal with storing
  * and retrieving service keys for use in authentication exchanges.
  *
+ * A KeyTab object is always constructed, if the file specified does not
+ * exist, it's still valid but empty. If there is an I/O error or file format
+ * error, it's invalid.
+ *
+ * The class is immutable on the read side (the write side is only used by
+ * the ktab tool).
+ *
  * @author Yanni Zhang
  */
 public class KeyTab implements KeyTabConstants {
-    int kt_vno;
-    private static KeyTab singleton = null;
+
     private static final boolean DEBUG = Krb5.DEBUG;
-    private static String name;
+    private static String defaultTabName = null;
+
+    // Attention: Currently there is no way to remove a keytab from this map,
+    // this might lead to a memory leak.
+    private static Map<String,KeyTab> map = new HashMap<>();
+
+    // KeyTab file does not exist. Note: a missing keytab is still valid
+    private boolean isMissing = false;
+
+    // KeyTab file is invalid, possibly an I/O error or a file format error.
+    private boolean isValid = true;
+
+    private final String tabName;
+    private long lastModified;
+    private int kt_vno;
+
     private Vector<KeyTabEntry> entries = new Vector<>();
 
-    private KeyTab(String filename) throws IOException, RealmException {
-        init(filename);
-    }
-
-    public static KeyTab getInstance(String s) {
-        name = parse(s);
-        if (name == null) {
-            return getInstance();
+    /**
+     * Constructs a KeyTab object.
+     *
+     * If there is any I/O error or format errot during the loading, the
+     * isValid flag is set to false, and all half-read entries are dismissed.
+     * @param filename path name for the keytab file, must not be null
+     */
+    private KeyTab(String filename) {
+        tabName = filename;
+        try {
+            lastModified = new File(tabName).lastModified();
+            KeyTabInputStream kis =
+                new KeyTabInputStream(new FileInputStream(filename));
+            load(kis);
+            kis.close();
+        } catch (FileNotFoundException e) {
+            entries.clear();
+            isMissing = true;
+        } catch (Exception ioe) {
+            entries.clear();
+            isValid = false;
         }
-        return getInstance(new File(name));
     }
 
     /**
-     * Gets the single instance of KeyTab class.
-     * @param file the key tab file.
-     * @return single instance of KeyTab;
-     *  return null if error occurs while reading data out of the file.
+     * Read a keytab file. Returns a new object and save it into cache when
+     * new content (modified since last read) is available. If keytab file is
+     * invalid, the old object will be returned. This is a safeguard for
+     * partial-written keytab files or non-stable network. Please note that
+     * a missing keytab is valid, which is equivalent to an empty keytab.
+     *
+     * @param s file name of keytab, must not be null
+     * @return the keytab object, can be invalid, but never null.
      */
-    public static KeyTab getInstance(File file) {
-        try {
-            if (!(file.exists())) {
-                singleton = null;
-            } else {
-                String fname = file.getAbsolutePath();
-                // Since this class deals with file I/O operations,
-                // we want only one class instance existing.
-                if (singleton != null) {
-                    File kfile = new File(singleton.name);
-                    String kname = kfile.getAbsolutePath();
-                    if (kname.equalsIgnoreCase(fname)) {
-                       if (DEBUG) {
-                          System.out.println("KeyTab instance already exists");
-                       }
-                    }
-                } else {
-                    singleton = new KeyTab(fname);
-                }
-            }
-        } catch (Exception e) {
-            singleton = null;
-            if (DEBUG) {
-                System.out.println("Could not obtain an instance of KeyTab" +
-                                   e.getMessage());
-            }
+    private synchronized static KeyTab getInstance0(String s) {
+        long lm = new File(s).lastModified();
+        KeyTab old = map.get(s);
+        if (old != null && old.isValid() && old.lastModified == lm) {
+            return old;
         }
-        return singleton;
+        KeyTab ktab = new KeyTab(s);
+        if (ktab.isValid()) {               // A valid new keytab
+            map.put(s, ktab);
+            return ktab;
+        } else if (old != null) {           // An existing old one
+            return old;
+        } else {
+            return ktab;                    // first read is invalid
+        }
     }
 
     /**
-     * Gets the single instance of KeyTab class.
-     * @return single instance of KeyTab; return null if default keytab file
-     *  does not exist, or error occurs while reading data from the file.
+     * Gets a KeyTab object.
+     * @param s the key tab file name.
+     * @return the KeyTab object, never null.
+     */
+    public static KeyTab getInstance(String s) {
+        if (s == null) {
+            return getInstance();
+        } else {
+            return getInstance0(s);
+        }
+    }
+
+    /**
+     * Gets a KeyTab object.
+     * @param file the key tab file.
+     * @return the KeyTab object, never null.
+     */
+    public static KeyTab getInstance(File file) {
+        if (file == null) {
+            return getInstance();
+        } else {
+            return getInstance0(file.getPath());
+        }
+    }
+
+    /**
+     * Gets the default KeyTab object.
+     * @return the KeyTab object, never null.
      */
     public static KeyTab getInstance() {
-        try {
-            name = getDefaultKeyTab();
-            if (name != null) {
-                singleton = getInstance(new File(name));
-            }
-        } catch (Exception e) {
-            singleton = null;
-            if (DEBUG) {
-                System.out.println("Could not obtain an instance of KeyTab" +
-                                   e.getMessage());
-            }
-        }
-        return singleton;
+        return getInstance(getDefaultTabName());
+    }
+
+    public boolean isMissing() {
+        return isMissing;
+    }
+
+    public boolean isValid() {
+        return isValid;
     }
 
     /**
      * The location of keytab file will be read from the configuration file
      * If it is not specified, consider user.home as the keytab file's
      * default location.
+     * @return never null
      */
-    private static String getDefaultKeyTab() {
-        if (name != null) {
-            return name;
+    private static String getDefaultTabName() {
+        if (defaultTabName != null) {
+            return defaultTabName;
         } else {
             String kname = null;
             try {
@@ -145,7 +192,7 @@
                     StringTokenizer st = new StringTokenizer(keytab_names, " ");
                     while (st.hasMoreTokens()) {
                         kname = parse(st.nextToken());
-                        if (kname != null) {
+                        if (new File(kname).exists()) {
                             break;
                         }
                     }
@@ -165,19 +212,20 @@
                         new sun.security.action.GetPropertyAction("user.dir"));
                 }
 
-                if (user_home != null) {
-                    kname = user_home + File.separator  + "krb5.keytab";
-                }
+                kname = user_home + File.separator  + "krb5.keytab";
             }
+            defaultTabName = kname;
             return kname;
         }
     }
 
+    /**
+     * Parses some common keytab name formats
+     * @param name never null
+     * @return never null
+     */
     private static String parse(String name) {
-        String kname = null;
-        if (name == null) {
-            return null;
-        }
+        String kname;
         if ((name.length() >= 5) &&
             (name.substring(0, 5).equalsIgnoreCase("FILE:"))) {
             kname = name.substring(5);
@@ -194,18 +242,6 @@
         return kname;
     }
 
-    private synchronized void init(String filename)
-        throws IOException, RealmException {
-
-        if (filename != null) {
-            KeyTabInputStream kis =
-                new KeyTabInputStream(new FileInputStream(filename));
-            load(kis);
-            kis.close();
-            name = filename;
-        }
-    }
-
     private void load(KeyTabInputStream kis)
         throws IOException, RealmException {
 
@@ -234,14 +270,13 @@
      * etypes that have been configured for use. If there are multiple
      * keys with same etype, the one with the highest kvno is returned.
      * @param service the PrincipalName of the requested service
-     * @return an array containing all the service keys
+     * @return an array containing all the service keys, never null
      */
     public EncryptionKey[] readServiceKeys(PrincipalName service) {
         KeyTabEntry entry;
         EncryptionKey key;
         int size = entries.size();
         ArrayList<EncryptionKey> keys = new ArrayList<>(size);
-
         for (int i = size-1; i >= 0; i--) {
             entry = entries.elementAt(i);
             if (entry.service.match(service)) {
@@ -260,10 +295,7 @@
                 }
             }
         }
-
         size = keys.size();
-        if (size == 0)
-            return null;
         EncryptionKey[] retVal = keys.toArray(new EncryptionKey[size]);
 
         // Sort keys according to default_tkt_enctypes
@@ -328,10 +360,13 @@
         return false;
     }
 
-    public static String tabName() {
-        return name;
+    public String tabName() {
+        return tabName;
     }
 
+    /////////////////// THE WRITE SIDE ///////////////////////
+    /////////////// only used by ktab tool //////////////////
+
     /**
      * Adds a new entry in the key table.
      * @param service the service which will have a new entry in the key table.
@@ -394,7 +429,7 @@
      */
     public synchronized static KeyTab create()
         throws IOException, RealmException {
-        String dname = getDefaultKeyTab();
+        String dname = getDefaultTabName();
         return create(dname);
     }
 
@@ -408,8 +443,7 @@
                 new KeyTabOutputStream(new FileOutputStream(name));
         kos.writeVersion(KRB5_KT_VNO);
         kos.close();
-        singleton = new KeyTab(name);
-        return singleton;
+        return new KeyTab(name);
     }
 
     /**
@@ -417,7 +451,7 @@
      */
     public synchronized void save() throws IOException {
         KeyTabOutputStream kos =
-                new KeyTabOutputStream(new FileOutputStream(name));
+                new KeyTabOutputStream(new FileOutputStream(tabName));
         kos.writeVersion(kt_vno);
         for (int i = 0; i < entries.size(); i++) {
             kos.writeEntry(entries.elementAt(i));
@@ -490,13 +524,4 @@
         kos.write16(KRB5_KT_VNO);
         kos.close();
     }
-
-    public static void refresh() {
-        if (singleton != null) {
-            if (DEBUG) {
-                System.out.println("Refreshing Keytab");
-            }
-            singleton = null;
-        }
-    }
 }
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java	Thu Apr 21 16:42:06 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
@@ -38,6 +38,7 @@
 import sun.security.util.*;
 import sun.security.x509.AlgorithmId;
 import sun.security.x509.CertificateIssuerName;
+import sun.security.x509.KeyUsageExtension;
 import sun.security.x509.X509CertImpl;
 import sun.security.x509.X509CertInfo;
 import sun.security.x509.X509CRLImpl;
@@ -492,7 +493,7 @@
         // CRLs (optional)
         if (crls != null && crls.length != 0) {
             // cast to X509CRLImpl[] since X509CRLImpl implements DerEncoder
-            Set<X509CRLImpl> implCRLs = new HashSet<X509CRLImpl>(crls.length);
+            Set<X509CRLImpl> implCRLs = new HashSet<>(crls.length);
             for (X509CRL crl: crls) {
                 if (crl instanceof X509CRLImpl)
                     implCRLs.add((X509CRLImpl) crl);
@@ -530,6 +531,168 @@
     }
 
     /**
+     * Verifying signed data using an external chunked data source.
+     */
+    public static class PKCS7Verifier {
+
+        private final SignerInfo si;          // Signer to verify
+        private final MessageDigest md;       // MessageDigest object for chunks
+        private final Signature sig;          // Signature object for chunks
+
+        private PKCS7Verifier(SignerInfo si, MessageDigest md, Signature sig) {
+            this.si = si;
+            this.md = md;
+            this.sig = sig;
+        }
+
+        public static PKCS7Verifier from(PKCS7 block, SignerInfo si) throws
+                SignatureException, NoSuchAlgorithmException {
+
+            try {
+                MessageDigest md = null;
+                Signature sig;
+
+                ContentInfo content = block.getContentInfo();
+                String digestAlgname = si.getDigestAlgorithmId().getName();
+
+                // if there are authenticate attributes, feed data chunks to
+                // the message digest. In this case, pv.md is not null
+                if (si.authenticatedAttributes != null) {
+                    // first, check content type
+                    ObjectIdentifier contentType = (ObjectIdentifier)
+                           si.authenticatedAttributes.getAttributeValue(
+                             PKCS9Attribute.CONTENT_TYPE_OID);
+                    if (contentType == null ||
+                        !contentType.equals(content.contentType))
+                        return null;  // contentType does not match, bad SignerInfo
+
+                    // now, check message digest
+                    byte[] messageDigest = (byte[])
+                        si.authenticatedAttributes.getAttributeValue(
+                             PKCS9Attribute.MESSAGE_DIGEST_OID);
+
+                    if (messageDigest == null) // fail if there is no message digest
+                        return null;
+
+                    md = MessageDigest.getInstance(digestAlgname);
+                }
+
+                // put together digest algorithm and encryption algorithm
+                // to form signing algorithm
+                String encryptionAlgname =
+                    si.getDigestEncryptionAlgorithmId().getName();
+
+                // Workaround: sometimes the encryptionAlgname is actually
+                // a signature name
+                String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname);
+                if (tmp != null) encryptionAlgname = tmp;
+                String algname = AlgorithmId.makeSigAlg(
+                        digestAlgname, encryptionAlgname);
+
+                sig = Signature.getInstance(algname);
+                X509Certificate cert = si.getCertificate(block);
+
+                if (cert == null) {
+                    return null;
+                }
+                if (cert.hasUnsupportedCriticalExtension()) {
+                    throw new SignatureException("Certificate has unsupported "
+                                                 + "critical extension(s)");
+                }
+
+                // Make sure that if the usage of the key in the certificate is
+                // restricted, it can be used for digital signatures.
+                // XXX We may want to check for additional extensions in the
+                // future.
+                boolean[] keyUsageBits = cert.getKeyUsage();
+                if (keyUsageBits != null) {
+                    KeyUsageExtension keyUsage;
+                    try {
+                        // We don't care whether or not this extension was marked
+                        // critical in the certificate.
+                        // We're interested only in its value (i.e., the bits set)
+                        // and treat the extension as critical.
+                        keyUsage = new KeyUsageExtension(keyUsageBits);
+                    } catch (IOException ioe) {
+                        throw new SignatureException("Failed to parse keyUsage "
+                                                     + "extension");
+                    }
+
+                    boolean digSigAllowed = ((Boolean)keyUsage.get(
+                            KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue();
+
+                    boolean nonRepuAllowed = ((Boolean)keyUsage.get(
+                            KeyUsageExtension.NON_REPUDIATION)).booleanValue();
+
+                    if (!digSigAllowed && !nonRepuAllowed) {
+                        throw new SignatureException("Key usage restricted: "
+                                                     + "cannot be used for "
+                                                     + "digital signatures");
+                    }
+                }
+
+                PublicKey key = cert.getPublicKey();
+                sig.initVerify(key);
+                return new PKCS7Verifier(si, md, sig);
+            } catch (IOException e) {
+                throw new SignatureException("IO error verifying signature:\n" +
+                                             e.getMessage());
+
+            } catch (InvalidKeyException e) {
+                throw new SignatureException("InvalidKey: " + e.getMessage());
+
+            }
+        }
+
+        public void update(byte[] data, int off, int end)
+                throws SignatureException {
+            if (md != null) {
+                md.update(data, off, end-off);
+            } else {
+                sig.update(data, off, end-off);
+            }
+        }
+
+        public SignerInfo verify() throws SignatureException {
+            try {
+                // if there are authenticate attributes, get the message
+                // digest and compare it with the digest of data
+                if (md != null) {
+                    // now, check message digest
+                    byte[] messageDigest = (byte[])
+                        si.authenticatedAttributes.getAttributeValue(
+                             PKCS9Attribute.MESSAGE_DIGEST_OID);
+
+                    byte[] computedMessageDigest = md.digest();
+
+                    if (!MessageDigest.isEqual(
+                            messageDigest, computedMessageDigest)) {
+                        return null;
+                    }
+
+                    // message digest attribute matched
+                    // digest of original data
+
+                    // the data actually signed is the DER encoding of
+                    // the authenticated attributes (tagged with
+                    // the "SET OF" tag, not 0xA0).
+                    byte[] dataSigned = si.authenticatedAttributes.getDerEncoding();
+                    sig.update(dataSigned);
+                }
+
+                if (sig.verify(si.getEncryptedDigest())) {
+                    return si;
+                }
+
+            } catch (IOException e) {
+                throw new SignatureException("IO error verifying signature:\n" +
+                                             e.getMessage());
+            }
+            return null;
+        }
+    }
+
+    /**
      * This verifies a given SignerInfo.
      *
      * @param info the signer information.
@@ -554,19 +717,16 @@
     public SignerInfo[] verify(byte[] bytes)
     throws NoSuchAlgorithmException, SignatureException {
 
-        Vector<SignerInfo> intResult = new Vector<SignerInfo>();
+        List<SignerInfo> intResult = new ArrayList<>();
         for (int i = 0; i < signerInfos.length; i++) {
 
             SignerInfo signerInfo = verify(signerInfos[i], bytes);
             if (signerInfo != null) {
-                intResult.addElement(signerInfo);
+                intResult.add(signerInfo);
             }
         }
-        if (intResult.size() != 0) {
-
-            SignerInfo[] result = new SignerInfo[intResult.size()];
-            intResult.copyInto(result);
-            return result;
+        if (!intResult.isEmpty()) {
+            return intResult.toArray(new SignerInfo[intResult.size()]);
         }
         return null;
     }
--- a/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, 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
@@ -230,7 +230,7 @@
         if (userCert == null)
             return null;
 
-        ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>();
+        ArrayList<X509Certificate> certList = new ArrayList<>();
         certList.add(userCert);
 
         X509Certificate[] pkcsCerts = block.getCertificates();
@@ -276,132 +276,20 @@
     /* Returns null if verify fails, this signerInfo if
        verify succeeds. */
     SignerInfo verify(PKCS7 block, byte[] data)
-    throws NoSuchAlgorithmException, SignatureException {
-
-        try {
-
-            ContentInfo content = block.getContentInfo();
-            if (data == null) {
-                data = content.getContentBytes();
-            }
-
-            String digestAlgname = getDigestAlgorithmId().getName();
-
-            byte[] dataSigned;
-
-            // if there are authenticate attributes, get the message
-            // digest and compare it with the digest of data
-            if (authenticatedAttributes == null) {
-                dataSigned = data;
-            } else {
-
-                // first, check content type
-                ObjectIdentifier contentType = (ObjectIdentifier)
-                       authenticatedAttributes.getAttributeValue(
-                         PKCS9Attribute.CONTENT_TYPE_OID);
-                if (contentType == null ||
-                    !contentType.equals(content.contentType))
-                    return null;  // contentType does not match, bad SignerInfo
-
-                // now, check message digest
-                byte[] messageDigest = (byte[])
-                    authenticatedAttributes.getAttributeValue(
-                         PKCS9Attribute.MESSAGE_DIGEST_OID);
-
-                if (messageDigest == null) // fail if there is no message digest
-                    return null;
-
-                MessageDigest md = MessageDigest.getInstance(digestAlgname);
-                byte[] computedMessageDigest = md.digest(data);
-
-                if (messageDigest.length != computedMessageDigest.length)
-                    return null;
-                for (int i = 0; i < messageDigest.length; i++) {
-                    if (messageDigest[i] != computedMessageDigest[i])
-                        return null;
-                }
-
-                // message digest attribute matched
-                // digest of original data
-
-                // the data actually signed is the DER encoding of
-                // the authenticated attributes (tagged with
-                // the "SET OF" tag, not 0xA0).
-                dataSigned = authenticatedAttributes.getDerEncoding();
-            }
-
-            // put together digest algorithm and encryption algorithm
-            // to form signing algorithm
-            String encryptionAlgname =
-                getDigestEncryptionAlgorithmId().getName();
+            throws NoSuchAlgorithmException, SignatureException {
 
-            // Workaround: sometimes the encryptionAlgname is actually
-            // a signature name
-            String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname);
-            if (tmp != null) encryptionAlgname = tmp;
-            String algname = AlgorithmId.makeSigAlg(
-                    digestAlgname, encryptionAlgname);
-
-            Signature sig = Signature.getInstance(algname);
-            X509Certificate cert = getCertificate(block);
-
-            if (cert == null) {
-                return null;
-            }
-            if (cert.hasUnsupportedCriticalExtension()) {
-                throw new SignatureException("Certificate has unsupported "
-                                             + "critical extension(s)");
+        PKCS7.PKCS7Verifier p7v = PKCS7.PKCS7Verifier.from(block, this);
+        if (p7v == null) return null;
+        if (data == null) {
+            try {
+                data = block.getContentInfo().getContentBytes();
+            } catch (IOException e) {
+                throw new SignatureException("IO error verifying signature:\n" +
+                                             e.getMessage());
             }
-
-            // Make sure that if the usage of the key in the certificate is
-            // restricted, it can be used for digital signatures.
-            // XXX We may want to check for additional extensions in the
-            // future.
-            boolean[] keyUsageBits = cert.getKeyUsage();
-            if (keyUsageBits != null) {
-                KeyUsageExtension keyUsage;
-                try {
-                    // We don't care whether or not this extension was marked
-                    // critical in the certificate.
-                    // We're interested only in its value (i.e., the bits set)
-                    // and treat the extension as critical.
-                    keyUsage = new KeyUsageExtension(keyUsageBits);
-                } catch (IOException ioe) {
-                    throw new SignatureException("Failed to parse keyUsage "
-                                                 + "extension");
-                }
-
-                boolean digSigAllowed = ((Boolean)keyUsage.get(
-                        KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue();
-
-                boolean nonRepuAllowed = ((Boolean)keyUsage.get(
-                        KeyUsageExtension.NON_REPUDIATION)).booleanValue();
-
-                if (!digSigAllowed && !nonRepuAllowed) {
-                    throw new SignatureException("Key usage restricted: "
-                                                 + "cannot be used for "
-                                                 + "digital signatures");
-                }
-            }
-
-            PublicKey key = cert.getPublicKey();
-            sig.initVerify(key);
-
-            sig.update(dataSigned);
-
-            if (sig.verify(encryptedDigest)) {
-                return this;
-            }
-
-        } catch (IOException e) {
-            throw new SignatureException("IO error verifying signature:\n" +
-                                         e.getMessage());
-
-        } catch (InvalidKeyException e) {
-            throw new SignatureException("InvalidKey: " + e.getMessage());
-
         }
-        return null;
+        p7v.update(data, 0, data.length);
+        return p7v.verify();
     }
 
     /* Verify the content of the pkcs7 block. */
--- a/jdk/src/share/classes/sun/security/pkcs11/Config.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/Config.java	Thu Apr 21 16:42:06 2011 -0700
@@ -343,6 +343,7 @@
         st.wordChars('{', '{'); // need {} for property subst
         st.wordChars('}', '}');
         st.wordChars('*', '*');
+        st.wordChars('+', '+');
         st.wordChars('~', '~');
         // XXX check ASCII table and add all other characters except special
 
--- a/jdk/src/share/classes/sun/security/pkcs11/SessionManager.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/SessionManager.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -76,6 +76,9 @@
     // maximum number of sessions to open with this token
     private final int maxSessions;
 
+    // total number of active sessions
+    private int activeSessions;
+
     // pool of available object sessions
     private final Pool objSessions;
 
@@ -115,11 +118,6 @@
         return (maxSessions <= DEFAULT_MAX_SESSIONS);
     }
 
-    // returns the total number of active sessions
-    int totalSessionCount() {
-        return SessionRef.totalCount();
-    }
-
     synchronized Session getObjSession() throws PKCS11Exception {
         Session session = objSessions.poll();
         if (session != null) {
@@ -141,7 +139,7 @@
         // create a new session rather than re-using an obj session
         // that avoids potential expensive cancels() for Signatures & RSACipher
         if (maxSessions == Integer.MAX_VALUE ||
-                totalSessionCount() < maxSessions) {
+                activeSessions < maxSessions) {
             session = openSession();
             return ensureValid(session);
         }
@@ -164,7 +162,7 @@
         if (debug != null) {
             String location = new Exception().getStackTrace()[2].toString();
             System.out.println("Killing session (" + location + ") active: "
-                + totalSessionCount());
+                + activeSessions);
         }
         closeSession(session);
         return null;
@@ -189,7 +187,7 @@
         }
         if (debug != null) {
             System.out.println("Demoting session, active: " +
-                totalSessionCount());
+                activeSessions);
         }
         boolean present = objSessions.remove(session);
         if (present == false) {
@@ -202,16 +200,16 @@
 
     private Session openSession() throws PKCS11Exception {
         if ((maxSessions != Integer.MAX_VALUE) &&
-                (totalSessionCount() >= maxSessions)) {
+                (activeSessions >= maxSessions)) {
             throw new ProviderException("No more sessions available");
         }
         long id = token.p11.C_OpenSession
                     (token.provider.slotID, openSessionFlags, null, null);
         Session session = new Session(token, id);
+        activeSessions++;
         if (debug != null) {
-            int currTotal = totalSessionCount();
-            if (currTotal > maxActiveSessions) {
-                maxActiveSessions = currTotal;
+            if (activeSessions > maxActiveSessions) {
+                maxActiveSessions = activeSessions;
                 if (maxActiveSessions % 10 == 0) {
                     System.out.println("Open sessions: " + maxActiveSessions);
                 }
@@ -222,6 +220,7 @@
 
     private void closeSession(Session session) {
         session.close();
+        activeSessions--;
     }
 
     private static final class Pool {
@@ -275,7 +274,7 @@
             }
             if (debug != null) {
                 System.out.println("Closing " + i + " idle sessions, active: "
-                        + mgr.totalSessionCount());
+                        + mgr.activeSessions);
             }
             List<Session> subList = pool.subList(0, i);
             subList.clear();
--- a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java	Thu Apr 21 16:42:06 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
@@ -249,7 +249,7 @@
         throws CertPathValidatorException
     {
         verifyRevocationStatus(currCert, prevKey, signFlag,
-                               allowSeparateKey, null);
+                   allowSeparateKey, null, mParams.getTrustAnchors());
     }
 
     /**
@@ -260,11 +260,12 @@
      *                     circular dependencies, we assume they're
      *                     revoked while checking the revocation
      *                     status of this cert.
+     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
      */
     private void verifyRevocationStatus(X509Certificate currCert,
         PublicKey prevKey, boolean signFlag, boolean allowSeparateKey,
-        Set<X509Certificate> stackedCerts) throws CertPathValidatorException
-    {
+        Set<X509Certificate> stackedCerts,
+        Set<TrustAnchor> trustAnchors) throws CertPathValidatorException {
 
         String msg = "revocation status";
         if (debug != null) {
@@ -311,7 +312,7 @@
                 DistributionPointFetcher.getInstance();
             // all CRLs returned by the DP Fetcher have also been verified
             mApprovedCRLs.addAll(store.getCRLs(sel, signFlag, prevKey,
-                mSigProvider, mStores, reasonsMask, mAnchor));
+                mSigProvider, mStores, reasonsMask, trustAnchors));
         } catch (Exception e) {
             if (debug != null) {
                 debug.println("CrlRevocationChecker.verifyRevocationStatus() "
@@ -328,7 +329,7 @@
             // Now that we have a list of possible CRLs, see which ones can
             // be approved
             mApprovedCRLs.addAll(verifyPossibleCRLs(mPossibleCRLs, currCert,
-                signFlag, prevKey, reasonsMask));
+                signFlag, prevKey, reasonsMask, trustAnchors));
         }
         if (debug != null) {
             debug.println("CrlRevocationChecker.verifyRevocationStatus() " +
@@ -353,9 +354,10 @@
         // See if the cert is in the set of approved crls.
         if (debug != null) {
             BigInteger sn = currCert.getSerialNumber();
-            debug.println("starting the final sweep...");
+            debug.println("CrlRevocationChecker.verifyRevocationStatus() " +
+                            "starting the final sweep...");
             debug.println("CrlRevocationChecker.verifyRevocationStatus" +
-                          " cert SN: " + sn.toString());
+                            " cert SN: " + sn.toString());
         }
 
         CRLReason reasonCode = CRLReason.UNSPECIFIED;
@@ -497,9 +499,9 @@
         certSel.setSubject(currCert.getIssuerX500Principal());
         certSel.setKeyUsage(mCrlSignUsage);
 
-        Set<TrustAnchor> newAnchors = mAnchor == null
-            ? mParams.getTrustAnchors()
-            : Collections.singleton(mAnchor);
+        Set<TrustAnchor> newAnchors =
+            (mAnchor == null ? mParams.getTrustAnchors() :
+                                Collections.singleton(mAnchor));
 
         PKIXBuilderParameters builderParams;
         if (mParams instanceof PKIXBuilderParameters) {
@@ -617,8 +619,8 @@
                             debug.println("CrlRevocationChecker.buildToNewKey()"
                                 + " index " + i + " checking " + cert);
                         }
-                        verifyRevocationStatus(cert, prevKey2, signFlag,
-                                               true, stackedCerts);
+                        verifyRevocationStatus(cert, prevKey2, signFlag, true,
+                                stackedCerts, newAnchors);
                         signFlag = certCanSignCrl(cert);
                         prevKey2 = cert.getPublicKey();
                     }
@@ -727,12 +729,14 @@
      * @param signFlag <code>true</code> if prevKey was trusted to sign CRLs
      * @param prevKey the public key of the issuer of cert
      * @param reasonsMask the reason code mask
+     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s>
      * @return a collection of approved crls (or an empty collection)
      */
     private Collection<X509CRL> verifyPossibleCRLs(Set<X509CRL> crls,
         X509Certificate cert, boolean signFlag, PublicKey prevKey,
-        boolean[] reasonsMask) throws CertPathValidatorException
-    {
+        boolean[] reasonsMask,
+        Set<TrustAnchor> trustAnchors) throws CertPathValidatorException {
+
         try {
             X509CertImpl certImpl = X509CertImpl.toImpl(cert);
             if (debug != null) {
@@ -764,7 +768,8 @@
                 DistributionPoint point = t.next();
                 for (X509CRL crl : crls) {
                     if (dpf.verifyCRL(certImpl, point, crl, reasonsMask,
-                        signFlag, prevKey, mSigProvider, mAnchor, mStores)) {
+                            signFlag, prevKey, mSigProvider,
+                            trustAnchors, mStores)) {
                         results.add(crl);
                     }
                 }
--- a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Thu Apr 21 16:42:06 2011 -0700
@@ -90,8 +90,9 @@
      */
     Collection<X509CRL> getCRLs(X509CRLSelector selector, boolean signFlag,
         PublicKey prevKey, String provider, List<CertStore> certStores,
-        boolean[] reasonsMask, TrustAnchor anchor) throws CertStoreException
-    {
+        boolean[] reasonsMask,
+        Set<TrustAnchor> trustAnchors) throws CertStoreException {
+
         if (USE_CRLDP == false) {
             return Collections.emptySet();
         }
@@ -121,7 +122,7 @@
                 DistributionPoint point = t.next();
                 Collection<X509CRL> crls = getCRLs(selector, certImpl,
                     point, reasonsMask, signFlag, prevKey, provider,
-                    certStores, anchor);
+                    certStores, trustAnchors);
                 results.addAll(crls);
             }
             if (debug != null) {
@@ -142,8 +143,8 @@
     private Collection<X509CRL> getCRLs(X509CRLSelector selector,
         X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
         boolean signFlag, PublicKey prevKey, String provider,
-        List<CertStore> certStores, TrustAnchor anchor)
-    {
+        List<CertStore> certStores, Set<TrustAnchor> trustAnchors) {
+
         // check for full name
         GeneralNames fullName = point.getFullName();
         if (fullName == null) {
@@ -194,7 +195,7 @@
                 // we check the issuer in verifyCRLs method
                 selector.setIssuerNames(null);
                 if (selector.match(crl) && verifyCRL(certImpl, point, crl,
-                        reasonsMask, signFlag, prevKey, provider, anchor,
+                        reasonsMask, signFlag, prevKey, provider, trustAnchors,
                         certStores)) {
                     crls.add(crl);
                 }
@@ -276,12 +277,17 @@
      * @param signFlag true if prevKey can be used to verify the CRL
      * @param prevKey the public key that verifies the certificate's signature
      * @param provider the Signature provider to use
+     * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
+     * @param certStores a {@code List} of {@code CertStore}s to be used in
+     *        finding certificates and CRLs
      * @return true if ok, false if not
      */
     boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point,
         X509CRL crl, boolean[] reasonsMask, boolean signFlag,
-        PublicKey prevKey, String provider, TrustAnchor anchor,
+        PublicKey prevKey, String provider,
+        Set<TrustAnchor> trustAnchors,
         List<CertStore> certStores) throws CRLException, IOException {
+
         boolean indirectCRL = false;
         X509CRLImpl crlImpl = X509CRLImpl.toImpl(crl);
         IssuingDistributionPointExtension idpExt =
@@ -335,7 +341,16 @@
             byte[] crlAKID = crlImpl.getExtensionValue(
                                 PKIXExtensions.AuthorityKey_Id.toString());
 
-            if (!Arrays.equals(certAKID, crlAKID)) {
+            if (certAKID == null || crlAKID == null) {
+                // cannot recognize indirect CRL without AKID
+
+                // we accept the case that a CRL issuer provide status
+                // information for itself.
+                if (issues(certImpl, crlImpl, provider)) {
+                    // reset the public key used to verify the CRL's signature
+                    prevKey = certImpl.getPublicKey();
+                }
+            } else if (!Arrays.equals(certAKID, crlAKID)) {
                 // we accept the case that a CRL issuer provide status
                 // information for itself.
                 if (issues(certImpl, crlImpl, provider)) {
@@ -572,46 +587,19 @@
             // Except the performance improvement, another benefit is to break
             // the dead loop while looking for the issuer back and forth
             // between the delegated self-issued certificate and its issuer.
-            Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
-            if (anchor != null) {
-                trustAnchors.add(anchor);
-            }
+            Set<TrustAnchor> newTrustAnchors = new HashSet<>(trustAnchors);
 
             if (prevKey != null) {
-                // if the previous key is of the anchor, don't bother to
-                // duplicate the trust.
-                boolean duplicated = false;
-                PublicKey publicKey = prevKey;
+                // Add the previous certificate as a trust anchor.
                 X500Principal principal = certImpl.getIssuerX500Principal();
-
-                if (anchor != null) {
-                    X509Certificate trustedCert = anchor.getTrustedCert();
-                    X500Principal trustedPrincipal;
-                    PublicKey trustedPublicKey;
-                    if (trustedCert != null) {
-                        trustedPrincipal = trustedCert.getSubjectX500Principal();
-                        trustedPublicKey = trustedCert.getPublicKey();
-                    } else {
-                        trustedPrincipal = anchor.getCA();
-                        trustedPublicKey = anchor.getCAPublicKey();
-                    }
-
-                    if (principal.equals(trustedPrincipal) &&
-                        publicKey.equals(trustedPublicKey)) {
-                        duplicated = true;
-                    }
-                }
-
-                if (!duplicated) {
-                    TrustAnchor temporary =
-                        new TrustAnchor(principal, publicKey, null);
-                    trustAnchors.add(temporary);
-                }
+                TrustAnchor temporary =
+                        new TrustAnchor(principal, prevKey, null);
+                newTrustAnchors.add(temporary);
             }
 
             PKIXBuilderParameters params = null;
             try {
-                params = new PKIXBuilderParameters(trustAnchors, certSel);
+                params = new PKIXBuilderParameters(newTrustAnchors, certSel);
             } catch (InvalidAlgorithmParameterException iape) {
                 throw new CRLException(iape);
             }
@@ -697,6 +685,8 @@
     private static boolean issues(X509CertImpl cert, X509CRLImpl crl,
             String provider) throws IOException {
 
+        boolean matched = false;
+
         AdaptableX509CertSelector issuerSelector =
                                     new AdaptableX509CertSelector();
 
@@ -719,9 +709,24 @@
          * and MUST include authority key identifier extension in all CRLs
          * issued. [section 5.2.1, RFC 2459]
          */
-        issuerSelector.parseAuthorityKeyIdentifierExtension(
-                                        crl.getAuthKeyIdExtension());
+        AuthorityKeyIdentifierExtension crlAKID = crl.getAuthKeyIdExtension();
+        if (crlAKID != null) {
+            issuerSelector.parseAuthorityKeyIdentifierExtension(crlAKID);
+        }
+
+        matched = issuerSelector.match(cert);
 
-        return issuerSelector.match(cert);
+        // if AKID is unreliable, verify the CRL signature with the cert
+        if (matched && (crlAKID == null ||
+                cert.getAuthorityKeyIdentifierExtension() == null)) {
+            try {
+                crl.verify(cert.getPublicKey(), provider);
+                matched = true;
+            } catch (Exception e) {
+                matched = false;
+            }
+        }
+
+        return matched;
     }
 }
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Thu Apr 21 16:42:06 2011 -0700
@@ -40,10 +40,6 @@
  */
 final class CipherSuiteList {
 
-    // lists of supported and default enabled ciphersuites
-    // created on demand
-    private static CipherSuiteList supportedSuites, defaultSuites;
-
     private final Collection<CipherSuite> cipherSuites;
     private String[] suiteNames;
 
@@ -206,57 +202,8 @@
      */
     static synchronized void clearAvailableCache() {
         if (CipherSuite.DYNAMIC_AVAILABILITY) {
-            supportedSuites = null;
-            defaultSuites = null;
             CipherSuite.BulkCipher.clearAvailableCache();
             JsseJce.clearEcAvailable();
         }
     }
-
-    /**
-     * Return the list of all available CipherSuites with a priority of
-     * minPriority or above.
-     * Should be called with the Class lock held.
-     */
-    private static CipherSuiteList buildAvailableCache(int minPriority) {
-        // SortedSet automatically arranges ciphersuites in default
-        // preference order
-        Set<CipherSuite> cipherSuites = new TreeSet<>();
-        Collection<CipherSuite> allowedCipherSuites =
-                                    CipherSuite.allowedCipherSuites();
-        for (CipherSuite c : allowedCipherSuites) {
-            if ((c.allowed == false) || (c.priority < minPriority)) {
-                continue;
-            }
-
-            if (c.isAvailable()) {
-                cipherSuites.add(c);
-            }
-        }
-
-        return new CipherSuiteList(cipherSuites);
-    }
-
-    /**
-     * Return supported CipherSuites in preference order.
-     */
-    static synchronized CipherSuiteList getSupported() {
-        if (supportedSuites == null) {
-            supportedSuites =
-                buildAvailableCache(CipherSuite.SUPPORTED_SUITES_PRIORITY);
-        }
-        return supportedSuites;
-    }
-
-    /**
-     * Return default enabled CipherSuites in preference order.
-     */
-    static synchronized CipherSuiteList getDefault() {
-        if (defaultSuites == null) {
-            defaultSuites =
-                buildAvailableCache(CipherSuite.DEFAULT_SUITES_PRIORITY);
-        }
-        return defaultSuites;
-    }
-
 }
--- a/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * 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
- * 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.security.ssl;
-
-import java.io.*;
-import java.util.*;
-
-import java.security.*;
-
-import javax.net.ssl.*;
-
-/**
- * "Default" SSLContext as returned by SSLContext.getDefault(). It comes
- * initialized with default KeyManagers and TrustManagers created using
- * various system properties.
- *
- * @since   1.6
- */
-public final class DefaultSSLContextImpl extends SSLContextImpl {
-
-    private static final String NONE = "NONE";
-    private static final String P11KEYSTORE = "PKCS11";
-    private static final Debug debug = Debug.getInstance("ssl");
-
-    private static volatile SSLContextImpl defaultImpl;
-
-    private static TrustManager[] defaultTrustManagers;
-
-    private static KeyManager[] defaultKeyManagers;
-
-    public DefaultSSLContextImpl() throws Exception {
-        super(defaultImpl);
-        try {
-            super.engineInit(getDefaultKeyManager(), getDefaultTrustManager(), null);
-        } catch (Exception e) {
-            if (debug != null && Debug.isOn("defaultctx")) {
-                System.out.println("default context init failed: " + e);
-            }
-            throw e;
-        }
-        if (defaultImpl == null) {
-            defaultImpl = this;
-        }
-    }
-
-    protected void engineInit(KeyManager[] km, TrustManager[] tm,
-            SecureRandom sr) throws KeyManagementException {
-        throw new KeyManagementException
-            ("Default SSLContext is initialized automatically");
-    }
-
-    static synchronized SSLContextImpl getDefaultImpl() throws Exception {
-        if (defaultImpl == null) {
-            new DefaultSSLContextImpl();
-        }
-        return defaultImpl;
-    }
-
-    private static synchronized TrustManager[] getDefaultTrustManager() throws Exception {
-        if (defaultTrustManagers != null) {
-            return defaultTrustManagers;
-        }
-
-        KeyStore ks = TrustManagerFactoryImpl.getCacertsKeyStore("defaultctx");
-
-        TrustManagerFactory tmf = TrustManagerFactory.getInstance(
-            TrustManagerFactory.getDefaultAlgorithm());
-        tmf.init(ks);
-        defaultTrustManagers = tmf.getTrustManagers();
-        return defaultTrustManagers;
-    }
-
-    private static synchronized KeyManager[] getDefaultKeyManager() throws Exception {
-        if (defaultKeyManagers != null) {
-            return defaultKeyManagers;
-        }
-
-        final Map<String,String> props = new HashMap<>();
-        AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<Object>() {
-            public Object run() throws Exception {
-                props.put("keyStore",  System.getProperty(
-                            "javax.net.ssl.keyStore", ""));
-                props.put("keyStoreType", System.getProperty(
-                            "javax.net.ssl.keyStoreType",
-                            KeyStore.getDefaultType()));
-                props.put("keyStoreProvider", System.getProperty(
-                            "javax.net.ssl.keyStoreProvider", ""));
-                props.put("keyStorePasswd", System.getProperty(
-                            "javax.net.ssl.keyStorePassword", ""));
-                return null;
-            }
-        });
-
-        final String defaultKeyStore = props.get("keyStore");
-        String defaultKeyStoreType = props.get("keyStoreType");
-        String defaultKeyStoreProvider = props.get("keyStoreProvider");
-        if (debug != null && Debug.isOn("defaultctx")) {
-            System.out.println("keyStore is : " + defaultKeyStore);
-            System.out.println("keyStore type is : " +
-                                    defaultKeyStoreType);
-            System.out.println("keyStore provider is : " +
-                                    defaultKeyStoreProvider);
-        }
-
-        if (P11KEYSTORE.equals(defaultKeyStoreType) &&
-                !NONE.equals(defaultKeyStore)) {
-            throw new IllegalArgumentException("if keyStoreType is "
-                + P11KEYSTORE + ", then keyStore must be " + NONE);
-        }
-
-        FileInputStream fs = null;
-        if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) {
-            fs = AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<FileInputStream>() {
-                public FileInputStream run() throws Exception {
-                    return new FileInputStream(defaultKeyStore);
-                }
-            });
-        }
-
-        String defaultKeyStorePassword = props.get("keyStorePasswd");
-        char[] passwd = null;
-        if (defaultKeyStorePassword.length() != 0) {
-            passwd = defaultKeyStorePassword.toCharArray();
-        }
-
-        /**
-         * Try to initialize key store.
-         */
-        KeyStore ks = null;
-        if ((defaultKeyStoreType.length()) != 0) {
-            if (debug != null && Debug.isOn("defaultctx")) {
-                System.out.println("init keystore");
-            }
-            if (defaultKeyStoreProvider.length() == 0) {
-                ks = KeyStore.getInstance(defaultKeyStoreType);
-            } else {
-                ks = KeyStore.getInstance(defaultKeyStoreType,
-                                    defaultKeyStoreProvider);
-            }
-
-            // if defaultKeyStore is NONE, fs will be null
-            ks.load(fs, passwd);
-        }
-        if (fs != null) {
-            fs.close();
-            fs = null;
-        }
-
-        /*
-         * Try to initialize key manager.
-         */
-        if (debug != null && Debug.isOn("defaultctx")) {
-            System.out.println("init keymanager of type " +
-                KeyManagerFactory.getDefaultAlgorithm());
-        }
-        KeyManagerFactory kmf = KeyManagerFactory.getInstance(
-            KeyManagerFactory.getDefaultAlgorithm());
-
-        if (P11KEYSTORE.equals(defaultKeyStoreType)) {
-            kmf.init(ks, null); // do not pass key passwd if using token
-        } else {
-            kmf.init(ks, passwd);
-        }
-
-        defaultKeyManagers = kmf.getKeyManagers();
-        return defaultKeyManagers;
-    }
-}
--- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -247,9 +247,9 @@
                 // the SunJSSE implementation does the actual crypto using
                 // a NONEwithRSA signature obtained from the cryptoProvider.
                 if (cryptoProvider.getService("Signature", algorithm) == null) {
-                    // Calling Signature.getInstance() and catching the exception
-                    // would be cleaner, but exceptions are a little expensive.
-                    // So we check directly via getService().
+                    // Calling Signature.getInstance() and catching the
+                    // exception would be cleaner, but exceptions are a little
+                    // expensive. So we check directly via getService().
                     try {
                         return Signature.getInstance(algorithm, "SunJSSE");
                     } catch (NoSuchProviderException e) {
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Thu Apr 21 16:42:06 2011 -0700
@@ -37,10 +37,6 @@
  */
 final class ProtocolList {
 
-    private static final ProtocolList SUPPORTED;
-    private static final ProtocolList CLIENT_DEFAULT;
-    private static final ProtocolList SERVER_DEFAULT;
-
     // the sorted protocol version list
     private final ArrayList<ProtocolVersion> protocols;
 
@@ -154,66 +150,4 @@
     public String toString() {
         return protocols.toString();
     }
-
-    /**
-     * Return the list of default enabled protocols.
-     */
-    static ProtocolList getDefault(boolean isServer) {
-        return isServer ? SERVER_DEFAULT : CLIENT_DEFAULT;
-    }
-
-    /**
-     * Return whether a protocol list is the original default enabled
-     * protocols.  See: SSLSocket/SSLEngine.setEnabledProtocols()
-     */
-    static boolean isDefaultProtocolList(ProtocolList protocols) {
-        return protocols == CLIENT_DEFAULT || protocols == SERVER_DEFAULT;
-    }
-
-    /**
-     * Return the list of supported protocols.
-     */
-    static ProtocolList getSupported() {
-        return SUPPORTED;
-    }
-
-    static {
-        if (SunJSSE.isFIPS()) {
-            SUPPORTED = new ProtocolList(new String[] {
-                ProtocolVersion.TLS10.name,
-                ProtocolVersion.TLS11.name,
-                ProtocolVersion.TLS12.name
-            });
-
-            SERVER_DEFAULT = SUPPORTED;
-            CLIENT_DEFAULT = new ProtocolList(new String[] {
-                ProtocolVersion.TLS10.name
-            });
-        } else {
-            SUPPORTED = new ProtocolList(new String[] {
-                ProtocolVersion.SSL20Hello.name,
-                ProtocolVersion.SSL30.name,
-                ProtocolVersion.TLS10.name,
-                ProtocolVersion.TLS11.name,
-                ProtocolVersion.TLS12.name
-            });
-
-            SERVER_DEFAULT = SUPPORTED;
-
-            /*
-             * RFC 5246 says that sending SSLv2 backward-compatible
-             * hello SHOULD NOT be done any longer.
-             *
-             * We are not enabling TLS 1.1/1.2 by default yet on clients
-             * out of concern for interop with existing
-             * SSLv3/TLS1.0-only servers.  When these versions of TLS
-             * gain more traction, we'll enable them.
-             */
-            CLIENT_DEFAULT = new ProtocolList(new String[] {
-                ProtocolVersion.SSL30.name,
-                ProtocolVersion.TLS10.name
-            });
-        }
-    }
-
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Thu Apr 21 16:42:06 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
@@ -27,6 +27,7 @@
 
 import java.net.Socket;
 
+import java.io.*;
 import java.util.*;
 import java.security.*;
 import java.security.cert.*;
@@ -36,7 +37,7 @@
 
 import sun.security.provider.certpath.AlgorithmChecker;
 
-public class SSLContextImpl extends SSLContextSpi {
+public abstract class SSLContextImpl extends SSLContextSpi {
 
     private static final Debug debug = Debug.getInstance("ssl");
 
@@ -50,20 +51,24 @@
     private X509TrustManager trustManager;
     private SecureRandom secureRandom;
 
-    public SSLContextImpl() {
-        this(null);
-    }
+    // The default algrithm constraints
+    private AlgorithmConstraints defaultAlgorithmConstraints =
+                                 new SSLAlgorithmConstraints(null);
+
+    // supported and default protocols
+    private ProtocolList defaultServerProtocolList;
+    private ProtocolList defaultClientProtocolList;
+    private ProtocolList supportedProtocolList;
 
-    SSLContextImpl(SSLContextImpl other) {
-        if (other == null) {
-            ephemeralKeyManager = new EphemeralKeyManager();
-            clientCache = new SSLSessionContextImpl();
-            serverCache = new SSLSessionContextImpl();
-        } else {
-            ephemeralKeyManager = other.ephemeralKeyManager;
-            clientCache = other.clientCache;
-            serverCache = other.serverCache;
-        }
+    // supported and default cipher suites
+    private CipherSuiteList defaultServerCipherSuiteList;
+    private CipherSuiteList defaultClientCipherSuiteList;
+    private CipherSuiteList supportedCipherSuiteList;
+
+    SSLContextImpl() {
+        ephemeralKeyManager = new EphemeralKeyManager();
+        clientCache = new SSLSessionContextImpl();
+        serverCache = new SSLSessionContextImpl();
     }
 
     protected void engineInit(KeyManager[] km, TrustManager[] tm,
@@ -177,7 +182,7 @@
             throw new IllegalStateException(
                 "SSLContextImpl is not initialized");
         }
-        return new SSLSocketFactoryImpl(this);
+       return new SSLSocketFactoryImpl(this);
     }
 
     protected SSLServerSocketFactory engineGetServerSocketFactory() {
@@ -227,6 +232,535 @@
         return ephemeralKeyManager;
     }
 
+    abstract SSLParameters getDefaultServerSSLParams();
+    abstract SSLParameters getDefaultClientSSLParams();
+    abstract SSLParameters getSupportedSSLParams();
+
+    // Get suported ProtoclList.
+    ProtocolList getSuportedProtocolList() {
+        if (supportedProtocolList == null) {
+            supportedProtocolList =
+                new ProtocolList(getSupportedSSLParams().getProtocols());
+        }
+
+        return supportedProtocolList;
+    }
+
+    // Get default ProtoclList.
+    ProtocolList getDefaultProtocolList(boolean roleIsServer) {
+        if (roleIsServer) {
+            if (defaultServerProtocolList == null) {
+                defaultServerProtocolList = new ProtocolList(
+                        getDefaultServerSSLParams().getProtocols());
+            }
+
+            return defaultServerProtocolList;
+        } else {
+            if (defaultClientProtocolList == null) {
+                defaultClientProtocolList = new ProtocolList(
+                        getDefaultClientSSLParams().getProtocols());
+            }
+
+            return defaultClientProtocolList;
+        }
+    }
+
+    // Get suported CipherSuiteList.
+    CipherSuiteList getSuportedCipherSuiteList() {
+        // Clear cache of available ciphersuites.
+        clearAvailableCache();
+
+        if (supportedCipherSuiteList == null) {
+            supportedCipherSuiteList =
+                getApplicableCipherSuiteList(getSuportedProtocolList(), false);
+        }
+
+        return supportedCipherSuiteList;
+    }
+
+    // Get default CipherSuiteList.
+    CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) {
+        // Clear cache of available ciphersuites.
+        clearAvailableCache();
+
+        if (roleIsServer) {
+            if (defaultServerCipherSuiteList == null) {
+                defaultServerCipherSuiteList = getApplicableCipherSuiteList(
+                        getDefaultProtocolList(true), true);
+            }
+
+            return defaultServerCipherSuiteList;
+        } else {
+            if (defaultClientCipherSuiteList == null) {
+                defaultClientCipherSuiteList = getApplicableCipherSuiteList(
+                        getDefaultProtocolList(false), true);
+            }
+
+            return defaultClientCipherSuiteList;
+        }
+    }
+
+    /**
+     * Return whether a protocol list is the original default enabled
+     * protocols.  See: SSLSocket/SSLEngine.setEnabledProtocols()
+     */
+    boolean isDefaultProtocolList(ProtocolList protocols) {
+        return (protocols == defaultServerProtocolList) ||
+               (protocols == defaultClientProtocolList);
+    }
+
+
+    /*
+     * Return the list of all available CipherSuites with a priority of
+     * minPriority or above.
+     */
+    private CipherSuiteList getApplicableCipherSuiteList(
+            ProtocolList protocols, boolean onlyEnabled) {
+
+        int minPriority = CipherSuite.SUPPORTED_SUITES_PRIORITY;
+        if (onlyEnabled) {
+            minPriority = CipherSuite.DEFAULT_SUITES_PRIORITY;
+        }
+
+        Collection<CipherSuite> allowedCipherSuites =
+                                    CipherSuite.allowedCipherSuites();
+
+        ArrayList<CipherSuite> suites = new ArrayList<>();
+        if (!(protocols.collection().isEmpty()) &&
+                protocols.min.v != ProtocolVersion.NONE.v) {
+            for (CipherSuite suite : allowedCipherSuites) {
+                if (suite.allowed == false || suite.priority < minPriority) {
+                    continue;
+                }
+
+                if (suite.isAvailable() &&
+                        suite.obsoleted > protocols.min.v &&
+                        suite.supported <= protocols.max.v) {
+                    if (defaultAlgorithmConstraints.permits(
+                            EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
+                            suite.name, null)) {
+                        suites.add(suite);
+                    }
+                } else if (debug != null &&
+                        Debug.isOn("sslctx") && Debug.isOn("verbose")) {
+                    if (suite.obsoleted <= protocols.min.v) {
+                        System.out.println(
+                            "Ignoring obsoleted cipher suite: " + suite);
+                    } else if (suite.supported > protocols.max.v) {
+                        System.out.println(
+                            "Ignoring unsupported cipher suite: " + suite);
+                    } else {
+                        System.out.println(
+                            "Ignoring unavailable cipher suite: " + suite);
+                    }
+                }
+            }
+        }
+
+        return new CipherSuiteList(suites);
+    }
+
+    /**
+     * Clear cache of available ciphersuites. If we support all ciphers
+     * internally, there is no need to clear the cache and calling this
+     * method has no effect.
+     */
+    synchronized void clearAvailableCache() {
+        if (CipherSuite.DYNAMIC_AVAILABILITY) {
+            supportedCipherSuiteList = null;
+            defaultServerCipherSuiteList = null;
+            defaultClientCipherSuiteList = null;
+            CipherSuite.BulkCipher.clearAvailableCache();
+            JsseJce.clearEcAvailable();
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS/SSL algorithm
+     *
+     * SSL/TLS protocols specify the forward compatibility and version
+     * roll-back attack protections, however, a number of SSL/TLS server
+     * vendors did not implement these aspects properly, and some current
+     * SSL/TLS servers may refuse to talk to a TLS 1.1 or later client.
+     *
+     * Considering above interoperability issues, SunJSSE will not set
+     * TLS 1.1 and TLS 1.2 as the enabled protocols for client by default.
+     *
+     * For SSL/TLS servers, there is no such interoperability issues as
+     * SSL/TLS clients. In SunJSSE, TLS 1.1 or later version will be the
+     * enabled protocols for server by default.
+     *
+     * We may change the behavior when popular TLS/SSL vendors support TLS
+     * forward compatibility properly.
+     *
+     * SSLv2Hello is no longer necessary.  This interoperability option was
+     * put in place in the late 90's when SSLv3/TLS1.0 were relatively new
+     * and there were a fair number of SSLv2-only servers deployed.  Because
+     * of the security issues in SSLv2, it is rarely (if ever) used, as
+     * deployments should now be using SSLv3 and TLSv1.
+     *
+     * Considering the issues of SSLv2Hello, we should not enable SSLv2Hello
+     * by default. Applications still can use it by enabling SSLv2Hello with
+     * the series of setEnabledProtocols APIs.
+     */
+
+    /*
+     * The conservative SSLContext implementation for TLS, SSL, SSLv3 and
+     * TLS10 algorithm.
+     *
+     * This is a super class of DefaultSSLContext and TLS10Context.
+     *
+     * @see SSLContext
+     */
+    private static class ConservativeSSLContext extends SSLContextImpl {
+        // parameters
+        private static SSLParameters defaultServerSSLParams;
+        private static SSLParameters defaultClientSSLParams;
+        private static SSLParameters supportedSSLParams;
+
+        static {
+            if (SunJSSE.isFIPS()) {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name
+                });
+
+            } else {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL20Hello.name,
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name
+                });
+            }
+        }
+
+        SSLParameters getDefaultServerSSLParams() {
+            return defaultServerSSLParams;
+        }
+
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+
+        SSLParameters getSupportedSSLParams() {
+            return supportedSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for default algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class DefaultSSLContext extends ConservativeSSLContext {
+        private static final String NONE = "NONE";
+        private static final String P11KEYSTORE = "PKCS11";
+
+        private static volatile SSLContextImpl defaultImpl;
+
+        private static TrustManager[] defaultTrustManagers;
+        private static KeyManager[] defaultKeyManagers;
+
+        public DefaultSSLContext() throws Exception {
+            try {
+                super.engineInit(getDefaultKeyManager(),
+                        getDefaultTrustManager(), null);
+            } catch (Exception e) {
+                if (debug != null && Debug.isOn("defaultctx")) {
+                    System.out.println("default context init failed: " + e);
+                }
+                throw e;
+            }
+
+            if (defaultImpl == null) {
+                defaultImpl = this;
+            }
+        }
+
+        protected void engineInit(KeyManager[] km, TrustManager[] tm,
+            SecureRandom sr) throws KeyManagementException {
+            throw new KeyManagementException
+                ("Default SSLContext is initialized automatically");
+        }
+
+        static synchronized SSLContextImpl getDefaultImpl() throws Exception {
+            if (defaultImpl == null) {
+                new DefaultSSLContext();
+            }
+            return defaultImpl;
+        }
+
+        private static synchronized TrustManager[] getDefaultTrustManager()
+                throws Exception {
+            if (defaultTrustManagers != null) {
+                return defaultTrustManagers;
+            }
+
+            KeyStore ks =
+                TrustManagerFactoryImpl.getCacertsKeyStore("defaultctx");
+
+            TrustManagerFactory tmf = TrustManagerFactory.getInstance(
+                TrustManagerFactory.getDefaultAlgorithm());
+            tmf.init(ks);
+            defaultTrustManagers = tmf.getTrustManagers();
+            return defaultTrustManagers;
+        }
+
+        private static synchronized KeyManager[] getDefaultKeyManager()
+                throws Exception {
+            if (defaultKeyManagers != null) {
+                return defaultKeyManagers;
+            }
+
+            final Map<String,String> props = new HashMap<>();
+            AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Object>() {
+                public Object run() throws Exception {
+                    props.put("keyStore",  System.getProperty(
+                                "javax.net.ssl.keyStore", ""));
+                    props.put("keyStoreType", System.getProperty(
+                                "javax.net.ssl.keyStoreType",
+                                KeyStore.getDefaultType()));
+                    props.put("keyStoreProvider", System.getProperty(
+                                "javax.net.ssl.keyStoreProvider", ""));
+                    props.put("keyStorePasswd", System.getProperty(
+                                "javax.net.ssl.keyStorePassword", ""));
+                    return null;
+                }
+            });
+
+            final String defaultKeyStore = props.get("keyStore");
+            String defaultKeyStoreType = props.get("keyStoreType");
+            String defaultKeyStoreProvider = props.get("keyStoreProvider");
+            if (debug != null && Debug.isOn("defaultctx")) {
+                System.out.println("keyStore is : " + defaultKeyStore);
+                System.out.println("keyStore type is : " +
+                                        defaultKeyStoreType);
+                System.out.println("keyStore provider is : " +
+                                        defaultKeyStoreProvider);
+            }
+
+            if (P11KEYSTORE.equals(defaultKeyStoreType) &&
+                    !NONE.equals(defaultKeyStore)) {
+                throw new IllegalArgumentException("if keyStoreType is "
+                    + P11KEYSTORE + ", then keyStore must be " + NONE);
+            }
+
+            FileInputStream fs = null;
+            if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) {
+                fs = AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<FileInputStream>() {
+                    public FileInputStream run() throws Exception {
+                        return new FileInputStream(defaultKeyStore);
+                    }
+                });
+            }
+
+            String defaultKeyStorePassword = props.get("keyStorePasswd");
+            char[] passwd = null;
+            if (defaultKeyStorePassword.length() != 0) {
+                passwd = defaultKeyStorePassword.toCharArray();
+            }
+
+            /**
+             * Try to initialize key store.
+             */
+            KeyStore ks = null;
+            if ((defaultKeyStoreType.length()) != 0) {
+                if (debug != null && Debug.isOn("defaultctx")) {
+                    System.out.println("init keystore");
+                }
+                if (defaultKeyStoreProvider.length() == 0) {
+                    ks = KeyStore.getInstance(defaultKeyStoreType);
+                } else {
+                    ks = KeyStore.getInstance(defaultKeyStoreType,
+                                        defaultKeyStoreProvider);
+                }
+
+                // if defaultKeyStore is NONE, fs will be null
+                ks.load(fs, passwd);
+            }
+            if (fs != null) {
+                fs.close();
+                fs = null;
+            }
+
+            /*
+             * Try to initialize key manager.
+             */
+            if (debug != null && Debug.isOn("defaultctx")) {
+                System.out.println("init keymanager of type " +
+                    KeyManagerFactory.getDefaultAlgorithm());
+            }
+            KeyManagerFactory kmf = KeyManagerFactory.getInstance(
+                KeyManagerFactory.getDefaultAlgorithm());
+
+            if (P11KEYSTORE.equals(defaultKeyStoreType)) {
+                kmf.init(ks, null); // do not pass key passwd if using token
+            } else {
+                kmf.init(ks, passwd);
+            }
+
+            defaultKeyManagers = kmf.getKeyManagers();
+            return defaultKeyManagers;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS, SSL, SSLv3 and TLS10 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS10Context extends ConservativeSSLContext {
+        // use the default constructor and methods
+    }
+
+    /*
+     * The SSLContext implementation for TLS11 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS11Context extends SSLContextImpl {
+        // parameters
+        private static SSLParameters defaultServerSSLParams;
+        private static SSLParameters defaultClientSSLParams;
+        private static SSLParameters supportedSSLParams;
+
+        static {
+            if (SunJSSE.isFIPS()) {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name
+                });
+
+            } else {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL20Hello.name,
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name
+                });
+            }
+        }
+
+        SSLParameters getDefaultServerSSLParams() {
+            return defaultServerSSLParams;
+        }
+
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+
+        SSLParameters getSupportedSSLParams() {
+            return supportedSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS12 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS12Context extends SSLContextImpl {
+        // parameters
+        private static SSLParameters defaultServerSSLParams;
+        private static SSLParameters defaultClientSSLParams;
+        private static SSLParameters supportedSSLParams;
+
+        static {
+            if (SunJSSE.isFIPS()) {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+            } else {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL20Hello.name,
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+            }
+        }
+
+        SSLParameters getDefaultServerSSLParams() {
+            return defaultServerSSLParams;
+        }
+
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+
+        SSLParameters getSupportedSSLParams() {
+            return supportedSSLParams;
+        }
+    }
+
 }
 
 
--- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -374,8 +374,10 @@
         clientVerifyData = new byte[0];
         serverVerifyData = new byte[0];
 
-        enabledCipherSuites = CipherSuiteList.getDefault();
-        enabledProtocols = ProtocolList.getDefault(roleIsServer);
+        enabledCipherSuites =
+                sslContext.getDefaultCipherSuiteList(roleIsServer);
+        enabledProtocols =
+                sslContext.getDefaultProtocolList(roleIsServer);
 
         wrapLock = new Object();
         unwrapLock = new Object();
@@ -1883,8 +1885,8 @@
              * change them to the corresponding default ones.
              */
             if (roleIsServer != (!flag) &&
-                    ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                enabledProtocols = ProtocolList.getDefault(!flag);
+                    sslContext.isDefaultProtocolList(enabledProtocols)) {
+                enabledProtocols = sslContext.getDefaultProtocolList(!flag);
             }
 
             roleIsServer = !flag;
@@ -1907,8 +1909,8 @@
                  * change them to the corresponding default ones.
                  */
                 if (roleIsServer != (!flag) &&
-                        ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                    enabledProtocols = ProtocolList.getDefault(!flag);
+                        sslContext.isDefaultProtocolList(enabledProtocols)) {
+                    enabledProtocols = sslContext.getDefaultProtocolList(!flag);
                 }
 
                 roleIsServer = !flag;
@@ -1951,8 +1953,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return sslContext.getSuportedCipherSuiteList().toStringArray();
     }
 
     /**
@@ -1992,7 +1993,7 @@
      * @return an array of protocol names.
      */
     public String[] getSupportedProtocols() {
-        return ProtocolList.getSupported().toStringArray();
+        return sslContext.getSuportedProtocolList().toStringArray();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -49,7 +49,7 @@
      * java.security file is set.
      */
     public SSLServerSocketFactoryImpl() throws Exception {
-        this.context = DefaultSSLContextImpl.getDefaultImpl();
+        this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl();
     }
 
     /**
@@ -99,8 +99,7 @@
      * is encrypted to provide confidentiality.
      */
     public String[] getDefaultCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getDefault().toStringArray();
+        return context.getDefaultCipherSuiteList(true).toStringArray();
     }
 
     /**
@@ -114,8 +113,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return context.getSuportedCipherSuiteList().toStringArray();
     }
 
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java	Thu Apr 21 16:42:06 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
@@ -153,8 +153,8 @@
             throw new SSLException("No Authentication context given");
         }
         sslContext = context;
-        enabledCipherSuites = CipherSuiteList.getDefault();
-        enabledProtocols = ProtocolList.getDefault(true);
+        enabledCipherSuites = sslContext.getDefaultCipherSuiteList(true);
+        enabledProtocols = sslContext.getDefaultProtocolList(true);
     }
 
     /**
@@ -168,8 +168,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return sslContext.getSuportedCipherSuiteList().toStringArray();
     }
 
     /**
@@ -194,7 +193,7 @@
     }
 
     public String[] getSupportedProtocols() {
-        return ProtocolList.getSupported().toStringArray();
+        return sslContext.getSuportedProtocolList().toStringArray();
     }
 
     /**
@@ -253,8 +252,8 @@
          * change them to the corresponding default ones.
          */
         if (useServerMode != (!flag) &&
-                ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-            enabledProtocols = ProtocolList.getDefault(!flag);
+                sslContext.isDefaultProtocolList(enabledProtocols)) {
+            enabledProtocols = sslContext.getDefaultProtocolList(!flag);
         }
 
         useServerMode = !flag;
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -42,20 +42,18 @@
  *
  * @author David Brownell
  */
-final
-public class SSLSocketFactoryImpl extends SSLSocketFactory
-{
+final public class SSLSocketFactoryImpl extends SSLSocketFactory {
+
     private static SSLContextImpl defaultContext;
     private SSLContextImpl context;
 
-
     /**
      * Constructor used to instantiate the default factory. This method is
      * only called if the old "ssl.SocketFactory.provider" property in the
      * java.security file is set.
      */
     public SSLSocketFactoryImpl() throws Exception {
-        this.context = DefaultSSLContextImpl.getDefaultImpl();
+        this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl();
     }
 
     /**
@@ -167,11 +165,9 @@
      * is encrypted to provide confidentiality.
      */
     public String[] getDefaultCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getDefault().toStringArray();
+        return context.getDefaultCipherSuiteList(false).toStringArray();
     }
 
-
     /**
      * Returns the names of the cipher suites which could be enabled for use
      * on an SSL connection.  Normally, only a subset of these will actually
@@ -181,7 +177,6 @@
      * certain kinds of certificates to use certain cipher suites.
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return context.getSuportedCipherSuiteList().toStringArray();
     }
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Apr 21 16:42:06 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
@@ -562,8 +562,11 @@
         clientVerifyData = new byte[0];
         serverVerifyData = new byte[0];
 
-        enabledCipherSuites = CipherSuiteList.getDefault();
-        enabledProtocols = ProtocolList.getDefault(roleIsServer);
+        enabledCipherSuites =
+                sslContext.getDefaultCipherSuiteList(roleIsServer);
+        enabledProtocols =
+                sslContext.getDefaultProtocolList(roleIsServer);
+
         inrec = null;
 
         // save the acc
@@ -2170,8 +2173,8 @@
              * change them to the corresponding default ones.
              */
             if (roleIsServer != (!flag) &&
-                    ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                enabledProtocols = ProtocolList.getDefault(!flag);
+                    sslContext.isDefaultProtocolList(enabledProtocols)) {
+                enabledProtocols = sslContext.getDefaultProtocolList(!flag);
             }
             roleIsServer = !flag;
             break;
@@ -2192,8 +2195,8 @@
                  * change them to the corresponding default ones.
                  */
                 if (roleIsServer != (!flag) &&
-                        ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                    enabledProtocols = ProtocolList.getDefault(!flag);
+                        sslContext.isDefaultProtocolList(enabledProtocols)) {
+                    enabledProtocols = sslContext.getDefaultProtocolList(!flag);
                 }
                 roleIsServer = !flag;
                 connectionState = cs_START;
@@ -2230,8 +2233,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return sslContext.getSuportedCipherSuiteList().toStringArray();
     }
 
     /**
@@ -2271,7 +2273,7 @@
      * @return an array of protocol names.
      */
     public String[] getSupportedProtocols() {
-        return ProtocolList.getSupported().toStringArray();
+        return sslContext.getSuportedProtocolList().toStringArray();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Apr 21 16:42:06 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
@@ -1285,11 +1285,12 @@
 
             // check permission to access and use the secret key of the
             // Kerberized "host" service
-            if (kerberosKeys != null) {
-
+            if (kerberosKeys != null && kerberosKeys.length > 0) {
                 if (debug != null && Debug.isOn("handshake")) {
-                    System.out.println("Using Kerberos key: " +
-                        kerberosKeys[0]);
+                    for (SecretKey k: kerberosKeys) {
+                        System.out.println("Using Kerberos key: " +
+                            k);
+                    }
                 }
 
                 String serverPrincipal =
--- a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Thu Apr 21 16:42:06 2011 -0700
@@ -204,22 +204,21 @@
         put("Alg.Alias.TrustManagerFactory.SunPKIX", "PKIX");
         put("Alg.Alias.TrustManagerFactory.X509", "PKIX");
         put("Alg.Alias.TrustManagerFactory.X.509", "PKIX");
+
+        put("SSLContext.TLSv1",
+            "sun.security.ssl.SSLContextImpl$TLS10Context");
+        put("Alg.Alias.SSLContext.TLS", "TLSv1");
         if (isfips == false) {
-            put("SSLContext.SSL",
-                "sun.security.ssl.SSLContextImpl");
-            put("SSLContext.SSLv3",
-                "sun.security.ssl.SSLContextImpl");
+            put("Alg.Alias.SSLContext.SSL", "TLSv1");
+            put("Alg.Alias.SSLContext.SSLv3", "TLSv1");
         }
-        put("SSLContext.TLS",
-            "sun.security.ssl.SSLContextImpl");
-        put("SSLContext.TLSv1",
-            "sun.security.ssl.SSLContextImpl");
+
         put("SSLContext.TLSv1.1",
-            "sun.security.ssl.SSLContextImpl");
+            "sun.security.ssl.SSLContextImpl$TLS11Context");
         put("SSLContext.TLSv1.2",
-            "sun.security.ssl.SSLContextImpl");
+            "sun.security.ssl.SSLContextImpl$TLS12Context");
         put("SSLContext.Default",
-            "sun.security.ssl.DefaultSSLContextImpl");
+            "sun.security.ssl.SSLContextImpl$DefaultSSLContext");
 
         /*
          * KeyStore
--- a/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java	Thu Apr 21 16:42:06 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
@@ -40,7 +40,7 @@
 import sun.security.ssl.Krb5Proxy;
 
 /**
- * An implementatin of Krb5Proxy that simply delegates to the appropriate
+ * An implementation of Krb5Proxy that simply delegates to the appropriate
  * Kerberos APIs.
  */
 public class Krb5ProxyImpl implements Krb5Proxy {
@@ -62,7 +62,7 @@
     @Override
     public SecretKey[] getServerKeys(AccessControlContext acc)
             throws LoginException {
-        return Krb5Util.getKeys(GSSCaller.CALLER_SSL_SERVER, null, acc);
+        return Krb5Util.getServiceCreds(GSSCaller.CALLER_SSL_SERVER, null, acc).getKKeys();
     }
 
     @Override
--- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Thu Apr 21 16:42:06 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
@@ -191,8 +191,8 @@
      *
      *
      */
-    public CodeSigner[] verify(Hashtable<String, CodeSigner[]> verifiedSigners,
-                Hashtable<String, CodeSigner[]> sigFileSigners)
+    public CodeSigner[] verify(Map<String, CodeSigner[]> verifiedSigners,
+                Map<String, CodeSigner[]> sigFileSigners)
         throws JarException
     {
         if (skip) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/util/SignatureFileManifest.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,251 @@
+/*
+ * 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.security.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+/**
+ * This class provides streaming mode reading of manifest files.
+ * Used by {@link SignatureFileVerifier}.
+ */
+class SignatureFileManifest extends Manifest {
+
+    /*
+     * Reading a manifest into this object by calling update(byte[]) on chunks.
+     * During the reading, the bytes are saved in (@code current} until a line
+     * is complete and the key-value pair is saved in {@code currentAttr}. When
+     * a section is complete, {@code consumeAttr} is called to merge
+     * {@code currentAttr} into main attributes or a named entry.
+     */
+
+    // Internal state during update() style reading
+    // 0. not in update mode
+    // 1, in update mode but main attributes not completed yet
+    // 2. main attributes completed, still reading the entries
+    private int state = 0;
+
+    // The partial line read
+    private byte[] current;
+
+    // Number of bytes in current
+    private int currentPos = 0;
+
+    // The current Attribute
+    private Attributes currentAttr;
+
+    /**
+     * Reads a manifest in chunks.
+     * <p>
+     * This method must be called in a row, reading chunks from a single
+     * manifest file by order. After all chunks are read, caller must call
+     * {@code update(null)} to fully consume the manifest.
+     * <p>
+     * The entry names and attributes read will be merged in with the current
+     * manifest entries. The {@link #read} method cannot be called inside a
+     * row of update calls.
+     * <p>
+     * Along with the calls, caller can call {@link #getMainAttributes()},
+     * {@link #getAttributes(java.lang.String)} or {@link #getEntries()}
+     * to get already available contents. However, in order not to return
+     * partial result, when the main attributes in the new manifest is not
+     * consumed completely, {@link #getMainAttributes()} throws an
+     * {@code IllegalStateException}. When a certain named entry is not
+     * consumed completely, {@link #getAttributes(java.lang.String)}
+     * returns the old {@code Attributes} for the name (if it exists).
+     *
+     * @param data null for last call, otherwise, feeding chunks
+     * @param offset offset into data to begin read
+     * @param length length of data after offset to read
+     * @exception IOException if an I/O error has occurred
+     * @exception IllegalStateException if {@code update(null)} is called
+     * without any previous {@code update(non-null)} call
+     */
+    public void update(byte[] data, int offset, int length) throws IOException {
+
+        // The last call
+        if (data == null) {
+            if (state == 0) {
+                throw new IllegalStateException("No data to update");
+            }
+            // We accept manifest not ended with \n or \n\n
+            if (hasLastByte()) {
+                consumeCurrent();
+            }
+            // We accept empty lines at the end
+            if (!currentAttr.isEmpty()) {
+                consumeAttr();
+            }
+            state = 0;  // back to non-update state
+            current = null;
+            currentAttr = null;
+            return;
+        }
+
+        // The first call
+        if (state == 0) {
+            current = new byte[1024];
+            currentAttr = super.getMainAttributes(); // the main attribute
+            state = 1;
+        }
+
+        int end = offset + length;
+
+        while (offset < end) {
+            switch (data[offset]) {
+                case '\r':
+                    break;  // always skip
+                case '\n':
+                    if (hasLastByte() && lastByte() == '\n') {  // new section
+                        consumeCurrent();
+                        consumeAttr();
+                        if (state == 1) {
+                            state = 2;
+                        }
+                        currentAttr = new Attributes(2);
+                    } else {
+                        if (hasLastByte()) {
+                            // save \n into current but do not parse,
+                            // there might be a continuation later
+                            ensureCapacity();
+                            current[currentPos++] = data[offset];
+                        } else if (state == 1) {
+                            // there can be multiple empty lines between
+                            // sections, but cannot be at the beginning
+                            throw new IOException("invalid manifest format");
+                        }
+                    }
+                    break;
+                case ' ':
+                    if (!hasLastByte()) {
+                        throw new IOException("invalid manifest format");
+                    } else if (lastByte() == '\n') {
+                        currentPos--;   // continuation, remove last \n
+                    } else {    // a very normal ' '
+                        ensureCapacity();
+                        current[currentPos++] = data[offset];
+                    }
+                    break;
+                default:
+                    if (hasLastByte() && lastByte() == '\n') {
+                        // The start of a new pair, not continuation
+                        consumeCurrent();   // the last line read
+                    }
+                    ensureCapacity();
+                    current[currentPos++] = data[offset];
+                    break;
+            }
+            offset++;
+        }
+    }
+
+    /**
+     * Returns the main Attributes for the Manifest.
+     * @exception IllegalStateException the main attributes is being read
+     * @return the main Attributes for the Manifest
+     */
+    public Attributes getMainAttributes() {
+        if (state == 1) {
+            throw new IllegalStateException();
+        }
+        return super.getMainAttributes();
+    }
+
+    /**
+     * Reads the Manifest from the specified InputStream. The entry
+     * names and attributes read will be merged in with the current
+     * manifest entries.
+     *
+     * @param is the input stream
+     * @exception IOException if an I/O error has occurred
+     * @exception IllegalStateException if called between two {@link #update}
+     * calls
+     */
+    public void read(InputStream is) throws IOException {
+        if (state != 0) {
+            throw new IllegalStateException("Cannot call read between updates");
+        }
+        super.read(is);
+    }
+
+    /*
+     * ----------  Helper methods  -----------------
+     */
+
+    private void ensureCapacity() {
+        if (currentPos >= current.length-1) {
+            current = Arrays.copyOf(current, current.length*2);
+        }
+    }
+
+    private boolean hasLastByte() {
+        return currentPos > 0;
+    }
+
+    private byte lastByte() {
+        return current[currentPos-1];
+    }
+
+    // Parse current as key:value and save into currentAttr.
+    // There MUST be something inside current.
+    private void consumeCurrent() throws IOException {
+        // current normally has a \n end, except for the last line
+        if (current[currentPos-1] == '\n') currentPos--;
+        for (int i=0; i<currentPos; i++) {
+            if (current[i] == ':') {
+                String key = new String(current, 0, 0, i);
+                i++;
+                while (i < currentPos && current[i] == ' ') { i++; }
+                String value = new String(current, i, currentPos-i, "UTF-8");
+                currentAttr.putValue(key, value);
+                currentPos = 0;
+                return;
+            }
+        }
+        throw new IOException("invalid header field");
+    }
+
+    // Merge currentAttr into Manifest
+    private void consumeAttr() throws IOException {
+        // Only needed for named entries. For the main attribute, key/value
+        // is added into attr directly, but since getMainAttributes() throws
+        // an exception, the partial data is not leaked.
+        if (state != 1) {
+            String name = currentAttr.getValue("Name");
+            if (name != null) {
+                currentAttr.remove(new Attributes.Name("Name"));
+                Attributes old = getAttributes(name);
+                if (old != null) old.putAll(currentAttr);
+                else getEntries().put(name, currentAttr);
+            } else {
+                throw new IOException("invalid manifest format");
+            }
+        }
+    }
+}
--- a/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java	Thu Apr 21 16:42:06 2011 -0700
@@ -55,8 +55,8 @@
     /** the PKCS7 block for this .DSA/.RSA/.EC file */
     private PKCS7 block;
 
-    /** the raw bytes of the .SF file */
-    private byte sfBytes[];
+    // the content of the raw .SF file as an InputStream
+    private InputStream sfStream;
 
     /** the name of the signature block file, uppercased and without
      *  the extension (.DSA/.RSA/.EC)
@@ -66,6 +66,9 @@
     /** the ManifestDigester */
     private ManifestDigester md;
 
+    /** The MANIFEST.MF */
+    private Manifest man;
+
     /** cache of created MessageDigest objects */
     private HashMap<String, MessageDigest> createdDigests;
 
@@ -83,6 +86,7 @@
      * @param rawBytes the raw bytes of the signature block file
      */
     public SignatureFileVerifier(ArrayList<CodeSigner[]> signerCache,
+                                 Manifest man,
                                  ManifestDigester md,
                                  String name,
                                  byte rawBytes[])
@@ -94,13 +98,18 @@
         try {
             obj = Providers.startJarVerification();
             block = new PKCS7(rawBytes);
-            sfBytes = block.getContentInfo().getData();
+            byte[] contentData = block.getContentInfo().getData();
+            if (contentData != null) {
+                sfStream = new ByteArrayInputStream(contentData);
+            }
             certificateFactory = CertificateFactory.getInstance("X509");
         } finally {
             Providers.stopJarVerification(obj);
         }
         this.name = name.substring(0, name.lastIndexOf("."))
                                                    .toUpperCase(Locale.ENGLISH);
+
+        this.man = man;
         this.md = md;
         this.signerCache = signerCache;
     }
@@ -108,31 +117,13 @@
     /**
      * returns true if we need the .SF file
      */
-    public boolean needSignatureFileBytes()
+    public boolean needSignatureFile()
     {
-
-        return sfBytes == null;
+        return sfStream == null;
     }
 
-
-    /**
-     * returns true if we need this .SF file.
-     *
-     * @param name the name of the .SF file without the extension
-     *
-     */
-    public boolean needSignatureFile(String name)
-    {
-        return this.name.equalsIgnoreCase(name);
-    }
-
-    /**
-     * used to set the raw bytes of the .SF file when it
-     * is external to the signature block file.
-     */
-    public void setSignatureFile(byte sfBytes[])
-    {
-        this.sfBytes = sfBytes;
+    public void setSignatureFile(InputStream ins) {
+        this.sfStream = ins;
     }
 
     /**
@@ -145,12 +136,18 @@
      *          Signature File or PKCS7 block file name
      */
     public static boolean isBlockOrSF(String s) {
-        // we currently only support DSA and RSA PKCS7 blocks
-        if (s.endsWith(".SF") || s.endsWith(".DSA") ||
-                s.endsWith(".RSA") || s.endsWith(".EC")) {
-            return true;
-        }
-        return false;
+        return s.endsWith(".SF") || isBlock(s);
+    }
+
+    /**
+     * Utility method used by JarVerifier to determine PKCS7 block
+     * files names that are supported
+     *
+     * @param s file name
+     * @return true if the input file name is a PKCS7 block file name
+     */
+    public static boolean isBlock(String s) {
+        return s.endsWith(".DSA") || s.endsWith(".RSA") || s.endsWith(".EC");
     }
 
     /** get digest from cache */
@@ -180,7 +177,7 @@
      *
      *
      */
-    public void process(Hashtable<String, CodeSigner[]> signers,
+    public void process(Map<String, CodeSigner[]> signers,
             List manifestDigests)
         throws IOException, SignatureException, NoSuchAlgorithmException,
             JarException, CertificateException
@@ -197,31 +194,86 @@
 
     }
 
-    private void processImpl(Hashtable<String, CodeSigner[]> signers,
+    private void processImpl(Map<String, CodeSigner[]> signers,
             List manifestDigests)
         throws IOException, SignatureException, NoSuchAlgorithmException,
             JarException, CertificateException
     {
-        Manifest sf = new Manifest();
-        sf.read(new ByteArrayInputStream(sfBytes));
+        SignatureFileManifest sf = new SignatureFileManifest();
+        InputStream ins = sfStream;
 
-        String version =
-            sf.getMainAttributes().getValue(Attributes.Name.SIGNATURE_VERSION);
+        byte[] buffer = new byte[4096];
+        int sLen = block.getSignerInfos().length;
+        boolean mainOK = false;         // main attributes of SF is available...
+        boolean manifestSigned = false; // and it matches MANIFEST.MF
+        BASE64Decoder decoder = new BASE64Decoder();
 
-        if ((version == null) || !(version.equalsIgnoreCase("1.0"))) {
-            // XXX: should this be an exception?
-            // for now we just ignore this signature file
-            return;
+        PKCS7.PKCS7Verifier[] pvs = new PKCS7.PKCS7Verifier[sLen];
+        for (int i=0; i<sLen; i++) {
+            pvs[i] = PKCS7.PKCS7Verifier.from(block, block.getSignerInfos()[i]);
         }
 
-        SignerInfo[] infos = block.verify(sfBytes);
+        /*
+         * Verify SF in streaming mode. The chunks of the file are fed into
+         * the Manifest object sf and all PKCS7Verifiers. As soon as the main
+         * attributes is available, we'll check if manifestSigned is true. If
+         * yes, there is no need to fill in sf's entries field, since it should
+         * be identical to entries in man.
+         */
+        while (true) {
+            int len = ins.read(buffer);
+            if (len < 0) {
+                if (!manifestSigned) {
+                    sf.update(null, 0, 0);
+                }
+                break;
+            } else {
+                for (int i=0; i<sLen; i++) {
+                    if (pvs[i] != null) pvs[i].update(buffer, 0, len);
+                }
+                // Continue reading if verifyManifestHash fails (or, the
+                // main attributes is not available yet)
+                if (!manifestSigned) {
+                    sf.update(buffer, 0, len);
+                    if (!mainOK) {
+                        try {
+                            Attributes attr = sf.getMainAttributes();
+                            String version = attr.getValue(
+                                    Attributes.Name.SIGNATURE_VERSION);
 
-        if (infos == null) {
+                            if ((version == null) ||
+                                    !(version.equalsIgnoreCase("1.0"))) {
+                                // XXX: should this be an exception?
+                                // for now we just ignore this signature file
+                                return;
+                            }
+
+                            mainOK = true;
+                            manifestSigned = verifyManifestHash(
+                                    sf, md, decoder, manifestDigests);
+                        } catch (IllegalStateException ise) {
+                            // main attributes not available yet
+                        }
+                    }
+                }
+            }
+        }
+        List<SignerInfo> intResult = new ArrayList<>(sLen);
+        for (int i = 0; i < sLen; i++) {
+            if (pvs[i] != null) {
+                SignerInfo signerInfo = pvs[i].verify();
+                if (signerInfo != null) {
+                    intResult.add(signerInfo);
+                }
+            }
+        }
+        if (intResult.isEmpty()) {
             throw new SecurityException("cannot verify signature block file " +
                                         name);
         }
 
-        BASE64Decoder decoder = new BASE64Decoder();
+        SignerInfo[] infos =
+                intResult.toArray(new SignerInfo[intResult.size()]);
 
         CodeSigner[] newSigners = getSigners(infos, block);
 
@@ -229,26 +281,37 @@
         if (newSigners == null)
             return;
 
-        Iterator<Map.Entry<String,Attributes>> entries =
-                                sf.getEntries().entrySet().iterator();
-
-        // see if we can verify the whole manifest first
-        boolean manifestSigned = verifyManifestHash(sf, md, decoder, manifestDigests);
-
         // verify manifest main attributes
         if (!manifestSigned && !verifyManifestMainAttrs(sf, md, decoder)) {
             throw new SecurityException
                 ("Invalid signature file digest for Manifest main attributes");
         }
 
-        // go through each section in the signature file
+        Iterator<Map.Entry<String,Attributes>> entries;
+
+        if (manifestSigned) {
+            if (debug != null) {
+                debug.println("full manifest signature match, "
+                        + "update signer info from MANIFEST.MF");
+            }
+            entries = man.getEntries().entrySet().iterator();
+        } else {
+            if (debug != null) {
+                debug.println("full manifest signature unmatch, "
+                        + "update signer info from SF file");
+            }
+            entries = sf.getEntries().entrySet().iterator();
+        }
+
+        // go through each section
+
         while(entries.hasNext()) {
 
             Map.Entry<String,Attributes> e = entries.next();
             String name = e.getKey();
 
             if (manifestSigned ||
-                (verifySection(e.getValue(), name, md, decoder))) {
+                    (verifySection(e.getValue(), name, md, decoder))) {
 
                 if (name.startsWith("./"))
                     name = name.substring(2);
@@ -593,7 +656,6 @@
         if (set == subset)
             return true;
 
-        boolean match;
         for (int i = 0; i < subset.length; i++) {
             if (!contains(set, subset[i]))
                 return false;
@@ -613,8 +675,6 @@
         if ((oldSigners == null) && (signers == newSigners))
             return true;
 
-        boolean match;
-
         // make sure all oldSigners are in signers
         if ((oldSigners != null) && !isSubSet(oldSigners, signers))
             return false;
@@ -638,7 +698,7 @@
     }
 
     void updateSigners(CodeSigner[] newSigners,
-        Hashtable<String, CodeSigner[]> signers, String name) {
+        Map<String, CodeSigner[]> signers, String name) {
 
         CodeSigner[] oldSigners = signers.get(name);
 
--- a/jdk/src/share/native/common/jdk_util.h	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/native/common/jdk_util.h	Thu Apr 21 16:42:06 2011 -0700
@@ -28,6 +28,7 @@
 
 #include "jni.h"
 #include "jvm.h"
+#include "jdk_util_md.h"
 
 #ifdef __cplusplus
 extern "C" {
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Thu Apr 21 16:42:06 2011 -0700
@@ -1971,6 +1971,13 @@
         return data->abortFlag;
     }
 
+    if (cinfo->output_components <= 0 ||
+        cinfo->image_width > (0xffffffffu / (unsigned int)cinfo->output_components))
+    {
+        JNU_ThrowByName(env, "javax/imageio/IIOException",
+                        "Invalid number of output components");
+        return data->abortFlag;
+    }
 
     // Allocate a 1-scanline buffer
     scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components);
--- a/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -186,7 +186,11 @@
   jchar buffer[256];
   jchar* chars = buffer;
   if (len > 256) {
-    chars = (jchar*)malloc(len * sizeof(jchar));
+    size_t size = len * sizeof(jchar);
+    if (size / sizeof(jchar) != len) {
+      return;
+    }
+    chars = (jchar*)malloc(size);
     if (chars == 0) {
       return;
     }
--- a/jdk/src/share/native/sun/java2d/loops/TransformHelper.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/share/native/sun/java2d/loops/TransformHelper.c	Thu Apr 21 16:42:06 2011 -0700
@@ -75,6 +75,94 @@
 TransformInterpFunc *pBicubicFunc = BicubicInterp;
 
 /*
+ * The dxydxy parameters of the inverse transform determine how
+ * quickly we step through the source image.  For tiny scale
+ * factors (on the order of 1E-16 or so) the stepping distances
+ * are huge.  The image has been scaled so small that stepping
+ * a single pixel in device space moves the sampling point by
+ * billions (or more) pixels in the source image space.  These
+ * huge stepping values can overflow the whole part of the longs
+ * we use for the fixed point stepping equations and so we need
+ * a more robust solution.  We could simply iterate over every
+ * device pixel, use the inverse transform to transform it back
+ * into the source image coordinate system and then test it for
+ * being in range and sample pixel-by-pixel, but that is quite
+ * a bit more expensive.  Fortunately, if the scale factors are
+ * so tiny that we overflow our long values then the number of
+ * pixels we are planning to visit should be very tiny.  The only
+ * exception to that rule is if the scale factor along one
+ * dimension is tiny (creating the huge stepping values), and
+ * the scale factor along the other dimension is fairly regular
+ * or an up-scale.  In that case we have a lot of pixels along
+ * the direction of the larger axis to sample, but few along the
+ * smaller axis.  Though, pessimally, with an added shear factor
+ * such a linearly tiny image could have bounds that cover a large
+ * number of pixels.  Such odd transformations should be very
+ * rare and the absolute limit on calculations would involve a
+ * single reverse transform of every pixel in the output image
+ * which is not fast, but it should not cause an undue stall
+ * of the rendering software.
+ *
+ * The specific test we will use is to calculate the inverse
+ * transformed values of every corner of the destination bounds
+ * (in order to be user-clip independent) and if we can
+ * perform a fixed-point-long inverse transform of all of
+ * those points without overflowing we will use the fast
+ * fixed point algorithm.  Otherwise we will use the safe
+ * per-pixel transform algorithm.
+ * The 4 corners are 0,0, 0,dsth, dstw,0, dstw,dsth
+ * Transformed they are:
+ *     tx,               ty
+ *     tx       +dxdy*H, ty       +dydy*H
+ *     tx+dxdx*W,        ty+dydx*W
+ *     tx+dxdx*W+dxdy*H, ty+dydx*W+dydy*H
+ */
+/* We reject coordinates not less than 1<<30 so that the distance between */
+/* any 2 of them is less than 1<<31 which would overflow into the sign */
+/* bit of a signed long value used to represent fixed point coordinates. */
+#define TX_FIXED_UNSAFE(v)  (fabs(v) >= (1<<30))
+static jboolean
+checkOverflow(jint dxoff, jint dyoff,
+              SurfaceDataBounds *pBounds,
+              TransformInfo *pItxInfo,
+              jdouble *retx, jdouble *rety)
+{
+    jdouble x, y;
+
+    x = dxoff+pBounds->x1+0.5; /* Center of pixel x1 */
+    y = dyoff+pBounds->y1+0.5; /* Center of pixel y1 */
+    Transform_transform(pItxInfo, &x, &y);
+    *retx = x;
+    *rety = y;
+    if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
+        return JNI_TRUE;
+    }
+
+    x = dxoff+pBounds->x2-0.5; /* Center of pixel x2-1 */
+    y = dyoff+pBounds->y1+0.5; /* Center of pixel y1 */
+    Transform_transform(pItxInfo, &x, &y);
+    if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
+        return JNI_TRUE;
+    }
+
+    x = dxoff+pBounds->x1+0.5; /* Center of pixel x1 */
+    y = dyoff+pBounds->y2-0.5; /* Center of pixel y2-1 */
+    Transform_transform(pItxInfo, &x, &y);
+    if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
+        return JNI_TRUE;
+    }
+
+    x = dxoff+pBounds->x2-0.5; /* Center of pixel x2-1 */
+    y = dyoff+pBounds->y2-0.5; /* Center of pixel y2-1 */
+    Transform_transform(pItxInfo, &x, &y);
+    if (TX_FIXED_UNSAFE(x) || TX_FIXED_UNSAFE(y)) {
+        return JNI_TRUE;
+    }
+
+    return JNI_FALSE;
+}
+
+/*
  * Fill the edge buffer with pairs of coordinates representing the maximum
  * left and right pixels of the destination surface that should be processed
  * on each scanline, clipped to the bounds parameter.
@@ -82,21 +170,19 @@
  * Only pixels that map back through the specified (inverse) transform to a
  * source coordinate that falls within the (0, 0, sw, sh) bounds of the
  * source image should be processed.
- * pEdgeBuf points to an array of jints that holds MAXEDGES*2 values.
- * If more storage is needed, then this function allocates a new buffer.
- * In either case, a pointer to the buffer actually used to store the
- * results is returned.
- * The caller is responsible for freeing the buffer if the return value
- * is not the same as the original pEdgeBuf passed in.
+ * pEdges points to an array of jints that holds 2 + numedges*2 values where
+ * numedges should match (pBounds->y2 - pBounds->y1).
+ * The first two jints in pEdges should be set to y1 and y2 and every pair
+ * of jints after that represent the xmin,xmax of all pixels in range of
+ * the transformed blit for the corresponding scanline.
  */
-static jint *
-calculateEdges(jint *pEdgeBuf,
+static void
+calculateEdges(jint *pEdges,
                SurfaceDataBounds *pBounds,
                TransformInfo *pItxInfo,
                jlong xbase, jlong ybase,
                juint sw, juint sh)
 {
-    jint *pEdges;
     jlong dxdxlong, dydxlong;
     jlong dxdylong, dydylong;
     jlong drowxlong, drowylong;
@@ -111,10 +197,8 @@
     dy1 = pBounds->y1;
     dx2 = pBounds->x2;
     dy2 = pBounds->y2;
-    if ((dy2-dy1) > MAXEDGES) {
-        pEdgeBuf = malloc(2 * (dy2-dy1) * sizeof (*pEdges));
-    }
-    pEdges = pEdgeBuf;
+    *pEdges++ = dy1;
+    *pEdges++ = dy2;
 
     drowxlong = (dx2-dx1-1) * dxdxlong;
     drowylong = (dx2-dx1-1) * dydxlong;
@@ -155,9 +239,21 @@
         ybase += dydylong;
         dy1++;
     }
+}
 
-    return pEdgeBuf;
-}
+static void
+Transform_SafeHelper(JNIEnv *env,
+                     SurfaceDataOps *srcOps,
+                     SurfaceDataOps *dstOps,
+                     SurfaceDataRasInfo *pSrcInfo,
+                     SurfaceDataRasInfo *pDstInfo,
+                     NativePrimitive *pMaskBlitPrim,
+                     CompositeInfo *pCompInfo,
+                     TransformHelperFunc *pHelperFunc,
+                     TransformInterpFunc *pInterpFunc,
+                     RegionData *pClipInfo, TransformInfo *pItxInfo,
+                     jint *pData, jint *pEdges,
+                     jint dxoff, jint dyoff, jint sw, jint sh);
 
 /*
  * Class:     sun_java2d_loops_TransformHelper
@@ -187,12 +283,14 @@
     jint maxlinepix;
     TransformHelperFunc *pHelperFunc;
     TransformInterpFunc *pInterpFunc;
-    jint edgebuf[MAXEDGES * 2];
+    jdouble xorig, yorig;
+    jint numedges;
     jint *pEdges;
-    jdouble x, y;
-    jlong xbase, ybase;
-    jlong dxdxlong, dydxlong;
-    jlong dxdylong, dydylong;
+    jint edgebuf[2 + MAXEDGES * 2];
+    union {
+        jlong align;
+        jint data[LINE_SIZE];
+    } rgb;
 
 #ifdef MAKE_STUBS
     static int th_initialized;
@@ -269,39 +367,62 @@
     if (srcOps->Lock(env, srcOps, &srcInfo, pHelperPrim->srcflags)
         != SD_SUCCESS)
     {
+        /* edgeArray should already contain zeros for min/maxy */
         return;
     }
     if (dstOps->Lock(env, dstOps, &dstInfo, pMaskBlitPrim->dstflags)
         != SD_SUCCESS)
     {
         SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
+        /* edgeArray should already contain zeros for min/maxy */
         return;
     }
     Region_IntersectBounds(&clipInfo, &dstInfo.bounds);
 
+    numedges = (dstInfo.bounds.y2 - dstInfo.bounds.y1);
+    if (numedges > MAXEDGES) {
+        pEdges = malloc((2 + 2 * numedges) * sizeof (*pEdges));
+        if (pEdges == NULL) {
+            SurfaceData_InvokeUnlock(env, dstOps, &dstInfo);
+            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
+            /* edgeArray should already contain zeros for min/maxy */
+            return;
+        }
+    } else {
+        pEdges = edgebuf;
+    }
+
     Transform_GetInfo(env, itxform, &itxInfo);
-    dxdxlong = DblToLong(itxInfo.dxdx);
-    dydxlong = DblToLong(itxInfo.dydx);
-    dxdylong = DblToLong(itxInfo.dxdy);
-    dydylong = DblToLong(itxInfo.dydy);
-    x = dxoff+dstInfo.bounds.x1+0.5; /* Center of pixel x1 */
-    y = dyoff+dstInfo.bounds.y1+0.5; /* Center of pixel y1 */
-    Transform_transform(&itxInfo, &x, &y);
-    xbase = DblToLong(x);
-    ybase = DblToLong(y);
-
-    pEdges = calculateEdges(edgebuf, &dstInfo.bounds, &itxInfo,
-                            xbase, ybase, sx2-sx1, sy2-sy1);
 
     if (!Region_IsEmpty(&clipInfo)) {
         srcOps->GetRasInfo(env, srcOps, &srcInfo);
         dstOps->GetRasInfo(env, dstOps, &dstInfo);
-        if (srcInfo.rasBase && dstInfo.rasBase) {
-            union {
-                jlong align;
-                jint data[LINE_SIZE];
-            } rgb;
+        if (srcInfo.rasBase == NULL || dstInfo.rasBase == NULL) {
+            pEdges[0] = pEdges[1] = 0;
+        } else if (checkOverflow(dxoff, dyoff, &dstInfo.bounds,
+                                 &itxInfo, &xorig, &yorig))
+        {
+            Transform_SafeHelper(env, srcOps, dstOps,
+                                 &srcInfo, &dstInfo,
+                                 pMaskBlitPrim, &compInfo,
+                                 pHelperFunc, pInterpFunc,
+                                 &clipInfo, &itxInfo, rgb.data, pEdges,
+                                 dxoff, dyoff, sx2-sx1, sy2-sy1);
+        } else {
             SurfaceDataBounds span;
+            jlong dxdxlong, dydxlong;
+            jlong dxdylong, dydylong;
+            jlong xbase, ybase;
+
+            dxdxlong = DblToLong(itxInfo.dxdx);
+            dydxlong = DblToLong(itxInfo.dydx);
+            dxdylong = DblToLong(itxInfo.dxdy);
+            dydylong = DblToLong(itxInfo.dydy);
+            xbase = DblToLong(xorig);
+            ybase = DblToLong(yorig);
+
+            calculateEdges(pEdges, &dstInfo.bounds, &itxInfo,
+                           xbase, ybase, sx2-sx1, sy2-sy1);
 
             Region_StartIteration(env, &clipInfo);
             while (Region_NextIteration(&clipInfo, &span)) {
@@ -318,8 +439,8 @@
 
                     /* Note - process at most one scanline at a time. */
 
-                    dx1 = pEdges[(dy1 - dstInfo.bounds.y1) * 2];
-                    dx2 = pEdges[(dy1 - dstInfo.bounds.y1) * 2 + 1];
+                    dx1 = pEdges[(dy1 - dstInfo.bounds.y1) * 2 + 2];
+                    dx2 = pEdges[(dy1 - dstInfo.bounds.y1) * 2 + 3];
                     if (dx1 < span.x1) dx1 = span.x1;
                     if (dx2 > span.x2) dx2 = span.x2;
 
@@ -376,21 +497,124 @@
         }
         SurfaceData_InvokeRelease(env, dstOps, &dstInfo);
         SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
+    } else {
+        pEdges[0] = pEdges[1] = 0;
     }
     SurfaceData_InvokeUnlock(env, dstOps, &dstInfo);
     SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
     if (!JNU_IsNull(env, edgeArray)) {
-        (*env)->SetIntArrayRegion(env, edgeArray, 0, 1, &dstInfo.bounds.y1);
-        (*env)->SetIntArrayRegion(env, edgeArray, 1, 1, &dstInfo.bounds.y2);
-        (*env)->SetIntArrayRegion(env, edgeArray,
-                                  2, (dstInfo.bounds.y2 - dstInfo.bounds.y1)*2,
-                                  pEdges);
+        (*env)->SetIntArrayRegion(env, edgeArray, 0, 2+numedges*2, pEdges);
     }
     if (pEdges != edgebuf) {
         free(pEdges);
     }
 }
 
+static void
+Transform_SafeHelper(JNIEnv *env,
+                     SurfaceDataOps *srcOps,
+                     SurfaceDataOps *dstOps,
+                     SurfaceDataRasInfo *pSrcInfo,
+                     SurfaceDataRasInfo *pDstInfo,
+                     NativePrimitive *pMaskBlitPrim,
+                     CompositeInfo *pCompInfo,
+                     TransformHelperFunc *pHelperFunc,
+                     TransformInterpFunc *pInterpFunc,
+                     RegionData *pClipInfo, TransformInfo *pItxInfo,
+                     jint *pData, jint *pEdges,
+                     jint dxoff, jint dyoff, jint sw, jint sh)
+{
+    SurfaceDataBounds span;
+    jint dx1, dx2;
+    jint dy1, dy2;
+    jint i, iy;
+
+    dy1 = pDstInfo->bounds.y1;
+    dy2 = pDstInfo->bounds.y2;
+    dx1 = pDstInfo->bounds.x1;
+    dx2 = pDstInfo->bounds.x2;
+    pEdges[0] = dy1;
+    pEdges[1] = dy2;
+    for (iy = dy1; iy < dy2; iy++) {
+        jint i = (iy - dy1) * 2;
+        /* row spans are set to max,min until we find a pixel in range below */
+        pEdges[i + 2] = dx2;
+        pEdges[i + 3] = dx1;
+    }
+
+    Region_StartIteration(env, pClipInfo);
+    while (Region_NextIteration(pClipInfo, &span)) {
+        dy1 = span.y1;
+        dy2 = span.y2;
+        while (dy1 < dy2) {
+            dx1 = span.x1;
+            dx2 = span.x2;
+            i = (dy1 - pDstInfo->bounds.y1) * 2;
+            while (dx1 < dx2) {
+                jdouble x, y;
+                jlong xlong, ylong;
+
+                x = dxoff + dx1 + 0.5;
+                y = dyoff + dy1 + 0.5;
+                Transform_transform(pItxInfo, &x, &y);
+                xlong = DblToLong(x);
+                ylong = DblToLong(y);
+
+                /* Process only pixels with centers in bounds
+                 * Test double values to avoid overflow in conversion
+                 * to long values and then also test the long values
+                 * in case they rounded up and out of bounds during
+                 * the conversion.
+                 */
+                if (x >= 0 && y >= 0 && x < sw && y < sh &&
+                    WholeOfLong(xlong) < sw &&
+                    WholeOfLong(ylong) < sh)
+                {
+                    void *pDst;
+
+                    if (pEdges[i + 2] > dx1) {
+                        pEdges[i + 2] = dx1;
+                    }
+                    if (pEdges[i + 3] <= dx1) {
+                        pEdges[i + 3] = dx1 + 1;
+                    }
+
+                    /* Get IntArgbPre pixel data from source */
+                    (*pHelperFunc)(pSrcInfo,
+                                   pData, 1,
+                                   xlong, 0,
+                                   ylong, 0);
+
+                    /* Interpolate result pixels if needed */
+                    if (pInterpFunc) {
+                        (*pInterpFunc)(pData, 1,
+                                       FractOfLong(xlong-LongOneHalf), 0,
+                                       FractOfLong(ylong-LongOneHalf), 0);
+                    }
+
+                    /* Store/Composite interpolated pixels into dest */
+                    pDst = PtrCoord(pDstInfo->rasBase,
+                                    dx1, pDstInfo->pixelStride,
+                                    dy1, pDstInfo->scanStride);
+                    (*pMaskBlitPrim->funcs.maskblit)(pDst, pData,
+                                                     0, 0, 0,
+                                                     1, 1,
+                                                     pDstInfo, pSrcInfo,
+                                                     pMaskBlitPrim,
+                                                     pCompInfo);
+                }
+
+                /* Increment to next input pixel */
+                dx1++;
+            }
+
+            /* Increment to next scanline */
+            dy1++;
+        }
+    }
+    Region_EndIteration(env, pClipInfo);
+}
+
 #define BL_INTERP_V1_to_V2_by_F(v1, v2, f) \
     (((v1)<<8) + ((v2)-(v1))*(f))
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/forkjoin/mergesort/MergeDemo.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Arrays;
+import java.util.Random;
+
+import static java.lang.Integer.parseInt;
+
+/**
+ * MergeExample is a class that runs a demo benchmark of the {@code ForkJoin} framework
+ * by benchmarking a {@link MergeSort} algorithm that is implemented using
+ * {@link java.util.concurrent.RecursiveAction}.
+ * The {@code ForkJoin} framework is setup with different parallelism levels
+ * and the sort is executed with arrays of different sizes to see the
+ * trade offs by using multiple threads for different sizes of the array.
+ */
+public class MergeDemo {
+    // Use a fixed seed to always get the same random values back
+    private final Random random = new Random(759123751834L);
+    private static final int ITERATIONS = 10;
+
+    /**
+     * Represents the formula {@code f(n) = start + (step * n)} for n = 0 & n < iterations
+     */
+    private static class Range {
+        private final int start;
+        private final int step;
+        private final int iterations;
+
+        private Range(int start, int step, int iterations) {
+            this.start = start;
+            this.step = step;
+            this.iterations = iterations;
+        }
+
+        /**
+         * Parses start, step and iterations from args
+         * @param args the string array containing the arguments
+         * @param start which element to start the start argument from
+         * @return the constructed range
+         */
+        public static Range parse(String[] args, int start) {
+            if (args.length < start + 3) {
+                throw new IllegalArgumentException("Too few elements in array");
+            }
+            return new Range(parseInt(args[start]), parseInt(args[start + 1]), parseInt(args[start + 2]));
+        }
+
+        public int get(int iteration) {
+            return start + (step * iteration);
+        }
+
+        public int getIterations() {
+            return iterations;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append(start).append(" ").append(step).append(" ").append(iterations);
+            return builder.toString();
+        }
+    }
+
+    /**
+     * Wraps the different parameters that is used when running the MergeExample.
+     * {@code sizes} represents the different array sizes
+     * {@code parallelism} represents the different parallelism levels
+     */
+    private static class Configuration {
+        private final Range sizes;
+        private final Range parallelism;
+
+        private final static Configuration defaultConfig = new Configuration(new Range(20000, 20000, 10),
+                new Range(2, 2, 10));
+
+        private Configuration(Range sizes, Range parallelism) {
+            this.sizes = sizes;
+            this.parallelism = parallelism;
+        }
+
+        /**
+         * Parses the arguments and attempts to create a configuration containing the
+         * parameters for creating the array sizes and parallelism sizes
+         * @param args the input arguments
+         * @return the configuration
+         */
+        public static Configuration parse(String[] args) {
+            if (args.length == 0) {
+                return defaultConfig;
+            } else {
+                try {
+                    if (args.length == 6) {
+                        return new Configuration(Range.parse(args, 0), Range.parse(args, 3));
+                    }
+                } catch (NumberFormatException e) {
+                    System.err.println("MergeExample: error: Argument was not a number.");
+                }
+                System.err.println("MergeExample <size start> <size step> <size steps> <parallel start> <parallel step>" +
+                        " <parallel steps>");
+                System.err.println("example: MergeExample 20000 10000 3 1 1 4");
+                System.err.println("example: will run with arrays of sizes 20000, 30000, 40000" +
+                        " and parallelism: 1, 2, 3, 4");
+                return null;
+            }
+        }
+
+        /**
+         * Creates an array for reporting the test result time in
+         * @return an array containing {@code sizes.iterations * parallelism.iterations} elements
+         */
+        private long[][] createTimesArray() {
+            return new long[sizes.getIterations()][parallelism.getIterations()];
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("");
+            if (this == defaultConfig) {
+                builder.append("Default configuration. ");
+            }
+            builder.append("Running with parameters: ");
+            builder.append(sizes);
+            builder.append(" ");
+            builder.append(parallelism);
+            return builder.toString();
+        }
+    }
+
+    /**
+     * Generates an array of {@code elements} random elements
+     * @param elements the number of elements requested in the array
+     * @return an array of {@code elements} random elements
+     */
+    private int[] generateArray(int elements) {
+        int[] array = new int[elements];
+        for (int i = 0; i < elements; ++i) {
+            array[i] = random.nextInt();
+        }
+        return array;
+    }
+
+    /**
+     * Runs the test
+     * @param config contains the settings for the test
+     */
+    private void run(Configuration config) {
+        Range sizes = config.sizes;
+        Range parallelism = config.parallelism;
+
+        // Run a couple of sorts to make the JIT compile / optimize the code
+        // which should produce somewhat more fair times
+        warmup();
+
+        long[][] times = config.createTimesArray();
+
+        for (int size = 0; size < sizes.getIterations(); size++) {
+            runForSize(parallelism, sizes.get(size), times, size);
+        }
+
+        printResults(sizes, parallelism, times);
+    }
+
+    /**
+     * Prints the results as a table
+     * @param sizes the different sizes of the arrays
+     * @param parallelism the different parallelism levels used
+     * @param times the median times for the different sizes / parallelism
+     */
+    private void printResults(Range sizes, Range parallelism, long[][] times) {
+        System.out.println("Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.");
+        long[] sums = new long[times[0].length];
+        System.out.format("%8s  ", "");
+        for (int i = 0; i < times[0].length; i++) {
+            System.out.format("%4d ", parallelism.get(i));
+        }
+        System.out.println("");
+        for (int size = 0; size < sizes.getIterations(); size++) {
+            System.out.format("%8d: ", sizes.get(size));
+            for (int i = 0; i < times[size].length; i++) {
+                sums[i] += times[size][i];
+                System.out.format("%4d ", times[size][i]);
+            }
+            System.out.println("");
+        }
+        System.out.format("%8s: ", "Total");
+        for (long sum : sums) {
+            System.out.format("%4d ", sum);
+        }
+        System.out.println("");
+    }
+
+    private void runForSize(Range parallelism, int elements, long[][] times, int size) {
+        for (int step = 0; step < parallelism.getIterations(); step++) {
+            long time = runForParallelism(ITERATIONS, elements, parallelism.get(step));
+            times[size][step] = time;
+        }
+    }
+
+    /**
+     * Runs <i>iterations</i> number of test sorts of a random array of <i>element</i> length
+     * @param iterations number of iterations
+     * @param elements number of elements in the random array
+     * @param parallelism parallelism for the ForkJoin framework
+     * @return the median time of runs
+     */
+    private long runForParallelism(int iterations, int elements, int parallelism) {
+        MergeSort mergeSort = new MergeSort(parallelism);
+        long[] times = new long[iterations];
+
+        for (int i = 0; i < iterations; i++) {
+            // Suggest the VM to run a garbage collection to reduce the risk of getting one
+            // while running the test run
+            System.gc();
+            long start = System.currentTimeMillis();
+            mergeSort.sort(generateArray(elements));
+            times[i] = System.currentTimeMillis() - start;
+        }
+
+        return medianValue(times);
+    }
+
+    /**
+     * Calculates the median value of the array
+     * @param times array of times
+     * @return the median value
+     */
+    private long medianValue(long[] times) {
+        if (times.length == 0) {
+            throw new IllegalArgumentException("Empty array");
+        }
+        // Make a copy of times to avoid having side effects on the parameter value
+        Arrays.sort(times.clone());
+        long median = times[times.length / 2];
+        if (times.length > 1 && times.length % 2 != 0) {
+            median = (median + times[times.length / 2 + 1]) / 2;
+        }
+        return median;
+    }
+
+    /**
+     * Generates 1000 arrays of 1000 elements and sorts them as a warmup
+     */
+    private void warmup() {
+        MergeSort mergeSort = new MergeSort(Runtime.getRuntime().availableProcessors());
+        for (int i = 0; i < 1000; i++) {
+            mergeSort.sort(generateArray(1000));
+        }
+    }
+
+    public static void main(String[] args) {
+        Configuration configuration = Configuration.parse(args);
+        if (configuration == null) {
+            System.exit(1);
+        }
+        System.out.println(configuration);
+        new MergeDemo().run(configuration);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/forkjoin/mergesort/MergeSort.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Arrays;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinTask;
+import java.util.concurrent.RecursiveAction;
+
+/**
+ * A class for sorting an array of {@code ints} in parallel.
+ * A {@code ForkJoinPool} is used for the parallelism, using the merge sort
+ * algorithm the array is split into halves and a new sub task is created
+ * for each part. Each sub task is dispatched to the {@code ForkJoinPool}
+ * which will schedule the task to a {@code Thread}.
+ * This happens until the size of the array is at most 2
+ * elements long. At this point the array is sorted using a simple compare
+ * and possibly a swap. The tasks then finish by using insert sort to
+ * merge the two just sorted arrays.
+ *
+ * The idea of this class is to demonstrate the usage of RecursiveAction not
+ * to implement the best possible parallel merge sort. This version creates
+ * a small array for each merge (creating a lot of objects), this could
+ * be avoided by keeping a single array.
+ */
+public class MergeSort {
+    private final ForkJoinPool pool;
+
+    private static class MergeSortTask extends RecursiveAction {
+        private final int[] array;
+        private final int low;
+        private final int high;
+        private static final int THRESHOLD = 8;
+
+        /**
+         * Creates a {@code MergeSortTask} containing the array and the bounds of the array
+         *
+         * @param array the array to sort
+         * @param low the lower element to start sorting at
+         * @param high the non-inclusive high element to sort to
+         */
+        protected MergeSortTask(int[] array, int low, int high) {
+            this.array = array;
+            this.low = low;
+            this.high = high;
+        }
+
+        @Override
+        protected void compute() {
+            if (high - low <= THRESHOLD) {
+                Arrays.sort(array, low, high);
+            } else {
+                int middle = low + ((high - low) >> 1);
+                // Execute the sub tasks and wait for them to finish
+                invokeAll(new MergeSortTask(array, low, middle), new MergeSortTask(array, middle, high));
+                // Then merge the results
+                merge(middle);
+            }
+        }
+
+        /**
+         * Merges the two sorted arrays this.low, middle - 1 and middle, this.high - 1
+         * @param middle the index in the array where the second sorted list begins
+         */
+        private void merge(int middle) {
+            if (array[middle - 1] < array[middle]) {
+                return; // the arrays are already correctly sorted, so we can skip the merge
+            }
+            int[] copy = new int[high - low];
+            System.arraycopy(array, low, copy, 0, copy.length);
+            int copyLow = 0;
+            int copyHigh = high - low;
+            int copyMiddle = middle - low;
+
+            for (int i = low, p = copyLow, q = copyMiddle; i < high; i++) {
+                if (q >= copyHigh || (p < copyMiddle && copy[p] < copy[q]) ) {
+                    array[i] = copy[p++];
+                } else {
+                    array[i] = copy[q++];
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates a {@code MergeSort} containing a ForkJoinPool with the indicated parallelism level
+     * @param parallelism the parallelism level used
+     */
+    public MergeSort(int parallelism) {
+        pool = new ForkJoinPool(parallelism);
+    }
+
+    /**
+     * Sorts all the elements of the given array using the ForkJoin framework
+     * @param array the array to sort
+     */
+    public void sort(int[] array) {
+        ForkJoinTask<Void> job = pool.submit(new MergeSortTask(array, 0, array.length));
+        job.join();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/ChatServer.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.StandardSocketOption;
+import java.nio.channels.*;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Implements a chat server, this class holds the list of {@code clients} connected to the server.
+ * It sets up a server socket using AsynchronousServerSocketChannel listening to a specified port.
+ */
+public class ChatServer implements Runnable {
+    private final List<Client> connections = Collections.synchronizedList(new ArrayList<Client>());
+    private int port;
+    private final AsynchronousServerSocketChannel listener;
+    private final AsynchronousChannelGroup channelGroup;
+
+    /**
+     *
+     * @param port to listen to
+     * @throws java.io.IOException when failing to start the server
+     */
+    public ChatServer(int port) throws IOException {
+        channelGroup = AsynchronousChannelGroup.withFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+                Executors.defaultThreadFactory());
+        this.port = port;
+        listener = createListener(channelGroup);
+    }
+
+    /**
+     *
+     * @return The socket address that the server is bound to
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    public SocketAddress getSocketAddress() throws IOException {
+        return listener.getLocalAddress();
+    }
+
+    /**
+     * Start accepting connections
+     */
+    public void run() {
+
+        // call accept to wait for connections, tell it to call our CompletionHandler when there
+        // is a new incoming connection
+        listener.accept(null, new CompletionHandler<AsynchronousSocketChannel, Void>() {
+            @Override
+            public void completed(AsynchronousSocketChannel result, Void attachment) {
+                // request a new accept and handle the incoming connection
+                listener.accept(null, this);
+                handleNewConnection(result);
+            }
+
+            @Override
+            public void failed(Throwable exc, Void attachment) {
+            }
+        });
+    }
+
+    /**
+     * Shuts down the server
+     * @throws InterruptedException if terminated while waiting for shutdown
+     * @throws IOException if failing to shutdown the channel group
+     */
+    public void shutdown() throws InterruptedException, IOException {
+        channelGroup.shutdownNow();
+        channelGroup.awaitTermination(1, TimeUnit.SECONDS);
+    }
+
+    /*
+    * Creates a listener and starts accepting connections
+    */
+    private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException {
+        final AsynchronousServerSocketChannel listener = openChannel(channelGroup);
+        listener.setOption(StandardSocketOption.SO_REUSEADDR, true);
+        listener.bind(new InetSocketAddress(port));
+        return listener;
+    }
+
+    private AsynchronousServerSocketChannel openChannel(AsynchronousChannelGroup channelGroup) throws IOException {
+        return AsynchronousServerSocketChannel.open(channelGroup);
+    }
+
+    /**
+     * Creates a new client and adds it to the list of connections.
+     * Sets the clients handler to the initial state of NameReader
+     *
+     * @param channel the newly accepted channel
+     */
+    private void handleNewConnection(AsynchronousSocketChannel channel) {
+        Client client = new Client(channel, new ClientReader(this, new NameReader(this)));
+        try {
+            channel.setOption(StandardSocketOption.TCP_NODELAY, true);
+        } catch (IOException e) {
+            // ignore
+        }
+        connections.add(client);
+        client.run();
+    }
+
+    /**
+     * Sends a message to all clients except the source.
+     * The method is synchronized as it is desired that messages are sent to
+     * all clients in the same order as received.
+     *
+     * @param client the message source
+     * @param message the message to be sent
+     */
+    public void writeMessageToClients(Client client, String message) {
+        synchronized (connections) {
+            for (Client clientConnection : connections) {
+                if (clientConnection != client) {
+                    clientConnection.writeMessageFrom(client, message);
+                }
+            }
+        }
+    }
+
+    public void removeClient(Client client) {
+        connections.remove(client);
+    }
+
+    private static void usage() {
+        System.err.println("ChatServer [-port <port number>]");
+        System.exit(1);
+    }
+
+    public static void main(String[] args) throws IOException {
+        int port = 5000;
+        if (args.length != 0 && args.length != 2) {
+            usage();
+        } else if (args.length == 2) {
+            try {
+                if (args[0].equals("-port")) {
+                    port = Integer.parseInt(args[1]);
+                } else {
+                    usage();
+                }
+            } catch (NumberFormatException e) {
+                usage();
+            }
+        }
+        System.out.println("Running on port " + port);
+        new ChatServer(port).run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/Client.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousSocketChannel;
+import java.nio.channels.CompletionHandler;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Client represents a remote connection to the chat server.
+ * It contains methods for reading and writing messages from the
+ * channel.
+ * Messages are considered to be separated by newline, so incomplete
+ * messages are buffered in the {@code Client}.
+ *
+ * All reads and writes are asynchronous and uses the nio2 asynchronous
+ * elements.
+ */
+class Client {
+    private final AsynchronousSocketChannel channel;
+    private AtomicReference<ClientReader> reader;
+    private String userName;
+    private final StringBuilder messageBuffer = new StringBuilder();
+
+    private final Queue<ByteBuffer> queue = new LinkedList<ByteBuffer>();
+    private boolean writing = false;
+
+    public Client(AsynchronousSocketChannel channel, ClientReader reader) {
+        this.channel = channel;
+        this.reader = new AtomicReference<ClientReader>(reader);
+    }
+
+    /**
+     * Enqueues a write of the buffer to the channel.
+     * The call is asynchronous so the buffer is not safe to modify after
+     * passing the buffer here.
+     *
+     * @param buffer the buffer to send to the channel
+     */
+    private void writeMessage(final ByteBuffer buffer) {
+        boolean threadShouldWrite = false;
+
+        synchronized(queue) {
+            queue.add(buffer);
+            // Currently no thread writing, make this thread dispatch a write
+            if (!writing) {
+                writing = true;
+                threadShouldWrite = true;
+            }
+        }
+
+        if (threadShouldWrite) {
+            writeFromQueue();
+        }
+    }
+
+    private void writeFromQueue() {
+        ByteBuffer buffer;
+
+        synchronized (queue) {
+            buffer = queue.poll();
+            if (buffer == null) {
+                writing = false;
+            }
+        }
+
+        // No new data in buffer to write
+        if (writing) {
+            writeBuffer(buffer);
+        }
+    }
+
+    private void writeBuffer(ByteBuffer buffer) {
+        channel.write(buffer, buffer, new CompletionHandler<Integer, ByteBuffer>() {
+            @Override
+            public void completed(Integer result, ByteBuffer buffer) {
+                if (buffer.hasRemaining()) {
+                    channel.write(buffer, buffer, this);
+                } else {
+                    // Go back and check if there is new data to write
+                    writeFromQueue();
+                }
+            }
+
+            @Override
+            public void failed(Throwable exc, ByteBuffer attachment) {
+            }
+        });
+    }
+
+    /**
+     * Sends a message
+     * @param string the message
+     */
+    public void writeStringMessage(String string) {
+        writeMessage(ByteBuffer.wrap(string.getBytes()));
+    }
+
+    /**
+     * Send a message from a specific client
+     * @param client the message is sent from
+     * @param message to send
+     */
+    public void writeMessageFrom(Client client, String message) {
+        if (reader.get().acceptsMessages()) {
+            writeStringMessage(client.getUserName() + ": " + message);
+        }
+    }
+
+    /**
+     * Enqueue a read
+     * @param completionHandler callback on completed read
+     */
+    public void read(CompletionHandler<Integer, ? super ByteBuffer> completionHandler) {
+        ByteBuffer input = ByteBuffer.allocate(256);
+        if (!channel.isOpen()) {
+            return;
+        }
+        channel.read(input, input, completionHandler);
+    }
+
+    /**
+     * Closes the channel
+     */
+    public void close() {
+        try {
+            channel.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Run the current states actions.
+     */
+    public void run() {
+        reader.get().run(this);
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public void setReader(ClientReader reader) {
+        this.reader.set(reader);
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void appendMessage(String message) {
+        synchronized (messageBuffer) {
+            messageBuffer.append(message);
+        }
+    }
+
+    /**
+     * @return the next newline separated message in the buffer. null is returned if the buffer
+     * doesn't contain any newline.
+     */
+    public String nextMessage() {
+        synchronized(messageBuffer) {
+            int nextNewline = messageBuffer.indexOf("\n");
+            if (nextNewline == -1) {
+                return null;
+            }
+            String message = messageBuffer.substring(0, nextNewline + 1);
+            messageBuffer.delete(0, nextNewline + 1);
+            return message;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/ClientReader.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+import java.nio.channels.CompletionHandler;
+
+/**
+ * Handles a cycle of reading / writing on the {@code Client}.
+ */
+class ClientReader {
+    private final DataReader callback;
+    private final ChatServer chatServer;
+
+    ClientReader(ChatServer chatServer, DataReader callback) {
+        this.chatServer = chatServer;
+        this.callback = callback;
+    }
+
+    public boolean acceptsMessages() {
+        return callback.acceptsMessages();
+    }
+
+    /**
+     * Runs a cycle of doing a beforeRead action and then enqueing a new
+     * read on the client. Handles closed channels and errors while reading.
+     * If the client is still connected a new round of actions are called.
+     */
+    public void run(final Client client) {
+        callback.beforeRead(client);
+        client.read(new CompletionHandler<Integer, ByteBuffer>() {
+            @Override
+            public void completed(Integer result, ByteBuffer buffer) {
+                // if result is negative or zero the connection has been closed or something gone wrong
+                if (result < 1) {
+                    client.close();
+                    System.out.println("Closing connection to " + client);
+                    chatServer.removeClient(client);
+                } else {
+                    callback.onData(client, buffer, result);
+                    // enqueue next round of actions
+                    client.run();
+                }
+            }
+
+            @Override
+            public void failed(Throwable exc, ByteBuffer buffer) {
+                client.close();
+                chatServer.removeClient(client);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/DataReader.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+
+public interface DataReader {
+    void beforeRead(Client client);
+    void onData(Client client, ByteBuffer buffer, int bytes);
+    boolean acceptsMessages();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/MessageReader.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+
+/**
+ * Writes all messages in our buffer to the other clients
+ * and appends new data read from the socket to our buffer
+ */
+class MessageReader implements DataReader {
+    private final ChatServer chatServer;
+
+    public MessageReader(ChatServer chatServer) {
+        this.chatServer = chatServer;
+    }
+
+    public boolean acceptsMessages() {
+        return true;
+    }
+
+    /**
+     * Write all full messages in our buffer to
+     * the other clients
+     *
+     * @param client the client to read messages from
+     */
+    @Override
+    public void beforeRead(Client client) {
+        // Check if we have any messages buffered and send them
+        String message = client.nextMessage();
+        while (message != null) {
+            chatServer.writeMessageToClients(client, message);
+            message = client.nextMessage();
+        }
+    }
+
+    /**
+     * Append the read buffer to the clients message buffer
+     * @param client the client to append messages to
+     * @param buffer the buffer we received from the socket
+     * @param bytes the number of bytes read into the buffer
+     */
+    @Override
+    public void onData(Client client, ByteBuffer buffer, int bytes) {
+        buffer.flip();
+        // Just append the message on the buffer
+        client.appendMessage(new String(buffer.array(), 0, bytes));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/NameReader.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+
+/**
+ * The first state a newly connected {@code Client} is in, this
+ * handles writing out the welcoming message and reads the response
+ * up to a newline. When a newline character have been received
+ * it changes the handler from NameReader to MessageReader on the
+ * client.
+ */
+class NameReader implements DataReader {
+    private final StringBuilder buffer = new StringBuilder();
+    private final ChatServer chatServer;
+    private boolean once = true;
+    private static final String NEWLINE = "\n";
+
+    public NameReader(ChatServer chatServer) {
+        this.chatServer = chatServer;
+    }
+
+    /**
+     * Writes the welcoming message to the client the first time this method
+     * is called.
+     *
+     * @param client the client to receive the message
+     */
+    @Override
+    public void beforeRead(Client client) {
+        // if it is a long name that takes more than one read we only want to display Name: once.
+        if (once) {
+            client.writeStringMessage("Name: ");
+            once = false;
+        }
+    }
+
+    public boolean acceptsMessages() {
+        return false;
+    }
+
+    /**
+     * Receives incoming data from the socket, searches for a newline
+     * and tries to set the username if one is found
+     */
+    @Override
+    public void onData(Client client, ByteBuffer buffer, int bytes) {
+        buffer.flip();
+        String name;
+        name = this.buffer.append(new String(buffer.array(), 0, bytes)).toString();
+        if (name.contains(NEWLINE)) {
+            onUserNameRead(client, name);
+        }
+    }
+
+    /**
+     * Splits the name on the newlines, takes the first as the username
+     * and appends everything else to the clients message buffer.
+     * Sets the clients handler to MessageReader.
+     *
+     * @param client the client to set the username for
+     * @param name the string containing the buffered input
+     */
+    private void onUserNameRead(Client client, String name) {
+        String[] strings = name.split(NEWLINE, 2);
+        client.setUserName(strings[0].trim());
+        sendRemainingParts(client, strings);
+        client.setReader(new ClientReader(chatServer, new MessageReader(chatServer)));
+        client.writeStringMessage("Welcome " + client.getUserName() + "\n");
+    }
+
+    /**
+     * Appends the remaining parts to the clients message buffer
+     *
+     * @param client the client
+     * @param strings the messages to append to the buffer
+     */
+    private void sendRemainingParts(Client client, String[] strings) {
+        for (int i = 1; i < strings.length; ++i) {
+            client.appendMessage(strings[i]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/README.txt	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,62 @@
+A Simple Chat Server Example
+
+INTRODUCTION
+============
+This directory contains a very simple chat server, the server takes input from a
+socket ("user") and sends it to all other connected sockets ("users") along with
+the provided name the user was asked for when first connecting.
+
+The server was written to demonstrate the asynchronous I/O API in JDK 7. 
+The sample assumes the reader has some familiarity with the subject matter.
+
+SETUP
+=====
+
+The server must be built with version 7 (or later) of the JDK.
+The server is built with:
+
+    % mkdir build
+    % javac -source 7 -target 7 -d build *.java
+
+EXECUTION
+=========
+
+    % java -classpath build ChatServer [-port <port number>]
+
+    Usage:  ChatServer [options]
+        options:
+            -port port      port number
+                default: 5000
+
+CLIENT EXECUTION
+================
+
+No client binary is included in the sample.
+Connections can be made using for example the telnet command or any program
+that supports a raw TCP connection to a port.
+
+SOURCE CODE OVERVIEW
+====================
+ChatServer is the main class, it handles the startup and handles incoming
+connections on the listening sockets. It keeps a list of connected client
+and provides methods for sending a message to them.
+
+Client represents a connected user, it provides methods for reading/writing
+from/to the underlying socket. It also contains a buffer of input read from
+the user.
+
+DataReader provides the interface of the two states a user can
+be in. Waiting for a name (and not receiving any messages while doing so, implemented
+by NameReader) and waiting for messages from the user (implemented by MessageReader).
+
+ClientReader contains the "main loop" for a connected client. 
+
+NameReader is the initial state for a new client, it sends the user a string and
+waits for a response before changing the state to MessageReader.
+
+MessageReader is the main state for a client, it checks for new messages to send to
+other clients and reads messages from the client.
+
+FINALLY
+=======
+This is a sample: it is not production quality and isn't optimized for performance.
--- a/jdk/src/solaris/bin/java_md.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/solaris/bin/java_md.c	Thu Apr 21 16:42:06 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
@@ -46,6 +46,10 @@
 #define JVM_DLL "libjvm.so"
 #define JAVA_DLL "libjava.so"
 
+/* help jettison the LD_LIBRARY_PATH settings in the future */
+#ifndef SETENV_REQUIRED
+#define SETENV_REQUIRED
+#endif
 /*
  * If a processor / os combination has the ability to run binaries of
  * two data models and cohabitation of jre/jdk bits with both data
@@ -106,10 +110,22 @@
  * Previously the launcher modified the LD_LIBRARY_PATH appropriately for the
  * desired data model path, regardless if data models matched or not. The
  * launcher subsequently exec'ed the desired executable, in order to make the
- * LD_LIBRARY_PATH path available for the runtime linker. This is no longer the
- * case, the launcher dlopens the target libjvm.so. All other required
- * libraries are loaded by the runtime linker, by virtue of the $ORIGIN paths
- * baked into the shared libraries, by the build infrastructure at compile time.
+ * LD_LIBRARY_PATH path available, for the runtime linker.
+ *
+ * Now, in most cases,the launcher will dlopen the target libjvm.so. All
+ * required libraries are loaded by the runtime linker, using the
+ * $RPATH/$ORIGIN baked into the shared libraries at compile time. Therefore,
+ * in most cases, the launcher will only exec, if the data models are
+ * mismatched, and will not set any environment variables, regardless of the
+ * data models.
+ *
+ * However, if the environment contains a LD_LIBRARY_PATH, this will cause the
+ * launcher to inspect the LD_LIBRARY_PATH. The launcher will check
+ *  a. if the LD_LIBRARY_PATH's first component is the the path to the desired
+ *     libjvm.so
+ *  b. if any other libjvm.so is found in any of the paths.
+ * If case b is true, then the launcher will set the LD_LIBRARY_PATH to the
+ * desired JRE and reexec, in order to propagate the environment.
  *
  *  Main
  *  (incoming argv)
@@ -137,11 +153,11 @@
  *  |                                          |
  *  |                                          |
  * \|/                                        \|/
- * YES                              (find the desired executable and exec child)
+ * YES                             Find the desired executable/library
  *  |                                          |
  *  |                                          |
  * \|/                                        \|/
- * CheckJvmType                                Main
+ * CheckJvmType                          RequiresSetenv
  * (removes -client, -server, etc.)
  *  |
  *  |
@@ -156,7 +172,42 @@
  *  processes version options,
  *  creates argument list for vm,
  *  etc.)
- *
+ *   |
+ *   |
+ *  \|/
+ * RequiresSetenv
+ * Is LD_LIBRARY_PATH
+ * and friends set ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *  YES                              YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ * Path is desired JRE ? YES --> Have Desired Model ? NO --> Re-exec --> Main
+ *  NO                               YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ * Paths have well known
+ * jvm paths ?       --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *  YES                              YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ *  Does libjvm.so exit
+ *  in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *   YES                             YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ *  Set the LD_LIBRARY_PATH
+ *   |
+ *   |
+ *  \|/
+ * Re-exec
+ *   |
+ *   |
+ *  \|/
+ * Main
  */
 
 static const char * SetExecname(char **argv);
@@ -182,6 +233,130 @@
     }
 }
 
+#ifdef SETENV_REQUIRED
+static jboolean
+JvmExists(const char *path) {
+    char tmp[PATH_MAX + 1];
+    struct stat statbuf;
+    JLI_Snprintf(tmp, PATH_MAX, "%s/%s", path, JVM_DLL);
+    if (stat(tmp, &statbuf) == 0) {
+        return JNI_TRUE;
+    }
+    return JNI_FALSE;
+}
+/*
+ * contains a lib/$LIBARCH/{server,client}/libjvm.so ?
+ */
+static jboolean
+ContainsLibJVM(int wanted, const char *env) {
+    char clientPattern[PATH_MAX + 1];
+    char serverPattern[PATH_MAX + 1];
+    char *envpath;
+    char *path;
+    jboolean clientPatternFound;
+    jboolean serverPatternFound;
+
+    /* fastest path */
+    if (env == NULL) {
+        return JNI_FALSE;
+    }
+
+    /* the usual suspects */
+    JLI_Snprintf(clientPattern, PATH_MAX, "lib/%s/client", GetArchPath(wanted));
+    JLI_Snprintf(serverPattern, PATH_MAX, "lib/%s/server", GetArchPath(wanted));
+
+    /* to optimize for time, test if any of our usual suspects are present. */
+    clientPatternFound = JLI_StrStr(env, clientPattern) != NULL;
+    serverPatternFound = JLI_StrStr(env, serverPattern) != NULL;
+    if (clientPatternFound == JNI_FALSE && serverPatternFound == JNI_FALSE) {
+        return JNI_FALSE;
+    }
+
+    /*
+     * we have a suspicious path component, check if it contains a libjvm.so
+     */
+    envpath = JLI_StringDup(env);
+    for (path = JLI_StrTok(envpath, ":"); path != NULL; path = JLI_StrTok(NULL, ":")) {
+        if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) {
+            if (JvmExists(path)) {
+                JLI_MemFree(envpath);
+                return JNI_TRUE;
+            }
+        }
+        if (serverPatternFound && JLI_StrStr(path, serverPattern)  != NULL) {
+            if (JvmExists(path)) {
+                JLI_MemFree(envpath);
+                return JNI_TRUE;
+            }
+        }
+    }
+    JLI_MemFree(envpath);
+    return JNI_FALSE;
+}
+
+/*
+ * Test whether the environment variable needs to be set, see flowchart.
+ */
+static jboolean
+RequiresSetenv(int wanted, const char *jvmpath) {
+    char jpath[PATH_MAX + 1];
+    char *llp;
+    char *dmllp = NULL;
+    char *p; /* a utility pointer */
+
+    llp = getenv("LD_LIBRARY_PATH");
+#ifdef __solaris__
+    dmllp = (CURRENT_DATA_MODEL == 32)
+            ? getenv("LD_LIBRARY_PATH_32")
+            : getenv("LD_LIBRARY_PATH_64");
+#endif /* __solaris__ */
+    /* no environment variable is a good environment variable */
+    if (llp == NULL && dmllp == NULL) {
+        return JNI_FALSE;
+    }
+#ifdef __linux
+    /*
+     * On linux, if a binary is running as sgid or suid, glibc sets
+     * LD_LIBRARY_PATH to the empty string for security purposes. (In contrast,
+     * on Solaris the LD_LIBRARY_PATH variable for a privileged binary does not
+     * lose its settings; but the dynamic linker does apply more scrutiny to the
+     * path.) The launcher uses the value of LD_LIBRARY_PATH to prevent an exec
+     * loop, here and further downstream. Therefore, if we are running sgid or
+     * suid, this function's setting of LD_LIBRARY_PATH will be ineffective and
+     * we should case a return from the calling function.  Getting the right
+     * libraries will be handled by the RPATH. In reality, this check is
+     * redundant, as the previous check for a non-null LD_LIBRARY_PATH will
+     * return back to the calling function forthwith, it is left here to safe
+     * guard against any changes, in the glibc's existing security policy.
+     */
+    if ((getgid() != getegid()) || (getuid() != geteuid())) {
+        return JNI_FALSE;
+    }
+#endif /* __linux */
+
+    /*
+     * Prevent recursions. Since LD_LIBRARY_PATH is the one which will be set by
+     * previous versions of the JRE, thus it is the only path that matters here.
+     * So we check to see if the desired JRE is set.
+     */
+    JLI_StrNCpy(jpath, jvmpath, PATH_MAX);
+    p = JLI_StrRChr(jpath, '/');
+    *p = '\0';
+    if (llp != NULL && JLI_StrNCmp(llp, jpath, JLI_StrLen(jpath)) == 0) {
+        return JNI_FALSE;
+    }
+
+    /* scrutinize all the paths further */
+    if (llp != NULL &&  ContainsLibJVM(wanted, llp)) {
+        return JNI_TRUE;
+    }
+    if (dmllp != NULL && ContainsLibJVM(wanted, dmllp)) {
+        return JNI_TRUE;
+    }
+    return JNI_FALSE;
+}
+#endif /* SETENV_REQUIRED */
+
 void
 CreateExecutionEnvironment(int *pargc, char ***pargv,
                            char jrepath[], jint so_jrepath,
@@ -195,7 +370,6 @@
    * informative to issue an error message based on whether or not the
    * os/processor combination has dual mode capabilities.
    */
-
     jboolean jvmpathExists;
 
     /* Compute/set the name of the executable */
@@ -207,13 +381,24 @@
       char * jvmtype    = NULL;
       int  argc         = *pargc;
       char **argv       = *pargv;
-
       int running       = CURRENT_DATA_MODEL;
 
       int wanted        = running;      /* What data mode is being
                                            asked for? Current model is
                                            fine unless another model
                                            is asked for */
+#ifdef SETENV_REQUIRED
+      jboolean mustsetenv = JNI_FALSE;
+      char *runpath     = NULL; /* existing effective LD_LIBRARY_PATH setting */
+      char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
+      char* newpath     = NULL; /* path on new LD_LIBRARY_PATH */
+      char* lastslash   = NULL;
+      char** newenvp    = NULL; /* current environment */
+#ifdef __solaris__
+      char*  dmpath     = NULL;  /* data model specific LD_LIBRARY_PATH,
+                                    Solaris only */
+#endif /* __solaris__ */
+#endif  /* SETENV_REQUIRED */
 
       char** newargv    = NULL;
       int    newargc    = 0;
@@ -300,9 +485,18 @@
         }
         /*
          * we seem to have everything we need, so without further ado
-         * we return back.
+         * we return back, otherwise proceed to set the environment.
          */
+#ifdef SETENV_REQUIRED
+        mustsetenv = RequiresSetenv(wanted, jvmpath);
+        JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE");
+
+        if (mustsetenv == JNI_FALSE) {
+            return;
+        }
+#else
         return;
+#endif /* SETENV_REQUIRED */
       } else {  /* do the same speculatively or exit */
 #ifdef DUAL_MODE
         if (running != wanted) {
@@ -331,67 +525,240 @@
 
           /* exec child can do error checking on the existence of the path */
           jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, GetArchPath(wanted));
-
+#ifdef SETENV_REQUIRED
+          mustsetenv = RequiresSetenv(wanted, jvmpath);
+#endif /* SETENV_REQUIRED */
         }
 #else
         JLI_ReportErrorMessage(JRE_ERROR2, wanted);
         exit(1);
 #endif
-      }
+        }
+#ifdef SETENV_REQUIRED
+        if (mustsetenv) {
+            /*
+             * We will set the LD_LIBRARY_PATH as follows:
+             *
+             *     o          $JVMPATH (directory portion only)
+             *     o          $JRE/lib/$LIBARCHNAME
+             *     o          $JRE/../lib/$LIBARCHNAME
+             *
+             * followed by the user's previous effective LD_LIBRARY_PATH, if
+             * any.
+             */
+
+#ifdef __solaris__
+            /*
+             * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH
+             * variables:
+             *
+             * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if
+             * data-model specific variables are not set.
+             *
+             * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH
+             * for 64-bit binaries.
+             *
+             * 3. LD_LIBRARY_PATH_32 -- overrides and replaces LD_LIBRARY_PATH
+             * for 32-bit binaries.
+             *
+             * The vm uses LD_LIBRARY_PATH to set the java.library.path system
+             * property.  To shield the vm from the complication of multiple
+             * LD_LIBRARY_PATH variables, if the appropriate data model
+             * specific variable is set, we will act as if LD_LIBRARY_PATH had
+             * the value of the data model specific variant and the data model
+             * specific variant will be unset.  Note that the variable for the
+             * *wanted* data model must be used (if it is set), not simply the
+             * current running data model.
+             */
+
+            switch (wanted) {
+                case 0:
+                    if (running == 32) {
+                        dmpath = getenv("LD_LIBRARY_PATH_32");
+                        wanted = 32;
+                    } else {
+                        dmpath = getenv("LD_LIBRARY_PATH_64");
+                        wanted = 64;
+                    }
+                    break;
 
-      {
-        char *newexec = execname;
+                case 32:
+                    dmpath = getenv("LD_LIBRARY_PATH_32");
+                    break;
+
+                case 64:
+                    dmpath = getenv("LD_LIBRARY_PATH_64");
+                    break;
+
+                default:
+                    JLI_ReportErrorMessage(JRE_ERROR3, __LINE__);
+                    exit(1); /* unknown value in wanted */
+                    break;
+            }
+
+            /*
+             * If dmpath is NULL, the relevant data model specific variable is
+             * not set and normal LD_LIBRARY_PATH should be used.
+             */
+            if (dmpath == NULL) {
+                runpath = getenv("LD_LIBRARY_PATH");
+            } else {
+                runpath = dmpath;
+            }
+#else
+            /*
+             * If not on Solaris, assume only a single LD_LIBRARY_PATH
+             * variable.
+             */
+            runpath = getenv("LD_LIBRARY_PATH");
+#endif /* __solaris__ */
+
+            /* runpath contains current effective LD_LIBRARY_PATH setting */
+
+            jvmpath = JLI_StringDup(jvmpath);
+            new_runpath = JLI_MemAlloc(((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
+                    2 * JLI_StrLen(jrepath) + 2 * JLI_StrLen(arch) +
+                    JLI_StrLen(jvmpath) + 52);
+            newpath = new_runpath + JLI_StrLen("LD_LIBRARY_PATH=");
+
+
+            /*
+             * Create desired LD_LIBRARY_PATH value for target data model.
+             */
+            {
+                /* remove the name of the .so from the JVM path */
+                lastslash = JLI_StrRChr(jvmpath, '/');
+                if (lastslash)
+                    *lastslash = '\0';
+
+                sprintf(new_runpath, "LD_LIBRARY_PATH="
+                        "%s:"
+                        "%s/lib/%s:"
+                        "%s/../lib/%s",
+                        jvmpath,
 #ifdef DUAL_MODE
-        /*
-         * If the data model is being changed, the path to the
-         * executable must be updated accordingly; the executable name
-         * and directory the executable resides in are separate.  In the
-         * case of 32 => 64, the new bits are assumed to reside in, e.g.
-         * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
-         * the bits are assumed to be in "olddir/../execname".  For example,
-         *
-         * olddir/sparcv9/execname
-         * olddir/amd64/execname
-         *
-         * for Solaris SPARC and Linux amd64, respectively.
-         */
-
-        if (running != wanted) {
-          char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname);
-          char *olddir = oldexec;
-          char *oldbase = JLI_StrRChr(oldexec, '/');
+                        jrepath, GetArchPath(wanted),
+                        jrepath, GetArchPath(wanted)
+#else
+                        jrepath, arch,
+                        jrepath, arch
+#endif
+                        );
 
 
-          newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20);
-          *oldbase++ = 0;
-          sprintf(newexec, "%s/%s/%s", olddir,
-                  ((wanted==64) ? LIBARCH64NAME : ".."), oldbase);
-          argv[0] = newexec;
+                /*
+                 * Check to make sure that the prefix of the current path is the
+                 * desired environment variable setting, though the RequiresSetenv
+                 * checks if the desired runpath exists, this logic does a more
+                 * comprehensive check.
+                 */
+                if (runpath != NULL &&
+                        JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath)) == 0 &&
+                        (runpath[JLI_StrLen(newpath)] == 0 || runpath[JLI_StrLen(newpath)] == ':') &&
+                        (running == wanted) /* data model does not have to be changed */
+#ifdef __solaris__
+                        && (dmpath == NULL) /* data model specific variables not set  */
+#endif
+                        ) {
+
+                    return;
+
+                }
+            }
+
+            /*
+             * Place the desired environment setting onto the prefix of
+             * LD_LIBRARY_PATH.  Note that this prevents any possible infinite
+             * loop of execv() because we test for the prefix, above.
+             */
+            if (runpath != 0) {
+                JLI_StrCat(new_runpath, ":");
+                JLI_StrCat(new_runpath, runpath);
+            }
+
+            if (putenv(new_runpath) != 0) {
+                exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set
+                    properly */
+            }
+
+            /*
+             * Unix systems document that they look at LD_LIBRARY_PATH only
+             * once at startup, so we have to re-exec the current executable
+             * to get the changed environment variable to have an effect.
+             */
+
+#ifdef __solaris__
+            /*
+             * If dmpath is not NULL, remove the data model specific string
+             * in the environment for the exec'ed child.
+             */
+            if (dmpath != NULL)
+                (void)UnsetEnv((wanted == 32) ? "LD_LIBRARY_PATH_32" : "LD_LIBRARY_PATH_64");
+#endif
+
+            newenvp = environ;
         }
-#endif
-        JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
-        (void)fflush(stdout);
-        (void)fflush(stderr);
-        execv(newexec, argv);
-        JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
+#endif /* SETENV_REQUIRED */
+        {
+            char *newexec = execname;
+#ifdef DUAL_MODE
+            /*
+             * If the data model is being changed, the path to the
+             * executable must be updated accordingly; the executable name
+             * and directory the executable resides in are separate.  In the
+             * case of 32 => 64, the new bits are assumed to reside in, e.g.
+             * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
+             * the bits are assumed to be in "olddir/../execname".  For example,
+             *
+             * olddir/sparcv9/execname
+             * olddir/amd64/execname
+             *
+             * for Solaris SPARC and Linux amd64, respectively.
+             */
+
+            if (running != wanted) {
+                char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname);
+                char *olddir = oldexec;
+                char *oldbase = JLI_StrRChr(oldexec, '/');
+
+
+                newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20);
+                *oldbase++ = 0;
+                sprintf(newexec, "%s/%s/%s", olddir,
+                        ((wanted == 64) ? LIBARCH64NAME : ".."), oldbase);
+                argv[0] = newexec;
+            }
+#endif /* DUAL_MODE */
+            JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
+            (void) fflush(stdout);
+            (void) fflush(stderr);
+#ifdef SETENV_REQUIRED
+            if (mustsetenv) {
+                execve(newexec, argv, newenvp);
+            } else {
+                execv(newexec, argv);
+            }
+#else
+            execv(newexec, argv);
+#endif /* SETENV_REQUIRED */
+            JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
 
 #ifdef DUAL_MODE
-        if (running != wanted) {
-          JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
-#  ifdef __solaris__
-#    ifdef __sparc
-          JLI_ReportErrorMessage(JRE_ERROR6);
-#    else
-          JLI_ReportErrorMessage(JRE_ERROR7);
-#    endif
+            if (running != wanted) {
+                JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
+#ifdef __solaris__
+#ifdef __sparc
+                JLI_ReportErrorMessage(JRE_ERROR6);
+#else
+                JLI_ReportErrorMessage(JRE_ERROR7);
+#endif  /* __sparc */
+            }
+#endif /* __solaris__ */
+#endif /* DUAL_MODE */
+
         }
-#  endif
-#endif
-
-      }
-      exit(1);
+        exit(1);
     }
-
 }
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/native/common/jdk_util_md.h	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// Currently, there are no unix specific functions defined.
--- a/jdk/src/windows/classes/java/lang/ProcessEnvironment.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/java/lang/ProcessEnvironment.java	Thu Apr 21 16:42:06 2011 -0700
@@ -143,7 +143,7 @@
                 public void remove() { i.remove();}
             };
         }
-        private static Map.Entry<String,String> checkedEntry (Object o) {
+        private static Map.Entry<String,String> checkedEntry(Object o) {
             Map.Entry<String,String> e = (Map.Entry<String,String>) o;
             nonNullString(e.getKey());
             nonNullString(e.getValue());
@@ -285,7 +285,7 @@
         return (Map<String,String>) theEnvironment.clone();
     }
 
-    // Only for use by Runtime.exec(...String[]envp...)
+    // Only for use by ProcessBuilder.environment(String[] envp)
     static Map<String,String> emptyEnvironment(int capacity) {
         return new ProcessEnvironment(capacity);
     }
@@ -299,19 +299,46 @@
         Collections.sort(list, entryComparator);
 
         StringBuilder sb = new StringBuilder(size()*30);
-        for (Map.Entry<String,String> e : list)
-            sb.append(e.getKey())
-              .append('=')
-              .append(e.getValue())
-              .append('\u0000');
-        // Ensure double NUL termination,
-        // even if environment is empty.
-        if (sb.length() == 0)
+        int cmp = -1;
+
+        // Some versions of MSVCRT.DLL require SystemRoot to be set.
+        // So, we make sure that it is always set, even if not provided
+        // by the caller.
+        final String SYSTEMROOT = "SystemRoot";
+
+        for (Map.Entry<String,String> e : list) {
+            String key = e.getKey();
+            String value = e.getValue();
+            if (cmp < 0 && (cmp = nameComparator.compare(key, SYSTEMROOT)) > 0) {
+                // Not set, so add it here
+                addToEnvIfSet(sb, SYSTEMROOT);
+            }
+            addToEnv(sb, key, value);
+        }
+        if (cmp < 0) {
+            // Got to end of list and still not found
+            addToEnvIfSet(sb, SYSTEMROOT);
+        }
+        if (sb.length() == 0) {
+            // Environment was empty and SystemRoot not set in parent
             sb.append('\u0000');
+        }
+        // Block is double NUL terminated
         sb.append('\u0000');
         return sb.toString();
     }
 
+    // add the environment variable to the child, if it exists in parent
+    private static void addToEnvIfSet(StringBuilder sb, String name) {
+        String s = getenv(name);
+        if (s != null)
+            addToEnv(sb, name, s);
+    }
+
+    private static void addToEnv(StringBuilder sb, String name, String val) {
+        sb.append(name).append('=').append(val).append('\u0000');
+    }
+
     static String toEnvironmentBlock(Map<String,String> map) {
         return map == null ? null :
             ((ProcessEnvironment)map).toEnvironmentBlock();
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java	Thu Apr 21 16:42:06 2011 -0700
@@ -56,8 +56,9 @@
         // parse default directory and check it is absolute
         WindowsPathParser.Result result = WindowsPathParser.parse(dir);
 
-        if (result.type() != WindowsPathType.ABSOLUTE)
-            throw new AssertionError("Default directory must be absolute/non-UNC");
+        if ((result.type() != WindowsPathType.ABSOLUTE) &&
+            (result.type() != WindowsPathType.UNC))
+            throw new AssertionError("Default directory is not an absolute path");
         this.defaultDirectory = result.path();
         this.defaultRoot = result.root();
 
--- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Kinit.java	Thu Apr 21 16:42:06 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
@@ -30,12 +30,15 @@
 
 package sun.security.krb5.internal.tools;
 
+import java.io.File;
 import sun.security.krb5.*;
 import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.ccache.*;
 import java.io.IOException;
 import java.util.Arrays;
+import javax.security.auth.kerberos.KerberosPrincipal;
 import sun.security.util.Password;
+import javax.security.auth.kerberos.KeyTab;
 
 /**
  * Kinit tool for obtaining Kerberos v5 tickets.
@@ -153,7 +156,6 @@
             System.out.println("Principal is " + principal);
         }
         char[] psswd = options.password;
-        EncryptionKey[] skeys = null;
         boolean useKeytab = options.useKeytabFile();
         if (!useKeytab) {
             if (princName == null) {
@@ -186,17 +188,9 @@
                 }
             }
 
-            // assert princName and principal are nonnull
-            skeys = EncryptionKey.acquireSecretKeys(principal, ktabName);
-
-            if (skeys == null || skeys.length == 0) {
-                String msg = "No supported key found in keytab";
-                if (princName != null) {
-                    msg += " for principal " + princName;
-                }
-                throw new KrbException(msg);
-            }
-            builder = new KrbAsReqBuilder(principal, skeys);
+            builder = new KrbAsReqBuilder(principal, ktabName == null
+                    ? KeyTab.getInstance()
+                    : KeyTab.getInstance(new File(ktabName)));
         }
 
         KDCOptions opt = new KDCOptions();
--- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2009, 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
@@ -95,16 +95,15 @@
             }
             break;
         case 'k':
-            if (klist.name == null) {
-                klist.target = KeyTab.getInstance();
-                klist.name = KeyTab.tabName();
-            } else klist.target = KeyTab.getInstance(klist.name);
-            if (klist.target != null) {
-                klist.displayTab();
-            } else {
+            try {
+                KeyTab ktab = KeyTab.getInstance(klist.name);
+                klist.target = ktab;
+                klist.name = ktab.tabName();
+            } catch (Exception e) {
                 klist.displayMessage("KeyTab");
                 System.exit(-1);
             }
+            klist.displayTab();
             break;
         default:
             if (klist.name != null) {
@@ -295,9 +294,10 @@
 
     void displayMessage(String target) {
         if (name == null) {
-            name = "";
+            System.out.println("Default " + target + " not found.");
+        } else {
+            System.out.println(target + " " + name + " not found.");
         }
-        System.out.println(target + " " + name + " not found.");
     }
     /**
      * Reformats the date from the form -
--- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Ktab.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -321,7 +321,7 @@
      * Lists key table name and entries in it.
      */
     void listKt() {
-        System.out.println("Keytab name: " + KeyTab.tabName());
+        System.out.println("Keytab name: " + table.tabName());
         KeyTabEntry[] entries = table.getEntries();
         if ((entries != null) && (entries.length > 0)) {
             String[][] output = new String[entries.length+1][showTime?3:2];
--- a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java	Thu Apr 21 16:42:06 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
@@ -25,6 +25,7 @@
 
 package sun.security.mscapi;
 
+import java.math.BigInteger;
 import java.security.*;
 import java.security.Key;
 import java.security.interfaces.*;
@@ -33,6 +34,8 @@
 import javax.crypto.*;
 import javax.crypto.spec.*;
 
+import sun.security.rsa.RSAKeyFactory;
+
 /**
  * RSA cipher implementation using the Microsoft Crypto API.
  * Supports RSA en/decryption and signing/verifying using PKCS#1 v1.5 padding.
@@ -189,8 +192,38 @@
         default:
             throw new InvalidKeyException("Unknown mode: " + opmode);
         }
+
         if (!(key instanceof sun.security.mscapi.Key)) {
-            throw new InvalidKeyException("Unsupported key type: " + key);
+            if (key instanceof java.security.interfaces.RSAPublicKey) {
+                java.security.interfaces.RSAPublicKey rsaKey =
+                    (java.security.interfaces.RSAPublicKey) key;
+
+                // Convert key to MSCAPI format
+
+                BigInteger modulus = rsaKey.getModulus();
+                BigInteger exponent =  rsaKey.getPublicExponent();
+
+                // Check against the local and global values to make sure
+                // the sizes are ok.  Round up to the nearest byte.
+                RSAKeyFactory.checkKeyLengths(((modulus.bitLength() + 7) & ~7),
+                    exponent, -1, RSAKeyPairGenerator.KEY_SIZE_MAX);
+
+                byte[] modulusBytes = modulus.toByteArray();
+                byte[] exponentBytes = exponent.toByteArray();
+
+                // Adjust key length due to sign bit
+                int keyBitLength = (modulusBytes[0] == 0)
+                    ? (modulusBytes.length - 1) * 8
+                    : modulusBytes.length * 8;
+
+                byte[] keyBlob = RSASignature.generatePublicKeyBlob(
+                    keyBitLength, modulusBytes, exponentBytes);
+
+                key = RSASignature.importPublicKey(keyBlob, keyBitLength);
+
+            } else {
+                throw new InvalidKeyException("Unsupported key type: " + key);
+            }
         }
 
         if (key instanceof PublicKey) {
@@ -358,6 +391,10 @@
 
         if (key instanceof sun.security.mscapi.Key) {
             return ((sun.security.mscapi.Key) key).bitLength();
+
+        } else if (key instanceof RSAKey) {
+            return ((RSAKey) key).getModulus().bitLength();
+
         } else {
             throw new InvalidKeyException("Unsupported key type: " + key);
         }
--- a/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 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
@@ -91,7 +91,7 @@
         if (exponent == null) {
             publicKeyBlob = getPublicKeyBlob(hCryptKey);
 
-            exponent = new BigInteger(getExponent(publicKeyBlob));
+            exponent = new BigInteger(1, getExponent(publicKeyBlob));
         }
 
         return exponent;
@@ -104,7 +104,7 @@
 
         if (modulus == null) {
             publicKeyBlob = getPublicKeyBlob(hCryptKey);
-            modulus = new BigInteger(getModulus(publicKeyBlob));
+            modulus = new BigInteger(1, getModulus(publicKeyBlob));
         }
 
         return modulus;
--- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java	Thu Apr 21 16:42:06 2011 -0700
@@ -379,11 +379,13 @@
     /**
      * Generates a public-key BLOB from a key's components.
      */
-    private native byte[] generatePublicKeyBlob(
+    // used by RSACipher
+    static native byte[] generatePublicKeyBlob(
         int keyBitLength, byte[] modulus, byte[] publicExponent);
 
     /**
      * Imports a public-key BLOB.
      */
-    private native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize);
+    // used by RSACipher
+    static native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize);
 }
--- a/jdk/src/windows/classes/sun/tools/attach/WindowsAttachProvider.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/classes/sun/tools/attach/WindowsAttachProvider.java	Thu Apr 21 16:42:06 2011 -0700
@@ -126,16 +126,6 @@
      * of the process list.
      */
     private List<VirtualMachineDescriptor> listJavaProcesses() {
-        // ensure that process status helper is loaded (psapi.dll)
-        if (!isProcessStatusHelperInitialized) {
-            synchronized (WindowsAttachProvider.class) {
-                if (!isProcessStatusHelperInitialized) {
-                    initializeProcessStatusHelper();
-                    isProcessStatusHelperInitialized = true;
-                }
-            }
-        }
-
         ArrayList<VirtualMachineDescriptor> list =
             new ArrayList<VirtualMachineDescriptor>();
 
@@ -172,12 +162,6 @@
         return list;
     }
 
-    // indicates if psapi.dll has been initialized
-    private static volatile boolean isProcessStatusHelperInitialized;
-
-    // loads psapi
-    private static native void initializeProcessStatusHelper();
-
     // enumerates processes using psapi's EnumProcesses
     private static native int enumProcesses(int[] processes, int max);
 
--- a/jdk/src/windows/native/common/jdk_util_md.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/common/jdk_util_md.c	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2005, 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
@@ -38,3 +38,25 @@
 void* JDK_FindJvmEntry(const char* name) {
     return (void*) GetProcAddress(jvm_handle, name);
 }
+
+JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
+    HMODULE handle = NULL;
+    char path[MAX_PATH];
+    int ret;
+
+    if (GetSystemDirectory(path, sizeof(path)) != 0) {
+        strcat(path, "\\");
+        strcat(path, name);
+        handle = LoadLibrary(path);
+    }
+
+    if (handle == NULL) {
+        if (GetWindowsDirectory(path, sizeof(path)) != 0) {
+            strcat(path, "\\");
+            strcat(path, name);
+            handle = LoadLibrary(path);
+        }
+    }
+    return handle;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/windows/native/common/jdk_util_md.h	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+
+#ifndef JDK_UTIL_MD_H
+#define JDK_UTIL_MD_H
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* JDK_UTIL_MD_H */
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -117,7 +117,7 @@
 {
     typedef IDirect3D9 * WINAPI FnDirect3DCreate9(UINT SDKVersion);
 
-    hLibD3D9 = ::LoadLibrary(TEXT("d3d9.dll"));
+    hLibD3D9 = JDK_LoadSystemLibrary("d3d9.dll");
     if (hLibD3D9 == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "InitD3D: no d3d9.dll");
         return E_FAIL;
--- a/jdk/src/windows/native/sun/java2d/opengl/OGLFuncs_md.h	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/java2d/opengl/OGLFuncs_md.h	Thu Apr 21 16:42:06 2011 -0700
@@ -29,6 +29,7 @@
 #include <windows.h>
 #include "J2D_GL/wglext.h"
 #include "OGLFuncMacros.h"
+#include <jdk_util.h>
 
 /**
  * Core WGL functions
@@ -60,7 +61,7 @@
 #define OGL_LIB_IS_UNINITIALIZED() \
     (OGL_LIB_HANDLE == 0)
 #define OGL_OPEN_LIB() \
-    OGL_LIB_HANDLE = LoadLibrary(L"opengl32.dll")
+    OGL_LIB_HANDLE = JDK_LoadSystemLibrary("opengl32.dll")
 #define OGL_CLOSE_LIB() \
     FreeLibrary(OGL_LIB_HANDLE)
 #define OGL_GET_PROC_ADDRESS(f) \
--- a/jdk/src/windows/native/sun/tools/attach/WindowsAttachProvider.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsAttachProvider.c	Thu Apr 21 16:42:06 2011 -0700
@@ -25,6 +25,7 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <string.h>
+#include <Psapi.h>
 
 #include "jni.h"
 #include "jni_util.h"
@@ -97,41 +98,6 @@
 
 
 /*
- * Process status helper library functions
- */
-static BOOL  (WINAPI *_EnumProcesses)     (DWORD *, DWORD, DWORD *);
-static BOOL  (WINAPI *_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
-static DWORD (WINAPI *_GetModuleBaseName) (HANDLE, HMODULE, LPTSTR, DWORD);
-
-
-/*
- * Class:     sun_tools_attach_WindowsAttachProvider
- * Method:    initializeProcessStatusHelper
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_tools_attach_WindowsAttachProvider_initializeProcessStatusHelper(JNIEnv *env, jclass cls)
-{
-    HINSTANCE psapi = LoadLibrary("PSAPI.DLL") ;
-    if (psapi != NULL) {
-        _EnumProcesses = (BOOL(WINAPI *)(DWORD *, DWORD, DWORD *))
-            GetProcAddress(psapi, "EnumProcesses") ;
-        _EnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD))
-            GetProcAddress(psapi, "EnumProcessModules");
-        _GetModuleBaseName = (DWORD(WINAPI *)(HANDLE, HMODULE, LPTSTR, DWORD))
-            GetProcAddress(psapi, "GetModuleBaseNameA");
-    }
-
-    if ((_EnumProcesses == NULL) ||
-        (_EnumProcessModules == NULL) ||
-        (_GetModuleBaseName == NULL))
-    {
-        JNU_ThrowInternalError(env, "Unable to initialize process status helper library");
-    }
-}
-
-
-/*
  * Class:     sun_tools_attach_WindowsAttachProvider
  * Method:    enumProcesses
  * Signature: ([JI)I
@@ -147,7 +113,7 @@
     size = max * sizeof(DWORD);
     ptr = (DWORD*)malloc(size);
     if (ptr != NULL) {
-        BOOL res = (*_EnumProcesses)(ptr, size, &bytesReturned);
+        BOOL res = EnumProcesses(ptr, size, &bytesReturned);
         if (res != 0) {
             result = (jint)(bytesReturned / sizeof(DWORD));
             (*env)->SetIntArrayRegion(env, arr, 0, (jsize)result, (jint*)ptr);
@@ -192,13 +158,13 @@
     size = 1024 * sizeof(HMODULE);
     ptr = (HMODULE*)malloc(size);
     if (ptr != NULL) {
-        BOOL res = (*_EnumProcessModules)(hProcess, ptr, size, &bytesReturned);
+        BOOL res = EnumProcessModules(hProcess, ptr, size, &bytesReturned);
         if (res != 0) {
             int count = bytesReturned / sizeof(HMODULE);
             int i = 0;
             while (i < count) {
                 char base[256];
-                BOOL res = (*_GetModuleBaseName)(hProcess, ptr[i], base, sizeof(base));
+                BOOL res = GetModuleBaseName(hProcess, ptr[i], base, sizeof(base));
                 if (res != 0) {
                     if (strcmp(base, lib) == 0) {
                       result = JNI_TRUE;
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Thu Apr 21 16:42:06 2011 -0700
@@ -32,13 +32,13 @@
 
 
 /* kernel32 */
-typedef HINSTANCE (WINAPI* LoadLibraryFunc) (LPCTSTR);
+typedef HINSTANCE (WINAPI* GetModuleHandleFunc) (LPCTSTR);
 typedef FARPROC (WINAPI* GetProcAddressFunc)(HMODULE, LPCSTR);
 
 /* only on Windows 64-bit or 32-bit application running under WOW64 */
 typedef BOOL (WINAPI *IsWow64ProcessFunc) (HANDLE, PBOOL);
 
-static LoadLibraryFunc _LoadLibrary;
+static GetModuleHandleFunc _GetModuleHandle;
 static GetProcAddressFunc _GetProcAddress;
 static IsWow64ProcessFunc _IsWow64Process;
 
@@ -70,7 +70,7 @@
 #define MAX_PIPE_NAME_LENGTH    256
 
 typedef struct {
-   LoadLibraryFunc _LoadLibrary;
+   GetModuleHandleFunc _GetModuleHandle;
    GetProcAddressFunc _GetProcAddress;
    char jvmLib[MAX_LIBNAME_LENGTH];         /* "jvm.dll" */
    char func1[MAX_FUNC_LENGTH];
@@ -96,7 +96,7 @@
     HINSTANCE h;
     EnqueueOperationFunc addr;
 
-    h = pData->_LoadLibrary(pData->jvmLib);
+    h = pData->_GetModuleHandle(pData->jvmLib);
     if (h == NULL) {
         return ERR_OPEN_JVM_FAIL;
     }
@@ -131,15 +131,10 @@
 JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_init
   (JNIEnv *env, jclass cls)
 {
-    HINSTANCE h = LoadLibrary("kernel32");
-    if (h != NULL) {
-        _LoadLibrary = (LoadLibraryFunc) GetProcAddress(h, "LoadLibraryA");
-        _GetProcAddress = (GetProcAddressFunc)GetProcAddress(h, "GetProcAddress");
-        _IsWow64Process = (IsWow64ProcessFunc)GetProcAddress(h, "IsWow64Process");
-    }
-    if (_LoadLibrary == NULL || _GetProcAddress == NULL) {
-        JNU_ThrowInternalError(env, "Unable to get address of LoadLibraryA or GetProcAddress");
-    }
+    // All following APIs exist on Windows XP with SP2/Windows Server 2008
+    _GetModuleHandle = (GetModuleHandleFunc)GetModuleHandle;
+    _GetProcAddress = (GetProcAddressFunc)GetProcAddress;
+    _IsWow64Process = (IsWow64ProcessFunc)IsWow64Process;
 }
 
 
@@ -375,7 +370,7 @@
     /*
      * Setup data to copy to target process
      */
-    data._LoadLibrary = _LoadLibrary;
+    data._GetModuleHandle = _GetModuleHandle;
     data._GetProcAddress = _GetProcAddress;
 
     strcpy(data.jvmLib, "jvm");
--- a/jdk/src/windows/native/sun/tracing/dtrace/jvm_symbols_md.c	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/tracing/dtrace/jvm_symbols_md.c	Thu Apr 21 16:42:06 2011 -0700
@@ -35,7 +35,7 @@
 JvmSymbols* lookupJvmSymbols() {
     JvmSymbols* syms = (JvmSymbols*)malloc(sizeof(JvmSymbols));
     if (syms != NULL) {
-        HINSTANCE jvm = LoadLibrary("jvm.dll");
+        HINSTANCE jvm = GetModuleHandle("jvm.dll");
         if (jvm == NULL) {
             free(syms);
             return NULL;
--- a/jdk/src/windows/native/sun/windows/DllUtil.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/DllUtil.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -25,6 +25,7 @@
 
 
 #include "DllUtil.h"
+#include <jdk_util.h>
 
 // Disable warning about using this in the initializer list.
 #pragma warning( disable : 4355)
@@ -40,7 +41,7 @@
 HMODULE DllUtil::GetModule()
 {
     if (!module) {
-        module = ::LoadLibrary(name);
+        module = JDK_LoadSystemLibrary(name);
     }
     return module;
 }
@@ -60,7 +61,7 @@
 }
 
 DwmAPI::DwmAPI() :
-    DllUtil(_T("DWMAPI.DLL")),
+    DllUtil("DWMAPI.DLL"),
     DwmIsCompositionEnabledFunction((DllUtil*)this, "DwmIsCompositionEnabled"),
     DwmGetWindowAttributeFunction((DllUtil*)this, "DwmGetWindowAttribute")
 {
--- a/jdk/src/windows/native/sun/windows/DllUtil.h	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/DllUtil.h	Thu Apr 21 16:42:06 2011 -0700
@@ -43,7 +43,7 @@
         FARPROC GetProcAddress(LPCSTR name);
 
     protected:
-        DllUtil(const TCHAR * name) : name(name), module(NULL) {}
+        DllUtil(const char * name) : name(name), module(NULL) {}
         virtual ~DllUtil();
 
         HMODULE GetModule();
@@ -68,7 +68,7 @@
         };
 
     private:
-        const TCHAR * const name;
+        const char * const name;
         HMODULE module;
 };
 
--- a/jdk/src/windows/native/sun/windows/ShellFolder2.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/ShellFolder2.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -120,15 +120,15 @@
         return TRUE;
     }
     // Load libraries
-    libShell32 = LoadLibrary(TEXT("shell32.dll"));
+    libShell32 = JDK_LoadSystemLibrary("shell32.dll");
     if (libShell32 == NULL) {
         return FALSE;
     }
-    libUser32 = LoadLibrary(TEXT("user32.dll"));
+    libUser32 = JDK_LoadSystemLibrary("user32.dll");
     if (libUser32 == NULL) {
         return FALSE;
     }
-    libComCtl32 = LoadLibrary(TEXT("comctl32.dll"));
+    libComCtl32 = JDK_LoadSystemLibrary("comctl32.dll");
     if (libComCtl32 == NULL) {
         return FALSE;
     }
@@ -1021,7 +1021,8 @@
     (JNIEnv* env, jclass cls, jstring libName, jint iconID,
      jint cxDesired, jint cyDesired, jboolean useVGAColors)
 {
-    HINSTANCE libHandle = LoadLibrary(JNU_GetStringPlatformChars(env, libName, NULL));
+    const char *pLibName = env->GetStringUTFChars(libName, NULL);
+    HINSTANCE libHandle = (HINSTANCE)JDK_LoadSystemLibrary(pLibName);
     if (libHandle != NULL) {
         UINT fuLoad = (useVGAColors && !IS_WINXP) ? LR_VGACOLOR : 0;
         return ptr_to_jlong(LoadImage(libHandle, MAKEINTRESOURCE(iconID),
--- a/jdk/src/windows/native/sun/windows/ThemeReader.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/ThemeReader.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -150,7 +150,7 @@
 
 BOOL InitThemes() {
     static HMODULE hModThemes = NULL;
-    hModThemes = LoadLibrary(TEXT("UXTHEME.DLL"));
+    hModThemes = JDK_LoadSystemLibrary("UXTHEME.DLL");
     DTRACE_PRINTLN1("InitThemes hModThemes = %x\n", hModThemes);
     if(hModThemes) {
         DTRACE_PRINTLN("Loaded UxTheme.dll\n");
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -285,7 +285,7 @@
         file = (jstring)env->GetObjectField(target, AwtFileDialog::fileID);
         if (file != NULL) {
             LPCTSTR tmp = JNU_GetStringPlatformChars(env, file, NULL);
-            _tcscpy(fileBuffer, tmp);
+            _tcsncpy(fileBuffer, tmp, bufferLimit - 2); // the fileBuffer is double null terminated string
             JNU_ReleaseStringPlatformChars(env, file, tmp);
         } else {
             fileBuffer[0] = _T('\0');
--- a/jdk/src/windows/native/sun/windows/awt_Mlib.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Mlib.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -43,12 +43,13 @@
         mlibSysFnS_t tempSysFns;
         mlib_status ret = MLIB_SUCCESS;
 
-        /* Try to load library. Routine should find the library successfully
-         * because this library is already loaded to the process space by
-         * the System.loadLibrary() call. Here we just need to get handle to
-         * initialize the pointers to required mlib routines.
+        /* Try to receive handle for the library. Routine should find
+         * the library successfully because this library is already
+         * loaded to the process space by the System.loadLibrary() call.
+         * Here we just need to get handle to initialize the pointers to
+         * required mlib routines.
          */
-        hDLL = ::LoadLibrary(TEXT("mlib_image.dll"));
+        hDLL = ::GetModuleHandle(TEXT("mlib_image.dll"));
 
         if (hDLL == NULL) {
             return MLIB_FAILURE;
@@ -94,9 +95,6 @@
             i++;
         }
 
-        if (ret != MLIB_SUCCESS) {
-            ::FreeLibrary(hDLL);
-        }
         return ret;
     }
 
--- a/jdk/src/windows/native/sun/windows/awt_TextArea.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TextArea.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -77,7 +77,7 @@
 LPCTSTR AwtTextArea::GetClassName() {
     static BOOL richedLibraryLoaded = FALSE;
     if (!richedLibraryLoaded) {
-        ::LoadLibrary(TEXT("RICHED20.DLL"));
+        JDK_LoadSystemLibrary("RICHED20.DLL");
         richedLibraryLoaded = TRUE;
     }
     return RICHEDIT_CLASS;
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -185,7 +185,7 @@
     int shellVersion = 5; // WIN_2000
     // MSDN: DllGetVersion should not be implicitly called, but rather
     // loaded using GetProcAddress
-    HMODULE hShell = LoadLibrary(TEXT("Shell32.dll"));
+    HMODULE hShell = JDK_LoadSystemLibrary("Shell32.dll");
     if (hShell != NULL) {
         DLLGETVERSIONPROC proc = (DLLGETVERSIONPROC)GetProcAddress(hShell, "DllGetVersion");
         if (proc != NULL) {
--- a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp	Thu Apr 21 16:42:06 2011 -0700
@@ -63,7 +63,7 @@
 
     bAlreadySet = TRUE;
 
-    HMODULE hLibUser32Dll = ::LoadLibrary(TEXT("user32.dll"));
+    HMODULE hLibUser32Dll = JDK_LoadSystemLibrary("user32.dll");
 
     if (hLibUser32Dll != NULL) {
         SetProcessDPIAwareFunc *lpSetProcessDPIAware =
--- a/jdk/src/windows/native/sun/windows/stdhdrs.h	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/stdhdrs.h	Thu Apr 21 16:42:06 2011 -0700
@@ -47,6 +47,7 @@
 // standard Java headers
 #include <jni.h>
 #include <jni_util.h>
+#include <jdk_util.h>
 
 } // extern "C"
 
--- a/jdk/src/windows/npt/npt_md.h	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/src/windows/npt/npt_md.h	Thu Apr 21 16:42:06 2011 -0700
@@ -47,7 +47,7 @@
         _handle =  NULL;                                                \
         *(pnpt) = NULL;                                                 \
         buf[0] = 0;                                                     \
-        jvm = LoadLibrary("jvm.dll");                                   \
+        jvm = GetModuleHandle("jvm.dll");                               \
         if ( jvm == NULL ) NPT_ERROR("Cannot find jvm.dll");            \
         GetModuleFileName(jvm, buf, FILENAME_MAX);                      \
         lastSlash = strrchr(buf, '\\');                                 \
--- a/jdk/test/ProblemList.txt	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/ProblemList.txt	Thu Apr 21 16:42:06 2011 -0700
@@ -288,12 +288,6 @@
 
 # jdk_math
 
-# Problems with rounding add failures on solaris-sparcv9 and -server
-java/math/BigDecimal/AddTests.java			 	solaris-sparcv9
-
-# Should be samevm? But seems problematic with samevm on windows
-java/math/BigInteger/ModPow65537.java			 	generic-all
-
 ############################################################################
 
 # jdk_misc
--- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh	Thu Apr 21 16:42:06 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# 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
@@ -40,7 +40,8 @@
 
 startApplication() 
 {
-  ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} &
+  # put all output from the app into ${OUTPUTFILE}
+  ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 &
   pid="$!"
 
   # MKS creates an intermediate shell to launch ${JAVA} so
--- a/jdk/test/com/sun/tools/attach/BasicTests.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -75,14 +75,23 @@
 
         // Test 3 - load an "bad" agent (agentmain throws an exception)
         System.out.println(" - Test: Load a bad agent");
+        System.out.println("INFO: This test will cause error messages "
+            + "to appear in the application log about SilverBullet.jar "
+            + "not being found and an agent failing to start.");
         try {
             vm.loadAgent(badagent);
+            throw new RuntimeException(
+                "AgentInitializationException not thrown as expected!");
         } catch (AgentInitializationException x) {
-            System.out.println(" - AgentInitializationException throws as expected!");
+            System.out.println(
+                " - AgentInitializationException thrown as expected!");
         }
 
         // Test 4 - detach from the VM and attempt a load (should throw IOE)
         System.out.println(" - Test: Detach from VM");
+        System.out.println("INFO: This test will cause error messages "
+            + "to appear in the application log about a BadAgent including "
+            + "a RuntimeException and an InvocationTargetException.");
         vm.detach();
         try {
             vm.loadAgent(agent);
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.sh	Thu Apr 21 16:42:06 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# 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
@@ -39,11 +39,9 @@
 
 # Windows 2000 is a problem here, so we skip it, see 6962615
 osrev=`uname -a`
-if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then
-  if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then
-     echo "Treating as a pass, not testing Windows 2000"
-     exit 0
-  fi
+if [ "`echo ${osrev} | grep 'CYGWIN[^ ]*-5\.0'`" != "" ] ; then
+  echo "Treating as a pass, not testing Windows 2000"
+  exit 0
 fi
 if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
   if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
@@ -58,7 +56,7 @@
 
 startApplication -Dattach.test=true
 # pid = process-id, port = shutdown port
-                                                                                                      
+
 failures=0
 
 echo "Running tests ..."
@@ -69,6 +67,18 @@
 
 stopApplication $port
 
+# Add these info messages to $OUTPUTFILE just in case someone
+# looks at it and wonders about the failures. We have to do
+# this after the application is stopped because it is writing
+# to $OUTPUTFILE.
+(
+echo ""
+echo "INFO: Test 2 will cause error messages about SilverBullet.jar" \
+    "and an agent failing to start."
+echo "INFO: Test 3 will cause error messages about BadAgent" \
+    "including a RuntimeException and an InvocationTargetException."
+) >> ${OUTPUTFILE}
+
 if [ $failures = 0 ]; 
   then echo "All tests passed.";
   else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/BufferedImage/TinyScale.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,68 @@
+/*
+ * @test %W% %E%
+ * @bug 7016495
+ * @summary Test tiny scales of BufferedImage
+ */
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+public class TinyScale {
+    static double tinyscales[] = {
+        1E-0,
+        1E-1,
+        1E-2,
+        1E-3,
+        1E-4,
+        1E-5,
+        1E-6,
+        1E-7,
+        1E-8,
+        1E-9,
+        1E-10,
+        1E-11,
+        1E-12,
+        1E-13,
+        1E-14,
+        1E-15,
+        1E-16,
+        1E-17,
+        1E-18,
+        1E-19,
+        1E-20,
+        1E-21,
+        1E-22,
+        1E-23,
+        1E-24,
+        1E-25,
+        1E-26,
+        1E-27,
+        1E-28,
+        1E-29,
+    };
+
+    static void test(BufferedImage rendImg, BufferedImage drawImg, double s) {
+        Graphics2D g = drawImg.createGraphics();
+        g.transform(new AffineTransform(s, 0.0, -1.0, 1.0, 0.0, 0.0));
+        g.drawImage(rendImg,
+                    -rendImg.getWidth() / 2,
+                    -rendImg.getHeight() / 2,
+                    null);
+        g.drawImage(rendImg, 0, 0, null);
+        g.dispose();
+    }
+
+    public static void main(String[] args) {
+        BufferedImage rendImg =
+            new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);
+        BufferedImage drawImg =
+            new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
+        for (double s: tinyscales) {
+            test(rendImg, drawImg, s);
+            for (int i = 0; args.length > 0 && i < 10; i++) {
+                test(rendImg, drawImg, Math.random()*s);
+            }
+        }
+    }
+}
--- a/jdk/test/java/lang/Character/CheckScript.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/lang/Character/CheckScript.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,34 +1,58 @@
+
+/*
+ * 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
+ * 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 6945564 6959267
+ * @bug 6945564 6959267 7033561
  * @summary  Check that the j.l.Character.UnicodeScript
  */
 
 import java.io.*;
-import java.lang.reflect.*;
 import java.util.*;
 import java.util.regex.*;
 import java.lang.Character.UnicodeScript;
 
 public class CheckScript {
 
-    static BufferedReader open(String[] args) throws FileNotFoundException {
+    public static void main(String[] args) throws Exception {
+        File fScripts;
+        File fAliases;
         if (args.length == 0) {
-            return new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Scripts.txt")));
-        } else if (args.length == 1) {
-            return new BufferedReader(new FileReader(args[0]));
+            fScripts = new File(System.getProperty("test.src", "."), "Scripts.txt");
+            fAliases = new File(System.getProperty("test.src", "."), "PropertyValueAliases.txt");
+        } else if (args.length == 2) {
+            fScripts = new File(args[0]);
+            fAliases = new File(args[1]);
         } else {
-            System.out.println("java CharacterScript Scripts.txt");
+            System.out.println("java CharacterScript Scripts.txt PropertyValueAliases.txt");
             throw new RuntimeException("Datafile name should be specified.");
         }
-    }
-
-    public static void main(String[] args) throws Exception {
 
         Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher("");
         String line = null;
         HashMap<String,ArrayList<Integer>> scripts = new HashMap<>();
-        try (BufferedReader sbfr = open(args)) {
+        try (BufferedReader sbfr = new BufferedReader(new FileReader(fScripts))) {
             while ((line = sbfr.readLine()) != null) {
                 if (line.length() <= 1 || line.charAt(0) == '#') {
                     continue;
@@ -107,5 +131,29 @@
                 }
             }
         }
+        // check all aliases
+        m = Pattern.compile("sc\\s*;\\s*(\\p{Alpha}{4})\\s*;\\s*([\\p{Alpha}|_]+)\\s*.*").matcher("");
+        line = null;
+        try (BufferedReader sbfr = new BufferedReader(new FileReader(fAliases))) {
+            while ((line = sbfr.readLine()) != null) {
+                if (line.length() <= 1 || line.charAt(0) == '#') {
+                    continue;
+                }
+                m.reset(line);
+                if (m.matches()) {
+                    String alias = m.group(1);
+                    String name = m.group(2);
+                    // HRKT -> Katakana_Or_Hiragana not supported
+                    if ("HRKT".equals(alias.toUpperCase(Locale.ENGLISH)))
+                        continue;
+                    if (Character.UnicodeScript.forName(alias) !=
+                        Character.UnicodeScript.forName(name)) {
+                        throw new RuntimeException(
+                            "UnicodeScript failed: alias<" + alias +
+                            "> does not map to <" + name + ">");
+                    }
+                }
+            }
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Character/PropertyValueAliases.txt	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,1178 @@
+# PropertyValueAliases-6.0.0.txt
+# Date: 2010-07-17, 22:44:06 GMT [MD]
+#
+# Unicode Character Database
+# Copyright (c) 1991-2010 Unicode, Inc.
+# For terms of use, see http://www.unicode.org/terms_of_use.html
+# For documentation, see http://www.unicode.org/reports/tr44/
+#
+# This file contains aliases for property values used in the UCD.
+# These names can be used for XML formats of UCD data, for regular-expression
+# property tests, and other programmatic textual descriptions of Unicode data.
+# For information on which properties are normative, see UCD.html.
+#
+# The names may be translated in appropriate environments, and additional
+# aliases may be useful.
+#
+# FORMAT
+#
+# Each line describes a property value name.
+# This consists of three or more fields, separated by semicolons.
+#
+# First Field: The first field describes the property for which that
+# property value name is used.
+#
+# Second Field: The second field is an abbreviated name.
+# If there is no abbreviated name available, the field is marked with "n/a".
+#
+# Third Field: The third field is a long name.
+#
+# In the case of ccc, there are 4 fields. The second field is numeric, third
+# is abbreviated, and fourth is long.
+#
+# The above are the preferred aliases. Other aliases may be listed in additional fields.
+#
+# Loose matching should be applied to all property names and property values, with
+# the exception of String Property values. With loose matching of property names and
+# values, the case distinctions, whitespace, and '_' are ignored. For Numeric Property
+# values, numeric equivalencies are applied: thus "01.00" is equivalent to "1".
+#
+# NOTE: Property value names are NOT unique across properties. For example:
+#
+#   AL means Arabic Letter for the Bidi_Class property, and
+#   AL means Above_Left for the Combining_Class property, and
+#   AL means Alphabetic for the Line_Break property.
+#
+# In addition, some property names may be the same as some property value names.
+# For example:
+#
+#   sc means the Script property, and
+#   Sc means the General_Category property value Currency_Symbol (Sc)
+#
+# The combination of property value and property name is, however, unique.
+#
+# For more information, see UTS #18: Unicode Regular Expressions
+# ================================================
+
+
+# ASCII_Hex_Digit (AHex)
+
+AHex; N        ; No                               ; F                                ; False
+AHex; Y        ; Yes                              ; T                                ; True
+
+# Age (age)
+
+age; n/a       ; 1.1
+age; n/a       ; 2.0
+age; n/a       ; 2.1
+age; n/a       ; 3.0
+age; n/a       ; 3.1
+age; n/a       ; 3.2
+age; n/a       ; 4.0
+age; n/a       ; 4.1
+age; n/a       ; 5.0
+age; n/a       ; 5.1
+age; n/a       ; 5.2
+age; n/a       ; 6.0
+age; n/a       ; unassigned
+
+# Alphabetic (Alpha)
+
+Alpha; N       ; No                               ; F                                ; False
+Alpha; Y       ; Yes                              ; T                                ; True
+
+# Bidi_Class (bc)
+
+bc ; AL        ; Arabic_Letter
+bc ; AN        ; Arabic_Number
+bc ; B         ; Paragraph_Separator
+bc ; BN        ; Boundary_Neutral
+bc ; CS        ; Common_Separator
+bc ; EN        ; European_Number
+bc ; ES        ; European_Separator
+bc ; ET        ; European_Terminator
+bc ; L         ; Left_To_Right
+bc ; LRE       ; Left_To_Right_Embedding
+bc ; LRO       ; Left_To_Right_Override
+bc ; NSM       ; Nonspacing_Mark
+bc ; ON        ; Other_Neutral
+bc ; PDF       ; Pop_Directional_Format
+bc ; R         ; Right_To_Left
+bc ; RLE       ; Right_To_Left_Embedding
+bc ; RLO       ; Right_To_Left_Override
+bc ; S         ; Segment_Separator
+bc ; WS        ; White_Space
+
+# Bidi_Control (Bidi_C)
+
+Bidi_C; N      ; No                               ; F                                ; False
+Bidi_C; Y      ; Yes                              ; T                                ; True
+
+# Bidi_Mirrored (Bidi_M)
+
+Bidi_M; N      ; No                               ; F                                ; False
+Bidi_M; Y      ; Yes                              ; T                                ; True
+
+# Bidi_Mirroring_Glyph (bmg)
+
+# @missing: 0000..10FFFF; Bidi_Mirroring_Glyph; <none>
+
+# Block (blk)
+
+blk; n/a       ; Aegean_Numbers
+blk; n/a       ; Alchemical_Symbols
+blk; n/a       ; Alphabetic_Presentation_Forms
+blk; n/a       ; Ancient_Greek_Musical_Notation
+blk; n/a       ; Ancient_Greek_Numbers
+blk; n/a       ; Ancient_Symbols
+blk; n/a       ; Arabic
+blk; n/a       ; Arabic_Presentation_Forms_A      ; Arabic_Presentation_Forms-A
+blk; n/a       ; Arabic_Presentation_Forms_B
+blk; n/a       ; Arabic_Supplement
+blk; n/a       ; Armenian
+blk; n/a       ; Arrows
+blk; n/a       ; Avestan
+blk; n/a       ; Balinese
+blk; n/a       ; Bamum
+blk; n/a       ; Bamum_Supplement
+blk; n/a       ; Basic_Latin                      ; ASCII
+blk; n/a       ; Batak
+blk; n/a       ; Bengali
+blk; n/a       ; Block_Elements
+blk; n/a       ; Bopomofo
+blk; n/a       ; Bopomofo_Extended
+blk; n/a       ; Box_Drawing
+blk; n/a       ; Brahmi
+blk; n/a       ; Braille_Patterns
+blk; n/a       ; Buginese
+blk; n/a       ; Buhid
+blk; n/a       ; Byzantine_Musical_Symbols
+blk; n/a       ; Carian
+blk; n/a       ; Cham
+blk; n/a       ; Cherokee
+blk; n/a       ; CJK_Compatibility
+blk; n/a       ; CJK_Compatibility_Forms
+blk; n/a       ; CJK_Compatibility_Ideographs
+blk; n/a       ; CJK_Compatibility_Ideographs_Supplement
+blk; n/a       ; CJK_Radicals_Supplement
+blk; n/a       ; CJK_Strokes
+blk; n/a       ; CJK_Symbols_And_Punctuation
+blk; n/a       ; CJK_Unified_Ideographs
+blk; n/a       ; CJK_Unified_Ideographs_Extension_A
+blk; n/a       ; CJK_Unified_Ideographs_Extension_B
+blk; n/a       ; CJK_Unified_Ideographs_Extension_C
+blk; n/a       ; CJK_Unified_Ideographs_Extension_D
+blk; n/a       ; Combining_Diacritical_Marks
+blk; n/a       ; Combining_Diacritical_Marks_For_Symbols; Combining_Marks_For_Symbols
+blk; n/a       ; Combining_Diacritical_Marks_Supplement
+blk; n/a       ; Combining_Half_Marks
+blk; n/a       ; Common_Indic_Number_Forms
+blk; n/a       ; Control_Pictures
+blk; n/a       ; Coptic
+blk; n/a       ; Counting_Rod_Numerals
+blk; n/a       ; Cuneiform
+blk; n/a       ; Cuneiform_Numbers_And_Punctuation
+blk; n/a       ; Currency_Symbols
+blk; n/a       ; Cypriot_Syllabary
+blk; n/a       ; Cyrillic
+blk; n/a       ; Cyrillic_Extended_A
+blk; n/a       ; Cyrillic_Extended_B
+blk; n/a       ; Cyrillic_Supplement              ; Cyrillic_Supplementary
+blk; n/a       ; Deseret
+blk; n/a       ; Devanagari
+blk; n/a       ; Devanagari_Extended
+blk; n/a       ; Dingbats
+blk; n/a       ; Domino_Tiles
+blk; n/a       ; Egyptian_Hieroglyphs
+blk; n/a       ; Emoticons
+blk; n/a       ; Enclosed_Alphanumeric_Supplement
+blk; n/a       ; Enclosed_Alphanumerics
+blk; n/a       ; Enclosed_CJK_Letters_And_Months
+blk; n/a       ; Enclosed_Ideographic_Supplement
+blk; n/a       ; Ethiopic
+blk; n/a       ; Ethiopic_Extended
+blk; n/a       ; Ethiopic_Extended_A
+blk; n/a       ; Ethiopic_Supplement
+blk; n/a       ; General_Punctuation
+blk; n/a       ; Geometric_Shapes
+blk; n/a       ; Georgian
+blk; n/a       ; Georgian_Supplement
+blk; n/a       ; Glagolitic
+blk; n/a       ; Gothic
+blk; n/a       ; Greek_And_Coptic                 ; Greek
+blk; n/a       ; Greek_Extended
+blk; n/a       ; Gujarati
+blk; n/a       ; Gurmukhi
+blk; n/a       ; Halfwidth_And_Fullwidth_Forms
+blk; n/a       ; Hangul_Compatibility_Jamo
+blk; n/a       ; Hangul_Jamo
+blk; n/a       ; Hangul_Jamo_Extended_A
+blk; n/a       ; Hangul_Jamo_Extended_B
+blk; n/a       ; Hangul_Syllables
+blk; n/a       ; Hanunoo
+blk; n/a       ; Hebrew
+blk; n/a       ; High_Private_Use_Surrogates
+blk; n/a       ; High_Surrogates
+blk; n/a       ; Hiragana
+blk; n/a       ; Ideographic_Description_Characters
+blk; n/a       ; Imperial_Aramaic
+blk; n/a       ; Inscriptional_Pahlavi
+blk; n/a       ; Inscriptional_Parthian
+blk; n/a       ; IPA_Extensions
+blk; n/a       ; Javanese
+blk; n/a       ; Kaithi
+blk; n/a       ; Kana_Supplement
+blk; n/a       ; Kanbun
+blk; n/a       ; Kangxi_Radicals
+blk; n/a       ; Kannada
+blk; n/a       ; Katakana
+blk; n/a       ; Katakana_Phonetic_Extensions
+blk; n/a       ; Kayah_Li
+blk; n/a       ; Kharoshthi
+blk; n/a       ; Khmer
+blk; n/a       ; Khmer_Symbols
+blk; n/a       ; Lao
+blk; n/a       ; Latin_1_Supplement               ; Latin_1
+blk; n/a       ; Latin_Extended_A
+blk; n/a       ; Latin_Extended_Additional
+blk; n/a       ; Latin_Extended_B
+blk; n/a       ; Latin_Extended_C
+blk; n/a       ; Latin_Extended_D
+blk; n/a       ; Lepcha
+blk; n/a       ; Letterlike_Symbols
+blk; n/a       ; Limbu
+blk; n/a       ; Linear_B_Ideograms
+blk; n/a       ; Linear_B_Syllabary
+blk; n/a       ; Lisu
+blk; n/a       ; Low_Surrogates
+blk; n/a       ; Lycian
+blk; n/a       ; Lydian
+blk; n/a       ; Mahjong_Tiles
+blk; n/a       ; Malayalam
+blk; n/a       ; Mandaic
+blk; n/a       ; Mathematical_Alphanumeric_Symbols
+blk; n/a       ; Mathematical_Operators
+blk; n/a       ; Meetei_Mayek
+blk; n/a       ; Miscellaneous_Mathematical_Symbols_A
+blk; n/a       ; Miscellaneous_Mathematical_Symbols_B
+blk; n/a       ; Miscellaneous_Symbols
+blk; n/a       ; Miscellaneous_Symbols_And_Arrows
+blk; n/a       ; Miscellaneous_Symbols_And_Pictographs
+blk; n/a       ; Miscellaneous_Technical
+blk; n/a       ; Modifier_Tone_Letters
+blk; n/a       ; Mongolian
+blk; n/a       ; Musical_Symbols
+blk; n/a       ; Myanmar
+blk; n/a       ; Myanmar_Extended_A
+blk; n/a       ; New_Tai_Lue
+blk; n/a       ; NKo
+blk; n/a       ; No_Block
+blk; n/a       ; Number_Forms
+blk; n/a       ; Ogham
+blk; n/a       ; Ol_Chiki
+blk; n/a       ; Old_Italic
+blk; n/a       ; Old_Persian
+blk; n/a       ; Old_South_Arabian
+blk; n/a       ; Old_Turkic
+blk; n/a       ; Optical_Character_Recognition
+blk; n/a       ; Oriya
+blk; n/a       ; Osmanya
+blk; n/a       ; Phags_Pa
+blk; n/a       ; Phaistos_Disc
+blk; n/a       ; Phoenician
+blk; n/a       ; Phonetic_Extensions
+blk; n/a       ; Phonetic_Extensions_Supplement
+blk; n/a       ; Playing_Cards
+blk; n/a       ; Private_Use_Area                 ; Private_Use
+blk; n/a       ; Rejang
+blk; n/a       ; Rumi_Numeral_Symbols
+blk; n/a       ; Runic
+blk; n/a       ; Samaritan
+blk; n/a       ; Saurashtra
+blk; n/a       ; Shavian
+blk; n/a       ; Sinhala
+blk; n/a       ; Small_Form_Variants
+blk; n/a       ; Spacing_Modifier_Letters
+blk; n/a       ; Specials
+blk; n/a       ; Sundanese
+blk; n/a       ; Superscripts_And_Subscripts
+blk; n/a       ; Supplemental_Arrows_A
+blk; n/a       ; Supplemental_Arrows_B
+blk; n/a       ; Supplemental_Mathematical_Operators
+blk; n/a       ; Supplemental_Punctuation
+blk; n/a       ; Supplementary_Private_Use_Area_A
+blk; n/a       ; Supplementary_Private_Use_Area_B
+blk; n/a       ; Syloti_Nagri
+blk; n/a       ; Syriac
+blk; n/a       ; Tagalog
+blk; n/a       ; Tagbanwa
+blk; n/a       ; Tags
+blk; n/a       ; Tai_Le
+blk; n/a       ; Tai_Tham
+blk; n/a       ; Tai_Viet
+blk; n/a       ; Tai_Xuan_Jing_Symbols
+blk; n/a       ; Tamil
+blk; n/a       ; Telugu
+blk; n/a       ; Thaana
+blk; n/a       ; Thai
+blk; n/a       ; Tibetan
+blk; n/a       ; Tifinagh
+blk; n/a       ; Transport_And_Map_Symbols
+blk; n/a       ; Ugaritic
+blk; n/a       ; Unified_Canadian_Aboriginal_Syllabics; Canadian_Syllabics
+blk; n/a       ; Unified_Canadian_Aboriginal_Syllabics_Extended
+blk; n/a       ; Vai
+blk; n/a       ; Variation_Selectors
+blk; n/a       ; Variation_Selectors_Supplement
+blk; n/a       ; Vedic_Extensions
+blk; n/a       ; Vertical_Forms
+blk; n/a       ; Yi_Radicals
+blk; n/a       ; Yi_Syllables
+blk; n/a       ; Yijing_Hexagram_Symbols
+
+# Canonical_Combining_Class (ccc)
+
+ccc;   0; NR   ; Not_Reordered
+ccc;   1; OV   ; Overlay
+ccc;   7; NK   ; Nukta
+ccc;   8; KV   ; Kana_Voicing
+ccc;   9; VR   ; Virama
+ccc; 200; ATBL ; Attached_Below_Left
+ccc; 202; ATB  ; Attached_Below
+ccc; 214; ATA  ; Attached_Above
+ccc; 216; ATAR ; Attached_Above_Right
+ccc; 218; BL   ; Below_Left
+ccc; 220; B    ; Below
+ccc; 222; BR   ; Below_Right
+ccc; 224; L    ; Left
+ccc; 226; R    ; Right
+ccc; 228; AL   ; Above_Left
+ccc; 230; A    ; Above
+ccc; 232; AR   ; Above_Right
+ccc; 233; DB   ; Double_Below
+ccc; 234; DA   ; Double_Above
+ccc; 240; IS   ; Iota_Subscript
+
+# Case_Folding (cf)
+
+# @missing: 0000..10FFFF; Case_Folding; <code point>
+
+# Case_Ignorable (CI)
+
+CI ; N         ; No                               ; F                                ; False
+CI ; Y         ; Yes                              ; T                                ; True
+
+# Cased (Cased)
+
+Cased; N       ; No                               ; F                                ; False
+Cased; Y       ; Yes                              ; T                                ; True
+
+# Changes_When_Casefolded (CWCF)
+
+CWCF; N        ; No                               ; F                                ; False
+CWCF; Y        ; Yes                              ; T                                ; True
+
+# Changes_When_Casemapped (CWCM)
+
+CWCM; N        ; No                               ; F                                ; False
+CWCM; Y        ; Yes                              ; T                                ; True
+
+# Changes_When_Lowercased (CWL)
+
+CWL; N         ; No                               ; F                                ; False
+CWL; Y         ; Yes                              ; T                                ; True
+
+# Changes_When_NFKC_Casefolded (CWKCF)
+
+CWKCF; N       ; No                               ; F                                ; False
+CWKCF; Y       ; Yes                              ; T                                ; True
+
+# Changes_When_Titlecased (CWT)
+
+CWT; N         ; No                               ; F                                ; False
+CWT; Y         ; Yes                              ; T                                ; True
+
+# Changes_When_Uppercased (CWU)
+
+CWU; N         ; No                               ; F                                ; False
+CWU; Y         ; Yes                              ; T                                ; True
+
+# Composition_Exclusion (CE)
+
+CE ; N         ; No                               ; F                                ; False
+CE ; Y         ; Yes                              ; T                                ; True
+
+# Dash (Dash)
+
+Dash; N        ; No                               ; F                                ; False
+Dash; Y        ; Yes                              ; T                                ; True
+
+# Decomposition_Mapping (dm)
+
+# @missing: 0000..10FFFF; Decomposition_Mapping; <code point>
+
+# Decomposition_Type (dt)
+
+dt ; Can       ; Canonical                        ; can
+dt ; Com       ; Compat                           ; com
+dt ; Enc       ; Circle                           ; enc
+dt ; Fin       ; Final                            ; fin
+dt ; Font      ; font
+dt ; Fra       ; Fraction                         ; fra
+dt ; Init      ; Initial                          ; init
+dt ; Iso       ; Isolated                         ; iso
+dt ; Med       ; Medial                           ; med
+dt ; Nar       ; Narrow                           ; nar
+dt ; Nb        ; Nobreak                          ; nb
+dt ; None      ; none
+dt ; Sml       ; Small                            ; sml
+dt ; Sqr       ; Square                           ; sqr
+dt ; Sub       ; sub
+dt ; Sup       ; Super                            ; sup
+dt ; Vert      ; Vertical                         ; vert
+dt ; Wide      ; wide
+
+# Default_Ignorable_Code_Point (DI)
+
+DI ; N         ; No                               ; F                                ; False
+DI ; Y         ; Yes                              ; T                                ; True
+
+# Deprecated (Dep)
+
+Dep; N         ; No                               ; F                                ; False
+Dep; Y         ; Yes                              ; T                                ; True
+
+# Diacritic (Dia)
+
+Dia; N         ; No                               ; F                                ; False
+Dia; Y         ; Yes                              ; T                                ; True
+
+# East_Asian_Width (ea)
+
+ea ; A         ; Ambiguous
+ea ; F         ; Fullwidth
+ea ; H         ; Halfwidth
+ea ; N         ; Neutral
+ea ; Na        ; Narrow
+ea ; W         ; Wide
+
+# Expands_On_NFC (XO_NFC)
+
+XO_NFC; N      ; No                               ; F                                ; False
+XO_NFC; Y      ; Yes                              ; T                                ; True
+
+# Expands_On_NFD (XO_NFD)
+
+XO_NFD; N      ; No                               ; F                                ; False
+XO_NFD; Y      ; Yes                              ; T                                ; True
+
+# Expands_On_NFKC (XO_NFKC)
+
+XO_NFKC; N     ; No                               ; F                                ; False
+XO_NFKC; Y     ; Yes                              ; T                                ; True
+
+# Expands_On_NFKD (XO_NFKD)
+
+XO_NFKD; N     ; No                               ; F                                ; False
+XO_NFKD; Y     ; Yes                              ; T                                ; True
+
+# Extender (Ext)
+
+Ext; N         ; No                               ; F                                ; False
+Ext; Y         ; Yes                              ; T                                ; True
+
+# FC_NFKC_Closure (FC_NFKC)
+
+# @missing: 0000..10FFFF; FC_NFKC_Closure; <code point>
+
+# Full_Composition_Exclusion (Comp_Ex)
+
+Comp_Ex; N     ; No                               ; F                                ; False
+Comp_Ex; Y     ; Yes                              ; T                                ; True
+
+# General_Category (gc)
+
+gc ; C         ; Other                            # Cc | Cf | Cn | Co | Cs
+gc ; Cc        ; Control                          ; cntrl
+gc ; Cf        ; Format
+gc ; Cn        ; Unassigned
+gc ; Co        ; Private_Use
+gc ; Cs        ; Surrogate
+gc ; L         ; Letter                           # Ll | Lm | Lo | Lt | Lu
+gc ; LC        ; Cased_Letter                     # Ll | Lt | Lu
+gc ; Ll        ; Lowercase_Letter
+gc ; Lm        ; Modifier_Letter
+gc ; Lo        ; Other_Letter
+gc ; Lt        ; Titlecase_Letter
+gc ; Lu        ; Uppercase_Letter
+gc ; M         ; Mark                             # Mc | Me | Mn
+gc ; Mc        ; Spacing_Mark
+gc ; Me        ; Enclosing_Mark
+gc ; Mn        ; Nonspacing_Mark
+gc ; N         ; Number                           # Nd | Nl | No
+gc ; Nd        ; Decimal_Number                   ; digit
+gc ; Nl        ; Letter_Number
+gc ; No        ; Other_Number
+gc ; P         ; Punctuation                      ; punct                            # Pc | Pd | Pe | Pf | Pi | Po | Ps
+gc ; Pc        ; Connector_Punctuation
+gc ; Pd        ; Dash_Punctuation
+gc ; Pe        ; Close_Punctuation
+gc ; Pf        ; Final_Punctuation
+gc ; Pi        ; Initial_Punctuation
+gc ; Po        ; Other_Punctuation
+gc ; Ps        ; Open_Punctuation
+gc ; S         ; Symbol                           # Sc | Sk | Sm | So
+gc ; Sc        ; Currency_Symbol
+gc ; Sk        ; Modifier_Symbol
+gc ; Sm        ; Math_Symbol
+gc ; So        ; Other_Symbol
+gc ; Z         ; Separator                        # Zl | Zp | Zs
+gc ; Zl        ; Line_Separator
+gc ; Zp        ; Paragraph_Separator
+gc ; Zs        ; Space_Separator
+
+# Grapheme_Base (Gr_Base)
+
+Gr_Base; N     ; No                               ; F                                ; False
+Gr_Base; Y     ; Yes                              ; T                                ; True
+
+# Grapheme_Cluster_Break (GCB)
+
+GCB; CN        ; Control
+GCB; CR        ; CR
+GCB; EX        ; Extend
+GCB; L         ; L
+GCB; LF        ; LF
+GCB; LV        ; LV
+GCB; LVT       ; LVT
+GCB; PP        ; Prepend
+GCB; SM        ; SpacingMark
+GCB; T         ; T
+GCB; V         ; V
+GCB; XX        ; Other
+
+# Grapheme_Extend (Gr_Ext)
+
+Gr_Ext; N      ; No                               ; F                                ; False
+Gr_Ext; Y      ; Yes                              ; T                                ; True
+
+# Grapheme_Link (Gr_Link)
+
+Gr_Link; N     ; No                               ; F                                ; False
+Gr_Link; Y     ; Yes                              ; T                                ; True
+
+# Hangul_Syllable_Type (hst)
+
+hst; L         ; Leading_Jamo
+hst; LV        ; LV_Syllable
+hst; LVT       ; LVT_Syllable
+hst; NA        ; Not_Applicable
+hst; T         ; Trailing_Jamo
+hst; V         ; Vowel_Jamo
+
+# Hex_Digit (Hex)
+
+Hex; N         ; No                               ; F                                ; False
+Hex; Y         ; Yes                              ; T                                ; True
+
+# Hyphen (Hyphen)
+
+Hyphen; N      ; No                               ; F                                ; False
+Hyphen; Y      ; Yes                              ; T                                ; True
+
+# IDS_Binary_Operator (IDSB)
+
+IDSB; N        ; No                               ; F                                ; False
+IDSB; Y        ; Yes                              ; T                                ; True
+
+# IDS_Trinary_Operator (IDST)
+
+IDST; N        ; No                               ; F                                ; False
+IDST; Y        ; Yes                              ; T                                ; True
+
+# ID_Continue (IDC)
+
+IDC; N         ; No                               ; F                                ; False
+IDC; Y         ; Yes                              ; T                                ; True
+
+# ID_Start (IDS)
+
+IDS; N         ; No                               ; F                                ; False
+IDS; Y         ; Yes                              ; T                                ; True
+
+# ISO_Comment (isc)
+
+# @missing: 0000..10FFFF; ISO_Comment; <none>
+
+# Ideographic (Ideo)
+
+Ideo; N        ; No                               ; F                                ; False
+Ideo; Y        ; Yes                              ; T                                ; True
+
+# Jamo_Short_Name (JSN)
+
+# @missing: 0000..10FFFF; Jamo_Short_Name; <none>
+JSN; A         ; A
+JSN; AE        ; AE
+JSN; B         ; B
+JSN; BB        ; BB
+JSN; BS        ; BS
+JSN; C         ; C
+JSN; D         ; D
+JSN; DD        ; DD
+JSN; E         ; E
+JSN; EO        ; EO
+JSN; EU        ; EU
+JSN; G         ; G
+JSN; GG        ; GG
+JSN; GS        ; GS
+JSN; H         ; H
+JSN; I         ; I
+JSN; J         ; J
+JSN; JJ        ; JJ
+JSN; K         ; K
+JSN; L         ; L
+JSN; LB        ; LB
+JSN; LG        ; LG
+JSN; LH        ; LH
+JSN; LM        ; LM
+JSN; LP        ; LP
+JSN; LS        ; LS
+JSN; LT        ; LT
+JSN; M         ; M
+JSN; N         ; N
+JSN; NG        ; NG
+JSN; NH        ; NH
+JSN; NJ        ; NJ
+JSN; O         ; O
+JSN; OE        ; OE
+JSN; P         ; P
+JSN; R         ; R
+JSN; S         ; S
+JSN; SS        ; SS
+JSN; T         ; T
+JSN; U         ; U
+JSN; WA        ; WA
+JSN; WAE       ; WAE
+JSN; WE        ; WE
+JSN; WEO       ; WEO
+JSN; WI        ; WI
+JSN; YA        ; YA
+JSN; YAE       ; YAE
+JSN; YE        ; YE
+JSN; YEO       ; YEO
+JSN; YI        ; YI
+JSN; YO        ; YO
+JSN; YU        ; YU
+
+# Join_Control (Join_C)
+
+Join_C; N      ; No                               ; F                                ; False
+Join_C; Y      ; Yes                              ; T                                ; True
+
+# Joining_Group (jg)
+
+jg ; n/a       ; Ain
+jg ; n/a       ; Alaph
+jg ; n/a       ; Alef
+jg ; n/a       ; Beh
+jg ; n/a       ; Beth
+jg ; n/a       ; Burushaski_Yeh_Barree
+jg ; n/a       ; Dal
+jg ; n/a       ; Dalath_Rish
+jg ; n/a       ; E
+jg ; n/a       ; Farsi_Yeh
+jg ; n/a       ; Fe
+jg ; n/a       ; Feh
+jg ; n/a       ; Final_Semkath
+jg ; n/a       ; Gaf
+jg ; n/a       ; Gamal
+jg ; n/a       ; Hah
+jg ; n/a       ; He
+jg ; n/a       ; Heh
+jg ; n/a       ; Heh_Goal
+jg ; n/a       ; Heth
+jg ; n/a       ; Kaf
+jg ; n/a       ; Kaph
+jg ; n/a       ; Khaph
+jg ; n/a       ; Knotted_Heh
+jg ; n/a       ; Lam
+jg ; n/a       ; Lamadh
+jg ; n/a       ; Meem
+jg ; n/a       ; Mim
+jg ; n/a       ; No_Joining_Group
+jg ; n/a       ; Noon
+jg ; n/a       ; Nun
+jg ; n/a       ; Nya
+jg ; n/a       ; Pe
+jg ; n/a       ; Qaf
+jg ; n/a       ; Qaph
+jg ; n/a       ; Reh
+jg ; n/a       ; Reversed_Pe
+jg ; n/a       ; Sad
+jg ; n/a       ; Sadhe
+jg ; n/a       ; Seen
+jg ; n/a       ; Semkath
+jg ; n/a       ; Shin
+jg ; n/a       ; Swash_Kaf
+jg ; n/a       ; Syriac_Waw
+jg ; n/a       ; Tah
+jg ; n/a       ; Taw
+jg ; n/a       ; Teh_Marbuta
+jg ; n/a       ; Teh_Marbuta_Goal                 ; Hamza_On_Heh_Goal
+jg ; n/a       ; Teth
+jg ; n/a       ; Waw
+jg ; n/a       ; Yeh
+jg ; n/a       ; Yeh_Barree
+jg ; n/a       ; Yeh_With_Tail
+jg ; n/a       ; Yudh
+jg ; n/a       ; Yudh_He
+jg ; n/a       ; Zain
+jg ; n/a       ; Zhain
+
+# Joining_Type (jt)
+
+jt ; C         ; Join_Causing
+jt ; D         ; Dual_Joining
+jt ; L         ; Left_Joining
+jt ; R         ; Right_Joining
+jt ; T         ; Transparent
+jt ; U         ; Non_Joining
+
+# Line_Break (lb)
+
+lb ; AI        ; Ambiguous
+lb ; AL        ; Alphabetic
+lb ; B2        ; Break_Both
+lb ; BA        ; Break_After
+lb ; BB        ; Break_Before
+lb ; BK        ; Mandatory_Break
+lb ; CB        ; Contingent_Break
+lb ; CL        ; Close_Punctuation
+lb ; CM        ; Combining_Mark
+lb ; CP        ; Close_Parenthesis
+lb ; CR        ; Carriage_Return
+lb ; EX        ; Exclamation
+lb ; GL        ; Glue
+lb ; H2        ; H2
+lb ; H3        ; H3
+lb ; HY        ; Hyphen
+lb ; ID        ; Ideographic
+lb ; IN        ; Inseparable                      ; Inseperable
+lb ; IS        ; Infix_Numeric
+lb ; JL        ; JL
+lb ; JT        ; JT
+lb ; JV        ; JV
+lb ; LF        ; Line_Feed
+lb ; NL        ; Next_Line
+lb ; NS        ; Nonstarter
+lb ; NU        ; Numeric
+lb ; OP        ; Open_Punctuation
+lb ; PO        ; Postfix_Numeric
+lb ; PR        ; Prefix_Numeric
+lb ; QU        ; Quotation
+lb ; SA        ; Complex_Context
+lb ; SG        ; Surrogate
+lb ; SP        ; Space
+lb ; SY        ; Break_Symbols
+lb ; WJ        ; Word_Joiner
+lb ; XX        ; Unknown
+lb ; ZW        ; ZWSpace
+
+# Logical_Order_Exception (LOE)
+
+LOE; N         ; No                               ; F                                ; False
+LOE; Y         ; Yes                              ; T                                ; True
+
+# Lowercase (Lower)
+
+Lower; N       ; No                               ; F                                ; False
+Lower; Y       ; Yes                              ; T                                ; True
+
+# Lowercase_Mapping (lc)
+
+# @missing: 0000..10FFFF; Lowercase_Mapping; <code point>
+
+# Math (Math)
+
+Math; N        ; No                               ; F                                ; False
+Math; Y        ; Yes                              ; T                                ; True
+
+# NFC_Quick_Check (NFC_QC)
+
+NFC_QC; M      ; Maybe
+NFC_QC; N      ; No
+NFC_QC; Y      ; Yes
+
+# NFD_Quick_Check (NFD_QC)
+
+NFD_QC; N      ; No
+NFD_QC; Y      ; Yes
+
+# NFKC_Casefold (NFKC_CF)
+
+# @missing: 0000..10FFFF; NFKC_Casefold; <code point>
+
+# NFKC_Quick_Check (NFKC_QC)
+
+NFKC_QC; M     ; Maybe
+NFKC_QC; N     ; No
+NFKC_QC; Y     ; Yes
+
+# NFKD_Quick_Check (NFKD_QC)
+
+NFKD_QC; N     ; No
+NFKD_QC; Y     ; Yes
+
+# Name (na)
+
+# @missing: 0000..10FFFF; Name; <none>
+
+# Name_Alias (Name_Alias)
+
+# @missing: 0000..10FFFF; Name_Alias; <none>
+
+# Noncharacter_Code_Point (NChar)
+
+NChar; N       ; No                               ; F                                ; False
+NChar; Y       ; Yes                              ; T                                ; True
+
+# Numeric_Type (nt)
+
+nt ; De        ; Decimal
+nt ; Di        ; Digit
+nt ; None      ; None
+nt ; Nu        ; Numeric
+
+# Numeric_Value (nv)
+
+# @missing: 0000..10FFFF; Numeric_Value; NaN
+
+# Other_Alphabetic (OAlpha)
+
+OAlpha; N      ; No                               ; F                                ; False
+OAlpha; Y      ; Yes                              ; T                                ; True
+
+# Other_Default_Ignorable_Code_Point (ODI)
+
+ODI; N         ; No                               ; F                                ; False
+ODI; Y         ; Yes                              ; T                                ; True
+
+# Other_Grapheme_Extend (OGr_Ext)
+
+OGr_Ext; N     ; No                               ; F                                ; False
+OGr_Ext; Y     ; Yes                              ; T                                ; True
+
+# Other_ID_Continue (OIDC)
+
+OIDC; N        ; No                               ; F                                ; False
+OIDC; Y        ; Yes                              ; T                                ; True
+
+# Other_ID_Start (OIDS)
+
+OIDS; N        ; No                               ; F                                ; False
+OIDS; Y        ; Yes                              ; T                                ; True
+
+# Other_Lowercase (OLower)
+
+OLower; N      ; No                               ; F                                ; False
+OLower; Y      ; Yes                              ; T                                ; True
+
+# Other_Math (OMath)
+
+OMath; N       ; No                               ; F                                ; False
+OMath; Y       ; Yes                              ; T                                ; True
+
+# Other_Uppercase (OUpper)
+
+OUpper; N      ; No                               ; F                                ; False
+OUpper; Y      ; Yes                              ; T                                ; True
+
+# Pattern_Syntax (Pat_Syn)
+
+Pat_Syn; N     ; No                               ; F                                ; False
+Pat_Syn; Y     ; Yes                              ; T                                ; True
+
+# Pattern_White_Space (Pat_WS)
+
+Pat_WS; N      ; No                               ; F                                ; False
+Pat_WS; Y      ; Yes                              ; T                                ; True
+
+# Quotation_Mark (QMark)
+
+QMark; N       ; No                               ; F                                ; False
+QMark; Y       ; Yes                              ; T                                ; True
+
+# Radical (Radical)
+
+Radical; N     ; No                               ; F                                ; False
+Radical; Y     ; Yes                              ; T                                ; True
+
+# STerm (STerm)
+
+STerm; N       ; No                               ; F                                ; False
+STerm; Y       ; Yes                              ; T                                ; True
+
+# Script (sc)
+
+sc ; Arab      ; Arabic
+sc ; Armi      ; Imperial_Aramaic
+sc ; Armn      ; Armenian
+sc ; Avst      ; Avestan
+sc ; Bali      ; Balinese
+sc ; Bamu      ; Bamum
+sc ; Batk      ; Batak
+sc ; Beng      ; Bengali
+sc ; Bopo      ; Bopomofo
+sc ; Brah      ; Brahmi
+sc ; Brai      ; Braille
+sc ; Bugi      ; Buginese
+sc ; Buhd      ; Buhid
+sc ; Cans      ; Canadian_Aboriginal
+sc ; Cari      ; Carian
+sc ; Cham      ; Cham
+sc ; Cher      ; Cherokee
+sc ; Copt      ; Coptic                           ; Qaac
+sc ; Cprt      ; Cypriot
+sc ; Cyrl      ; Cyrillic
+sc ; Deva      ; Devanagari
+sc ; Dsrt      ; Deseret
+sc ; Egyp      ; Egyptian_Hieroglyphs
+sc ; Ethi      ; Ethiopic
+sc ; Geor      ; Georgian
+sc ; Glag      ; Glagolitic
+sc ; Goth      ; Gothic
+sc ; Grek      ; Greek
+sc ; Gujr      ; Gujarati
+sc ; Guru      ; Gurmukhi
+sc ; Hang      ; Hangul
+sc ; Hani      ; Han
+sc ; Hano      ; Hanunoo
+sc ; Hebr      ; Hebrew
+sc ; Hira      ; Hiragana
+sc ; Hrkt      ; Katakana_Or_Hiragana
+sc ; Ital      ; Old_Italic
+sc ; Java      ; Javanese
+sc ; Kali      ; Kayah_Li
+sc ; Kana      ; Katakana
+sc ; Khar      ; Kharoshthi
+sc ; Khmr      ; Khmer
+sc ; Knda      ; Kannada
+sc ; Kthi      ; Kaithi
+sc ; Lana      ; Tai_Tham
+sc ; Laoo      ; Lao
+sc ; Latn      ; Latin
+sc ; Lepc      ; Lepcha
+sc ; Limb      ; Limbu
+sc ; Linb      ; Linear_B
+sc ; Lisu      ; Lisu
+sc ; Lyci      ; Lycian
+sc ; Lydi      ; Lydian
+sc ; Mand      ; Mandaic
+sc ; Mlym      ; Malayalam
+sc ; Mong      ; Mongolian
+sc ; Mtei      ; Meetei_Mayek
+sc ; Mymr      ; Myanmar
+sc ; Nkoo      ; Nko
+sc ; Ogam      ; Ogham
+sc ; Olck      ; Ol_Chiki
+sc ; Orkh      ; Old_Turkic
+sc ; Orya      ; Oriya
+sc ; Osma      ; Osmanya
+sc ; Phag      ; Phags_Pa
+sc ; Phli      ; Inscriptional_Pahlavi
+sc ; Phnx      ; Phoenician
+sc ; Prti      ; Inscriptional_Parthian
+sc ; Rjng      ; Rejang
+sc ; Runr      ; Runic
+sc ; Samr      ; Samaritan
+sc ; Sarb      ; Old_South_Arabian
+sc ; Saur      ; Saurashtra
+sc ; Shaw      ; Shavian
+sc ; Sinh      ; Sinhala
+sc ; Sund      ; Sundanese
+sc ; Sylo      ; Syloti_Nagri
+sc ; Syrc      ; Syriac
+sc ; Tagb      ; Tagbanwa
+sc ; Tale      ; Tai_Le
+sc ; Talu      ; New_Tai_Lue
+sc ; Taml      ; Tamil
+sc ; Tavt      ; Tai_Viet
+sc ; Telu      ; Telugu
+sc ; Tfng      ; Tifinagh
+sc ; Tglg      ; Tagalog
+sc ; Thaa      ; Thaana
+sc ; Thai      ; Thai
+sc ; Tibt      ; Tibetan
+sc ; Ugar      ; Ugaritic
+sc ; Vaii      ; Vai
+sc ; Xpeo      ; Old_Persian
+sc ; Xsux      ; Cuneiform
+sc ; Yiii      ; Yi
+sc ; Zinh      ; Inherited                        ; Qaai
+sc ; Zyyy      ; Common
+sc ; Zzzz      ; Unknown
+
+# Sentence_Break (SB)
+
+SB ; AT        ; ATerm
+SB ; CL        ; Close
+SB ; CR        ; CR
+SB ; EX        ; Extend
+SB ; FO        ; Format
+SB ; LE        ; OLetter
+SB ; LF        ; LF
+SB ; LO        ; Lower
+SB ; NU        ; Numeric
+SB ; SC        ; SContinue
+SB ; SE        ; Sep
+SB ; SP        ; Sp
+SB ; ST        ; STerm
+SB ; UP        ; Upper
+SB ; XX        ; Other
+
+# Simple_Case_Folding (scf)
+
+# @missing: 0000..10FFFF; Simple_Case_Folding; <code point>
+
+# Simple_Lowercase_Mapping (slc)
+
+# @missing: 0000..10FFFF; Simple_Lowercase_Mapping; <code point>
+
+# Simple_Titlecase_Mapping (stc)
+
+# @missing: 0000..10FFFF; Simple_Titlecase_Mapping; <code point>
+
+# Simple_Uppercase_Mapping (suc)
+
+# @missing: 0000..10FFFF; Simple_Uppercase_Mapping; <code point>
+
+# Soft_Dotted (SD)
+
+SD ; N         ; No                               ; F                                ; False
+SD ; Y         ; Yes                              ; T                                ; True
+
+# Terminal_Punctuation (Term)
+
+Term; N        ; No                               ; F                                ; False
+Term; Y        ; Yes                              ; T                                ; True
+
+# Titlecase_Mapping (tc)
+
+# @missing: 0000..10FFFF; Titlecase_Mapping; <code point>
+
+# Unicode_1_Name (na1)
+
+# @missing: 0000..10FFFF; Unicode_1_Name; <none>
+
+# Unified_Ideograph (UIdeo)
+
+UIdeo; N       ; No                               ; F                                ; False
+UIdeo; Y       ; Yes                              ; T                                ; True
+
+# Uppercase (Upper)
+
+Upper; N       ; No                               ; F                                ; False
+Upper; Y       ; Yes                              ; T                                ; True
+
+# Uppercase_Mapping (uc)
+
+# @missing: 0000..10FFFF; Uppercase_Mapping; <code point>
+
+# Variation_Selector (VS)
+
+VS ; N         ; No                               ; F                                ; False
+VS ; Y         ; Yes                              ; T                                ; True
+
+# White_Space (WSpace)
+
+WSpace; N      ; No                               ; F                                ; False
+WSpace; Y      ; Yes                              ; T                                ; True
+
+# Word_Break (WB)
+
+WB ; CR        ; CR
+WB ; EX        ; ExtendNumLet
+WB ; Extend    ; Extend
+WB ; FO        ; Format
+WB ; KA        ; Katakana
+WB ; LE        ; ALetter
+WB ; LF        ; LF
+WB ; MB        ; MidNumLet
+WB ; ML        ; MidLetter
+WB ; MN        ; MidNum
+WB ; NL        ; Newline
+WB ; NU        ; Numeric
+WB ; XX        ; Other
+
+# XID_Continue (XIDC)
+
+XIDC; N        ; No                               ; F                                ; False
+XIDC; Y        ; Yes                              ; T                                ; True
+
+# XID_Start (XIDS)
+
+XIDS; N        ; No                               ; F                                ; False
+XIDS; Y        ; Yes                              ; T                                ; True
+
+# cjkAccountingNumeric (cjkAccountingNumeric)
+
+# @missing: 0000..10FFFF; cjkAccountingNumeric; NaN
+
+# cjkCompatibilityVariant (cjkCompatibilityVariant)
+
+# @missing: 0000..10FFFF; cjkCompatibilityVariant; <code point>
+
+# cjkIICore (cjkIICore)
+
+# @missing: 0000..10FFFF; cjkIICore; <none>
+
+# cjkIRG_GSource (cjkIRG_GSource)
+
+# @missing: 0000..10FFFF; cjkIRG_GSource; <none>
+
+# cjkIRG_HSource (cjkIRG_HSource)
+
+# @missing: 0000..10FFFF; cjkIRG_HSource; <none>
+
+# cjkIRG_JSource (cjkIRG_JSource)
+
+# @missing: 0000..10FFFF; cjkIRG_JSource; <none>
+
+# cjkIRG_KPSource (cjkIRG_KPSource)
+
+# @missing: 0000..10FFFF; cjkIRG_KPSource; <none>
+
+# cjkIRG_KSource (cjkIRG_KSource)
+
+# @missing: 0000..10FFFF; cjkIRG_KSource; <none>
+
+# cjkIRG_MSource (cjkIRG_MSource)
+
+# @missing: 0000..10FFFF; cjkIRG_MSource; <none>
+
+# cjkIRG_TSource (cjkIRG_TSource)
+
+# @missing: 0000..10FFFF; cjkIRG_TSource; <none>
+
+# cjkIRG_USource (cjkIRG_USource)
+
+# @missing: 0000..10FFFF; cjkIRG_USource; <none>
+
+# cjkIRG_VSource (cjkIRG_VSource)
+
+# @missing: 0000..10FFFF; cjkIRG_VSource; <none>
+
+# cjkOtherNumeric (cjkOtherNumeric)
+
+# @missing: 0000..10FFFF; cjkOtherNumeric; NaN
+
+# cjkPrimaryNumeric (cjkPrimaryNumeric)
+
+# @missing: 0000..10FFFF; cjkPrimaryNumeric; NaN
+
+# cjkRSUnicode (cjkRSUnicode)
+
+# @missing: 0000..10FFFF; cjkRSUnicode; <none>
+
+# EOF
--- a/jdk/test/java/lang/Double/ParseDouble.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/lang/Double/ParseDouble.java	Thu Apr 21 16:42:06 2011 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4160406 4705734 4707389 4826774 4895911 4421494
+ * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568
  * @summary Test for Double.parseDouble method and acceptance regex
  */
 
@@ -581,6 +581,31 @@
         }
     }
 
+
+    private static void testStrictness() {
+        final double expected = 0x0.0000008000001p-1022;
+        boolean failed = false;
+        double conversion = 0.0;
+        double sum = 0.0; // Prevent conversion from being optimized away
+
+        //2^-1047 + 2^-1075
+        String decimal = "6.631236871469758276785396630275967243399099947355303144249971758736286630139265439618068200788048744105960420552601852889715006376325666595539603330361800519107591783233358492337208057849499360899425128640718856616503093444922854759159988160304439909868291973931426625698663157749836252274523485312442358651207051292453083278116143932569727918709786004497872322193856150225415211997283078496319412124640111777216148110752815101775295719811974338451936095907419622417538473679495148632480391435931767981122396703443803335529756003353209830071832230689201383015598792184172909927924176339315507402234836120730914783168400715462440053817592702766213559042115986763819482654128770595766806872783349146967171293949598850675682115696218943412532098591327667236328125E-316";
+
+        for(int i = 0; i <= 12_000; i++) {
+            conversion = Double.parseDouble(decimal);
+            sum += conversion;
+            if (conversion != expected) {
+                failed = true;
+                System.out.printf("Iteration %d converts as %a%n",
+                                  i, conversion);
+            }
+        }
+
+        System.out.println("Sum = "  + sum);
+        if (failed)
+            throw new RuntimeException("Inconsistent conversion");
+    }
+
     public static void main(String[] args) throws Exception {
         rudimentaryTest();
 
@@ -595,5 +620,6 @@
         testRegex(paddedBadStrings, true);
 
         testSubnormalPowers();
+        testStrictness();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Math/RoundTests.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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 6430675
+ * @summary Check for correct implementation of {Math, StrictMath}.round
+ */
+public class RoundTests {
+    public static void main(String... args) {
+        int failures = 0;
+
+        failures += testNearFloatHalfCases();
+        failures += testNearDoubleHalfCases();
+
+        if (failures > 0) {
+            System.err.println("Testing {Math, StrictMath}.round incurred "
+                               + failures + " failures.");
+            throw new RuntimeException();
+        }
+    }
+
+    private static int testNearDoubleHalfCases() {
+        int failures = 0;
+        double [][] testCases = {
+            {+0x1.fffffffffffffp-2,  0.0},
+            {+0x1.0p-1,              1.0}, // +0.5
+            {+0x1.0000000000001p-1,  1.0},
+
+            {-0x1.fffffffffffffp-2,  0.0},
+            {-0x1.0p-1,              0.0}, // -0.5
+            {-0x1.0000000000001p-1, -1.0},
+        };
+
+        for(double[] testCase : testCases) {
+            failures += testNearHalfCases(testCase[0], (long)testCase[1]);
+        }
+
+        return failures;
+    }
+
+    private static int testNearHalfCases(double input, double expected) {
+        int failures = 0;
+
+        failures += Tests.test("Math.round",        input, Math.round(input),       expected);
+        failures += Tests.test("StrictMath.round",  input, StrictMath.round(input), expected);
+
+        return failures;
+    }
+
+    private static int testNearFloatHalfCases() {
+        int failures = 0;
+        float [][] testCases = {
+            {+0x1.fffffep-2f,  0.0f},
+            {+0x1.0p-1f,       1.0f}, // +0.5
+            {+0x1.000002p-1f,  1.0f},
+
+            {-0x1.fffffep-2f,  0.0f},
+            {-0x1.0p-1f,       0.0f}, // -0.5
+            {-0x1.000002p-1f, -1.0f},
+        };
+
+        for(float[] testCase : testCases) {
+            failures += testNearHalfCases(testCase[0], (int)testCase[1]);
+        }
+
+        return failures;
+    }
+
+    private static int testNearHalfCases(float input, float expected) {
+        int failures = 0;
+
+        failures += Tests.test("Math.round",        input, Math.round(input),       expected);
+        failures += Tests.test("StrictMath.round",  input, StrictMath.round(input), expected);
+
+        return failures;
+    }
+}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Thu Apr 21 16:42:06 2011 -0700
@@ -26,7 +26,7 @@
  * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
  *      5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
  *      6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
- *      4947220 7018606
+ *      4947220 7018606 7034570
  * @summary Basic tests for Process and Environment Variable code
  * @run main/othervm/timeout=300 Basic
  * @author Martin Buchholz
@@ -1440,11 +1440,12 @@
         // Check for sort order of environment variables on Windows.
         //----------------------------------------------------------------
         try {
+            String systemRoot = "SystemRoot=" + System.getenv("SystemRoot");
             // '+' < 'A' < 'Z' < '_' < 'a' < 'z' < '~'
             String[]envp = {"FOO=BAR","BAZ=GORP","QUUX=",
-                            "+=+", "_=_", "~=~"};
+                            "+=+", "_=_", "~=~", systemRoot};
             String output = nativeEnv(envp);
-            String expected = "+=+\nBAZ=GORP\nFOO=BAR\nQUUX=\n_=_\n~=~\n";
+            String expected = "+=+\nBAZ=GORP\nFOO=BAR\nQUUX=\n"+systemRoot+"\n_=_\n~=~\n";
             // On Windows, Java must keep the environment sorted.
             // Order is random on Unix, so this test does the sort.
             if (! Windows.is())
@@ -1453,6 +1454,21 @@
         } catch (Throwable t) { unexpected(t); }
 
         //----------------------------------------------------------------
+        // Test Runtime.exec(...envp...)
+        // and check SystemRoot gets set automatically on Windows
+        //----------------------------------------------------------------
+        try {
+            if (Windows.is()) {
+                String systemRoot = "SystemRoot=" + System.getenv("SystemRoot");
+                String[]envp = {"FOO=BAR","BAZ=GORP","QUUX=",
+                                "+=+", "_=_", "~=~"};
+                String output = nativeEnv(envp);
+                String expected = "+=+\nBAZ=GORP\nFOO=BAR\nQUUX=\n"+systemRoot+"\n_=_\n~=~\n";
+                equal(output, expected);
+            }
+        } catch (Throwable t) { unexpected(t); }
+
+        //----------------------------------------------------------------
         // System.getenv() must be consistent with System.getenv(String)
         //----------------------------------------------------------------
         try {
--- a/jdk/test/java/lang/reflect/Generics/Probe.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/lang/reflect/Generics/Probe.java	Thu Apr 21 16:42:06 2011 -0700
@@ -38,12 +38,12 @@
           "java.util.concurrent.ConcurrentHashMap$KeyIterator",
           "java.util.concurrent.ConcurrentHashMap$ValueIterator",
           "java.util.AbstractList$ListItr",
-          "java.util.EnumMap$EntryIterator",
-          "java.util.EnumMap$KeyIterator",
-          "java.util.EnumMap$ValueIterator",
-          "java.util.IdentityHashMap$EntryIterator",
-          "java.util.IdentityHashMap$KeyIterator",
-          "java.util.IdentityHashMap$ValueIterator",
+//          "java.util.EnumMap$EntryIterator",
+//          "java.util.EnumMap$KeyIterator",
+//          "java.util.EnumMap$ValueIterator",
+//          "java.util.IdentityHashMap$EntryIterator",
+//          "java.util.IdentityHashMap$KeyIterator",
+//          "java.util.IdentityHashMap$ValueIterator",
           "java.util.WeakHashMap$EntryIterator",
           "java.util.WeakHashMap$KeyIterator",
           "java.util.WeakHashMap$ValueIterator",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigDecimal/DivideMcTests.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,5797 @@
+/*
+ * 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 7036582
+ * @summary Some tests for the divide(..,MathContext) method.
+ * @run main DivideMcTests
+ * @run main/othervm -XX:+AggressiveOpts DivideMcTests
+ * @author Sergey V. Kuksenko
+ */
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+
+
+public class DivideMcTests {
+
+    static String[] value = new String[75];
+    static String[][] results = new String[75][75];
+    static {
+        value[0]="11061";
+        value[1]="5030285645";
+        value[2]="224198292018431";
+        value[3]="19226185404220649458";
+        value[4]="2754593222460641763294400";
+        value[5]="88290e4";
+        value[6]="14207e-4";
+        value[7]="9206524943e4";
+        value[8]="9637167289e-4";
+        value[9]="987673128759528e4";
+        value[10]="270627774630281e-4";
+        value[11]="81503625886547904651e4";
+        value[12]="60700032235397315737e-4";
+        value[13]="6477954854329556663533122e4";
+        value[14]="8056417378028557868905113e-4";
+        value[15]="74996e8";
+        value[16]="65282e-8";
+        value[17]="6336626690e8";
+        value[18]="8318166778e-8";
+        value[19]="983114227763768e8";
+        value[20]="245802997834566e-8";
+        value[21]="52727924122290902686e8";
+        value[22]="42785567085625398961e-8";
+        value[23]="4810906998143118279742863e8";
+        value[24]="8077506080975981172874361e-8";
+        value[25]="80689e12";
+        value[26]="30125e-12";
+        value[27]="6921467144e12";
+        value[28]="1953347181e-12";
+        value[29]="405471649883944e12";
+        value[30]="866720590936024e-12";
+        value[31]="33231666378140173438e12";
+        value[32]="42631490906110209257e-12";
+        value[33]="7723154992826793726050991e12";
+        value[34]="1611437259018380210686834e-12";
+        value[35]="65645e16";
+        value[36]="31153e-16";
+        value[37]="7758733150e16";
+        value[38]="6365465077e-16";
+        value[39]="727973863299662e16";
+        value[40]="351084160935215e-16";
+        value[41]="45470432070181568402e16";
+        value[42]="97216256670931719037e-16";
+        value[43]="2520581904836081418366563e16";
+        value[44]="3700768934485477578987416e-16";
+        value[45]="28736e20";
+        value[46]="52779e-20";
+        value[47]="7904805864e20";
+        value[48]="6373815349e-20";
+        value[49]="186651310031326e20";
+        value[50]="189125880591366e-20";
+        value[51]="74987916068454915171e20";
+        value[52]="10554589082317914511e-20";
+        value[53]="3599986721169840668392202e20";
+        value[54]="2588106172836128849130551e-20";
+        value[55]="71080e24";
+        value[56]="61576e-24";
+        value[57]="7086656363e24";
+        value[58]="7703864845e-24";
+        value[59]="361167296280301e24";
+        value[60]="149150690375117e-24";
+        value[61]="78129219923655854302e24";
+        value[62]="20861932490694515212e-24";
+        value[63]="9185868654811652011998047e24";
+        value[64]="1996563690880014012200226e-24";
+        value[65]="84665e28";
+        value[66]="94968e-28";
+        value[67]="2622821029e28";
+        value[68]="4451579486e-28";
+        value[69]="590522407411869e28";
+        value[70]="606293232614518e-28";
+        value[71]="96628087822208148505e28";
+        value[72]="24875240094942654314e-28";
+        value[73]="5099400093819597146233149e28";
+        value[74]="8906650752845770170008864e-28";
+        //--------------------------------------------
+        initResults1();
+        initResults2();
+    }
+
+    private static void initResults1() {
+        results[0][0]="1";
+        results[0][1]="0.000002198881093560642";
+        results[0][2]="4.933579065397471E-11";
+        results[0][3]="5.753091300977375E-16";
+        results[0][4]="4.015474920147867E-21";
+        results[0][5]="0.00001252803261977574";
+        results[0][6]="7785.598648553530";
+        results[0][7]="1.201430514605841E-10";
+        results[0][8]="0.01147743903192921";
+        results[0][9]="1.119904923797219E-15";
+        results[0][10]="4.087163638363069E-7";
+        results[0][11]="1.357117536758031E-20";
+        results[0][12]="1.822239559462666E-12";
+        results[0][13]="1.707483341383177E-25";
+        results[0][14]="1.372942771084022E-17";
+        results[0][15]="1.474878660195210E-9";
+        results[0][16]="16943414.72381361";
+        results[0][17]="1.745565983468090E-14";
+        results[0][18]="132.9740109233477";
+        results[0][19]="1.125098151123273E-19";
+        results[0][20]="0.004499945117611804";
+        results[0][21]="2.097749946374985E-24";
+        results[0][22]="2.585217575324869E-8";
+        results[0][23]="2.299150660004288E-29";
+        results[0][24]="1.369358300583728E-13";
+        results[0][25]="1.370818822887878E-13";
+        results[0][26]="367170124481.3278";
+        results[0][27]="1.598071589430057E-18";
+        results[0][28]="5662587.842852089";
+        results[0][29]="2.727934247231818E-23";
+        results[0][30]="12.76189825841631";
+        results[0][31]="3.328451806821200E-28";
+        results[0][32]="0.0002594560913752765";
+        results[0][33]="1.432186717769276E-33";
+        results[0][34]="6.864058738928437E-9";
+        results[0][35]="1.684972198948892E-17";
+        results[0][36]="3550540878888069";
+        results[0][37]="1.425619335806130E-22";
+        results[0][38]="17376577934.52694";
+        results[0][39]="1.519422682273810E-27";
+        results[0][40]="315052.6634564146";
+        results[0][41]="2.432569803367569E-32";
+        results[0][42]="1.137772670824026";
+        results[0][43]="4.388272398043467E-37";
+        results[0][44]="0.00002988838318687904";
+        results[0][45]="3.849178730512249E-21";
+        results[0][46]="2.095719888592054E+19";
+        results[0][47]="1.399275351008165E-26";
+        results[0][48]="173538130528606.9";
+        results[0][49]="5.926023234524105E-31";
+        results[0][50]="5848485656.967753";
+        results[0][51]="1.475037656720937E-36";
+        results[0][52]="104798.0164242535";
+        results[0][53]="3.072511333154488E-41";
+        results[0][54]="0.4273781391232109";
+        results[0][55]="1.556133933595948E-25";
+        results[0][56]="1.796316746784461E+23";
+        results[0][57]="1.560820707738894E-30";
+        results[0][58]="1.435772852009322E+18";
+        results[0][59]="3.062569649555309E-35";
+        results[0][60]="74159898101586.80";
+        results[0][61]="1.415731529229177E-40";
+        results[0][62]="530200162.6615257";
+        results[0][63]="1.204132174718842E-45";
+        results[0][64]="5540.018608234184";
+        results[0][65]="1.306443040217327E-29";
+        results[0][66]="1.164708112206217E+27";
+        results[0][67]="4.217214929154817E-34";
+        results[0][68]="2.484736043641657E+22";
+        results[0][69]="1.873087263272185E-39";
+        results[0][70]="1.824364747121068E+17";
+        results[0][71]="1.144698218633054E-44";
+        results[0][72]="4446590247082.196";
+        results[0][73]="2.169078675235893E-49";
+        results[0][74]="12418809.61422664";
+        results[1][0]="454776.7511979025";
+        results[1][1]="1";
+        results[1][2]="0.00002243677059139446";
+        results[1][3]="2.616372171203405E-10";
+        results[1][4]="1.826144638701504E-15";
+        results[1][5]="5.697457973722958";
+        results[1][6]="3540709259.519955";
+        results[1][7]="0.00005463826662224685";
+        results[1][8]="5219.672435012765";
+        results[1][9]="5.093067228950338E-10";
+        results[1][10]="0.1858747001068956";
+        results[1][11]="6.171855043605175E-15";
+        results[1][12]="8.287121867567282E-7";
+        results[1][13]="7.765237267187802E-20";
+        results[1][14]="6.243824530142372E-12";
+        results[1][15]="0.0006707405254946931";
+        results[1][16]="7705471102294.660";
+        results[1][17]="7.938428269631898E-9";
+        results[1][18]="60473488.68147447";
+        results[1][19]="5.116684819466090E-14";
+        results[1][20]="2046.470421156359";
+        results[1][21]="9.540079054379898E-19";
+        results[1][22]="0.01175696850045963";
+        results[1][23]="1.045600267671264E-23";
+        results[1][24]="6.227523191653488E-8";
+        results[1][25]="6.234165307538822E-8";
+        results[1][26]="1.669804363485477E+17";
+        results[1][27]="7.267658056226699E-13";
+        results[1][28]="2575213302545.012";
+        results[1][29]="1.240601074437582E-17";
+        results[1][30]="5803814.629080740";
+        results[1][31]="1.513702499224934E-22";
+        results[1][32]="117.9945983141544";
+        results[1][33]="6.513252226158986E-28";
+        results[1][34]="0.003121614333321446";
+        results[1][35]="7.662861824967629E-12";
+        results[1][36]="1.614703445896061E+21";
+        results[1][37]="6.483385299828233E-17";
+        results[1][38]="7902463660001319";
+        results[1][39]="6.909981111408860E-22";
+        results[1][40]="143278626742.9544";
+        results[1][41]="1.106276192237624E-26";
+        results[1][42]="517432.5588391111";
+        results[1][43]="1.995684264553637E-31";
+        results[1][44]="13.59254180428686";
+        results[1][45]="1.750516997842428E-15";
+        results[1][46]="9.530846823547244E+24";
+        results[1][47]="6.363578981627979E-21";
+        results[1][48]="7.892110721075739E+19";
+        results[1][49]="2.695017594120158E-25";
+        results[1][50]="2659755306503325";
+        results[1][51]="6.708128334181145E-31";
+        results[1][52]="47659701441.40646";
+        results[1][53]="1.397306722110734E-35";
+        results[1][54]="194361.6416434591";
+        results[1][55]="7.076935347495779E-20";
+        results[1][56]="8.169230942250227E+28";
+        results[1][57]="7.098249706679054E-25";
+        results[1][58]="6.529561130949462E+23";
+        results[1][59]="1.392785475542062E-29";
+        results[1][60]="3.372619752780715E+19";
+        results[1][61]="6.438417854312836E-35";
+        results[1][62]="241122707459808.1";
+        results[1][63]="5.476113184315002E-40";
+        results[1][64]="2519471664.228668";
+        results[1][65]="5.941399214551468E-24";
+        results[1][66]="5.296821713629854E+32";
+        results[1][67]="1.917891304584321E-28";
+        results[1][68]="1.130000185511682E+28";
+        results[1][69]="8.518365403010947E-34";
+        results[1][70]="8.296786726957023E+22";
+        results[1][71]="5.205821369719668E-39";
+        results[1][72]="2.022205866476320E+18";
+        results[1][73]="9.864465530164297E-44";
+        results[1][74]="5647785890103.269";
+        results[2][0]="20269260647.17756";
+        results[2][1]="44569.69401753148";
+        results[2][2]="1";
+        results[2][3]="0.00001166109071065203";
+        results[2][4]="8.139070777868161E-11";
+        results[2][5]="253933.9585665772";
+        results[2][6]="157808328301844.9";
+        results[2][7]="2.435210825001846";
+        results[2][8]="232639203.3002624";
+        results[2][9]="0.00002269964480050335";
+        results[2][10]="8284.378509364762";
+        results[2][11]="2.750776908140411E-10";
+        results[2][12]="0.03693544859234678";
+        results[2][13]="3.460942489720927E-15";
+        results[2][14]="2.782853488076028E-7";
+        results[2][15]="29.89469998645674";
+        results[2][16]="3.434304892902040E+17";
+        results[2][17]="0.0003538133189576156";
+        results[2][18]="2695284886705.971";
+        results[2][19]="2.280490767877520E-9";
+        results[2][20]="91210560.48686773";
+        results[2][21]="4.251984043567731E-14";
+        results[2][22]="524.0044886392415";
+        results[2][23]="4.660208399475724E-19";
+        results[2][24]="0.002775588031390770";
+        results[2][25]="0.002778548402117154";
+        results[2][26]="7.442266954968664E+21";
+        results[2][27]="3.239172957900716E-8";
+        results[2][28]="1.147764689243079E+17";
+        results[2][29]="5.529321028550383E-13";
+        results[2][30]="258674242152.6016";
+        results[2][31]="6.746525722402801E-18";
+        results[2][32]="5258983.142583397";
+        results[2][33]="2.902936587789118E-23";
+        results[2][34]="139.1293956768774";
+        results[2][35]="3.415314068374301E-7";
+        results[2][36]="7.196683851264116E+25";
+        results[2][37]="2.889624990111060E-12";
+        results[2][38]="3.522103873109208E+20";
+        results[2][39]="3.079757438024150E-17";
+        results[2][40]="6385884553185581";
+        results[2][41]="4.930639138691073E-22";
+        results[2][42]="23061810822.16754";
+        results[2][43]="8.894703702675794E-27";
+        results[2][44]="605815.4291375707";
+        results[2][45]="7.802000696632482E-11";
+        results[2][46]="4.247869266534626E+29";
+        results[2][47]="2.836227680675536E-16";
+        results[2][48]="3.517489599908254E+24";
+        results[2][49]="1.201161095417993E-20";
+        results[2][50]="1.185444801723589E+20";
+        results[2][51]="2.989792272847868E-26";
+        results[2][52]="2124178310210390";
+        results[2][53]="6.227753305311532E-31";
+        results[2][54]="8662638896.794075";
+        results[2][55]="3.154168430197397E-15";
+        results[2][56]="3.641001234546430E+33";
+        results[2][57]="3.163668174867180E-20";
+        results[2][58]="2.910205416751843E+28";
+        results[2][59]="6.207602247697180E-25";
+        results[2][60]="1.503166304189191E+24";
+        results[2][61]="2.869583137237347E-30";
+        results[2][62]="1.074676529216240E+19";
+        results[2][63]="2.440686890302896E-35";
+        results[2][64]="112292081160512.5";
+        results[2][65]="2.648063450285608E-19";
+        results[2][66]="2.360777230418994E+37";
+        results[2][67]="8.547982860420744E-24";
+        results[2][68]="5.036376250800950E+32";
+        results[2][69]="3.796609395417242E-29";
+        results[2][70]="3.697852457491911E+27";
+        results[2][71]="2.320218655583322E-34";
+        results[2][72]="9.012909670930670E+22";
+        results[2][73]="4.396562103259092E-39";
+        results[2][74]="2.517200889984344E+17";
+        results[3][0]="1738195950114877";
+        results[3][1]="3822086211.611279";
+        results[3][2]="85755.27151045421";
+        results[3][3]="1";
+        results[3][4]="0.000006979682243988879";
+        results[3][5]="21776175562.60126";
+        results[3][6]="1.353289604013560E+19";
+        results[3][7]="208832.1654832305";
+        results[3][8]="19950038042989.76";
+        results[3][9]="1.946614203058035";
+        results[3][10]="710429128.3659471";
+        results[3][11]="0.00002358936206222687";
+        results[3][12]="3167.409422397122";
+        results[3][13]="2.967940628880855E-10";
+        results[3][14]="0.02386443564437743";
+        results[3][15]="2563628.114062170";
+        results[3][16]="2.945097485404958E+22";
+        results[3][17]="30.34135723122526";
+        results[3][18]="2.311348872574943E+17";
+        results[3][19]="0.0001955641049764209";
+        results[3][20]="7821786379172.049";
+        results[3][21]="3.646300461142698E-9";
+        results[3][22]="44936147.19595487";
+        results[3][23]="3.996374365923399E-14";
+        results[3][24]="238.0213052330826";
+        results[3][25]="238.2751726284952";
+        results[3][26]="6.382136233766191E+26";
+        results[3][27]="0.002777761564740970";
+        results[3][28]="9.842687255615237E+21";
+        results[3][29]="4.741684260718020E-8";
+        results[3][30]="2.218267986855733E+16";
+        results[3][31]="5.785501450769154E-13";
+        results[3][32]="450985527261.1410";
+        results[3][33]="2.489421152634873E-18";
+        results[3][34]="11931079.10135604";
+        results[3][35]="0.02928811852269122";
+        results[3][36]="6.171535776400555E+30";
+        results[3][37]="2.478005755903675E-7";
+        results[3][38]="3.020389739265025E+25";
+        results[3][39]="2.641054352841019E-12";
+        results[3][40]="5.476232636928451E+20";
+        results[3][41]="4.228282980585251E-17";
+        results[3][42]="1977671848577708";
+        results[3][43]="7.627677310280051E-22";
+        results[3][44]="51951866610.91471";
+        results[3][45]="0.000006690626880644714";
+        results[3][46]="3.642771822925908E+34";
+        results[3][47]="2.432214748217965E-11";
+        results[3][48]="3.016432756753313E+29";
+        results[3][49]="1.030058958653646E-15";
+        results[3][50]="1.016581408324629E+25";
+        results[3][51]="2.563904481179269E-21";
+        results[3][52]="1.821594877287098E+20";
+        results[3][53]="5.340626755971191E-26";
+        results[3][54]="742866950591597.5";
+        results[3][55]="2.704865701212809E-10";
+        results[3][56]="3.122350494384281E+38";
+        results[3][57]="2.713012233047182E-15";
+        results[3][58]="2.495654556647489E+33";
+        results[3][59]="5.323346161801775E-20";
+        results[3][60]="1.289044345411101E+29";
+        results[3][61]="2.460818810556097E-25";
+        results[3][62]="9.215917754885128E+23";
+        results[3][63]="2.093017669499310E-30";
+        results[3][64]="9.629637908393713E+18";
+        results[3][65]="2.270854001561525E-14";
+        results[3][66]="2.024490923702789E+42";
+        results[3][67]="7.330345910620899E-19";
+        results[3][68]="4.318958128162389E+37";
+        results[3][69]="3.255792695231470E-24";
+        results[3][70]="3.171103414978191E+32";
+        results[3][71]="1.989709807731689E-29";
+        results[3][72]="7.729045159298581E+27";
+        results[3][73]="3.770283768775571E-34";
+        results[3][74]="2.158632457669644E+22";
+        results[4][0]="2.490365448386802E+20";
+        results[4][1]="547601750051441.0";
+        results[4][2]="12286414841.35031";
+        results[4][3]="143272.9979736873";
+        results[4][4]="1";
+        results[4][5]="3119937957255229";
+        results[4][6]="1.938898586936469E+24";
+        results[4][7]="29920010422.11961";
+        results[4][8]="2.858301760108257E+18";
+        results[4][9]="278897.2527702849";
+        results[4][10]="101785311068822.8";
+        results[4][11]="3.379718622942007";
+        results[4][12]="453804243.7569410";
+        results[4][13]="0.00004252257517076709";
+        results[4][14]="3419.129239720079";
+        results[4][15]="367298685591.3171";
+        results[4][16]="4.219529460587362E+27";
+        results[4][17]="4347097.213108260";
+        results[4][18]="3.311538823369143E+22";
+        results[4][19]="28.01905561601273";
+        results[4][20]="1.120650784053732E+18";
+        results[4][21]="0.0005224163985807529";
+        results[4][22]="6438136526151.358";
+        results[4][23]="5.725725364310391E-9";
+        results[4][24]="34102025.98235386";
+        results[4][25]="34138398.32518239";
+        results[4][26]="9.143877916881798E+31";
+        results[4][27]="397.9782270365194";
+        results[4][28]="1.410191311229400E+27";
+        results[4][29]="0.006793553194777180";
+        results[4][30]="3.178179047858768E+21";
+        results[4][31]="8.289061376328140E-8";
+        results[4][32]="6.461404853344776E+16";
+        results[4][33]="3.566668317571105E-13";
+        results[4][34]="1709401471912.486";
+        results[4][35]="4196.196545754653";
+        results[4][36]="8.842144327867755E+35";
+        results[4][37]="0.03550313136443727";
+        results[4][38]="4.327402929934638E+30";
+        results[4][39]="3.783917749429893E-7";
+        results[4][40]="7.845962674940902E+25";
+        results[4][41]="6.057987789095672E-12";
+        results[4][42]="2.833469747538924E+20";
+        results[4][43]="1.092840195819694E-16";
+        results[4][44]="7443299679674857";
+        results[4][45]="0.9585861715133080";
+        results[4][46]="5.219108400046689E+39";
+        results[4][47]="0.000003484706986930048";
+        results[4][48]="4.321733642460815E+34";
+        results[4][49]="1.475796350959623E-10";
+        results[4][50]="1.456486660549828E+30";
+        results[4][51]="3.673382815367253E-16";
+        results[4][52]="2.609853591624336E+25";
+        results[4][53]="7.651676063864807E-21";
+        results[4][54]="1.064327751068292E+20";
+        results[4][55]="0.00003875342181289592";
+        results[4][56]="4.473485160550607E+43";
+        results[4][57]="3.887013961679578E-10";
+        results[4][58]="3.575599102375792E+38";
+        results[4][59]="7.626917638530619E-15";
+        results[4][60]="1.846852478880778E+34";
+        results[4][61]="3.525688884584153E-20";
+        results[4][62]="1.320392165821326E+29";
+        results[4][63]="2.998729163210665E-25";
+        results[4][64]="1.379667092536635E+24";
+        results[4][65]="3.253520607642641E-9";
+        results[4][66]="2.900548840094181E+47";
+        results[4][67]="1.050240634798815E-13";
+        results[4][68]="6.187900791446503E+42";
+        results[4][69]="4.664671802266443E-19";
+        results[4][70]="4.543334931485233E+37";
+        results[4][71]="2.850716892513680E-24";
+        results[4][72]="1.107363471446723E+33";
+        results[4][73]="5.401798587640085E-29";
+        results[4][74]="3.092737437336386E+27";
+        results[5][0]="79820.99267697315";
+        results[5][1]="0.1755168716666387";
+        results[5][2]="0.000003938031784503595";
+        results[5][3]="4.592174586052730E-11";
+        results[5][4]="3.205191941956922E-16";
+        results[5][5]="1";
+        results[5][6]="621454212.7120434";
+        results[5][7]="0.000009589937630824491";
+        results[5][8]="916.1405769180272";
+        results[5][9]="8.939192272132398E-11";
+        results[5][10]="0.03262414588473695";
+        results[5][11]="1.083264689633546E-15";
+        results[5][12]="1.454529705315602E-7";
+        results[5][13]="1.362930152886002E-20";
+        results[5][14]="1.095896548766010E-12";
+        results[5][15]="0.0001177262787348659";
+        results[5][16]="1352440182592.445";
+        results[5][17]="1.393328095835799E-9";
+        results[5][18]="10614117.55214028";
+        results[5][19]="8.980645128168683E-15";
+        results[5][20]="359.1900862796728";
+        results[5][21]="1.674444831077185E-19";
+        results[5][22]="0.002063546331483886";
+        results[5][23]="1.835204879954603E-24";
+        results[5][24]="1.093035388830462E-8";
+        results[5][25]="1.094201192231903E-8";
+        results[5][26]="2.930788381742739E+16";
+        results[5][27]="1.275596606371755E-13";
+        results[5][28]="451993382737.0138";
+        results[5][29]="2.177464195715552E-18";
+        results[5][30]="1018667.387429325";
+        results[5][31]="2.656803272979331E-23";
+        results[5][32]="20.71004276966202";
+        results[5][33]="1.143185655111196E-28";
+        results[5][34]="0.0005478959823343203";
+        results[5][35]="1.344961535532028E-12";
+        results[5][36]="2.834076974930183E+20";
+        results[5][37]="1.137943505635324E-17";
+        results[5][38]="1387015700062728";
+        results[5][39]="1.212818267950047E-22";
+        results[5][40]="25147816342.61536";
+        results[5][41]="1.941701364608288E-27";
+        results[5][42]="90818.14402590475";
+        results[5][43]="3.502762589487909E-32";
+        results[5][44]="2.385720415486439";
+        results[5][45]="3.072452672605791E-16";
+        results[5][46]="1.672824418802933E+24";
+        results[5][47]="1.116915475458918E-21";
+        results[5][48]="1.385198584609954E+19";
+        results[5][49]="4.730210572065213E-26";
+        results[5][50]="466831930796205.5";
+        results[5][51]="1.177389699953815E-31";
+        results[5][52]="8365081701.561654";
+        results[5][53]="2.452509046236414E-36";
+        results[5][54]="34113.74731325223";
+        results[5][55]="1.242121553179516E-20";
+        results[5][56]="1.433837858906067E+28";
+        results[5][57]="1.245862582824943E-25";
+        results[5][58]="1.146048143060329E+23";
+        results[5][59]="2.444573495698746E-30";
+        results[5][60]="5.919516683291835E+18";
+        results[5][61]="1.130050960271621E-35";
+        results[5][62]="42321103301135.62";
+        results[5][63]="9.611502550034045E-41";
+        results[5][64]="442209784.7581557";
+        results[5][65]="1.042815803460698E-24";
+        results[5][66]="9.296815769522365E+31";
+        results[5][67]="3.366222819772885E-29";
+        results[5][68]="1.983340975437319E+27";
+        results[5][69]="1.495116847249808E-34";
+        results[5][70]="1.456226051200787E+22";
+        results[5][71]="9.137094812685324E-40";
+        results[5][72]="3.549312475498482E+17";
+        results[5][73]="1.731380130517828E-44";
+        results[5][74]="991281711273.9084";
+        results[6][0]="0.0001284422746587108";
+        results[6][1]="2.824292893609623E-10";
+        results[6][2]="6.336801173682476E-15";
+        results[6][3]="7.389401330167758E-20";
+        results[6][4]="5.157567325787970E-25";
+        results[6][5]="1.609129006682524E-9";
+        results[6][6]="1";
+        results[6][7]="1.543144681403597E-14";
+        results[6][8]="0.000001474188376517659";
+        results[6][9]="1.438431358140050E-19";
+        results[6][10]="5.249645946137250E-11";
+        results[6][11]="1.743112634004281E-24";
+        results[6][12]="2.340525939904718E-16";
+        results[6][13]="2.193130443091112E-29";
+        results[6][14]="1.763438924942655E-21";
+        results[6][15]="1.894367699610646E-13";
+        results[6][16]="2176.250727612512";
+        results[6][17]="2.242044654835111E-18";
+        results[6][18]="0.01707948443348703";
+        results[6][19]="1.445101657445832E-23";
+        results[6][20]="5.779831867454199E-7";
+        results[6][21]="2.694397747775916E-28";
+        results[6][22]="3.320512258624031E-12";
+        results[6][23]="2.953081405540270E-33";
+        results[6][24]="1.758834949497607E-17";
+        results[6][25]="1.760710877566955E-17";
+        results[6][26]="47160165.97510373";
+        results[6][27]="2.052599500138579E-22";
+        results[6][28]="727.3156629906847";
+        results[6][29]="3.503820798338526E-27";
+        results[6][30]="0.001639167241274031";
+        results[6][31]="4.275139211600108E-32";
+        results[6][32]="3.332513055029883E-8";
+        results[6][33]="1.839533197662788E-37";
+        results[6][34]="8.816353178189703E-13";
+        results[6][35]="2.164216619696854E-21";
+        results[6][36]="456039546753.1217";
+        results[6][37]="1.831097902883797E-26";
+        results[6][38]="2231887.195695002";
+        results[6][39]="1.951581054792877E-31";
+        results[6][40]="40.46608073162718";
+        results[6][41]="3.124447988106234E-36";
+        results[6][42]="0.0001461381098851545";
+        results[6][43]="5.636396886267384E-41";
+        results[6][44]="3.838931922393911E-9";
+        results[6][45]="4.943972717149220E-25";
+        results[6][46]="2691790295382633";
+        results[6][47]="1.797261089573547E-30";
+        results[6][48]="22289632225.11453";
+        results[6][49]="7.611519039226468E-35";
+        results[6][50]="751192.8010897827";
+        results[6][51]="1.894571918364917E-40";
+        results[6][52]="13.46049560925206";
+        results[6][53]="3.946403445450303E-45";
+        results[6][54]="0.00005489342032839216";
+        results[6][55]="1.998733821046708E-29";
+        results[6][56]="2.307230089645316E+19";
+        results[6][57]="2.004753620364024E-34";
+        results[6][58]="184413931005301.8";
+        results[6][59]="3.933634120896147E-39";
+        results[6][60]="9525266000.626017";
+        results[6][61]="1.818397779202506E-44";
+        results[6][62]="68100.11491666482";
+        results[6][63]="1.546614755106283E-49";
+        results[6][64]="0.7115725916931837";
+        results[6][65]="1.678025157975551E-33";
+        results[6][66]="1.495977592452194E+23";
+        results[6][67]="5.416686782253186E-38";
+        results[6][68]="3.191451493718201E+18";
+        results[6][69]="2.405835887289389E-43";
+        results[6][70]="23432555792739.37";
+        results[6][71]="1.470276429990037E-48";
+        results[6][72]="571130165.8104760";
+        results[6][73]="2.786013989610011E-53";
+        results[6][74]="1595.100155404736";
+        results[7][0]="8323411032.456378";
+        results[7][1]="18302.19115320239";
+        results[7][2]="0.4106420642242513";
+        results[7][3]="0.000004788534360528390";
+        results[7][4]="3.342244825091065E-11";
+        results[7][5]="104275.9649224148";
+        results[7][6]="64802737685647.92";
+        results[7][7]="1";
+        results[7][8]="95531442.66270503";
+        results[7][9]="0.000009321428998035992";
+        results[7][10]="3401.914291900572";
+        results[7][11]="1.129584707779182E-10";
+        results[7][12]="0.01516724885301000";
+        results[7][13]="1.421208568140421E-15";
+        results[7][14]="1.142756700777198E-7";
+        results[7][15]="12.27602131180330";
+        results[7][16]="1.410270050396740E+17";
+        results[7][17]="0.0001452906316467887";
+        results[7][18]="1106797349549.367";
+        results[7][19]="9.364654363655727E-10";
+        results[7][20]="37454892.83737830";
+        results[7][21]="1.746043504699232E-14";
+        results[7][22]="215.1782848775914";
+        results[7][23]="1.913677596875906E-19";
+        results[7][24]="0.001139773198646432";
+        results[7][25]="0.001140988851392383";
+        results[7][26]="3.056107864896266E+21";
+        results[7][27]="1.330140669811724E-8";
+        results[7][28]="4.713204612344845E+16";
+        results[7][29]="2.270571800922490E-13";
+        results[7][30]="106222524759.1882";
+        results[7][31]="2.770407248989495E-18";
+        results[7][32]="2159559.693390987";
+        results[7][33]="1.192067872721828E-23";
+        results[7][34]="57.13238223502557";
+        results[7][35]="1.402471619011349E-7";
+        results[7][36]="2.955261112252432E+25";
+        results[7][37]="1.186601570773187E-12";
+        results[7][38]="1.446324004865796E+20";
+        results[7][39]="1.264677951660229E-17";
+        results[7][40]="2622312814817888";
+        results[7][41]="2.024727833856987E-22";
+        results[7][42]="9470149600.764056";
+        results[7][43]="3.652539489129880E-27";
+        results[7][44]="248773.2983599527";
+        results[7][45]="3.203829671144209E-11";
+        results[7][46]="1.744353804164535E+29";
+        results[7][47]="1.164674389402563E-16";
+        results[7][48]="1.444429190193662E+24";
+        results[7][49]="4.932472716883077E-21";
+        results[7][50]="4.867935004036829E+19";
+        results[7][51]="1.227734470523965E-26";
+        results[7][52]="872276966085176.7";
+        results[7][53]="2.557377472772532E-31";
+        results[7][54]="3557243918.208811";
+        results[7][55]="1.295234235087226E-15";
+        results[7][56]="1.495148262797194E+33";
+        results[7][57]="1.299135229848029E-20";
+        results[7][58]="1.195052759651575E+28";
+        results[7][59]="2.549102600877473E-25";
+        results[7][60]="6.172633140245884E+23";
+        results[7][61]="1.178371542938247E-30";
+        results[7][62]="4.413073883307109E+18";
+        results[7][63]="1.002248702759050E-35";
+        results[7][64]="46111852003790.03";
+        results[7][65]="1.087406241422075E-19";
+        results[7][66]="9.694344350728666E+36";
+        results[7][67]="3.510161326756695E-24";
+        results[7][68]="2.068147939838898E+32";
+        results[7][69]="1.559047519187323E-29";
+        results[7][70]="1.518493766341199E+27";
+        results[7][71]="9.527793781803528E-35";
+        results[7][72]="3.701079831937688E+22";
+        results[7][73]="1.805413337572430E-39";
+        results[7][74]="1.033668569530294E+17";
+        results[8][0]="87.12745040231444";
+        results[8][1]="0.0001915829034197918";
+        results[8][2]="4.298501653263149E-9";
+        results[8][3]="5.012521769858929E-14";
+        results[8][4]="3.498580919469208E-19";
+        results[8][5]="0.001091535540718088";
+        results[8][6]="678339.3601041740";
+        results[8][7]="1.046775775731475E-8";
+        results[8][8]="1";
+        results[8][9]="9.757446070344992E-14";
+        results[8][10]="0.00003561041471876213";
+        results[8][11]="1.182421908739965E-18";
+        results[8][12]="1.587670868382187E-10";
+        results[8][13]="1.487686701391408E-23";
+        results[8][14]="1.196210031928393E-15";
+        results[8][15]="1.285024173155902E-7";
+        results[8][16]="1476236525.994914";
+        results[8][17]="1.520867136485833E-12";
+        results[8][18]="11585.68654152080";
+        results[8][19]="9.802693335972867E-18";
+        results[8][20]="0.3920687450478594";
+        results[8][21]="1.827716044092442E-22";
+        results[8][22]="0.000002252434160733091";
+        results[8][23]="2.003191350969721E-27";
+        results[8][24]="1.193086974171064E-11";
+        results[8][25]="1.194359490017227E-11";
+        results[8][26]="31990596809958.51";
+        results[8][27]="1.392359031474151E-16";
+        results[8][28]="493366841.4268441";
+        results[8][29]="2.376779558264652E-21";
+        results[8][30]="1111.911657549550";
+        results[8][31]="2.899995197153080E-26";
+        results[8][32]="0.02260574773287777";
+        results[8][33]="1.247827772192961E-31";
+        results[8][34]="5.980479373345604E-7";
+        results[8][35]="1.468073316931983E-15";
+        results[8][36]="3.093495743267101E+17";
+        results[8][37]="1.242105779730290E-20";
+        results[8][38]="1513976932152.447";
+        results[8][39]="1.323834243899629E-25";
+        results[8][40]="27449735.30941583";
+        results[8][41]="2.119436048930757E-30";
+        results[8][42]="99.13123194632914";
+        results[8][43]="3.823389857123776E-35";
+        results[8][44]="0.002604098623720172";
+        results[8][45]="3.353691289323497E-19";
+        results[8][46]="1.825947306504481E+21";
+        results[8][47]="1.219152937441450E-24";
+        results[8][48]="1.511993486054156E+16";
+        results[8][49]="5.163192954489619E-29";
+        results[8][50]="509563644006.1053";
+        results[8][51]="1.285162702774995E-34";
+        results[8][52]="9130783.978265085";
+        results[8][53]="2.677000787899666E-39";
+        results[8][54]="37.23636761949100";
+        results[8][55]="1.355819821187394E-23";
+        results[8][56]="1.565084982623100E+25";
+        results[8][57]="1.359903288004258E-28";
+        results[8][58]="1.250952279524317E+20";
+        results[8][59]="2.668338852452637E-33";
+        results[8][60]="6461362843686697";
+        results[8][61]="1.233490785959079E-38";
+        results[8][62]="46194988375.59113";
+        results[8][63]="1.049129663306469E-43";
+        results[8][64]="482687.6965168229";
+        results[8][65]="1.138270511899841E-27";
+        results[8][66]="1.014780482794204E+29";
+        results[8][67]="3.674351845758363E-32";
+        results[8][68]="2.164887164052315E+24";
+        results[8][69]="1.631973176299542E-37";
+        results[8][70]="1.589522490205218E+19";
+        results[8][71]="9.973463726956913E-43";
+        results[8][72]="387420071212069.1";
+        results[8][73]="1.889862946953332E-47";
+        results[8][74]="1082019218.719317";
+        results[9][0]="892932943458573.4";
+        results[9][1]="1963453367.188511";
+        results[9][2]="44053.55276650961";
+        results[9][3]="0.5137124749367641";
+        results[9][4]="0.000003585549839831714";
+        results[9][5]="11186693042.92137";
+        results[9][6]="6.952017517839994E+18";
+        results[9][7]="107279.6885767942";
+        results[9][8]="10248583418146.87";
+        results[9][9]="1";
+        results[9][10]="364956305.8000387";
+        results[9][11]="0.00001211814956716597";
+        results[9][12]="1627.137733517652";
+        results[9][13]="1.524668125927760E-10";
+        results[9][14]="0.01225945829784226";
+        results[9][15]="1316967.743292346";
+        results[9][16]="1.512933318157422E+22";
+        results[9][17]="15.58673371619321";
+        results[9][18]="1.187368749772774E+17";
+        results[9][19]="0.0001004637203762303";
+        results[9][20]="4018149239271.144";
+        results[9][21]="1.873150034256679E-9";
+        results[9][22]="23084259.39015671";
+        results[9][23]="2.052987366292351E-14";
+        results[9][24]="122.2745137989658";
+        results[9][25]="122.4049286469690";
+        results[9][26]="3.278583000031628E+26";
+        results[9][27]="0.001426970768207302";
+        results[9][28]="5.056311230110650E+21";
+        results[9][29]="2.435862356942155E-8";
+        results[9][30]="1.139551937600652E+16";
+        results[9][31]="2.972084269024861E-13";
+        results[9][32]="231676891369.9822";
+        results[9][33]="1.278846701479992E-18";
+        results[9][34]="6129144.173823912";
+        results[9][35]="0.01504567185253299";
+        results[9][36]="3.170394917855513E+30";
+        results[9][37]="1.272982469772824E-7";
+        results[9][38]="1.551611888231443E+25";
+        results[9][39]="1.356742568040473E-12";
+        results[9][40]="2.813209021245996E+20";
+        results[9][41]="2.172121714689447E-17";
+        results[9][42]="1015954699945620";
+        results[9][43]="3.918432989082965E-22";
+        results[9][44]="26688321974.27763";
+        results[9][45]="0.000003437058493734438";
+        results[9][46]="1.871337328785176E+34";
+        results[9][47]="1.249459057884749E-11";
+        results[9][48]="1.549579136952070E+29";
+        results[9][49]="5.291541369807505E-16";
+        results[9][50]="5.222305512451464E+24";
+        results[9][51]="1.317109716528063E-21";
+        results[9][52]="9.357760127432864E+19";
+        results[9][53]="2.743546588523462E-26";
+        results[9][54]="381620019737136.4";
+        results[9][55]="1.389523253741598E-10";
+        results[9][56]="1.603990400090178E+38";
+        results[9][57]="1.393708228772385E-15";
+        results[9][58]="1.282048878882594E+33";
+        results[9][59]="2.734669331724314E-20";
+        results[9][60]="6.621981609843777E+28";
+        results[9][61]="1.264153321541716E-25";
+        results[9][62]="4.734331918675705E+23";
+        results[9][63]="1.075209287084869E-30";
+        results[9][64]="4.946865122665819E+18";
+        results[9][65]="1.166566029362225E-14";
+        results[9][66]="1.040006242902376E+42";
+        results[9][67]="3.765690139887650E-19";
+        results[9][68]="2.218702669166555E+37";
+        results[9][69]="1.672541323348396E-24";
+        results[9][70]="1.629035383588871E+32";
+        results[9][71]="1.022138749735799E-29";
+        results[9][72]="3.970506917681290E+27";
+        results[9][73]="1.936841806071609E-34";
+        results[9][74]="1.108916422308302E+22";
+        results[10][0]="2446684.518852554";
+        results[10][1]="5.379968330412397";
+        results[10][2]="0.0001207091152184304";
+        results[10][3]="1.407599942164664E-9";
+        results[10][4]="9.824600322966481E-15";
+        results[10][5]="30.65214346248511";
+        results[10][6]="19048903683.41529";
+        results[10][7]="0.0002939521440563168";
+        results[10][8]="28081.67239549524";
+        results[10][9]="2.740054039641405E-9";
+        results[10][10]="1";
+        results[10][11]="3.320438467449187E-14";
+        results[10][12]="0.000004458445319778002";
+        results[10][13]="4.177673057560849E-19";
+        results[10][14]="3.359157823281803E-11";
+        results[10][15]="0.003608562785085618";
+        results[10][16]="41455190501253.18";
+        results[10][17]="4.270849268387010E-8";
+        results[10][18]="325345453.9358852";
+        results[10][19]="2.752760228542944E-13";
+        results[10][20]="11009.94605494694";
+        results[10][21]="5.132532318219450E-18";
+        results[10][22]="0.06325211819412893";
+        results[10][23]="5.625296326342124E-23";
+        results[10][24]="3.350387754800450E-7";
+        results[10][25]="3.353961192111453E-7";
+        results[10][26]="8.983494593536299E+17";
+        results[10][27]="3.909977017876616E-12";
+        results[10][28]="13854566011748.89";
+        results[10][29]="6.674394491149785E-17";
+        results[10][30]="31224338.90003856";
+        results[10][31]="8.143671507496243E-22";
+        results[10][32]="634.8072020898827";
+        results[10][33]="3.504109070472339E-27";
+        results[10][34]="0.01679418625303079";
+        results[10][35]="4.122595393865199E-11";
+        results[10][36]="8.687053401928578E+21";
+        results[10][37]="3.488040758693718E-16";
+        results[10][38]="4.251500422304194E+16";
+        results[10][39]="3.717547954312753E-21";
+        results[10][40]="770834474302.0734";
+        results[10][41]="5.951730878927634E-26";
+        results[10][42]="2783770.779678667";
+        results[10][43]="1.073671814080092E-30";
+        results[10][44]="73.12744443686990";
+        results[10][45]="9.417726010240848E-15";
+        results[10][46]="5.127565407269577E+25";
+        results[10][47]="3.423585338923651E-20";
+        results[10][48]="4.245930573949562E+20";
+        results[10][49]="1.449910930627067E-24";
+        results[10][50]="1.430939931563421E+16";
+        results[10][51]="3.608951799423663E-30";
+        results[10][52]="256407684391.6768";
+        results[10][53]="7.517465912828107E-35";
+        results[10][54]="1045659.476688773";
+        results[10][55]="3.807368804590335E-19";
+        results[10][56]="4.395020375313125E+29";
+        results[10][57]="3.818835862329240E-24";
+        results[10][58]="3.512883209599986E+24";
+        results[10][59]="7.493141749474667E-29";
+        results[10][60]="1.814458746048353E+20";
+        results[10][61]="3.463848415416480E-34";
+        results[10][62]="1297232529877061";
+        results[10][63]="2.946131550536850E-39";
+        results[10][64]="13554677762.92165";
+        results[10][65]="3.196453961262399E-23";
+        results[10][66]="2.849673307116934E+33";
+        results[10][67]="1.031819447983696E-27";
+        results[10][68]="6.079365211412986E+28";
+        results[10][69]="4.582853609507953E-33";
+        results[10][70]="4.463644983521472E+23";
+        results[10][71]="2.800715410287590E-38";
+        results[10][72]="1.087940351921676E+19";
+        results[10][73]="5.307051214872866E-43";
+        results[10][74]="30384909225705.58";
+        results[11][0]="7.368558528753992E+19";
+        results[11][1]="162025840356721.7";
+        results[11][2]="3635336609.961668";
+        results[11][3]="42391.98997251724";
+        results[11][4]="0.2958826196985332";
+        results[11][5]="923135416089567.4";
+        results[11][6]="5.736863932325467E+23";
+        results[11][7]="8852811065.104166";
+        results[11][8]="8.457218126697593E+17";
+        results[11][9]="82520.84977639587";
+        results[11][10]="30116504485873.39";
+        results[11][11]="1";
+        results[11][12]="134272788.4731154";
+        results[11][13]="0.00001258169093785437";
+        results[11][14]="1011.660916536231";
+        results[11][15]="108677297304.5868";
+        results[11][16]="1.248485430693727E+27";
+        results[11][17]="1286230.511498665";
+        results[11][18]="9.798267822918602E+21";
+        results[11][19]="8.290351577144743";
+        results[11][20]="3.315810897530334E+17";
+        results[11][21]="0.0001545739325855462";
+        results[11][22]="1904932701334.478";
+        results[11][23]="1.694142620466497E-9";
+        results[11][24]="10090196.78468630";
+        results[11][25]="10100958.72876698";
+        results[11][26]="2.705514552250553E+31";
+        results[11][27]="117.7548403985430";
+        results[11][28]="4.172510994426643E+26";
+        results[11][29]="0.002010094316332011";
+        results[11][30]="9.403679425514422E+20";
+        results[11][31]="2.452589194869899E-8";
+        results[11][32]="1.911817394940469E+16";
+        results[11][33]="1.055315165398698E-13";
+        results[11][34]="505782185625.9951";
+        results[11][35]="1241.581626727822";
+        results[11][36]="2.616236827482037E+35";
+        results[11][37]="0.01050475951561086";
+        results[11][38]="1.280403315400169E+30";
+        results[11][39]="1.119595496425095E-7";
+        results[11][40]="2.321483990318425E+25";
+        results[11][41]="1.792453297139352E-12";
+        results[11][42]="8.383744517383584E+19";
+        results[11][43]="3.233524200509892E-17";
+        results[11][44]="2202343008423450";
+        results[11][45]="0.2836289876341450";
+        results[11][46]="1.544243465896434E+39";
+        results[11][47]="0.000001031064232174645";
+        results[11][48]="1.278725871770590E+34";
+        results[11][49]="4.366624904634691E-11";
+        results[11][50]="4.309490886794513E+29";
+        results[11][51]="1.086890130566436E-16";
+        results[11][52]="7.722103177194344E+24";
+        results[11][53]="2.263997958860880E-21";
+        results[11][54]="3.149160832039346E+19";
+        results[11][55]="0.00001146646396828192";
+        results[11][56]="1.323626508486227E+43";
+        results[11][57]="1.150099873786527E-10";
+        results[11][58]="1.057957629402673E+38";
+        results[11][59]="2.256672371113390E-15";
+        results[11][60]="5.464515496479744E+33";
+        results[11][61]="1.043190063412758E-20";
+        results[11][62]="3.906810930526339E+28";
+        results[11][63]="8.872718405771617E-26";
+        results[11][64]="4.082195136515981E+23";
+        results[11][65]="9.626602006324680E-10";
+        results[11][66]="8.582219893706080E+46";
+        results[11][67]="3.107479503381239E-14";
+        results[11][68]="1.830892296607818E+42";
+        results[11][69]="1.380195312888473E-19";
+        results[11][70]="1.344293841695707E+37";
+        results[11][71]="8.434775821758094E-25";
+        results[11][72]="3.276496048901183E+32";
+        results[11][73]="1.598298317194785E-29";
+        results[11][74]="9.150872549988179E+26";
+        results[12][0]="548775266570.8102";
+        results[12][1]="1206691.558276256";
+        results[12][2]="27.07426166761666";
+        results[12][3]="0.0003157154212300068";
+        results[12][4]="2.203593319712548E-9";
+        results[12][5]="6875074.440525237";
+        results[12][6]="4272543973773303";
+        results[12][7]="65.93153509191260";
+        results[12][8]="6298534664.297173";
+        results[12][9]="0.0006145761230907817";
+        results[12][10]="224293.4315161216";
+        results[12][11]="7.447525380023099E-9";
+        results[12][12]="1";
+        results[12][13]="9.370246258327704E-14";
+        results[12][14]="0.000007534370351881011";
+        results[12][15]="809.3769299082260";
+        results[12][16]="9.298126931680603E+18";
+        results[12][17]="0.009579234378946397";
+        results[12][18]="72972848291449.96";
+        results[12][19]="6.174260378010000E-8";
+        results[12][20]="2469458581.471433";
+        results[12][21]="1.151193286020835E-12";
+        results[12][22]="14187.03464042448";
+        results[12][23]="1.261717016330308E-17";
+        results[12][24]="0.07514699664337871";
+        results[12][25]="0.07522714649505796";
+        results[12][26]="2.014938829390782E+23";
+        results[12][27]="8.769821624887181E-7";
+        results[12][28]="3.107488152941784E+18";
+        results[12][29]="1.497022843712283E-11";
+        results[12][30]="7003414118711.969";
+        results[12][31]="1.826572027556399E-16";
+        results[12][32]="142383085.7078879";
+        results[12][33]="7.859486478230080E-22";
+        results[12][34]="3766.825664213152";
+        results[12][35]="0.000009246710676425823";
+        results[12][36]="1.948449017282359E+27";
+        results[12][37]="7.823446310355102E-11";
+        results[12][38]="9.535836188108477E+21";
+        results[12][39]="8.338215874985453E-16";
+        results[12][40]="1.728931093721377E+17";
+        results[12][41]="1.334934142295141E-20";
+        results[12][42]="624381500728.4375";
+        results[12][43]="2.408175355021632E-25";
+        results[12][44]="16402005.45075007";
+        results[12][45]="2.112334083915552E-9";
+        results[12][46]="1.150079240519853E+31";
+        results[12][47]="7.678877037554697E-15";
+        results[12][48]="9.523343384103629E+25";
+        results[12][49]="3.252054980230781E-19";
+        results[12][50]="3.209504275438039E+21";
+        results[12][51]="8.094641832690152E-25";
+        results[12][52]="5.751055939931189E+16";
+        results[12][53]="1.686118225893689E-29";
+        results[12][54]="234534552223.8769";
+        results[12][55]="8.539678142289999E-14";
+        results[12][56]="9.857742015622534E+34";
+        results[12][57]="8.565397999586525E-19";
+        results[12][58]="7.879166295965479E+29";
+        results[12][59]="1.680662475826388E-23";
+        results[12][60]="4.069711784956242E+25";
+        results[12][61]="7.769184473454425E-29";
+        results[12][62]="2.909607356004657E+20";
+        results[12][63]="6.607979551678220E-34";
+        results[12][64]="3040225188540963";
+        results[12][65]="7.169436276548434E-18";
+        results[12][66]="6.391630047531518E+38";
+        results[12][67]="2.314303246933335E-22";
+        results[12][68]="1.363561684707550E+34";
+        results[12][69]="1.027903962212583E-27";
+        results[12][70]="1.001166250423753E+29";
+        results[12][71]="6.281820700734860E-33";
+        results[12][72]="2.440178748173697E+24";
+        results[12][73]="1.190336728215637E-37";
+        results[12][74]="6.815135556539365E+18";
+        results[13][0]="5.856572510920854E+24";
+        results[13][1]="1.287790656733084E+19";
+        results[13][2]="288938635348614.2";
+        results[13][3]="3369339636.612199";
+        results[13][4]="23516.92003563011";
+        results[13][5]="7.337133145689837E+19";
+        results[13][6]="4.559692302618115E+28";
+        results[13][7]="703626492562206.3";
+        results[13][8]="6.721845393016666E+22";
+        results[13][9]="6558804391.555706";
+        results[13][10]="2.393677021207241E+18";
+        results[13][11]="79480.57259865707";
+        results[13][12]="10672078112261.57";
+        results[13][13]="1";
+        results[13][14]="80407388.92198187";
+        results[13][15]="8637733818243049";
+        results[13][16]="9.923033691261843E+31";
+        results[13][17]="102230337547.7774";
+        results[13][18]="7.787719370405676E+26";
+        results[13][19]="658921.8903956439";
+        results[13][20]="2.635425487645780E+22";
+        results[13][21]="12.28562467072543";
+        results[13][22]="1.514051418639709E+17";
+        results[13][23]="0.0001346514255384665";
+        results[13][24]="801974618079.9959";
+        results[13][25]="802829983557.8030";
+        results[13][26]="2.150358457868733E+36";
+        results[13][27]="9359222.141139671";
+        results[13][28]="3.316335630112216E+31";
+        results[13][29]="159.7634472393744";
+        results[13][30]="7.474098252740968E+25";
+        results[13][31]="0.001949331935575389";
+        results[13][32]="1.519523412539414E+21";
+        results[13][33]="8.387705361793504E-9";
+        results[13][34]="4.019985772375435E+16";
+        results[13][35]="98681618.62029944";
+        results[13][36]="2.079400011019663E+40";
+        results[13][37]="834.9243013119425";
+        results[13][38]="1.017671886652243E+35";
+        results[13][39]="0.008898609113474424";
+        results[13][40]="1.845128768291237E+30";
+        results[13][41]="1.424652144129865E-7";
+        results[13][42]="6.663448147624991E+24";
+        results[13][43]="2.570023549681410E-12";
+        results[13][44]="1.750434833681448E+20";
+        results[13][45]="22542.99434273927";
+        results[13][46]="1.227373549011834E+44";
+        results[13][47]="0.08194957555923548";
+        results[13][48]="1.016338644850434E+39";
+        results[13][49]="0.000003470618477439216";
+        results[13][50]="3.425208032911223E+34";
+        results[13][51]="8.638664992924948E-12";
+        results[13][52]="6.137571821893155E+29";
+        results[13][53]="1.799438541324536E-16";
+        results[13][54]="2.502971061357505E+24";
+        results[13][55]="0.9113611218809168";
+        results[13][56]="1.052025928012465E+48";
+        results[13][57]="0.000009141059651419642";
+        results[13][58]="8.408707817004228E+42";
+        results[13][59]="1.793616122236614E-10";
+        results[13][60]="4.343228206344449E+38";
+        results[13][61]="8.291334356927543E-16";
+        results[13][62]="3.105155697929257E+33";
+        results[13][63]="7.052087393973718E-21";
+        results[13][64]="3.244552069097433E+28";
+        results[13][65]="0.00007651278396420666";
+        results[13][66]="6.821197513193451E+51";
+        results[13][67]="2.469842502673314E-9";
+        results[13][68]="1.455203681008597E+47";
+        results[13][69]="1.096987137663585E-14";
+        results[13][70]="1.068452442788232E+42";
+        results[13][71]="6.704008120546416E-20";
+        results[13][72]="2.604177820839036E+37";
+        results[13][73]="1.270336654341115E-24";
+        results[13][74]="7.273165900503936E+31";
+        results[14][0]="7.283624788019671E+16";
+        results[14][1]="160158248389.6609";
+        results[14][2]="3593433.877438394";
+        results[14][3]="41.90335840753915";
+        results[14][4]="0.0002924721266406031";
+        results[14][5]="912494889345.1759";
+        results[14][6]="5.670737930617694E+20";
+        results[14][7]="8750769.077266332";
+        results[14][8]="835973594359440.8";
+        results[14][9]="81.56967263194704";
+        results[14][10]="29769366389.07392";
+        results[14][11]="0.0009884734930986993";
+        results[14][12]="132725.0922501232";
+        results[14][13]="1.243666799042916E-8";
+        results[14][14]="1";
+        results[14][15]="107424627.6871908";
+        results[14][16]="1.234094754760663E+24";
+        results[14][17]="1271.404766631212";
+        results[14][18]="9.685328021236938E+18";
+        results[14][19]="0.008194792782476575";
+        results[14][20]="327759118033654.3";
+        results[14][21]="1.527922350848377E-7";
+        results[14][22]="1882975481.406032";
+        results[14][23]="1.674615073859902E-12";
+        results[14][24]="9973.892061812134";
+        results[14][25]="9984.529958270096";
+        results[14][26]="2.674329420092467E+28";
+        results[14][27]="0.1163975384180276";
+        results[14][28]="4.124416517653632E+23";
+        results[14][29]="0.000001986924950322545";
+        results[14][30]="9.295287849718610E+17";
+        results[14][31]="2.424319408589176E-11";
+        results[14][32]="18897808185436.61";
+        results[14][33]="1.043151067861683E-16";
+        results[14][34]="499952283.7728221";
+        results[14][35]="1.227270527538816";
+        results[14][36]="2.586080755634628E+32";
+        results[14][37]="0.00001038367633255766";
+        results[14][38]="1.265644737748760E+27";
+        results[14][39]="1.106690471208886E-10";
+        results[14][40]="2.294725389082761E+22";
+        results[14][41]="1.771792571839617E-15";
+        results[14][42]="8.287109228345220E+16";
+        results[14][43]="3.196252961497192E-20";
+        results[14][44]="2176957686537.825";
+        results[14][45]="0.0002803597361507711";
+        results[14][46]="1.526443732929490E+36";
+        results[14][47]="1.019179663186800E-9";
+        results[14][48]="1.263986629184754E+31";
+        results[14][49]="4.316292972536028E-14";
+        results[14][50]="4.259817510346784E+26";
+        results[14][51]="1.074362083975506E-19";
+        results[14][52]="7.633094301629857E+21";
+        results[14][53]="2.237901970763539E-24";
+        results[14][54]="3.112862007975538E+16";
+        results[14][55]="1.133429569221800E-8";
+        results[14][56]="1.308369718401416E+40";
+        results[14][57]="1.136843239654142E-13";
+        results[14][58]="1.045763073486079E+35";
+        results[14][59]="2.230660821453777E-18";
+        results[14][60]="5.401528720897306E+30";
+        results[14][61]="1.031165725947463E-23";
+        results[14][62]="3.861779047373550E+25";
+        results[14][63]="8.770446955834192E-29";
+        results[14][64]="4.035141686102474E+20";
+        results[14][65]="9.515640911862703E-13";
+        results[14][66]="8.483296876872797E+43";
+        results[14][67]="3.071661119439865E-17";
+        results[14][68]="1.809788503915430E+39";
+        results[14][69]="1.364286482089321E-22";
+        results[14][70]="1.328798829452025E+34";
+        results[14][71]="8.337552320037675E-28";
+        results[14][72]="3.238729494581439E+29";
+        results[14][73]="1.579875520611302E-32";
+        results[14][74]="9.045394954387817E+23";
+        results[15][0]="678021878.6728144";
+        results[15][1]="1490.889490034119";
+        results[15][2]="0.03345074546501661";
+        results[15][3]="3.900721772064906E-7";
+        results[15][4]="2.722579849122226E-12";
+        results[15][5]="8494.280212934647";
+        results[15][6]="5278806222284.789";
+        results[15][7]="0.08145961746078984";
+        results[15][8]="7781954.774781330";
+        results[15][9]="7.593200403679254E-7";
+        results[15][10]="277.1186368526144";
+        results[15][11]="9.201553818525026E-12";
+        results[15][12]="0.001235518289498798";
+        results[15][13]="1.157711062927156E-16";
+        results[15][14]="9.308852369606484E-9";
+        results[15][15]="1";
+        results[15][16]="1.148800588217273E+16";
+        results[15][17]="0.00001183531927458393";
+        results[15][18]="90159288700.90755";
+        results[15][19]="7.628411621159118E-11";
+        results[15][20]="3051061.242567714";
+        results[15][21]="1.422320359626963E-15";
+        results[15][22]="17.52834077199745";
+        results[15][23]="1.558874449847949E-20";
+        results[15][24]="0.00009284548875379919";
+        results[15][25]="0.00009294451536144952";
+        results[15][26]="2.489493775933610E+20";
+        results[15][27]="1.083527501319018E-9";
+        results[15][28]="3839358447360413";
+        results[15][29]="1.849599103204027E-14";
+        results[15][30]="8652846232.602745";
+        results[15][31]="2.256763147132834E-19";
+        results[15][32]="175916.9065073704";
+        results[15][33]="9.710539289921761E-25";
+        results[15][34]="4.653982001488808";
+        results[15][35]="1.142448015842791E-8";
+        results[15][36]="2.407344397008314E+24";
+        results[15][37]="9.666011003355619E-14";
+        results[15][38]="1.178170001607253E+19";
+        results[15][39]="1.030201821533375E-18";
+        results[15][40]="213612598757592.2";
+        results[15][41]="1.649335548082038E-23";
+        results[15][42]="771434763.7746916";
+        results[15][43]="2.975344695449488E-28";
+        results[15][44]="20264.97771886068";
+        results[15][45]="2.609827394209354E-12";
+        results[15][46]="1.420943936035166E+28";
+        results[15][47]="9.487393022711177E-18";
+        results[15][48]="1.176626492823741E+23";
+        results[15][49]="4.017973406530782E-22";
+        results[15][50]="3.965401232528285E+18";
+        results[15][51]="1.000107803123075E-27";
+        results[15][52]="71055347977156.85";
+        results[15][53]="2.083229906348919E-32";
+        results[15][54]="289771728.7920109";
+        results[15][55]="1.055092853123241E-16";
+        results[15][56]="1.217942055346239E+32";
+        results[15][57]="1.058270588532557E-21";
+        results[15][58]="9.734854064667849E+26";
+        results[15][59]="2.076489227357834E-26";
+        results[15][60]="5.028203343302236E+22";
+        results[15][61]="9.598969511443032E-32";
+        results[15][62]="3.594873103603994E+17";
+        results[15][63]="8.164279592732510E-37";
+        results[15][64]="3756253824637.292";
+        results[15][65]="8.857969645071753E-21";
+        results[15][66]="7.896975823435262E+35";
+        results[15][67]="2.859363989032589E-25";
+        results[15][68]="1.684705400315972E+31";
+        results[15][69]="1.269994145161927E-30";
+        results[15][70]="1.236959213227480E+26";
+        results[15][71]="7.761304367110075E-36";
+        results[15][72]="3.014885473014884E+21";
+        results[15][73]="1.470682798372580E-40";
+        results[15][74]="8420224625517956";
+        results[16][0]="5.901998011029744E-8";
+        results[16][1]="1.297779184068582E-13";
+        results[16][2]="2.911797383123386E-18";
+        results[16][3]="3.395473341564099E-23";
+        results[16][4]="2.369932499205253E-28";
+        results[16][5]="7.394042360403217E-13";
+        results[16][6]="0.0004595058773843880";
+        results[16][7]="7.090840507594115E-18";
+        results[16][8]="6.773982233816134E-10";
+        results[16][9]="6.609676632793603E-23";
+        results[16][10]="2.412243166437193E-14";
+        results[16][11]="8.009705002679486E-28";
+        results[16][12]="1.075485425556837E-19";
+        results[16][13]="1.007756328470993E-32";
+        results[16][14]="8.103105504195564E-25";
+        results[16][15]="8.704730918982346E-17";
+        results[16][16]="1";
+        results[16][17]="1.030232696254985E-21";
+        results[16][18]="0.000007848123479882456";
+        results[16][19]="6.640327050142802E-27";
+        results[16][20]="2.655866713388787E-10";
+        results[16][21]="1.238091601114291E-31";
+        results[16][22]="1.525794898764651E-15";
+        results[16][23]="1.356958262240303E-36";
+        results[16][24]="8.081949966432234E-21";
+        results[16][25]="8.090569966166392E-21";
+        results[16][26]="21670.37344398340";
+        results[16][27]="9.431815342299341E-26";
+        results[16][28]="0.3342058218579424";
+        results[16][29]="1.610026250138211E-30";
+        results[16][30]="7.532069813813702E-7";
+        results[16][31]="1.964451594366708E-35";
+        results[16][32]="1.531309335246434E-11";
+        results[16][33]="8.452763159697483E-41";
+        results[16][34]="4.051166102474697E-16";
+        results[16][35]="9.944702566836774E-25";
+        results[16][36]="209552852.0527718";
+        results[16][37]="8.414002484413322E-30";
+        results[16][38]="1025.565284080813";
+        results[16][39]="8.967629648693503E-35";
+        results[16][40]="0.01859440193089382";
+        results[16][41]="1.435702214116641E-39";
+        results[16][42]="6.715132040207400E-8";
+        results[16][43]="2.589957496510927E-44";
+        results[16][44]="1.764011781218549E-12";
+        results[16][45]="2.271784521158129E-28";
+        results[16][46]="1236893461414.578";
+        results[16][47]="8.258520338533136E-34";
+        results[16][48]="10242217.01217658";
+        results[16][49]="3.497537734347732E-38";
+        results[16][50]="345.1775071495967";
+        results[16][51]="8.705669316160942E-44";
+        results[16][52]="0.006185176844958069";
+        results[16][53]="1.813395577714413E-48";
+        results[16][54]="2.522384927062784E-8";
+        results[16][55]="9.184299380979178E-33";
+        results[16][56]="1.060185786670131E+16";
+        results[16][57]="9.211960712648993E-38";
+        results[16][58]="84739285168.49519";
+        results[16][59]="1.807527998031550E-42";
+        results[16][60]="4376915.710937338";
+        results[16][61]="8.355644669662702E-48";
+        results[16][62]="31.29240305475972";
+        results[16][63]="7.106785700207527E-53";
+        results[16][64]="0.0003269717880686592";
+        results[16][65]="7.710624224886317E-37";
+        results[16][66]="6.874104961671300E+19";
+        results[16][67]="2.488999412395668E-41";
+        results[16][68]="1466490718750697";
+        results[16][69]="1.105495730231758E-46";
+        results[16][70]="10767397108.90133";
+        results[16][71]="6.756006609601578E-52";
+        results[16][72]="262437.6679414338";
+        results[16][73]="1.280189802700927E-56";
+        results[16][74]="0.7329578964252270";
+        results[17][0]="57288009131181.63";
+        results[17][1]="125969520.1662847";
+        results[17][2]="2826.349225478968";
+        results[17][3]="0.03295831469829135";
+        results[17][4]="2.300385638914618E-7";
+        results[17][5]="717706047.1174538";
+        results[17][6]="4.460214464700500E+17";
+        results[17][7]="6882.756229121966";
+        results[17][8]="657519632063.7410";
+        results[17][9]="0.06415712350055034";
+        results[17][10]="23414546.78351770";
+        results[17][11]="7.774656183788081E-7";
+        results[17][12]="104.3924765216976";
+        results[17][13]="9.781832125249994E-12";
+        results[17][14]="0.0007865315800645127";
+        results[17][15]="84492.86215264814";
+        results[17][16]="9.706544974112313E+20";
+        results[17][17]="1";
+        results[17][18]="7617816351986589";
+        results[17][19]="0.000006445463315502565";
+        results[17][20]="257792896987.5612";
+        results[17][21]="1.201759180828659E-10";
+        results[17][22]="1481019.680613023";
+        results[17][23]="1.317137640042879E-15";
+        results[17][24]="7.844781082769998";
+        results[17][25]="7.853148124279642";
+        results[17][26]="2.103444544398340E+25";
+        results[17][27]="0.00009155033980755107";
+        results[17][28]="3.243983840474286E+20";
+        results[17][29]="1.562779220646795E-9";
+        results[17][30]="731103743959364.5";
+        results[17][31]="1.906803775018709E-14";
+        results[17][32]="14863722931.84754";
+        results[17][33]="8.204712576512332E-20";
+        results[17][34]="393228.2597126994";
+        results[17][35]="0.0009652870271917130";
+        results[17][36]="2.034034182903733E+29";
+        results[17][37]="8.167089352725064E-9";
+        results[17][38]="9.954695553818683E+23";
+        results[17][39]="8.704470049622648E-14";
+        results[17][40]="1.804873986089417E+19";
+        results[17][41]="1.393570811075580E-18";
+        results[17][42]="65180731155375.70";
+        results[17][43]="2.513953892092264E-23";
+        results[17][44]="1712245968.926182";
+        results[17][45]="2.205117862611359E-7";
+        results[17][46]="1.200596201140605E+33";
+        results[17][47]="8.016169908559313E-13";
+        results[17][48]="9.941654006331020E+27";
+        results[17][49]="3.394900731710114E-17";
+        results[17][50]="3.350480997199534E+23";
+        results[17][51]="8.450197074706576E-23";
+        results[17][52]="6.003669721842360E+18";
+        results[17][53]="1.760180573094133E-27";
+        results[17][54]="24483642736557.92";
+        results[17][55]="8.914781499718627E-12";
+        results[17][56]="1.029074101922827E+37";
+        results[17][57]="8.941631095708316E-17";
+        results[17][58]="8.225256825621270E+31";
+        results[17][59]="1.754485180486043E-21";
+        results[17][60]="4.248472919611204E+27";
+        results[17][61]="8.110444077378283E-27";
+        results[17][62]="3.037411175990747E+22";
+        results[17][63]="6.898233502044262E-32";
+        results[17][64]="3.173766366154361E+17";
+        results[17][65]="7.484352081733892E-16";
+        results[17][66]="6.672380896723107E+40";
+        results[17][67]="2.415958473695767E-20";
+        results[17][68]="1.423455811567193E+36";
+        results[17][69]="1.073054402418369E-25";
+        results[17][70]="1.045142242916776E+31";
+        results[17][71]="6.557748200149776E-31";
+        results[17][72]="2.547363026774680E+26";
+        results[17][73]="1.242621989531652E-35";
+        results[17][74]="7.114488785782220E+20";
+        results[18][0]="0.007520266502124582";
+        results[18][1]="1.653617183005917E-8";
+        results[18][2]="3.710182938109170E-13";
+        results[18][3]="4.326477979440449E-18";
+        results[18][4]="3.019744153210938E-23";
+        results[18][5]="9.421414404802356E-8";
+        results[18][6]="58.54977671570353";
+        results[18][7]="9.035077653620603E-13";
+        results[18][8]="0.00008631340028199442";
+        results[18][9]="8.421983483996608E-18";
+        results[18][10]="3.073655979828342E-9";
+        results[18][11]="1.020588555112725E-22";
+        results[18][12]="1.370372711787334E-14";
+        results[18][13]="1.284072977513965E-27";
+        results[18][14]="1.032489553071727E-19";
+        results[18][15]="1.109148058296442E-11";
+        results[18][16]="127418.9941790999";
+        results[18][17]="1.312712139272323E-16";
+        results[18][18]="1";
+        results[18][19]="8.461037937494653E-22";
+        results[18][20]="0.00003384078652937511";
+        results[18][21]="1.577563865155743E-26";
+        results[18][22]="1.944152513241934E-10";
+        results[18][23]="1.729022569176787E-31";
+        results[18][24]="1.029793935728606E-15";
+        results[18][25]="1.030892287424556E-15";
+        results[18][26]="2761217187.717842";
+        results[18][27]="1.201792424198785E-20";
+        results[18][28]="42584.16966993846";
+        results[18][29]="2.051479253945588E-25";
+        results[18][30]="0.09597287597629022";
+        results[18][31]="2.503084462677351E-30";
+        results[18][32]="0.000001951178952741667";
+        results[18][33]="1.077042579842804E-35";
+        results[18][34]="5.161955100297903E-11";
+        results[18][35]="1.267143998476655E-19";
+        results[18][36]="26701013635925.91";
+        results[18][37]="1.072103733584393E-24";
+        results[18][38]="130676496.9625801";
+        results[18][39]="1.142646350007201E-29";
+        results[18][40]="2369.279991396404";
+        results[18][41]="1.829357320634491E-34";
+        results[18][42]="0.008556353703430740";
+        results[18][43]="3.300097791720419E-39";
+        results[18][44]="2.247686068829500E-7";
+        results[18][45]="2.894684986776169E-23";
+        results[18][46]="1.576037207601508E+17";
+        results[18][47]="1.052292354943532E-28";
+        results[18][48]="1305052989855.606";
+        results[18][49]="4.456527402140359E-33";
+        results[18][50]="43982170.77425067";
+        results[18][51]="1.109267627921080E-38";
+        results[18][52]="788.1090124044157";
+        results[18][53]="2.310610405611983E-43";
+        results[18][54]="0.003213997503388622";
+        results[18][55]="1.170254189364097E-27";
+        results[18][56]="1.350878065804859E+21";
+        results[18][57]="1.173778768423119E-32";
+        results[18][58]="1.079739448362558E+16";
+        results[18][59]="2.303133994597421E-37";
+        results[18][60]="557702197494.3356";
+        results[18][61]="1.064667839526379E-42";
+        results[18][62]="3987246.522684476";
+        results[18][63]="9.055394857668533E-48";
+        results[18][64]="41.66241636065038";
+        results[18][65]="9.824799832280163E-32";
+        results[18][66]="8.758915400977171E+24";
+        results[18][67]="3.171458016398266E-36";
+        results[18][68]="1.868587723561991E+20";
+        results[18][69]="1.408611540154202E-41";
+        results[18][70]="1371970909543155";
+        results[18][71]="8.608435668627840E-47";
+        results[18][72]="33439543683.80610";
+        results[18][73]="1.631204970184925E-51";
+        results[18][74]="93392.75793813131";
+        results[19][0]="8.888113441495055E+18";
+        results[19][1]="19543904603925.69";
+        results[19][2]="438502104.0583787";
+        results[19][3]="5113.412812236528";
+        results[19][4]="0.03568999661175253";
+        results[19][5]="111350575123317.2";
+        results[19][6]="6.919928399829436E+22";
+        results[19][7]="1067845070.589050";
+        results[19][8]="1.020127801336300E+17";
+        results[19][9]="9953.842006398556";
+        results[19][10]="3632717407172.463";
+        results[19][11]="0.1206221462014772";
+        results[19][12]="16196271.92208414";
+        results[19][13]="0.000001517630563767670";
+        results[19][14]="122.0287109807536";
+        results[19][15]="13108888844.25527";
+        results[19][16]="1.505949921515530E+26";
+        results[19][17]="155147.8848067927";
+        results[19][18]="1.181888093857317E+21";
+        results[19][19]="1";
+        results[19][20]="3.999602268583552E+16";
+        results[19][21]="0.00001864503949527103";
+        results[19][22]="229777070804.3422";
+        results[19][23]="2.043511188520634E-10";
+        results[19][24]="1217101.191764106";
+        results[19][25]="1218399.320556418";
+        results[19][26]="3.263449718717902E+30";
+        results[19][27]="14.20384157448466";
+        results[19][28]="5.032972311970014E+25";
+        results[19][29]="0.0002424618905033581";
+        results[19][30]="1.134291994496223E+20";
+        results[19][31]="2.958365724357601E-9";
+        results[19][32]="2306075173230364";
+        results[19][33]="1.272943801693578E-14";
+        results[19][34]="61008532740.68144";
+        results[19][35]="149.7622405002312";
+        results[19][36]="3.155761011022271E+34";
+        results[19][37]="0.001267106638103371";
+        results[19][38]="1.544449959070552E+29";
+        results[19][39]="1.350480116563032E-8";
+        results[19][40]="2.800223812845777E+24";
+        results[19][41]="2.162095636668628E-13";
+        results[19][42]="1.011265256891675E+19";
+        results[19][43]="3.900346288599187E-18";
+        results[19][44]="265651340347854.4";
+        results[19][45]="0.03421193721338280";
+        results[19][46]="1.862699611140355E+38";
+        results[19][47]="1.243691805564838E-7";
+        results[19][48]="1.542426590563234E+33";
+        results[19][49]="5.267116676538570E-12";
+        results[19][50]="5.198200398008612E+28";
+        results[19][51]="1.311030202341272E-17";
+        results[19][52]="9.314566584224275E+23";
+        results[19][53]="2.730882927935629E-22";
+        results[19][54]="3.798585382942154E+18";
+        results[19][55]="0.000001383109493196072";
+        results[19][56]="1.596586702227764E+42";
+        results[19][57]="1.387275151221789E-11";
+        results[19][58]="1.276131198487774E+37";
+        results[19][59]="2.722046646772734E-16";
+        results[19][60]="6.591415871366172E+32";
+        results[19][61]="1.258318243449020E-21";
+        results[19][62]="4.712479192434771E+27";
+        results[19][63]="1.070246336745521E-26";
+        results[19][64]="4.924031385797897E+22";
+        results[19][65]="1.161181394630329E-10";
+        results[19][66]="1.035205782751841E+46";
+        results[19][67]="3.748308469749455E-15";
+        results[19][68]="2.208461582805865E+41";
+        results[19][69]="1.664821208178269E-20";
+        results[19][70]="1.621516083107649E+36";
+        results[19][71]="1.017420762348790E-25";
+        results[19][72]="3.952179854391208E+31";
+        results[19][73]="1.927901732902443E-30";
+        results[19][74]="1.103797886595758E+26";
+        results[20][0]="222.2249324966694";
+        results[20][1]="0.0004886462025847162";
+        results[20][2]="1.096364274774934E-8";
+        results[20][3]="1.278480326006873E-13";
+        results[20][4]="8.923386430719285E-19";
+        results[20][5]="0.002784041203245736";
+        results[20][6]="1730154.134120969";
+        results[20][7]="2.669878150077217E-8";
+        results[20][8]="2.550573114105107";
+        results[20][9]="2.488707960935246E-13";
+        results[20][10]="0.00009082696636380747";
+        results[20][11]="3.015853529960997E-18";
+        results[20][12]="4.049470630943514E-10";
+        results[20][13]="3.794453702780639E-23";
+        results[20][14]="3.051021146259370E-15";
+        results[20][15]="3.277548107026588E-7";
+        results[20][16]="3765249193.262553";
+        results[20][17]="3.879082828446787E-12";
+        results[20][18]="29550.14060125232";
+        results[20][19]="2.500248606854969E-17";
+        results[20][20]="1";
+        results[20][21]="4.661723402280728E-22";
+        results[20][22]="0.000005744998011657722";
+        results[20][23]="5.109286002191258E-27";
+        results[20][24]="3.043055559109729E-11";
+        results[20][25]="3.046301203814225E-11";
+        results[20][26]="81594356127656.76";
+        results[20][27]="3.551313510859396E-16";
+        results[20][28]="1258368201.134266";
+        results[20][29]="6.062150039464433E-21";
+        results[20][30]="2836.011979005927";
+        results[20][31]="7.396649780892585E-26";
+        results[20][32]="0.05765761239172050";
+        results[20][33]="3.182675966789038E-31";
+        results[20][34]="0.000001525364989911545";
+        results[20][35]="3.744428331701820E-15";
+        results[20][36]="7.890187071375662E+17";
+        results[20][37]="3.168081606654638E-20";
+        results[20][38]="3861508858523.363";
+        results[20][39]="3.376536030022057E-25";
+        results[20][40]="70012556.86949763";
+        results[20][41]="5.405776603467944E-30";
+        results[20][42]="252.8414549704244";
+        results[20][43]="9.751835374322068E-35";
+        results[20][44]="0.006641943936138782";
+        results[20][45]="8.553834835557002E-19";
+        results[20][46]="4.657212107742966E+21";
+        results[20][47]="3.109538704220428E-24";
+        results[20][48]="3.856449934231786E+16";
+        results[20][49]="1.316910113265814E-28";
+        results[20][50]="1299679330327.398";
+        results[20][51]="3.277901436948555E-34";
+        results[20][52]="23288732.12566459";
+        results[20][53]="6.827886236055077E-39";
+        results[20][54]="94.97407811720772";
+        results[20][55]="3.458117583491362E-23";
+        results[20][56]="3.991863677968137E+25";
+        results[20][57]="3.468532764166796E-28";
+        results[20][58]="3.190645251183220E+20";
+        results[20][59]="6.805793336387770E-33";
+        results[20][60]="1.648017834958501E+16";
+        results[20][61]="3.146108435163604E-38";
+        results[20][62]="117823695357.1807";
+        results[20][63]="2.675881912439624E-43";
+        results[20][64]="1231130.261245134";
+        results[20][65]="2.903242164230390E-27";
+        results[20][66]="2.588271816133498E+29";
+        results[20][67]="9.371703029553756E-32";
+        results[20][68]="5.521702995703085E+24";
+        results[20][69]="4.162466906410325E-37";
+        results[20][70]="4.054193327782826E+19";
+        results[20][71]="2.543804843647882E-42";
+        results[20][72]="988143217498189.4";
+        results[20][73]="4.820233621842614E-47";
+        results[20][74]="2759769128.210504";
+        results[21][0]="4.767012396916274E+23";
+        results[21][1]="1.048209343234839E+18";
+        results[21][2]="23518432565916.35";
+        results[21][3]="274250575.5235032";
+        results[21][4]="1914.181872385126";
+        results[21][5]="5.972128680744241E+18";
+        results[21][6]="3.711404527506926E+27";
+        results[21][7]="57272341571595.42";
+        results[21][8]="5.471309415005725E+21";
+        results[21][9]="533860065.5108917";
+        results[21][10]="1.948355973230217E+17";
+        results[21][11]="6469.396121798011";
+        results[21][12]="868663857010.9776";
+        results[21][13]="0.08139594255901624";
+        results[21][14]="6544835.210014115";
+        results[21][15]="703076485709783.2";
+        results[21][16]="8.076946803451319E+30";
+        results[21][17]="8321134682.827734";
+        results[21][18]="6.338887585392785E+25";
+        results[21][19]="53633.56834152223";
+        results[21][20]="2.145129416109833E+21";
+        results[21][21]="1";
+        results[21][22]="1.232376423029948E+16";
+        results[21][23]="0.00001096007969861868";
+        results[21][24]="65277479947.02833";
+        results[21][25]="65347103226.32689";
+        results[21][26]="1.750304535179781E+35";
+        results[21][27]="761802.7077972777";
+        results[21][28]="2.699362644550329E+30";
+        results[21][29]="13.00409637452654";
+        results[21][30]="6.083612720605475E+24";
+        results[21][31]="0.0001586677102565503";
+        results[21][32]="1.236830404041385E+20";
+        results[21][33]="6.827251838304966E-10";
+        results[21][34]="3272105310163334";
+        results[21][35]="8032283.360848641";
+        results[21][36]="1.692547238541742E+39";
+        results[21][37]="67.95945047071364";
+        results[21][38]="8.283436242987168E+33";
+        results[21][39]="0.0007243106762555027";
+        results[21][40]="1.501859952378219E+29";
+        results[21][41]="1.159609040901739E-8";
+        results[21][42]="5.423776426690670E+23";
+        results[21][43]="2.091894892251871E-13";
+        results[21][44]="1.424782931756363E+19";
+        results[21][45]="1834.908272629834";
+        results[21][46]="9.990322689382312E+42";
+        results[21][47]="0.006670362944955292";
+        results[21][48]="8.272584195675434E+37";
+        results[21][49]="2.824942622339028E-7";
+        results[21][50]="2.787980362995230E+33";
+        results[21][51]="7.031522795507035E-13";
+        results[21][52]="4.995734434666519E+28";
+        results[21][53]="1.464669961481319E-17";
+        results[21][54]="2.037316887371354E+23";
+        results[21][55]="0.07418109752713971";
+        results[21][56]="8.563064200709839E+46";
+        results[21][57]="7.440451663154942E-7";
+        results[21][58]="6.844346984684270E+41";
+        results[21][59]="1.459930748584969E-11";
+        results[21][60]="3.535211536043119E+37";
+        results[21][61]="6.748809750540721E-17";
+        results[21][62]="2.527470748254518E+32";
+        results[21][63]="5.740113004410473E-22";
+        results[21][64]="2.640933738459919E+27";
+        results[21][65]="0.000006227830168580984";
+        results[21][66]="5.552178009675986E+50";
+        results[21][67]="2.010351584774140E-10";
+        results[21][68]="1.184476752310447E+46";
+        results[21][69]="8.929030204524482E-16";
+        results[21][70]="8.696769366023154E+40";
+        results[21][71]="5.456790598951745E-21";
+        results[21][72]="2.119695083184782E+36";
+        results[21][73]="1.034002493473623E-25";
+        results[21][74]="5.920061938596140E+30";
+        results[22][0]="38681463.77870482";
+        results[22][1]="85.05593937424482";
+        results[22][2]="0.001908380599175486";
+        results[22][3]="2.225379927743381E-8";
+        results[22][4]="1.553244476779973E-13";
+        results[22][5]="484.6026400002877";
+        results[22][6]="301158352119.5565";
+        results[22][7]="0.004647309093335652";
+        results[22][8]="443964.1421858626";
+        results[22][9]="4.331956174545530E-8";
+        results[22][10]="15.80974722349805";
+        results[22][11]="5.249529284155089E-13";
+        results[22][12]="0.00007048689351547812";
+        results[22][13]="6.604795502245522E-18";
+        results[22][14]="5.310743606992122E-10";
+        results[22][15]="0.05705046547232572";
+        results[22][16]="655396082926770.0";
+        results[22][17]="6.752104736286019E-7";
+        results[22][18]="5143629387.040573";
+        results[22][19]="4.352044338016266E-12";
+        results[22][20]="174064.4640730606";
+        results[22][21]="8.114403856748394E-17";
+        results[22][22]="1";
+        results[22][23]="8.893451297674116E-22";
+        results[22][24]="0.000005296878350409827";
+        results[22][25]="0.000005302527864470423";
+        results[22][26]="1.420267787074702E+19";
+        results[22][27]="6.181574830231600E-11";
+        results[22][28]="219037186537017.3";
+        results[22][29]="1.055204897749860E-15";
+        results[22][30]="493648905.2304466";
+        results[22][31]="1.287493880047189E-20";
+        results[22][32]="10036.14140069709";
+        results[22][33]="5.539907864773438E-26";
+        results[22][34]="0.2655118394847626";
+        results[22][35]="6.517719108176616E-10";
+        results[22][36]="1.373401184015196E+23";
+        results[22][37]="5.514504270020602E-15";
+        results[22][38]="6.721514699722450E+17";
+        results[22][39]="5.877349344891688E-20";
+        results[22][40]="12186698189873.78";
+        results[22][41]="9.409536073813374E-25";
+        results[22][42]="44010712.35487979";
+        results[22][43]="1.697447998160085E-29";
+        results[22][44]="1156.126411647312";
+        results[22][45]="1.488918676420706E-13";
+        results[22][46]="8.106551296088482E+26";
+        results[22][47]="5.412601880645680E-19";
+        results[22][48]="6.712708910266456E+21";
+        results[22][49]="2.292272530980073E-23";
+        results[22][50]="2.262279861002728E+17";
+        results[22][51]="5.705661569067654E-29";
+        results[22][52]="4053740676394.876";
+        results[22][53]="1.188492358430754E-33";
+        results[22][54]="16531612.00830475";
+        results[22][55]="6.019353838720512E-18";
+        results[22][56]="6.948416117582402E+30";
+        results[22][57]="6.037482967145447E-23";
+        results[22][58]="5.553779556944628E+25";
+        results[22][59]="1.184646769690344E-27";
+        results[22][60]="2.868613412248970E+21";
+        results[22][61]="5.476256786824880E-33";
+        results[22][62]="2.050891838745521E+16";
+        results[22][63]="4.657759510115996E-38";
+        results[22][64]="214296029127.7612";
+        results[22][65]="5.053512913910754E-22";
+        results[22][66]="4.505261465506844E+34";
+        results[22][67]="1.631280465291153E-26";
+        results[22][68]="9.611322727176706E+29";
+        results[22][69]="7.245375712861636E-32";
+        results[22][70]="7.056909888490957E+24";
+        results[22][71]="4.427860268160242E-37";
+        results[22][72]="1.720006195812521E+20";
+        results[22][73]="8.390313820929822E-42";
+        results[22][74]="480377734267339.0";
+        results[23][0]="4.349432237720928E+28";
+        results[23][1]="9.563884315247705E+22";
+        results[23][2]="2.145826783438484E+18";
+        results[23][3]="25022680771022.83";
+        results[23][4]="174650360.6745100";
+        results[23][5]="5.448982895167197E+23";
+        results[23][6]="3.386293375197521E+32";
+        results[23][7]="5.225540611608288E+18";
+        results[23][8]="4.992034333194938E+26";
+        results[23][9]="48709505787460.23";
+        results[23][10]="1.777684128953709E+22";
+        results[23][11]="590269076.4751797";
+        results[23][12]="7.925707484777299E+16";
+        results[23][13]="7426.583090383436";
+        results[23][14]="597152154909.8750";
+        results[23][15]="6.414884791379698E+19";
+        results[23][16]="7.369423421683034E+35";
+        results[23][17]="759222096156514.8";
+        results[23][18]="5.783614498890633E+30";
+        results[23][19]="4893538169.095777";
+        results[23][20]="1.957220636251567E+26";
+        results[23][21]="91240.21243440706";
+        results[23][22]="1.124422866364071E+21";
+        results[23][23]="1";
+        results[23][24]="5955931137549612";
+        results[23][25]="5962283580343192";
+        results[23][26]="1.596981576147093E+40";
+        results[23][27]="69507040892.53014";
+        results[23][28]="2.462904211262749E+35";
+        results[23][29]="1186496.515729304";
+        results[23][30]="5.550701169967046E+29";
+        results[23][31]="14.47687559028860";
+        results[23][32]="1.128486688100694E+25";
+        results[23][33]="0.00006229199080701412";
+        results[23][34]="2.985475836070540E+20";
+        results[23][35]="732867240177.1831";
+        results[23][36]="1.544283695998176E+44";
+        results[23][37]="6200634.697873477";
+        results[23][38]="7.557824824970159E+38";
+        results[23][39]="66.08625997006110";
+        results[23][40]="1.370300211017172E+34";
+        results[23][41]="0.001058029752327336";
+        results[23][42]="4.948665133679859E+28";
+        results[23][43]="1.908649343595118E-8";
+        results[23][44]="1.299974973663679E+24";
+        results[23][45]="167417420.5923969";
+        results[23][46]="9.115191644675190E+47";
+        results[23][47]="608.6053321123179";
+        results[23][48]="7.547923393949451E+42";
+        results[23][49]="0.02577483649772239";
+        results[23][50]="2.543759205826400E+38";
+        results[23][51]="6.415576335994377E-8";
+        results[23][52]="4.558118710848557E+33";
+        results[23][53]="1.336367984318503E-12";
+        results[23][54]="1.858852255999673E+28";
+        results[23][55]="6768.299096993695";
+        results[23][56]="7.812957967622318E+51";
+        results[23][57]="0.06788683903541942";
+        results[23][58]="6.244796728573862E+46";
+        results[23][59]="0.000001332043916404155";
+        results[23][60]="3.225534515491407E+42";
+        results[23][61]="6.157628353187331E-12";
+        results[23][62]="2.306069679924920E+37";
+        results[23][63]="5.237291299199141E-17";
+        results[23][64]="2.409593553222759E+32";
+        results[23][65]="0.5682285475867381";
+        results[23][66]="5.065819010764803E+55";
+        results[23][67]="0.00001834249056626394";
+        results[23][68]="1.080719105044218E+51";
+        results[23][69]="8.146866126940509E-11";
+        results[23][70]="7.934950844489962E+45";
+        results[23][71]="4.978787334584325E-16";
+        results[23][72]="1.934014296859477E+41";
+        results[23][73]="9.434260716223996E-21";
+        results[23][74]="5.401477089023595E+35";
+        results[24][0]="7302690607518.291";
+        results[24][1]="16057748.30899485";
+        results[24][2]="360.2840150232697";
+        results[24][3]="0.004201304580784266";
+        results[24][4]="2.932377098408908E-8";
+        results[24][5]="91488346.14311905";
+        results[24][6]="5.685581812469896E+16";
+        results[24][7]="877.3675334597941";
+        results[24][8]="83816186216.83326";
+        results[24][9]="0.008178319168327438";
+        results[24][10]="2984729.151326427";
+        results[24][11]="9.910609488981233E-8";
+        results[24][12]="13.30725171553627";
+        results[24][13]="1.246922255961287E-12";
+        results[24][14]="0.0001002617627905542";
+        results[24][15]="10770.58253903672";
+        results[24][16]="1.237325155628808E+20";
+        results[24][17]="0.1274732831227585";
+        results[24][18]="971068060613965.9";
+        results[24][19]="8.216243700744122E-7";
+        results[24][20]="32861706944.73151";
+        results[24][21]="1.531921883031460E-11";
+        results[24][22]="188790.4410571613";
+        results[24][23]="1.678998593008280E-16";
+        results[24][24]="1";
+        results[24][25]="1.001066574251259";
+        results[24][26]="2.681329819411114E+24";
+        results[24][27]="0.00001167022238627271";
+        results[24][28]="4.135212705424321E+19";
+        results[24][29]="1.992125980518727E-10";
+        results[24][30]="93196194545840.82";
+        results[24][31]="2.430665374725046E-15";
+        results[24][32]="1894727561.549639";
+        results[24][33]="1.045881649206614E-20";
+        results[24][34]="50126.09728222654";
+        results[24][35]="0.0001230483065119351";
+        results[24][36]="2.592850152786563E+28";
+        results[24][37]="1.041085693348789E-9";
+        results[24][38]="1.268957724732794E+23";
+        results[24][39]="1.109587375069120E-14";
+        results[24][40]="2.300732126296780E+18";
+        results[24][41]="1.776430465518496E-19";
+        results[24][42]="8308801796717.613";
+        results[24][43]="3.204619562442379E-24";
+        results[24][44]="218265615.1727291";
+        results[24][45]="2.810936136197098E-8";
+        results[24][46]="1.530439394641047E+32";
+        results[24][47]="1.021847496313918E-13";
+        results[24][48]="1.267295275857541E+27";
+        results[24][49]="4.327591421469434E-18";
+        results[24][50]="4.270968127534385E+22";
+        results[24][51]="1.077174364147177E-23";
+        results[24][52]="7.653074902279439E+17";
+        results[24][53]="2.243759965412078E-28";
+        results[24][54]="3121010322433.718";
+        results[24][55]="1.136396466091162E-12";
+        results[24][56]="1.311794543487070E+36";
+        results[24][57]="1.139819072242488E-17";
+        results[24][58]="1.048500492089822E+31";
+        results[24][59]="2.236499861467814E-22";
+        results[24][60]="5.415667913209714E+26";
+        results[24][61]="1.033864934126942E-27";
+        results[24][62]="3.871887747972994E+21";
+        results[24][63]="8.793404722529862E-33";
+        results[24][64]="4.045704185582832E+16";
+        results[24][65]="9.540549319052715E-17";
+        results[24][66]="8.505502991508699E+39";
+        results[24][67]="3.079701585302480E-21";
+        results[24][68]="1.814525856806408E+35";
+        results[24][69]="1.367857676455993E-26";
+        results[24][70]="1.332277130348850E+30";
+        results[24][71]="8.359376929654525E-32";
+        results[24][72]="3.247207283284959E+25";
+        results[24][73]="1.584011046861337E-36";
+        results[24][74]="9.069072432637074E+19";
+        results[25][0]="7294910044299.792";
+        results[25][1]="16040639.77563644";
+        results[25][2]="359.9001547851519";
+        results[25][3]="0.004196828351727361";
+        results[25][4]="2.929252832762058E-8";
+        results[25][5]="91390870.99331748";
+        results[25][6]="5.679524178222003E+16";
+        results[25][7]="876.4327528526417";
+        results[25][8]="83726885276.85887";
+        results[25][9]="0.008169605677269126";
+        results[25][10]="2981549.107819164";
+        results[25][11]="9.900050350191554E-8";
+        results[25][12]="13.29307366544463";
+        results[25][13]="1.245593737753071E-12";
+        results[25][14]="0.0001001549401102962";
+        results[25][15]="10759.10715238146";
+        results[25][16]="1.236006862534849E+20";
+        results[25][17]="0.1273374682578942";
+        results[25][18]="970033447915559.5";
+        results[25][19]="8.207489803452292E-7";
+        results[25][20]="32826694837.26416";
+        results[25][21]="1.530289715424023E-11";
+        results[25][22]="188589.2965693774";
+        results[25][23]="1.677209724302378E-16";
+        results[25][24]="0.9989345621173533";
+        results[25][25]="1";
+        results[25][26]="2.678473029045643E+24";
+        results[25][27]="0.00001165778848924346";
+        results[25][28]="4.130806893155160E+19";
+        results[25][29]="1.990003494032078E-10";
+        results[25][30]="93096899789653.17";
+        results[25][31]="2.428075651754777E-15";
+        results[25][32]="1892708847.028269";
+        results[25][33]="1.044767327276784E-20";
+        results[25][34]="50072.69103927282";
+        results[25][35]="0.0001229172061847818";
+        results[25][36]="2.590087632009758E+28";
+        results[25][37]="1.039976481212013E-9";
+        results[25][38]="1.267605729101387E+23";
+        results[25][39]="1.108405178645614E-14";
+        results[25][40]="2.298280839131601E+18";
+        results[25][41]="1.774537789204645E-19";
+        results[25][42]="8299949284523.987";
+        results[25][43]="3.201205239361082E-24";
+        results[25][44]="218033066.7178449";
+        results[25][45]="2.807941258351893E-8";
+        results[25][46]="1.528808806532901E+32";
+        results[25][47]="1.020758781281058E-13";
+        results[25][48]="1.265945051462143E+27";
+        results[25][49]="4.322980641628383E-18";
+        results[25][50]="4.266417676295733E+22";
+        results[25][51]="1.076026701773399E-23";
+        results[25][52]="7.644921026359818E+17";
+        results[25][53]="2.241369378545362E-28";
+        results[25][54]="3117685079804.065";
+        results[25][55]="1.135185706246483E-12";
+        results[25][56]="1.310396907886189E+36";
+        results[25][57]="1.138604665823557E-17";
+        results[25][58]="1.047383379945576E+31";
+        results[25][59]="2.234117009790872E-22";
+        results[25][60]="5.409897855455146E+26";
+        results[25][61]="1.032763415260583E-27";
+        results[25][62]="3.867762492088947E+21";
+        results[25][63]="8.784035896021034E-33";
+        results[25][64]="4.041393739081530E+16";
+        results[25][65]="9.530384456386937E-17";
+        results[25][66]="8.496440906410580E+39";
+        results[25][67]="3.076420354566251E-21";
+        results[25][68]="1.812592592219525E+35";
+        results[25][69]="1.366400309069427E-26";
+        results[25][70]="1.330857671823993E+30";
+        results[25][71]="8.350470532798348E-32";
+        results[25][72]="3.243747585632540E+25";
+        results[25][73]="1.582323381485480E-36";
+        results[25][74]="9.059409899306875E+19";
+        results[26][0]="2.723533134436308E-12";
+        results[26][1]="5.988725516997952E-18";
+        results[26][2]="1.343676605597132E-22";
+        results[26][3]="1.566873478364917E-27";
+        results[26][4]="1.093627899552070E-32";
+        results[26][5]="3.412051194925813E-17";
+        results[26][6]="2.120433589075808E-8";
+        results[26][7]="3.272135815251872E-22";
+        results[26][8]="3.125918550193178E-14";
+        results[26][9]="3.050098167380094E-27";
+        results[26][10]="1.113152559494507E-18";
+        results[26][11]="3.696154578685082E-32";
+        results[26][12]="4.962929819077190E-24";
+        results[26][13]="4.650387456755103E-37";
+        results[26][14]="3.739255128732137E-29";
+        results[26][15]="4.016880900314683E-21";
+        results[26][16]="0.00004614595141080237";
+        results[26][17]="4.754106794320244E-26";
+        results[26][18]="3.621591247686330E-10";
+        results[26][19]="3.064242094077263E-31";
+        results[26][20]="1.225574963096063E-14";
+        results[26][21]="5.713291486714258E-36";
+        results[26][22]="7.040925726124371E-20";
+        results[26][23]="6.261813003582785E-41";
+        results[26][24]="3.729492704555177E-25";
+        results[26][25]="3.733470485444113E-25";
+        results[26][26]="1";
+        results[26][27]="4.352400925014057E-30";
+        results[26][28]="0.00001542224561666388";
+        results[26][29]="7.429619310899423E-35";
+        results[26][30]="3.475745276510183E-11";
+        results[26][31]="9.065148782251936E-40";
+        results[26][32]="7.066372617918999E-16";
+        results[26][33]="3.900607980544203E-45";
+        results[26][34]="1.869449141218870E-20";
+        results[26][35]="4.589077614441313E-29";
+        results[26][36]="9670.015728822264";
+        results[26][37]="3.882721498161075E-34";
+        results[26][38]="0.04732568576779893";
+        results[26][39]="4.138198020386811E-39";
+        results[26][40]="8.580563680159561E-7";
+        results[26][41]="6.625184461300789E-44";
+        results[26][42]="3.098761568445328E-12";
+        results[26][43]="1.195160527900366E-48";
+        results[26][44]="8.140200194419411E-17";
+        results[26][45]="1.048336581291759E-32";
+        results[26][46]="57077625.57077626";
+        results[26][47]="3.810972782670732E-38";
+        results[26][48]="472.6368485827938";
+        results[26][49]="1.613972063466582E-42";
+        results[26][50]="0.01592854447302717";
+        results[26][51]="4.017313932620759E-48";
+        results[26][52]="2.854208701546549E-7";
+        results[26][53]="8.368086421777320E-53";
+        results[26][54]="1.163978522835795E-12";
+        results[26][55]="4.238182329769274E-37";
+        results[26][56]="489232817981.0316";
+        results[26][57]="4.250946914441208E-42";
+        results[26][58]="3910374.935971505";
+        results[26][59]="8.341009917082876E-47";
+        results[26][60]="201.9769397260919";
+        results[26][61]="3.855791729321848E-52";
+        results[26][62]="0.001444017710892185";
+        results[26][63]="3.279493876087616E-57";
+        results[26][64]="1.508842424491952E-8";
+        results[26][65]="3.558140908285596E-41";
+        results[26][66]="3172121135540393";
+        results[26][67]="1.148572459459261E-45";
+        results[26][68]="67672609451.86232";
+        results[26][69]="5.101415225212420E-51";
+        results[26][70]="496871.7838081744";
+        results[26][71]="3.117623527377340E-56";
+        results[26][72]="12.11043587318969";
+        results[26][73]="5.907557643204166E-61";
+        results[26][74]="0.00003382303947460244";
+        results[27][0]="6.257541943766386E+17";
+        results[27][1]="1375959067231.062";
+        results[27][2]="30872077.93461244";
+        results[27][3]="360.0021012218345";
+        results[27][4]="0.002512700273696726";
+        results[27][5]="7839468959112.017";
+        results[27][6]="4.871871010065461E+21";
+        results[27][7]="75180018.37666884";
+        results[27][8]="7182055614931850";
+        results[27][9]="700.7852033691596";
+        results[27][10]="255755978980.9374";
+        results[27][11]="0.008492219908884301";
+        results[27][12]="1140274.047492801";
+        results[27][13]="1.068464862698761E-7";
+        results[27][14]="8.591246976449121";
+        results[27][15]="922911507.8137501";
+        results[27][16]="1.060241283048926E+25";
+        results[27][17]="10922.95235716340";
+        results[27][18]="8.320904507836979E+19";
+        results[27][19]="0.07040348871507895";
+        results[27][20]="2815859531810263";
+        results[27][21]="0.000001312675827697515";
+        results[27][22]="16177107411.35740";
+        results[27][23]="1.438703169001500E-11";
+        results[27][24]="85688.17001947338";
+        results[27][25]="85779.56281525363";
+        results[27][26]="2.297582454439834E+29";
+        results[27][27]="1";
+        results[27][28]="3.543388093690857E+24";
+        results[27][29]="0.00001707016297188988";
+        results[27][30]="7.985811363411926E+18";
+        results[27][31]="2.082792678898868E-10";
+        results[27][32]="162355737434647.7";
+        results[27][33]="8.961968457746355E-16";
+        results[27][34]="4295213546.332090";
+        results[27][35]="10.54378420900297";
+        results[27][36]="2.221765847269926E+33";
+        results[27][37]="0.00008920872789651233";
+        results[27][38]="1.087346652644278E+28";
+        results[27][39]="9.507851164638391E-10";
+        results[27][40]="1.971455256073830E+23";
+        results[27][41]="1.522190757571212E-14";
+        results[27][42]="7.119660210152448E+17";
+        results[27][43]="2.745979859142930E-19";
+        results[27][44]="18702781142325.76";
+        results[27][45]="0.002408639735523385";
+        results[27][46]="1.311405510525019E+37";
+        results[27][47]="8.756024199812025E-9";
+        results[27][48]="1.085922130625564E+32";
+        results[27][49]="3.708233894976874E-13";
+        results[27][50]="3.659714430599182E+27";
+        results[27][51]="9.230110005566145E-19";
+        results[27][52]="6.557779833982852E+22";
+        results[27][53]="1.922636853991178E-23";
+        results[27][54]="2.674336631412318E+17";
+        results[27][55]="9.737573359594823E-8";
+        results[27][56]="1.124052738729375E+41";
+        results[27][57]="9.766901045375269E-13";
+        results[27][58]="8.984408843169418E+35";
+        results[27][59]="1.916415803779827E-17";
+        results[27][60]="4.640586729161206E+31";
+        results[27][61]="8.858999425264104E-23";
+        results[27][62]="3.317749756446258E+26";
+        results[27][63]="7.534907589141790E-28";
+        results[27][64]="3.466689881027168E+21";
+        results[27][65]="8.175122121301600E-12";
+        results[27][66]="7.288209864375369E+44";
+        results[27][67]="2.638939930506406E-16";
+        results[27][68]="1.554834001227581E+40";
+        results[27][69]="1.172092211426029E-21";
+        results[27][70]="1.141603892583884E+35";
+        results[27][71]="7.162997116051003E-27";
+        results[27][72]="2.782472497785938E+30";
+        results[27][73]="1.357310078961783E-31";
+        results[27][74]="7.771122205267246E+24";
+        results[28][0]="1.765977019256848E-7";
+        results[28][1]="3.883173479306462E-13";
+        results[28][2]="8.712587252178613E-18";
+        results[28][3]="1.015982702721253E-22";
+        results[28][4]="7.091236430383361E-28";
+        results[28][5]="2.212421770302413E-12";
+        results[28][6]="0.001374918829450271";
+        results[28][7]="2.121698679027844E-17";
+        results[28][8]="2.026889357030855E-9";
+        results[28][9]="1.977726359178481E-22";
+        results[28][10]="7.217837059291388E-14";
+        results[28][11]="2.396638382345144E-27";
+        results[28][12]="3.218033185591791E-19";
+        results[28][13]="3.015376341646586E-32";
+        results[28][14]="2.424585382489199E-24";
+        results[28][15]="2.604601820097072E-16";
+        results[28][16]="2.992168102999295";
+        results[28][17]="3.082629412401127E-21";
+        results[28][18]="0.00002348290474490412";
+        results[28][19]="1.986897479292069E-26";
+        results[28][20]="7.946799665619501E-10";
+        results[28][21]="3.704578197445509E-31";
+        results[28][22]="4.565434827802628E-15";
+        results[28][23]="4.060247229376789E-36";
+        results[28][24]="2.418255289959476E-20";
+        results[28][25]="2.420834538784717E-20";
+        results[28][26]="64841.40019917012";
+        results[28][27]="2.822157702060747E-25";
+        results[28][28]="1";
+        results[28][29]="4.817469190655120E-30";
+        results[28][30]="0.000002253721904645720";
+        results[28][31]="5.877969400550175E-35";
+        results[28][32]="4.581934948749433E-11";
+        results[28][33]="2.529208830865435E-40";
+        results[28][34]="1.212176999177676E-15";
+        results[28][35]="2.975622181430421E-24";
+        results[28][36]="627017359.8048342";
+        results[28][37]="2.517610985241837E-29";
+        results[28][38]="3068.663730570020";
+        results[28][39]="2.683265539433148E-34";
+        results[28][40]="0.05563757635196901";
+        results[28][41]="4.295862370485278E-39";
+        results[28][42]="2.009280389813716E-7";
+        results[28][43]="7.749588209183903E-44";
+        results[28][44]="5.278219785077115E-12";
+        results[28][45]="6.797561181096882E-28";
+        results[28][46]="3700993162053.089";
+        results[28][47]="2.471088113492979E-33";
+        results[28][48]="30646435.04783151";
+        results[28][49]="1.046522084775171E-37";
+        results[28][50]="1032.829126765834";
+        results[28][51]="2.604882604307646E-43";
+        results[28][52]="0.01850708886689335";
+        results[28][53]="5.425984405757048E-48";
+        results[28][54]="7.547399722243467E-8";
+        results[28][55]="2.748096765616207E-32";
+        results[28][56]="3.172254094127582E+16";
+        results[28][57]="2.756373501047097E-37";
+        results[28][58]="253554186152.1326";
+        results[28][59]="5.408427620988176E-42";
+        results[28][60]="13096467.57978319";
+        results[28][61]="2.500149346056082E-47";
+        results[28][62]="93.63213028664973";
+        results[28][63]="2.126469748701247E-52";
+        results[28][64]="0.0009783545548396877";
+        results[28][65]="2.307148385991850E-36";
+        results[28][66]="2.056847760298206E+20";
+        results[28][67]="7.447504650154305E-41";
+        results[28][68]="4387986751990347";
+        results[28][69]="3.307829062001381E-46";
+        results[28][70]="32217862181.58138";
+        results[28][71]="2.021510748090225E-51";
+        results[28][72]="785257.6190398789";
+        results[28][73]="3.830543093426676E-56";
+        results[28][74]="2.193133238525025";
+        results[29][0]="3.665777505505325E+22";
+        results[29][1]="8.060608850055552E+16";
+        results[29][2]="1808540315956.603";
+        results[29][3]="21089552.67824123";
+        results[29][4]="147.1983763619884";
+        results[29][5]="4.592498016581085E+17";
+        results[29][6]="2.854027239276019E+26";
+        results[29][7]="4404176954869.778";
+        results[29][8]="4.207373782405491E+20";
+        results[29][9]="41053222.77960500";
+        results[29][10]="1.498263252683064E+16";
+        results[29][11]="497.4890938574387";
+        results[29][12]="66799247867.20172";
+        results[29][13]="0.006259254023867518";
+        results[29][14]="503290.2726585955";
+        results[29][15]="54065770158934.34";
+        results[29][16]="6.211078856100365E+29";
+        results[29][17]="639885651.6572606";
+        results[29][18]="4.874531380596274E+24";
+        results[29][19]="4124.359493873326";
+        results[29][20]="1.649579758814986E+20";
+        results[29][21]="0.07689884565596421";
+        results[29][22]="947683243446292.2";
+        results[29][23]="8.428174771211442E-7";
+        results[29][24]="5019762855.256830";
+        results[29][25]="5025116805.065672";
+        results[29][26]="1.345963983017241E+34";
+        results[29][27]="58581.74884719846";
+        results[29][28]="2.075778713727511E+29";
+        results[29][29]="1";
+        results[29][30]="4.678227956325009E+23";
+        results[29][31]="0.00001220136376160371";
+        results[29][32]="9.511083034298228E+18";
+        results[29][33]="5.250077853682115E-11";
+        results[29][34]="251621121216311.1";
+        results[29][35]="617673.3184308691";
+        results[29][36]="1.301549288620499E+38";
+        results[29][37]="5.226003292611552";
+        results[29][38]="6.369866851504902E+32";
+        results[29][39]="0.00005569865490033896";
+        results[29][40]="1.154912966748064E+28";
+        results[29][41]="8.917259665756348E-10";
+        results[29][42]="4.170821463085429E+22";
+        results[29][43]="1.608643024477765E-14";
+        results[29][44]="1.095641627623847E+18";
+        results[29][45]="141.1023280498135";
+        results[29][46]="7.682442825440876E+41";
+        results[29][47]="0.0005129432105733799";
+        results[29][48]="6.361521752392140E+36";
+        results[29][49]="2.172348267022037E-8";
+        results[29][50]="2.143924716258292E+32";
+        results[29][51]="5.407159861780895E-14";
+        results[29][52]="3.841662112296063E+27";
+        results[29][53]="1.126314293048790E-18";
+        results[29][54]="1.566673168742592E+22";
+        results[29][55]="0.005704440769329544";
+        results[29][56]="6.584897523124984E+45";
+        results[29][57]="5.721621440556141E-8";
+        results[29][58]="5.263223823910997E+40";
+        results[29][59]="1.122669893038318E-12";
+        results[29][60]="2.718536862713640E+36";
+        results[29][61]="5.189756793682972E-18";
+        results[29][62]="1.943595829699885E+31";
+        results[29][63]="4.414080639739539E-23";
+        results[29][64]="2.030847559414579E+26";
+        results[29][65]="4.789129509052666E-7";
+        results[29][66]="4.269560798205122E+49";
+        results[29][67]="1.545937162317696E-11";
+        results[29][68]="9.108489495899883E+44";
+        results[29][69]="6.866321155551707E-17";
+        results[29][70]="6.687715251833322E+39";
+        results[29][71]="4.196208980457067E-22";
+        results[29][72]="1.630021050395328E+35";
+        results[29][73]="7.951359815351027E-27";
+        results[29][74]="4.552459292898528E+29";
+        results[30][0]="0.07835824888672127";
+        results[30][1]="1.723004720015306E-7";
+        results[30][2]="3.865866163087327E-12";
+        results[30][3]="4.508021600300163E-17";
+        results[30][4]="3.146455831913338E-22";
+        results[30][5]="9.816746980813501E-7";
+        results[30][6]="610.0658766354783";
+        results[30][7]="9.414199128358610E-12";
+        results[30][8]="0.0008993520242460782";
+        results[30][9]="8.775378874836710E-17";
+        results[30][10]="3.202629856156106E-8";
+        results[30][11]="1.063413537138199E-21";
+        results[30][12]="1.427875009316049E-13";
+        results[30][13]="1.337954046340334E-26";
+        results[30][14]="1.075813913638266E-18";
+        results[30][15]="1.155689091332903E-10";
+        results[30][16]="1327656.307919525";
+        results[30][17]="1.367794937807870E-15";
+        results[30][18]="10.41961064339727";
+        results[30][19]="8.816072094770739E-21";
+        results[30][20]="0.0003526078195024119";
+        results[30][21]="1.643760124001572E-25";
+        results[30][22]="2.025731221936322E-9";
+        results[30][23]="1.801574196446855E-30";
+        results[30][24]="1.073005185322375E-14";
+        results[30][25]="1.074149625024506E-14";
+        results[30][26]="28770807997.87632";
+        results[30][27]="1.252220913433587E-19";
+        results[30][28]="443710.4675331262";
+        results[30][29]="2.137561506912014E-24";
+        results[30][30]="1";
+        results[30][31]="2.608116550863527E-29";
+        results[30][32]="0.00002033052498315981";
+        results[30][33]="1.122236432832213E-34";
+        results[30][34]="5.378556230380286E-10";
+        results[30][35]="1.320314709324433E-18";
+        results[30][36]="278214165870389.4";
+        results[30][37]="1.117090347328190E-23";
+        results[30][38]="1361598218.593171";
+        results[30][39]="1.190593007017408E-28";
+        results[30][40]="24686.97501554217";
+        results[30][41]="1.906119100865986E-33";
+        results[30][42]="0.08915387411693861";
+        results[30][43]="3.438573407486192E-38";
+        results[30][44]="0.000002342001368579163";
+        results[30][45]="3.016149049749527E-22";
+        results[30][46]="1.642169406271479E+18";
+        results[30][47]="1.096447662153521E-27";
+        results[30][48]="13598144023296.90";
+        results[30][49]="4.643528035193328E-32";
+        results[30][50]="458277094.7190988";
+        results[30][51]="1.155813678226253E-37";
+        results[30][52]="8211.789053806363";
+        results[30][53]="2.407566077505911E-42";
+        results[30][54]="0.03348860259416035";
+        results[30][55]="1.219359300697839E-26";
+        results[30][56]="1.407562347239223E+22";
+        results[30][57]="1.223031774845527E-31";
+        results[30][58]="1.125046464825440E+17";
+        results[30][59]="2.399775948327737E-36";
+        results[30][60]="5811039752858.027";
+        results[30][61]="1.109342435241184E-41";
+        results[30][62]="41545556.30561193";
+        results[30][63]="9.435368863912798E-47";
+        results[30][64]="434.1061569410814";
+        results[30][65]="1.023705889016741E-30";
+        results[30][66]="9.126448813663803E+25";
+        results[30][67]="3.304535770275098E-35";
+        results[30][68]="1.946995653254801E+21";
+        results[30][69]="1.467718379620295E-40";
+        results[30][70]="1.429540269150730E+16";
+        results[30][71]="8.969654791583536E-46";
+        results[30][72]="348427025278.1341";
+        results[30][73]="1.699652066890138E-50";
+        results[30][74]="973116.1746283781";
+        results[31][0]="3.004399817208225E+27";
+        results[31][1]="6.606317955556214E+21";
+        results[31][2]="1.482244404226248E+17";
+        results[31][3]="1728458645303.865";
+        results[31][4]="12064092.11609646";
+        results[31][5]="3.763921891283291E+22";
+        results[31][6]="2.339105115657083E+31";
+        results[31][7]="3.609577618470172E+17";
+        results[31][8]="3.448281572954666E+25";
+        results[31][9]="3364642148346.955";
+        results[31][10]="1.227947368799811E+21";
+        results[31][11]="40773236.79365905";
+        results[31][12]="5474736199359228";
+        results[31][13]="512.9962638737704";
+        results[31][14]="41248690104.82190";
+        results[31][15]="4.431125177094802E+18";
+        results[31][16]="5.090479209910875E+34";
+        results[31][17]="52443781216564.26";
+        results[31][18]="3.995070941115503E+29";
+        results[31][19]="338024467.9576074";
+        results[31][20]="1.351963428879995E+25";
+        results[31][21]="6302.479555437567";
+        results[31][22]="7.767027210749525E+19";
+        results[31][23]="0.06907567822651053";
+        results[31][24]="411409982796631.8";
+        results[31][25]="411848782090993.5";
+        results[31][26]="1.103125854876022E+39";
+        results[31][27]="4801245991.169322";
+        results[31][28]="1.701267787999033E+34";
+        results[31][29]="81958.05153739330";
+        results[31][30]="3.834184479481592E+28";
+        results[31][31]="1";
+        results[31][32]="7.795098335014412E+23";
+        results[31][33]="0.000004302861513074059";
+        results[31][34]="2.062237682054311E+19";
+        results[31][35]="50623301665.22991";
+        results[31][36]="1.066724436752164E+43";
+        results[31][37]="428313.0471904447";
+        results[31][38]="5.220618757019720E+37";
+        results[31][39]="4.564953228885464";
+        results[31][40]="9.465441644994164E+32";
+        results[31][41]="0.00007308412272583773";
+        results[31][42]="3.418324004248217E+27";
+        results[31][43]="1.318412479054169E-9";
+        results[31][44]="8.979665298330876E+22";
+        results[31][45]="11564471.87435279";
+        results[31][46]="6.296380450205607E+46";
+        results[31][47]="42.03982608792905";
+        results[31][48]="5.213779276388035E+41";
+        results[31][49]="0.001780414312257591";
+        results[31][50]="1.757118923873884E+37";
+        results[31][51]="4.431602866227630E-9";
+        results[31][52]="3.148551413888119E+32";
+        results[31][53]="9.231052487699542E-14";
+        results[31][54]="1.284014803060566E+27";
+        results[31][55]="467.5248505647183";
+        results[31][56]="5.396853705687309E+50";
+        results[31][57]="0.004689329449025547";
+        results[31][58]="4.313635694129337E+45";
+        results[31][59]="9.201183695311428E-8";
+        results[31][60]="2.228059843005880E+41";
+        results[31][61]="4.253423547632060E-13";
+        results[31][62]="1.592933271784059E+36";
+        results[31][63]="3.617694485619832E-18";
+        results[31][64]="1.664443089390894E+31";
+        results[31][65]="0.03925077231221895";
+        results[31][66]="3.499248839413294E+54";
+        results[31][67]="0.000001267019976228053";
+        results[31][68]="7.465140515327681E+49";
+        results[31][69]="5.627503031390007E-12";
+        results[31][70]="5.481121112771666E+44";
+        results[31][71]="3.439131118819729E-17";
+        results[31][72]="1.335933492553362E+40";
+        results[31][73]="6.516779575388975E-22";
+        results[31][74]="3.731106933492626E+34";
+        results[32][0]="3854.216698861785";
+        results[32][1]="0.008474964229612891";
+        results[32][2]="1.901508281900985E-7";
+        results[32][3]="2.217366056230347E-12";
+        results[32][4]="1.547651049109460E-17";
+        results[32][5]="0.04828575252702482";
+        results[32][6]="30007384.32189076";
+        results[32][7]="4.630573551915940E-7";
+        results[32][8]="44.23653717702960";
+        results[32][9]="4.316356258436777E-12";
+        results[32][10]="0.001575281434595963";
+        results[32][11]="5.230625072490977E-17";
+        results[32][12]="7.023306139407549E-9";
+        results[32][13]="6.581010807387358E-22";
+        results[32][14]="5.291618954893612E-14";
+        results[32][15]="0.000005684501960919277";
+        results[32][16]="65303591964.26306";
+        results[32][17]="6.727789562447809E-11";
+        results[32][18]="512510.6534153962";
+        results[32][19]="4.336372081917841E-16";
+        results[32][20]="17.34376361626097";
+        results[32][21]="8.085182873354881E-21";
+        results[32][22]="0.00009963988749008084";
+        results[32][23]="8.861424866987624E-26";
+        results[32][24]="5.277803628834801E-10";
+        results[32][25]="5.283432798288516E-10";
+        results[32][26]="1415153225099094";
+        results[32][27]="6.159314205957922E-15";
+        results[32][28]="21824840622.69226";
+        results[32][29]="1.051404972907783E-19";
+        results[32][30]="49187.12137676328";
+        results[32][31]="1.282857453520695E-24";
+        results[32][32]="1";
+        results[32][33]="5.519957963514394E-30";
+        results[32][34]="0.00002645556981354615";
+        results[32][35]="6.494247986306681E-14";
+        results[32][36]="1.368455394540179E+19";
+        results[32][37]="5.494645850284232E-19";
+        results[32][38]="66973096844326.95";
+        results[32][39]="5.856184274649082E-24";
+        results[32][40]="1214281236.514595";
+        results[32][41]="9.375651157286216E-29";
+        results[32][42]="4385.222427398534";
+        results[32][43]="1.691335275569338E-33";
+        results[32][44]="0.1151963055808490";
+        results[32][45]="1.483556894004392E-17";
+        results[32][46]="8.077358590748254E+22";
+        results[32][47]="5.393110424161355E-23";
+        results[32][48]="6.688535605726128E+17";
+        results[32][49]="2.284017770834574E-27";
+        results[32][50]="22541331082138.75";
+        results[32][51]="5.685114767983791E-33";
+        results[32][52]="403914264.9099497";
+        results[32][53]="1.184212448768611E-37";
+        results[32][54]="1647.207960537155";
+        results[32][55]="5.997677392530980E-22";
+        results[32][56]="6.923394001901749E+26";
+        results[32][57]="6.015741235696518E-27";
+        results[32][58]="5.533779701986738E+21";
+        results[32][59]="1.180380708474336E-31";
+        results[32][60]="2.858283176490243E+17";
+        results[32][61]="5.456536101060227E-37";
+        results[32][62]="2043506320669.287";
+        results[32][63]="4.640986335438119E-42";
+        results[32][64]="21352432.23186122";
+        results[32][65]="5.035314581717381E-26";
+        results[32][66]="4.489037455364987E+30";
+        results[32][67]="1.625406020263772E-30";
+        results[32][68]="9.576711151667440E+25";
+        results[32][69]="7.219284208528977E-36";
+        results[32][70]="7.031497073168779E+20";
+        results[32][71]="4.411914989412857E-41";
+        results[32][72]="1.713812238330015E+16";
+        results[32][73]="8.360099251239178E-46";
+        results[32][74]="47864783395.13761";
+        results[33][0]="6.982329800946383E+32";
+        results[33][1]="1.535331298830604E+27";
+        results[33][2]="3.444787613364996E+22";
+        results[33][3]="4.016998083837972E+17";
+        results[33][4]="2803737019990.124";
+        results[33][5]="8.747485550828852E+27";
+        results[33][6]="5.436161746200319E+36";
+        results[33][7]="8.388784085898711E+22";
+        results[33][8]="8.013926459118452E+30";
+        results[33][9]="7.819545523655909E+17";
+        results[33][10]="2.853792447348690E+26";
+        results[33][11]="9475842220292.549";
+        results[33][12]="1.272347758049958E+21";
+        results[33][13]="119222118.1915926";
+        results[33][14]="9586339225533875";
+        results[33][15]="1.029808922186089E+24";
+        results[33][16]="1.183045095558775E+40";
+        results[33][17]="1.218811738588753E+19";
+        results[33][18]="9.284683992214605E+34";
+        results[33][19]="78558063495777.08";
+        results[33][20]="3.142010089732407E+30";
+        results[33][21]="1464718196.550773";
+        results[33][22]="1.805084171812118E+25";
+        results[33][23]="16053.42817021349";
+        results[33][24]="9.561311270339060E+19";
+        results[33][25]="9.571509118748273E+19";
+        results[33][26]="2.563702902183168E+44";
+        results[33][27]="1115826288292324";
+        results[33][28]="3.953805584562284E+39";
+        results[33][29]="19047336589.46896";
+        results[33][30]="8.910778252638594E+33";
+        results[33][31]="232403.4824178150";
+        results[33][32]="1.811607998846661E+29";
+        results[33][33]="1";
+        results[33][34]="4.792712188826647E+24";
+        results[33][35]="1.176503159848700E+16";
+        results[33][36]="2.479104738813852E+48";
+        results[33][37]="99541443732.04527";
+        results[33][38]="1.213289979507148E+43";
+        results[33][39]="1060911.027467431";
+        results[33][40]="2.199801600919255E+38";
+        results[33][41]="16.98500463093566";
+        results[33][42]="7.944304026196954E+32";
+        results[33][43]="0.0003064036513952934";
+        results[33][44]="2.086905486278503E+28";
+        results[33][45]="2687623535922.464";
+        results[33][46]="1.463300743255233E+52";
+        results[33][47]="9770201.983074019";
+        results[33][48]="1.211700460390415E+47";
+        results[33][49]="413.7744863151833";
+        results[33][50]="4.083605569305342E+42";
+        results[33][51]="0.001029919938804072";
+        results[33][52]="7.317343131591340E+37";
+        results[33][53]="2.145328744523008E-8";
+        results[33][54]="2.984095117073005E+32";
+        results[33][55]="108654403.3881091";
+        results[33][56]="1.254247595301220E+56";
+        results[33][57]="1089.816494157951";
+        results[33][58]="1.002503957197447E+51";
+        results[33][59]="0.02138387133156396";
+        results[33][60]="5.178088665498566E+46";
+        results[33][61]="9.885104446676278E-8";
+        results[33][62]="3.702032396218190E+41";
+        results[33][63]="8.407647967817748E-13";
+        results[33][64]="3.868223702607104E+36";
+        results[33][65]="9122.016172948436";
+        results[33][66]="8.132376161261471E+59";
+        results[33][67]="0.2944598547683367";
+        results[33][68]="1.734924652500475E+55";
+        results[33][69]="0.000001307851301811848";
+        results[33][70]="1.273831634161944E+50";
+        results[33][71]="7.992660485051813E-12";
+        results[33][72]="3.104755959479955E+45";
+        results[33][73]="1.514522267469688E-16";
+        results[33][74]="8.671222446169412E+39";
+        results[34][0]="145686398.9710135";
+        results[34][1]="320.3470682862941";
+        results[34][2]="0.007187553680765358";
+        results[34][3]="8.381471545908569E-8";
+        results[34][4]="5.850000812747606E-13";
+        results[34][5]="1825.163958566520";
+        results[34][6]="1134255830941.353";
+        results[34][7]="0.01750320852868166";
+        results[34][8]="1672106.761971122";
+        results[34][9]="1.631549155379241E-7";
+        results[34][10]="59.54441524783812";
+        results[34][11]="1.977135669106896E-12";
+        results[34][12]="0.0002654755194806417";
+        results[34][13]="2.487570993091087E-17";
+        results[34][14]="2.000190883125157E-9";
+        results[34][15]="0.2148697609230333";
+        results[34][16]="2468425077384854";
+        results[34][17]="0.000002543052222977617";
+        results[34][18]="19372504808.15474";
+        results[34][19]="1.639114981260948E-11";
+        results[34][20]="655580.7997520574";
+        results[34][21]="3.056136356290082E-16";
+        results[34][22]="3.766310391056549";
+        results[34][23]="3.349549803478537E-21";
+        results[34][24]="0.00001994968797131100";
+        results[34][25]="0.00001997096579482185";
+        results[34][26]="5.349169324542341E+19";
+        results[34][27]="2.328172951619490E-10";
+        results[34][28]="824962031682160.1";
+        results[34][29]="3.974229171089060E-15";
+        results[34][30]="1859235001.303121";
+        results[34][31]="4.849101578843441E-20";
+        results[34][32]="37799.22364355827";
+        results[34][33]="2.086501255659210E-25";
+        results[34][34]="1";
+        results[34][35]="2.454775320311342E-9";
+        results[34][36]="5.172655150445800E+23";
+        results[34][37]="2.076933473370431E-14";
+        results[34][38]="2.531531065720401E+18";
+        results[34][39]="2.213592190953497E-19";
+        results[34][40]="45898888025191.66";
+        results[34][41]="3.543923348982476E-24";
+        results[34][42]="165758003.2599846";
+        results[34][43]="6.393116033748466E-29";
+        results[34][44]="4354.330917562191";
+        results[34][45]="5.607729882441468E-13";
+        results[34][46]="3.053178838209099E+27";
+        results[34][47]="2.038553870572805E-18";
+        results[34][48]="2.528214532087444E+22";
+        results[34][49]="8.633409852563746E-23";
+        results[34][50]="8.520448147972540E+17";
+        results[34][51]="2.148929245543152E-28";
+        results[34][52]="15267645632154.63";
+        results[34][53]="4.476231119249052E-33";
+        results[34][54]="62263182.08779341";
+        results[34][55]="2.267075491021919E-17";
+        results[34][56]="2.616989182503541E+31";
+        results[34][57]="2.273903483498682E-22";
+        results[34][58]="2.091725765495799E+26";
+        results[34][59]="4.461747438416318E-27";
+        results[34][60]="1.080408850247748E+22";
+        results[34][61]="2.062528284031250E-32";
+        results[34][62]="7.724295243200328E+16";
+        results[34][63]="1.754256804199234E-37";
+        results[34][64]="807105361266.0442";
+        results[34][65]="1.903309819900053E-21";
+        results[34][66]="1.696821307196509E+35";
+        results[34][67]="6.143908567153631E-26";
+        results[34][68]="3.619922465916360E+30";
+        results[34][69]="2.728833383445953E-31";
+        results[34][70]="2.657851304177320E+25";
+        results[34][71]="1.667669613811836E-36";
+        results[34][72]="6.478077207970342E+20";
+        results[34][73]="3.160052612799337E-41";
+        results[34][74]="1809251652203281";
+        results[35][0]="5.934816020251334E+16";
+        results[35][1]="130499547406.9147";
+        results[35][2]="2927988.407449751";
+        results[35][3]="34.14353841900911";
+        results[35][4]="0.0002383110488501100";
+        results[35][5]="743515686940.7634";
+        results[35][6]="4.620609558668262E+20";
+        results[35][7]="7130269.065301548";
+        results[35][8]="681164890381514.3";
+        results[35][9]="66.46429682910084";
+        results[35][10]="24256564238.34587";
+        results[35][11]="0.0008054242898515592";
+        results[35][12]="108146.5653023476";
+        results[35][13]="1.013359948875315E-8";
+        results[35][14]="0.8148162752717714";
+        results[35][15]="87531335.00453358";
+        results[35][16]="1.005560491406513E+24";
+        results[35][17]="1035.961296309220";
+        results[35][18]="7.891762903049598E+18";
+        results[35][19]="0.006677250531641558";
+        results[35][20]="267063463742543.0";
+        results[35][21]="1.244975998822763E-7";
+        results[35][22]="1534279068.187334";
+        results[35][23]="1.364503616996488E-12";
+        results[35][24]="8126.889579768451";
+        results[35][25]="8135.557510937055";
+        results[35][26]="2.179087136929461E+28";
+        results[35][27]="0.09484260870458016";
+        results[35][28]="3.360641704583902E+23";
+        results[35][29]="0.000001618978787266365";
+        results[35][30]="7.573951823286671E+17";
+        results[35][31]="1.975374910575696E-11";
+        results[35][32]="15398241676457.85";
+        results[35][33]="8.499764676608273E-17";
+        results[35][34]="407369257.6773865";
+        results[35][35]="1";
+        results[35][36]="2.107180688858216E+32";
+        results[35][37]="0.000008460788472922284";
+        results[35][38]="1.031267931029763E+27";
+        results[35][39]="9.017494076291857E-11";
+        results[35][40]="1.869779594303981E+22";
+        results[35][41]="1.443685423940549E-15";
+        results[35][42]="6.752471474210576E+16";
+        results[35][43]="2.604358932913510E-20";
+        results[35][44]="1773820553569.003";
+        results[35][45]="0.0002284416759465479";
+        results[35][46]="1.243771196877546E+36";
+        results[35][47]="8.304441769906065E-10";
+        results[35][48]="1.029916877185643E+31";
+        results[35][49]="3.516985762863528E-14";
+        results[35][50]="3.470968637118237E+26";
+        results[35][51]="8.754077115581401E-20";
+        results[35][52]="6.219569467652223E+21";
+        results[35][53]="1.823478948240904E-24";
+        results[35][54]="2.536410626773635E+16";
+        results[35][55]="9.235368598761958E-9";
+        results[35][56]="1.066080940626218E+40";
+        results[35][57]="9.263183741028816E-14";
+        results[35][58]="8.521047723546869E+34";
+        results[35][59]="1.817578741931636E-18";
+        results[35][60]="4.401253513135038E+30";
+        results[35][61]="8.402106160044240E-24";
+        results[35][62]="3.146640419303486E+25";
+        results[35][63]="7.146302921021462E-29";
+        results[35][64]="3.287899118863873E+20";
+        results[35][65]="7.753499084627650E-13";
+        results[35][66]="6.912328363238143E+43";
+        results[35][67]="2.502839472239110E-17";
+        results[35][68]="1.474645127790042E+39";
+        results[35][69]="1.111642829739649E-22";
+        results[35][70]="1.082726912799589E+34";
+        results[35][71]="6.793573326296614E-28";
+        results[35][72]="2.638969503387675E+29";
+        results[35][73]="1.287308287097552E-32";
+        results[35][74]="7.370335025096355E+23";
+        results[36][0]="2.816472290028026E-16";
+        results[36][1]="6.193087669080073E-22";
+        results[36][2]="1.389528872835434E-26";
+        results[36][3]="1.620342223120407E-31";
+        results[36][4]="1.130947384389897E-36";
+        results[36][5]="3.528485672216559E-21";
+        results[36][6]="2.192792285493067E-12";
+        results[36][7]="3.383795752781463E-26";
+        results[36][8]="3.232588899391471E-18";
+        results[36][9]="3.154181185340816E-31";
+        results[36][10]="1.151138313225971E-22";
+        results[36][11]="3.822283936590086E-36";
+        results[36][12]="5.132287225019476E-28";
+        results[36][13]="4.809079516690182E-41";
+        results[36][14]="3.866855270552440E-33";
+        results[36][15]="4.153954877593472E-25";
+        results[36][16]="4.772065806807389E-9";
+        results[36][17]="4.916338222853396E-30";
+        results[36][18]="3.745176170594929E-14";
+        results[36][19]="3.168807766200464E-35";
+        results[36][20]="1.267397073040055E-18";
+        results[36][21]="5.908254595372923E-40";
+        results[36][22]="7.281193664595935E-24";
+        results[36][23]="6.475494124501726E-45";
+        results[36][24]="3.856759708713939E-29";
+        results[36][25]="3.860873229312546E-29";
+        results[36][26]="0.0001034124481327801";
+        results[36][27]="4.500924349110802E-34";
+        results[36][28]="1.594852174924249E-9";
+        results[36][29]="7.683151216346878E-39";
+        results[36][30]="3.594353281298647E-15";
+        results[36][31]="9.374492282605629E-44";
+        results[36][32]="7.307508918374459E-20";
+        results[36][33]="4.033714204743355E-49";
+        results[36][34]="1.933243123531666E-24";
+        results[36][35]="4.745677507807144E-33";
+        results[36][36]="1";
+        results[36][37]="4.015217355426124E-38";
+        results[36][38]="0.000004894065024810755";
+        results[36][39]="4.279411881464243E-43";
+        results[36][40]="8.873370965245172E-11";
+        results[36][41]="6.851265444743684E-48";
+        results[36][42]="3.204505199727048E-16";
+        results[36][43]="1.235944761018426E-52";
+        results[36][44]="8.417980303958437E-21";
+        results[36][45]="1.084110523385301E-36";
+        results[36][46]="5902.536993880142";
+        results[36][47]="3.941020252233737E-42";
+        results[36][48]="0.04887653358970880";
+        results[36][49]="1.669048023009940E-46";
+        results[36][50]="0.000001647209779147603";
+        results[36][51]="4.154402686902390E-52";
+        results[36][52]="2.951607093088121E-11";
+        results[36][53]="8.653643030626684E-57";
+        results[36][54]="1.203698686204266E-16";
+        results[36][55]="4.382808103545301E-41";
+        results[36][56]="50592763.41431727";
+        results[36][57]="4.396008273048529E-46";
+        results[36][58]="404.3814452458765";
+        results[36][59]="8.625642554253372E-51";
+        results[36][60]="0.02088692980344213";
+        results[36][61]="3.987368622192980E-56";
+        results[36][62]="1.493294066304539E-7";
+        results[36][63]="3.391404903626805E-61";
+        results[36][64]="1.560330889633121E-12";
+        results[36][65]="3.679560621272072E-45";
+        results[36][66]="328036812399.9663";
+        results[36][67]="1.187766898905705E-49";
+        results[36][68]="6998190.214950595";
+        results[36][69]="5.275498373810540E-55";
+        results[36][70]="51.38272757170476";
+        results[36][71]="3.224010813224441E-60";
+        results[36][72]="0.001252369821601588";
+        results[36][73]="6.109149983692593E-65";
+        results[36][74]="3.497723315360298E-9";
+        results[37][0]="7.014495208389838E+21";
+        results[37][1]="1.542404089460013E+16";
+        results[37][2]="346065667144.4297";
+        results[37][3]="4035503.136413506";
+        results[37][4]="28.16652958678678";
+        results[37][5]="8.787782478196851E+16";
+        results[37][6]="5.461204441472514E+25";
+        results[37][7]="842742858791.6008";
+        results[37][8]="8.050844109405394E+19";
+        results[37][9]="7855567.721827779";
+        results[37][10]="2866938975720293";
+        results[37][11]="95.19494458811030";
+        results[37][12]="12782090658.38928";
+        results[37][13]="0.001197713371653776";
+        results[37][14]="96305.00489162340";
+        results[37][15]="10345529294895.73";
+        results[37][16]="1.188495013939524E+29";
+        results[37][17]="122442642.2696522";
+        results[37][18]="9.327455624622005E+23";
+        results[37][19]="789.1995590022467";
+        results[37][20]="3.156484346550524E+19";
+        results[37][21]="0.01471465694724737";
+        results[37][22]="181339962947614.9";
+        results[37][23]="1.612738128796641E-7";
+        results[37][24]="960535723.8013413";
+        results[37][25]="961560206.4717620";
+        results[37][26]="2.575513078838174E+33";
+        results[37][27]="11209.66550672107";
+        results[37][28]="3.972019529077253E+28";
+        results[37][29]="0.1913508170601013";
+        results[37][30]="8.951827418361983E+22";
+        results[37][31]="0.000002334740925030381";
+        results[37][32]="1.819953509739433E+18";
+        results[37][33]="1.004606686931215E-11";
+        results[37][34]="48147907134319.92";
+        results[37][35]="118192.2941579709";
+        results[37][36]="2.490525198215260E+37";
+        results[37][37]="1";
+        results[37][38]="1.218879226599518E+32";
+        results[37][39]="0.00001065798312432847";
+        results[37][40]="2.209935398205477E+27";
+        results[37][41]="1.706324922979563E-10";
+        results[37][42]="7.980900947732038E+21";
+        results[37][43]="3.078151570918528E-15";
+        results[37][44]="2.096519206508824E+17";
+        results[37][45]="27.00004576141425";
+        results[37][46]="1.470041711665625E+41";
+        results[37][47]="0.00009815210244864781";
+        results[37][48]="1.217282385065843E+36";
+        results[37][49]="4.156806158337618E-9";
+        results[37][50]="4.102417461713700E+31";
+        results[37][51]="1.034664457526358E-14";
+        results[37][52]="7.351051840566861E+26";
+        results[37][53]="2.155211602413563E-19";
+        results[37][54]="2.997841909050329E+21";
+        results[37][55]="0.001091549402082161";
+        results[37][56]="1.260025521307003E+45";
+        results[37][57]="1.094836937559011E-8";
+        results[37][58]="1.007122179075560E+40";
+        results[37][59]="2.148238013216586E-13";
+        results[37][60]="5.201942498882593E+35";
+        results[37][61]="9.930642028144481E-19";
+        results[37][62]="3.719086500476785E+30";
+        results[37][63]="8.446379369833354E-24";
+        results[37][64]="3.886043398184922E+25";
+        results[37][65]="9.164038445638694E-8";
+        results[37][66]="8.169839472243282E+48";
+        results[37][67]="2.958163391330656E-12";
+        results[37][68]="1.742916907223793E+44";
+        results[37][69]="1.313876163311878E-17";
+        results[37][70]="1.279699777703607E+39";
+        results[37][71]="8.029480169653943E-23";
+        results[37][72]="3.119058598183105E+34";
+        results[37][73]="1.521499197406275E-27";
+        results[37][74]="8.711168053289843E+28";
+    }
+
+    private static void initResults2() {
+        results[38][0]="5.754873046740801E-11";
+        results[38][1]="1.265428153832008E-16";
+        results[38][2]="2.839212118742058E-21";
+        results[38][3]="3.310831006343367E-26";
+        results[38][4]="2.310854838782263E-31";
+        results[38][5]="7.209723725223695E-16";
+        results[38][6]="4.480513181530232E-7";
+        results[38][7]="6.914080086037084E-21";
+        results[38][8]="6.605120453046024E-13";
+        results[38][9]="6.444910660872926E-26";
+        results[38][10]="2.352110786003469E-17";
+        results[38][11]="7.810039133548062E-31";
+        results[38][12]="1.048675732545652E-22";
+        results[38][13]="9.826349859084964E-36";
+        results[38][14]="7.901111348029064E-28";
+        results[38][15]="8.487739448770601E-20";
+        results[38][16]="0.0009750720071382617";
+        results[38][17]="1.004551062956811E-24";
+        results[38][18]="7.652485513797906E-9";
+        results[38][19]="6.474797024837234E-30";
+        results[38][20]="2.589661286915703E-13";
+        results[38][21]="1.207228462519536E-34";
+        results[38][22]="1.487759894419769E-18";
+        results[38][23]="1.323132016365500E-39";
+        results[38][24]="7.880483175360085E-24";
+        results[38][25]="7.888888295802402E-24";
+        results[38][26]="21.13017452946058";
+        results[38][27]="9.196699116773269E-29";
+        results[38][28]="0.0003258747415163162";
+        results[38][29]="1.569891527267555E-33";
+        results[38][30]="7.344310431260839E-10";
+        results[38][31]="1.915481759045105E-38";
+        results[38][32]="1.493136867068297E-14";
+        results[38][33]="8.242052739990580E-44";
+        results[38][34]="3.950178662790491E-19";
+        results[38][35]="9.696801092238556E-28";
+        results[38][36]="204329.1200526434";
+        results[38][37]="8.204258290543218E-33";
+        results[38][38]="1";
+        results[38][39]="8.744084640824158E-38";
+        results[38][40]="0.00001813088081229221";
+        results[38][41]="1.399913039571560E-42";
+        results[38][42]="6.547737276643480E-11";
+        results[38][43]="2.525395054525697E-47";
+        results[38][44]="1.720038508128311E-15";
+        results[38][45]="2.215153492831292E-31";
+        results[38][46]="1206060190.037704";
+        results[38][47]="8.052652002485662E-37";
+        results[38][48]="9986.899099608667";
+        results[38][49]="3.410351138672251E-41";
+        results[38][50]="0.3365729247153389";
+        results[38][51]="8.488654453591028E-47";
+        results[38][52]="0.000006030992800718365";
+        results[38][53]="1.768191265697641E-51";
+        results[38][54]="2.459506933606407E-11";
+        results[38][55]="8.955353231570062E-36";
+        results[38][56]="10337574829479.02";
+        results[38][57]="8.982325021761465E-41";
+        results[38][58]="82626904.87270614";
+        results[38][59]="1.762469952999227E-45";
+        results[38][60]="4267.807987338662";
+        results[38][61]="8.147355218982128E-51";
+        results[38][62]="0.03051234625478403";
+        results[38][63]="6.929627797002850E-56";
+        results[38][64]="3.188210376696939E-7";
+        results[38][65]="7.518413839248804E-40";
+        results[38][66]="6.702747322255918E+16";
+        results[38][67]="2.426953652810597E-44";
+        results[38][68]="1429934048581.875";
+        results[38][69]="1.077937940559859E-49";
+        results[38][70]="10498987.51063113";
+        results[38][71]="6.587592925063573E-55";
+        results[38][72]="255.8956236283385";
+        results[38][73]="1.248277240437528E-59";
+        results[38][74]="0.0007146867272151842";
+        results[39][0]="6.581447096100371E+26";
+        results[39][1]="1.447181958788470E+21";
+        results[39][2]="3.247008961334176E+16";
+        results[39][3]="378636660364.1785";
+        results[39][4]="2642763.575267104";
+        results[39][5]="8.245258390527376E+21";
+        results[39][6]="5.124050561692560E+30";
+        results[39][7]="7.907151371518986E+16";
+        results[39][8]="7.553815778735954E+24";
+        results[39][9]="737059500863.3713";
+        results[39][10]="2.689945125899165E+20";
+        results[39][11]="8931797.271363033";
+        results[39][12]="1199297325702478";
+        results[39][13]="112.3771127878607";
+        results[39][14]="9035950213.862933";
+        results[39][15]="9.706835875242173E+17";
+        results[39][16]="1.115121876320673E+34";
+        results[39][17]="11488350172947.65";
+        results[39][18]="8.751614180482857E+28";
+        results[39][19]="74047739.59538163";
+        results[39][20]="2.961615072691725E+24";
+        results[39][21]="1380.623029291435";
+        results[39][22]="1.701447270390950E+19";
+        results[39][23]="0.01513173843478247";
+        results[39][24]="90123592108977.16";
+        results[39][25]="90219715611751.54";
+        results[39][26]="2.416510749542446E+38";
+        results[39][27]="1051762362.161496";
+        results[39][28]="3.726802231475215E+33";
+        results[39][29]="17953.75492979660";
+        results[39][30]="8.399175823358240E+27";
+        results[39][31]="0.2190602947851342";
+        results[39][32]="1.707596539147366E+23";
+        results[39][33]="9.425861114736121E-7";
+        results[39][34]="4.517543945478293E+18";
+        results[39][35]="11089555385.78204";
+        results[39][36]="2.336769695694354E+42";
+        results[39][37]="93826.38237785791";
+        results[39][38]="1.143630283873541E+37";
+        results[39][39]="1";
+        results[39][40]="2.073502437023907E+32";
+        results[39][41]="0.00001600982946843494";
+        results[39][42]="7.488190640417148E+26";
+        results[39][43]="2.888118263100058E-10";
+        results[39][44]="1.967088127324202E+22";
+        results[39][45]="2533316.617830116";
+        results[39][46]="1.379286957501396E+46";
+        results[39][47]="9.209256695537514";
+        results[39][48]="1.142132025230187E+41";
+        results[39][49]="0.0003900180840828200";
+        results[39][50]="3.849149894363509E+36";
+        results[39][51]="9.707882302464703E-10";
+        results[39][52]="6.897226008724825E+31";
+        results[39][53]="2.022157079132508E-14";
+        results[39][54]="2.812766612669237E+26";
+        results[39][55]="102.4161315840830";
+        results[39][56]="1.182236363680106E+50";
+        results[39][57]="0.001027245891448147";
+        results[39][58]="9.449463067516497E+44";
+        results[39][59]="2.015614012667092E-8";
+        results[39][60]="4.880794460077878E+40";
+        results[39][61]="9.317562161903105E-14";
+        results[39][62]="3.489484320900643E+35";
+        results[39][63]="7.924932204624348E-19";
+        results[39][64]="3.646133938150488E+30";
+        results[39][65]="0.008598285753258867";
+        results[39][66]="7.665464822884150E+53";
+        results[39][67]="2.775537694911710E-7";
+        results[39][68]="1.635315881900131E+49";
+        results[39][69]="1.232762472960531E-12";
+        results[39][70]="1.200696006716784E+44";
+        results[39][71]="7.533770766933783E-18";
+        results[39][72]="2.926499846920735E+39";
+        results[39][73]="1.427567654834451E-22";
+        results[39][74]="8.173373847257529E+33";
+        results[40][0]="0.000003174072515461667";
+        results[40][1]="6.979408043839129E-12";
+        results[40][2]="1.565953771433517E-16";
+        results[40][3]="1.826072897737389E-21";
+        results[40][4]="1.274540858056698E-26";
+        results[40][5]="3.976488401123740E-11";
+        results[40][6]="0.02471205468678926";
+        results[40][7]="3.813427575647367E-16";
+        results[40][8]="3.643022377913347E-8";
+        results[40][9]="3.554659438554945E-21";
+        results[40][10]="1.297295377072253E-12";
+        results[40][11]="4.307589473674706E-26";
+        results[40][12]="5.783920502277423E-18";
+        results[40][13]="5.419675944492992E-31";
+        results[40][14]="4.357819914999574E-23";
+        results[40][15]="4.681371818966545E-15";
+        results[40][16]="53.77962699292531";
+        results[40][17]="5.540553012050880E-20";
+        results[40][18]="0.0004220691533424975";
+        results[40][19]="3.571143118677119E-25";
+        results[40][20]="1.428315211889754E-8";
+        results[40][21]="6.658410449100025E-30";
+        results[40][22]="8.205668052327118E-14";
+        results[40][23]="7.297670918825164E-35";
+        results[40][24]="4.346442545702108E-19";
+        results[40][25]="4.351078349405929E-19";
+        results[40][26]="1165424.600614822";
+        results[40][27]="5.072395109750087E-24";
+        results[40][28]="17.97346443838419";
+        results[40][29]="8.658661118125126E-29";
+        results[40][30]="0.00004050719050715733";
+        results[40][31]="1.056474739906990E-33";
+        results[40][32]="8.235324486033761E-10";
+        results[40][33]="4.545864497880714E-39";
+        results[40][34]="2.178702018774722E-14";
+        results[40][35]="5.348223946000686E-23";
+        results[40][36]="11269674218.70173";
+        results[40][37]="4.525019151292953E-28";
+        results[40][38]="55154.51843475961";
+        results[40][39]="4.822757775174344E-33";
+        results[40][40]="1";
+        results[40][41]="7.721152954810994E-38";
+        results[40][42]="0.000003611372963305955";
+        results[40][43]="1.392869480898883E-42";
+        results[40][44]="9.486789560505935E-11";
+        results[40][45]="1.221757241561856E-26";
+        results[40][46]="66519668984864.25";
+        results[40][47]="4.441401433197993E-32";
+        results[40][48]="550822610.4954504";
+        results[40][49]="1.880962747469021E-36";
+        results[40][50]="18563.51758085312";
+        results[40][51]="4.681876485468906E-42";
+        results[40][52]="0.3326365036071236";
+        results[40][53]="9.752373776010145E-47";
+        results[40][54]="0.000001356529205100136";
+        results[40][55]="4.939281949004150E-31";
+        results[40][56]="5.701639615032074E+17";
+        results[40][57]="4.954158109997452E-36";
+        results[40][58]="4557247148008.799";
+        results[40][59]="9.720818151340577E-41";
+        results[40][60]="235388894.3136845";
+        results[40][61]="4.493634536198847E-46";
+        results[40][62]="1682.893763997254";
+        results[40][63]="3.822002840758163E-51";
+        results[40][64]="0.01758442079954232";
+        results[40][65]="4.146744946969999E-35";
+        results[40][66]="3.696868007488996E+21";
+        results[40][67]="1.338574599842493E-39";
+        results[40][68]="7.886732384299944E+16";
+        results[40][69]="5.945314801413554E-45";
+        results[40][70]="579066600201.4157";
+        results[40][71]="3.633355154261108E-50";
+        results[40][72]="14113799.89078350";
+        results[40][73]="6.884813006940251E-55";
+        results[40][74]="39.41820227126789";
+        results[41][0]="4.110878950382567E+31";
+        results[41][1]="9.039334001912643E+25";
+        results[41][2]="2.028134632999056E+21";
+        results[41][3]="2.365026192881695E+16";
+        results[41][4]="165071313250.2498";
+        results[41][5]="5.150122558634225E+26";
+        results[41][6]="3.200565360046566E+35";
+        results[41][7]="4.938935412840446E+21";
+        results[41][8]="4.718236252065705E+29";
+        results[41][9]="4.603793577667779E+16";
+        results[41][10]="1.680183496771577E+25";
+        results[41][11]="557894591505.3629";
+        results[41][12]="7.491006247549473E+19";
+        results[41][13]="7019257.326220990";
+        results[41][14]="564400153772921.7";
+        results[41][15]="6.063047638564933E+22";
+        results[41][16]="6.965232693572741E+38";
+        results[41][17]="7.175810457942816E+17";
+        results[41][18]="5.466400624527316E+33";
+        results[41][19]="4625142306567.008";
+        results[41][20]="1.849872966186717E+29";
+        results[41][21]="86235960.97719082";
+        results[41][22]="1.062751651256206E+24";
+        results[41][23]="945.1530051969814";
+        results[41][24]="5.629266213401292E+18";
+        results[41][25]="5.635270243797986E+18";
+        results[41][26]="1.509391935939637E+43";
+        results[41][27]="65694788581924.34";
+        results[41][28]="2.327821316787288E+38";
+        results[41][29]="1121420747.497299";
+        results[41][30]="5.246261891744755E+32";
+        results[41][31]="13682.86247002409";
+        results[41][32]="1.066592584583160E+28";
+        results[41][33]="0.05887546231095213";
+        results[41][34]="2.821731458405042E+23";
+        results[41][35]="692671674463882.5";
+        results[41][36]="1.459584376149378E+47";
+        results[41][37]="5860548518.823794";
+        results[41][38]="7.143300846072895E+41";
+        results[41][39]="62461.62721293222";
+        results[41][40]="1.295143362464938E+37";
+        results[41][41]="1";
+        results[41][42]="4.677245722811041E+31";
+        results[41][43]="0.00001803965662966171";
+        results[41][44]="1.228675253039092E+27";
+        results[41][45]="158235078195.2310";
+        results[41][46]="8.615250775911171E+50";
+        results[41][47]="575225.1586248642";
+        results[41][48]="7.133942478787923E+45";
+        results[41][49]="24.36116417428315";
+        results[41][50]="2.404241657884309E+41";
+        results[41][51]="0.00006063701254035724";
+        results[41][52]="4.308119597603104E+36";
+        results[41][53]="1.263072216427666E-9";
+        results[41][54]="1.756899795975280E+31";
+        results[41][55]="6397078.231595606";
+        results[41][56]="7.384440702575934E+54";
+        results[41][57]="64.16344992765041";
+        results[41][58]="5.902288394855864E+49";
+        results[41][59]="0.001258985310643743";
+        results[41][60]="3.048623640683292E+45";
+        results[41][61]="5.819900942901146E-9";
+        results[41][62]="2.179588688174679E+40";
+        results[41][63]="4.950041610530071E-14";
+        results[41][64]="2.277434588131763E+35";
+        results[41][65]="537.0629193903215";
+        results[41][66]="4.787974061808353E+58";
+        results[41][67]="0.01733646008150164";
+        results[41][68]="1.021444909906334E+54";
+        results[41][69]="7.700035002815314E-8";
+        results[41][70]="7.499742636760013E+48";
+        results[41][71]="4.705715811519044E-13";
+        results[41][72]="1.827939424770661E+44";
+        results[41][73]="8.916819867750936E-18";
+        results[41][74]="5.105222303193294E+38";
+        results[42][0]="0.8789101950179163";
+        results[42][1]="0.000001932619010762593";
+        results[42][2]="4.336172938504800E-11";
+        results[42][3]="5.056450597297903E-16";
+        results[42][4]="3.529241845156713E-21";
+        results[42][5]="0.00001101101559303791";
+        results[42][6]="6842.842026531408";
+        results[42][7]="1.055949527892695E-10";
+        results[42][8]="0.01008763817785915";
+        results[42][9]="9.842958549761383E-16";
+        results[42][10]="3.592249790463821E-7";
+        results[42][11]="1.192784438894235E-20";
+        results[42][12]="1.601584926576693E-12";
+        results[42][13]="1.500724516564931E-25";
+        results[42][14]="1.206693398681896E-17";
+        results[42][15]="1.296285890859935E-9";
+        results[42][16]="14891739.93917645";
+        results[42][17]="1.534195738946580E-14";
+        results[42][18]="116.8722138729541";
+        results[42][19]="9.888602354180532E-20";
+        results[42][20]="0.003955047640890110";
+        results[42][21]="1.843733814467261E-24";
+        results[42][22]="2.272174083292525E-8";
+        results[42][23]="2.020746954959940E-29";
+        results[42][24]="1.203542971015447E-13";
+        results[42][25]="1.204826638958615E-13";
+        results[42][26]="322709565712.6364";
+        results[42][27]="1.404561412318563E-18";
+        results[42][28]="4976906.185267212";
+        results[42][29]="2.397609221230570E-23";
+        results[42][30]="11.21656248710349";
+        results[42][31]="2.925410226640957E-28";
+        results[42][32]="0.0002280386038692306";
+        results[42][33]="1.258763507416664E-33";
+        results[42][34]="6.032891204846025E-9";
+        results[42][35]="1.480939243977938E-17";
+        results[42][36]="3120606576282596";
+        results[42][37]="1.252991368454678E-22";
+        results[42][38]="15272451501.17909";
+        results[42][39]="1.335436085991919E-27";
+        results[42][40]="276902.9978793913";
+        results[42][41]="2.138010400272485E-32";
+        results[42][42]="1";
+        results[42][43]="3.856897349156122E-37";
+        results[42][44]="0.00002626920469555007";
+        results[42][45]="3.383082428693337E-21";
+        results[42][46]="1.841949575985368E+19";
+        results[42][47]="1.229837371638349E-26";
+        results[42][48]="152524432145942.5";
+        results[42][49]="5.208442236736284E-31";
+        results[42][50]="5140293669.325014";
+        results[42][51]="1.296425634527369E-36";
+        results[42][52]="92108.04505293148";
+        results[42][53]="2.700461535017569E-41";
+        results[42][54]="0.3756270036031754";
+        results[42][55]="1.367701979050812E-25";
+        results[42][56]="1.578801102230280E+23";
+        results[42][57]="1.371821232626794E-30";
+        results[42][58]="1.261915397360943E+18";
+        results[42][59]="2.691723687946608E-35";
+        results[42][60]="65179890502974.45";
+        results[42][61]="1.244300874447829E-40";
+        results[42][62]="465998328.3633725";
+        results[42][63]="1.058324044509485E-45";
+        results[42][64]="4869.178835365991";
+        results[42][65]="1.148246107257210E-29";
+        results[42][66]="1.023673834038115E+27";
+        results[42][67]="3.706553195815928E-34";
+        results[42][68]="2.183859840685134E+22";
+        results[42][69]="1.646275491848131E-39";
+        results[42][70]="1.603452775675989E+17";
+        results[42][71]="1.006086934575439E-44";
+        results[42][72]="3908153501227.777";
+        results[42][73]="1.906425361460782E-49";
+        results[42][74]="10915018.37993031";
+        results[43][0]="2.278801107346606E+36";
+        results[43][1]="5.010812670929508E+30";
+        results[43][2]="1.124264543740979E+26";
+        results[43][3]="1.311015082733337E+21";
+        results[43][4]="9150468694555485";
+        results[43][5]="2.854889460681936E+31";
+        results[43][6]="1.774183082168003E+40";
+        results[43][7]="2.737821187083793E+26";
+        results[43][8]="2.615480077546344E+34";
+        results[43][9]="2.552040580472019E+21";
+        results[43][10]="9.313833025008547E+29";
+        results[43][11]="3.092600945563700E+16";
+        results[43][12]="4.152521525954315E+24";
+        results[43][13]="389101492911.9866";
+        results[43][14]="3.128663507069788E+19";
+        results[43][15]="3.360955124054725E+27";
+        results[43][16]="3.861067223485925E+43";
+        results[43][17]="3.977797696073652E+22";
+        results[43][18]="3.030213233404445E+38";
+        results[43][19]="2.563874912653335E+17";
+        results[43][20]="1.025447991701273E+34";
+        results[43][21]="4780354900735.599";
+        results[43][22]="5.891196673382220E+28";
+        results[43][23]="52393070.69974453";
+        results[43][24]="3.120495211724467E+23";
+        results[43][25]="3.123823451568468E+23";
+        results[43][26]="8.367076862526411E+47";
+        results[43][27]="3.641687307612366E+18";
+        results[43][28]="1.290391144673877E+43";
+        results[43][29]="62164195833605.98";
+        results[43][30]="2.908182788312382E+37";
+        results[43][31]="758487966.3133965";
+        results[43][32]="5.912488283338024E+32";
+        results[43][33]="3263.668678379727";
+        results[43][34]="1.564182465516227E+28";
+        results[43][35]="3.839716512812981E+19";
+        results[43][36]="8.090976486489524E+51";
+        results[43][37]="324870292108974.2";
+        results[43][38]="3.959776503909459E+46";
+        results[43][39]="3462462090.893108";
+        results[43][40]="7.179423583569754E+41";
+        results[43][41]="55433.42761611934";
+        results[43][42]="2.592757622182496E+36";
+        results[43][43]="1";
+        results[43][44]="6.810968070305965E+31";
+        results[43][45]="8771512753466319";
+        results[43][46]="4.775728802811879E+55";
+        results[43][47]="31886702193.60218";
+        results[43][48]="3.954588840154493E+50";
+        results[43][49]="1350422.830899525";
+        results[43][50]="1.332753559139886E+46";
+        results[43][51]="3.361317445513614";
+        results[43][52]="2.388138358753168E+41";
+        results[43][53]="0.00007001642228327445";
+        results[43][54]="9.739097766897050E+35";
+        results[43][55]="354611973105.8077";
+        results[43][56]="4.093448591717685E+59";
+        results[43][57]="3556799.957164907";
+        results[43][58]="3.271840765057037E+54";
+        results[43][59]="69.78987108732747";
+        results[43][60]="1.689956579146075E+50";
+        results[43][61]="0.0003226170576512954";
+        results[43][62]="1.208220717788436E+45";
+        results[43][63]="2.743977733140975E-9";
+        results[43][64]="1.262460053916486E+40";
+        results[43][65]="29771238.46732512";
+        results[43][66]="2.654138135831102E+63";
+        results[43][67]="961.0194050476638";
+        results[43][68]="5.662219247714633E+58";
+        results[43][69]="0.004268393329701480";
+        results[43][70]="4.157364405943601E+53";
+        results[43][71]="2.608539568198692E-8";
+        results[43][72]="1.013289477896753E+49";
+        results[43][73]="4.942898887049463E-13";
+        results[43][74]="2.829999710082635E+43";
+        results[44][0]="33457.81515672613";
+        results[44][1]="0.07356975717997179";
+        results[44][2]="0.000001650667764311622";
+        results[44][3]="1.924858653278701E-11";
+        results[44][4]="1.343490176447769E-16";
+        results[44][5]="0.4191605996698921";
+        results[44][6]="260489120.4677608";
+        results[44][7]="0.000004019724008133258";
+        results[44][8]="384.0100336028812";
+        results[44][9]="3.746957193351482E-11";
+        results[44][10]="0.01367475655276438";
+        results[44][11]="4.540618769080169E-16";
+        results[44][12]="6.096815435177592E-8";
+        results[44][13]="5.712866201918743E-21";
+        results[44][14]="4.593566545569257E-13";
+        results[44][15]="0.00004934621759141124";
+        results[44][16]="566889637953.1077";
+        results[44][17]="5.840282401874423E-10";
+        results[44][18]="4449019.878121849";
+        results[44][19]="3.764332597345680E-15";
+        results[44][20]="150.5583319604680";
+        results[44][21]="7.018612995084639E-20";
+        results[44][22]="0.0008649573177513917";
+        results[44][23]="7.692455779988837E-25";
+        results[44][24]="4.581573690425900E-9";
+        results[44][25]="4.586460278954353E-9";
+        results[44][26]="1.228471015596839E+16";
+        results[44][27]="5.346798384636640E-14";
+        results[44][28]="189457817354.8698";
+        results[44][29]="9.127071980358501E-19";
+        results[44][30]="426985.2329790381";
+        results[44][31]="1.113627253106948E-23";
+        results[44][32]="8.680833946520647";
+        results[44][33]="4.791783847304273E-29";
+        results[44][34]="0.0002296564085119783";
+        results[44][35]="5.637548837665439E-13";
+        results[44][36]="1.187933404322369E+20";
+        results[44][37]="4.769810822125617E-18";
+        results[44][38]="581382332589848.2";
+        results[44][39]="5.083656324845414E-23";
+        results[44][40]="10540973778.55897";
+        results[44][41]="8.138847083690577E-28";
+        results[44][42]="38067.38771080486";
+        results[44][43]="1.468220067511016E-32";
+        results[44][44]="1";
+        results[44][45]="1.287851104706806E-16";
+        results[44][46]="7.011820865278762E+23";
+        results[44][47]="4.681669604739426E-22";
+        results[44][48]="5.806206693869941E+18";
+        results[44][49]="1.982717899951718E-26";
+        results[44][50]="195677552057591.1";
+        results[44][51]="4.935153726777955E-32";
+        results[44][52]="3506312662.314225";
+        results[44][53]="1.027995162516290E-36";
+        results[44][54]="14299.13878080998";
+        results[44][55]="5.206484150936237E-21";
+        results[44][56]="6.010083367684613E+27";
+        results[44][57]="5.222165073231839E-26";
+        results[44][58]="4.803782268957339E+22";
+        results[44][59]="1.024668892394211E-30";
+        results[44][60]="2.481228162724536E+18";
+        results[44][61]="4.736728381649903E-36";
+        results[44][62]="17739339038395.46";
+        results[44][63]="4.028763172600968E-41";
+        results[44][64]="185356918.5591225";
+        results[44][65]="4.371072975238266E-25";
+        results[44][66]="3.896858872973504E+31";
+        results[44][67]="1.410987975758478E-29";
+        results[44][68]="8.313383926141755E+26";
+        results[44][69]="6.266940742697879E-35";
+        results[44][70]="6.103925848762411E+21";
+        results[44][71]="3.829910140925841E-40";
+        results[44][72]="1.487731945645773E+17";
+        results[44][73]="7.257263337643890E-45";
+        results[44][74]="415506236539.3683";
+        results[45][0]="2.597956785100805E+20";
+        results[45][1]="571259805664574.7";
+        results[45][2]="12817225207.78065";
+        results[45][3]="149462.8258067859";
+        results[45][4]="1.043203031420026";
+        results[45][5]="3254728734851059";
+        results[45][6]="2.022664883508130E+24";
+        results[45][7]="31212645572.47396";
+        results[45][8]="2.981789060858130E+18";
+        results[45][9]="290946.4595446784";
+        results[45][10]="106182745061026.3";
+        results[45][11]="3.525732712799818";
+        results[45][12]="473409962.7585133";
+        results[45][13]="0.00004435967932193017";
+        results[45][14]="3566.845987692836";
+        results[45][15]="383167102245.4531";
+        results[45][16]="4.401825924450844E+27";
+        results[45][17]="4534904.990592084";
+        results[45][18]="3.454607339203797E+22";
+        results[45][19]="29.22956375615078";
+        results[45][20]="1.169066295088082E+18";
+        results[45][21]="0.0005449863706629740";
+        results[45][22]="6716283540777.093";
+        results[45][23]="5.973094057127134E-9";
+        results[45][24]="35575336.88235604";
+        results[45][25]="35613280.62065461";
+        results[45][26]="9.538921161825726E+31";
+        results[45][27]="415.1720928836645";
+        results[45][28]="1.471115850756691E+27";
+        results[45][29]="0.007087055286904757";
+        results[45][30]="3.315486017121880E+21";
+        results[45][31]="8.647173955412170E-8";
+        results[45][32]="6.740557130241340E+16";
+        results[45][33]="3.720759200959941E-13";
+        results[45][34]="1783252797412.961";
+        results[45][35]="4377.484956965496";
+        results[45][36]="9.224151767085032E+35";
+        results[45][37]="0.03703697426428437";
+        results[45][38]="4.514359854683718E+30";
+        results[45][39]="3.947394466849308E-7";
+        results[45][40]="8.184932046906727E+25";
+        results[45][41]="6.319711225890107E-12";
+        results[45][42]="2.955884230069542E+20";
+        results[45][43]="1.140054205136760E-16";
+        results[45][44]="7764872789604521";
+        results[45][45]="1";
+        results[45][46]="5.444589704238428E+39";
+        results[45][47]="0.000003635256892375972";
+        results[45][48]="4.508445636805033E+34";
+        results[45][49]="1.539555227079692E-10";
+        results[45][50]="1.519411299508411E+30";
+        results[45][51]="3.832084088557348E-16";
+        results[45][52]="2.722607178344951E+25";
+        results[45][53]="7.982251665267820E-21";
+        results[45][54]="1.110309936338901E+20";
+        results[45][55]="0.00004042768711311199";
+        results[45][56]="4.666753280498896E+43";
+        results[45][57]="4.054944747996101E-10";
+        results[45][58]="3.730075822741150E+38";
+        results[45][59]="7.956423600906009E-15";
+        results[45][60]="1.926642104554017E+34";
+        results[45][61]="3.678009332242079E-20";
+        results[45][62]="1.377437110048061E+29";
+        results[45][63]="3.128283353469004E-25";
+        results[45][64]="1.439272893284671E+24";
+        results[45][65]="3.394082560680328E-9";
+        results[45][66]="3.025861342768090E+47";
+        results[45][67]="1.095614213942617E-13";
+        results[45][68]="6.455236863763371E+42";
+        results[45][69]="4.866199764703870E-19";
+        results[45][70]="4.739620773281892E+37";
+        results[45][71]="2.973876503990548E-24";
+        results[45][72]="1.155204930297025E+33";
+        results[45][73]="5.635172661746553E-29";
+        results[45][74]="3.226353070015521E+27";
+        results[46][0]="4.771630051532411E-20";
+        results[46][1]="1.049224710578041E-25";
+        results[46][2]="2.354121413006176E-30";
+        results[46][3]="2.745162334095334E-35";
+        results[46][4]="1.916036080015227E-40";
+        results[46][5]="5.977913693510024E-25";
+        results[46][6]="3.714999648060815E-16";
+        results[46][7]="5.732781948321280E-30";
+        results[46][8]="5.476609299938448E-22";
+        results[46][9]="5.343771989249925E-35";
+        results[46][10]="1.950243284234377E-26";
+        results[46][11]="6.475662821856263E-40";
+        results[46][12]="8.695053043023237E-32";
+        results[46][13]="8.147478824234940E-45";
+        results[46][14]="6.551174985538704E-37";
+        results[46][15]="7.037575337351325E-29";
+        results[46][16]="8.084770687172574E-13";
+        results[46][17]="8.329195103649068E-34";
+        results[46][18]="6.345027865946450E-18";
+        results[46][19]="5.368552148823365E-39";
+        results[46][20]="2.147207335344303E-22";
+        results[46][21]="1.000968668472338E-43";
+        results[46][22]="1.233570187216990E-27";
+        results[46][23]="1.097069638227704E-48";
+        results[46][24]="6.534071218380670E-33";
+        results[46][25]="6.541040290498085E-33";
+        results[46][26]="1.752E-8";
+        results[46][27]="7.625406420624627E-38";
+        results[46][28]="2.701977432039512E-13";
+        results[46][29]="1.301669303269579E-42";
+        results[46][30]="6.089505724445841E-19";
+        results[46][31]="1.588214066650539E-47";
+        results[46][32]="1.238028482659409E-23";
+        results[46][33]="6.833865181913444E-53";
+        results[46][34]="3.275274895415460E-28";
+        results[46][35]="8.040063980501181E-37";
+        results[46][36]="0.0001694186755689661";
+        results[46][37]="6.802528064778204E-42";
+        results[46][38]="8.291460146518372E-10";
+        results[46][39]="7.250122931717692E-47";
+        results[46][40]="1.503314756763955E-14";
+        results[46][41]="1.160732317619898E-51";
+        results[46][42]="5.429030267916215E-20";
+        results[46][43]="2.093921244881440E-56";
+        results[46][44]="1.426163074062281E-24";
+        results[46][45]="1.836685690423163E-40";
+        results[46][46]="1";
+        results[46][47]="6.676824315239122E-46";
+        results[46][48]="0.000008280597587170547";
+        results[46][49]="2.827679055193452E-50";
+        results[46][50]="2.790680991674361E-10";
+        results[46][51]="7.038334009951569E-56";
+        results[46][52]="5.000573645109554E-15";
+        results[46][53]="1.466088741095387E-60";
+        results[46][54]="2.039290372008313E-20";
+        results[46][55]="7.425295441755768E-45";
+        results[46][56]="8571.358971027673";
+        results[46][57]="7.447658994100996E-50";
+        results[46][58]="0.06850976887822076";
+        results[46][59]="1.461344937472920E-54";
+        results[46][60]="0.000003538635984001130";
+        results[46][61]="6.755347109771878E-60";
+        results[46][62]="2.529919029483109E-11";
+        results[46][63]="5.745673270905503E-65";
+        results[46][64]="2.643491927709899E-16";
+        results[46][65]="6.233862871316364E-49";
+        results[46][66]="55575562.29466768";
+        results[46][67]="2.012298948972625E-53";
+        results[46][68]="1185.624117596628";
+        results[46][69]="8.937679474572159E-59";
+        results[46][70]="0.008705193652319216";
+        results[46][71]="5.462076419965100E-64";
+        results[46][72]="2.121748364982833E-7";
+        results[46][73]="1.035004099089370E-68";
+        results[46][74]="5.925796515950347E-13";
+        results[47][0]="7.146556246270681E+25";
+        results[47][1]="1.571442741399231E+20";
+        results[47][2]="3525810028628656";
+        results[47][3]="41114790572.36538";
+        results[47][4]="286968.1737232600";
+        results[47][5]="8.953228977234115E+20";
+        results[47][6]="5.564021865277680E+29";
+        results[47][7]="8586090748616571";
+        results[47][8]="8.202416360482460E+23";
+        results[47][9]="80034635283.92306";
+        results[47][10]="2.920914482927399E+19";
+        results[47][11]="969871.6809241588";
+        results[47][12]="130227375058794.5";
+        results[47][13]="12.20262573876507";
+        results[47][14]="981181273.6462696";
+        results[47][15]="1.054030330150941E+17";
+        results[47][16]="1.210870663276248E+33";
+        results[47][17]="1247478548243.150";
+        results[47][18]="9.503062483559163E+27";
+        results[47][19]="8040577.219577623";
+        results[47][20]="3.215911088814389E+23";
+        results[47][21]="149.9168798238013";
+        results[47][22]="1.847540281090668E+18";
+        results[47][23]="0.001643100951037101";
+        results[47][24]="9786196116419.247";
+        results[47][25]="9796633821214.788";
+        results[47][26]="2.624001946556017E+37";
+        results[47][27]="114207084.9942909";
+        results[47][28]="4.046800251839102E+32";
+        results[47][29]="1949.533553397026";
+        results[47][30]="9.120362371295601E+26";
+        results[47][31]="0.02378696805044898";
+        results[47][32]="1.854217550450959E+22";
+        results[47][33]="1.023520293369992E-7";
+        results[47][34]="4.905438185545787E+17";
+        results[47][35]="1204174859.319065";
+        results[47][36]="2.537414009565692E+41";
+        results[47][37]="10188.26876910955";
+        results[47][38]="1.241826915768028E+36";
+        results[47][39]="0.1085863966072925";
+        results[47][40]="2.251541579928655E+31";
+        results[47][41]="0.000001738449692274594";
+        results[47][42]="8.131156387513517E+25";
+        results[47][43]="3.136103551657476E-11";
+        results[47][44]="2.135990115551220E+21";
+        results[47][45]="275083.7229955457";
+        results[47][46]="1.497718006025124E+45";
+        results[47][47]="1";
+        results[47][48]="1.240200010695352E+40";
+        results[47][49]="0.00004235065836223342";
+        results[47][50]="4.179653170302738E+35";
+        results[47][51]="1.054143957912348E-10";
+        results[47][52]="7.489449188735266E+30";
+        results[47][53]="2.195787505969266E-15";
+        results[47][54]="3.054281909670523E+25";
+        results[47][55]="11.12099868317389";
+        results[47][56]="1.283747866701312E+49";
+        results[47][57]="0.0001115449297820002";
+        results[47][58]="1.026083144375309E+44";
+        results[47][59]="2.188682625866851E-9";
+        results[47][60]="5.299878830006924E+39";
+        results[47][61]="1.011760500325512E-14";
+        results[47][62]="3.789105284242457E+34";
+        results[47][63]="8.605398314572440E-20";
+        results[47][64]="3.959205458913181E+29";
+        results[47][65]="0.0009336568669461997";
+        results[47][66]="8.323652034369472E+52";
+        results[47][67]="3.013856369381733E-8";
+        results[47][68]="1.775730589302118E+48";
+        results[47][69]="1.338612348114789E-13";
+        results[47][70]="1.303792527901410E+43";
+        results[47][71]="8.180650204466976E-19";
+        results[47][72]="3.177780730489156E+38";
+        results[47][73]="1.550144275515960E-23";
+        results[47][74]="8.875172141979778E+32";
+        results[48][0]="5.762422338848205E-15";
+        results[48][1]="1.267088153400481E-20";
+        results[48][2]="2.842936621692024E-25";
+        results[48][3]="3.315174183018531E-30";
+        results[48][4]="2.313886238094478E-35";
+        results[48][5]="7.219181503001472E-20";
+        results[48][6]="4.486390757373126E-11";
+        results[48][7]="6.923150035938593E-25";
+        results[48][8]="6.613785107035720E-17";
+        results[48][9]="6.453365150275192E-30";
+        results[48][10]="2.355196305223146E-21";
+        results[48][11]="7.820284410257130E-35";
+        results[48][12]="1.050051394418058E-26";
+        results[48][13]="9.839240149597593E-40";
+        results[48][14]="7.911476094054727E-32";
+        results[48][15]="8.498873738599392E-24";
+        results[48][16]="9.763511150087314E-8";
+        results[48][17]="1.005868841707006E-28";
+        results[48][18]="7.662524110309441E-13";
+        results[48][19]="6.483290719429564E-34";
+        results[48][20]="2.593058426931717E-17";
+        results[48][21]="1.208812115230884E-38";
+        results[48][22]="1.489711550683502E-22";
+        results[48][23]="1.324867712358631E-43";
+        results[48][24]="7.890820861170891E-28";
+        results[48][25]="7.899237007522711E-28";
+        results[48][26]="0.002115789327468880";
+        results[48][27]="9.208763426010420E-33";
+        results[48][28]="3.263022268134115E-8";
+        results[48][29]="1.571950924515769E-37";
+        results[48][30]="7.353944761040615E-14";
+        results[48][31]="1.917994504540616E-42";
+        results[48][32]="1.495095576891135E-18";
+        results[48][33]="8.252864735875365E-48";
+        results[48][34]="3.955360541236747E-23";
+        results[48][35]="9.709521439561277E-32";
+        results[48][36]="20.45971607549835";
+        results[48][37]="8.215020707343183E-37";
+        results[48][38]="0.0001001311808626548";
+        results[48][39]="8.755555206487259E-42";
+        results[48][40]="1.815466505814869E-9";
+        results[48][41]="1.401749457573287E-46";
+        results[48][42]="6.556326654887352E-15";
+        results[48][43]="2.528707889543666E-51";
+        results[48][44]="1.722294869481269E-19";
+        results[48][45]="2.218059350292316E-35";
+        results[48][46]="120764.2310199132";
+        results[48][47]="8.063215540849113E-41";
+        results[48][48]="1";
+        results[48][49]="3.414824866715520E-45";
+        results[48][50]="0.00003370144439814430";
+        results[48][51]="8.499789943731035E-51";
+        results[48][52]="6.038904309100998E-10";
+        results[48][53]="1.770510794253370E-55";
+        results[48][54]="2.462733336018967E-15";
+        results[48][55]="8.967100941193022E-40";
+        results[48][56]="1035113574.931792";
+        results[48][57]="8.994108113211472E-45";
+        results[48][58]="8273.529555930313";
+        results[48][59]="1.764781976287603E-49";
+        results[48][60]="0.4273406534672904";
+        results[48][61]="8.158042989841942E-55";
+        results[48][62]="0.000003055237261381728";
+        results[48][63]="6.938718142525727E-60";
+        results[48][64]="3.192392698572340E-11";
+        results[48][65]="7.528276559381090E-44";
+        results[48][66]="6711540044014.826";
+        results[48][67]="2.430137351548587E-48";
+        results[48][68]="143180984.8402199";
+        results[48][69]="1.079351988849169E-53";
+        results[48][70]="1051.276017301760";
+        results[48][71]="6.596234586290859E-59";
+        results[48][72]="0.02562313097149101";
+        results[48][73]="1.249914741289858E-63";
+        results[48][74]="7.156242594292246E-8";
+        results[49][0]="1.687472290311238E+30";
+        results[49][1]="3.710550915072856E+24";
+        results[49][2]="8.325277964917845E+19";
+        results[49][3]="970818215402995.0";
+        results[49][4]="6776002660.189255";
+        results[49][5]="2.114070789798686E+25";
+        results[49][6]="1.313798198291870E+34";
+        results[49][7]="2.027380702131727E+20";
+        results[49][8]="1.936786033011718E+28";
+        results[49][9]="1889808526690925";
+        results[49][10]="6.896975385705340E+23";
+        results[49][11]="22900982379.74620";
+        results[49][12]="3.074978762902205E+18";
+        results[49][13]="288133.0824752154";
+        results[49][14]="23168028823874.12";
+        results[49][15]="2.488816870650781E+21";
+        results[49][16]="2.859154284968690E+37";
+        results[49][17]="2.945594228012286E+16";
+        results[49][18]="2.243899587646931E+32";
+        results[49][19]="189857195390.0929";
+        results[49][20]="7.593532693891262E+27";
+        results[49][21]="3539894.906509671";
+        results[49][22]="4.362483022786321E+22";
+        results[49][23]="38.79753030008030";
+        results[49][24]="2.310754187742728E+17";
+        results[49][25]="2.313218778660363E+17";
+        results[49][26]="6.195894108923685E+41";
+        results[49][27]="2696701525096.859";
+        results[49][28]="9.555460076266186E+36";
+        results[49][29]="46033134.51994738";
+        results[49][30]="2.153534968284877E+31";
+        results[49][31]="561.6670193647148";
+        results[49][32]="4.378249647482396E+26";
+        results[49][33]="0.002416775400787454";
+        results[49][34]="1.158290892101044E+22";
+        results[49][35]="28433438956710.49";
+        results[49][36]="5.991439348740924E+45";
+        results[49][37]="240569312.5704755";
+        results[49][38]="2.932249376494788E+40";
+        results[49][39]="2563.983673607429";
+        results[49][40]="5.316426395714516E+35";
+        results[49][41]="0.04104894137430629";
+        results[49][42]="1.919959854688953E+30";
+        results[49][43]="7.405088074035996E-7";
+        results[49][44]="5.043581843006266E+25";
+        results[49][45]="6495382448.194808";
+        results[49][46]="3.536469240253245E+49";
+        results[49][47]="23612.38381341809";
+        results[49][48]="2.928407865794388E+44";
+        results[49][49]="1";
+        results[49][50]="9.869157486415798E+39";
+        results[49][51]="0.000002489085172882200";
+        results[49][52]="1.768437487955098E+35";
+        results[49][53]="5.184777736365438E-11";
+        results[49][54]="7.211887672551995E+29";
+        results[49][55]="262593.2892956190";
+        results[49][56]="3.031234734820807E+53";
+        results[49][57]="2.633841694453359";
+        results[49][58]="2.422826902946868E+48";
+        results[49][59]="0.00005168001420772782";
+        results[49][60]="1.251427730987327E+44";
+        results[49][61]="2.389007726094191E-10";
+        results[49][62]="8.946980828098355E+38";
+        results[49][63]="2.031939678710256E-15";
+        results[49][64]="9.348627889203813E+33";
+        results[49][65]="22.04586429236709";
+        results[49][66]="1.965412665648703E+57";
+        results[49][67]="0.0007116433335235624";
+        results[49][68]="4.192923222382870E+52";
+        results[49][69]="3.160782854106722E-9";
+        results[49][70]="3.078564958187471E+47";
+        results[49][71]="1.931646524711914E-14";
+        results[49][72]="7.503497828319405E+42";
+        results[49][73]="3.660260159965578E-19";
+        results[49][74]="2.095639710265825E+37";
+        results[50][0]="1.709844323220016E-10";
+        results[50][1]="3.759744355260485E-16";
+        results[50][2]="8.435652158126978E-21";
+        results[50][3]="9.836890501942623E-26";
+        results[50][4]="6.865836997247178E-31";
+        results[50][5]="2.142098545603874E-15";
+        results[50][6]="0.000001331216165209868";
+        results[50][7]="2.054259145142100E-20";
+        results[50][8]="1.962463397384800E-12";
+        results[50][9]="1.914863076500820E-25";
+        results[50][10]="6.988413545126361E-17";
+        results[50][11]="2.320459716168051E-30";
+        results[50][12]="3.115745966294182E-22";
+        results[50][13]="2.919530698256769E-35";
+        results[50][14]="2.347518403243974E-27";
+        results[50][15]="2.521812904573124E-19";
+        results[50][16]="0.002897060148147514";
+        results[50][17]="2.984646087638879E-24";
+        results[50][18]="2.273648577130825E-8";
+        results[50][19]="1.923742686763465E-29";
+        results[50][20]="7.694205614150171E-13";
+        results[50][21]="3.586825837344361E-34";
+        results[50][22]="4.420319595457841E-18";
+        results[50][23]="3.931189704235886E-39";
+        results[50][24]="2.341389516707296E-23";
+        results[50][25]="2.343886782477983E-23";
+        results[50][26]="62.78037530003851";
+        results[50][27]="2.732453635286172E-28";
+        results[50][28]="0.0009682143677835323";
+        results[50][29]="4.664342886746792E-33";
+        results[50][30]="2.182085929066454E-9";
+        results[50][31]="5.691134427004636E-38";
+        results[50][32]="4.436295249628704E-14";
+        results[50][33]="2.448816329168904E-43";
+        results[50][34]="1.173647186900553E-18";
+        results[50][35]="2.881040149156310E-27";
+        results[50][36]="607087.2166127371";
+        results[50][37]="2.437587128400801E-32";
+        results[50][38]="2.971124313834108";
+        results[50][39]="2.597976247857604E-37";
+        results[50][40]="0.00005386910081262968";
+        results[50][41]="4.159315669124470E-42";
+        results[50][42]="1.945414142323337E-10";
+        results[50][43]="7.503262648537709E-47";
+        results[50][44]="5.110448232230970E-15";
+        results[50][45]="6.581496401425599E-31";
+        results[50][46]="3583354754.568408";
+        results[50][47]="2.392543015543006E-36";
+        results[50][48]="29672.31873465527";
+        results[50][49]="1.013257718682096E-40";
+        results[50][50]="1";
+        results[50][51]="2.522084763880048E-46";
+        results[50][52]="0.00001791882934677280";
+        results[50][53]="5.253516061023365E-51";
+        results[50][54]="7.307500850481565E-11";
+        results[50][55]="2.660746772529066E-35";
+        results[50][56]="30714219921944.59";
+        results[50][57]="2.668760426691597E-40";
+        results[50][58]="245494806.0441551";
+        results[50][59]="5.236517329758060E-45";
+        results[50][60]="12680.18807795731";
+        results[50][61]="2.420680518456101E-50";
+        results[50][62]="0.09065597382971390";
+        results[50][63]="2.058878563349585E-55";
+        results[50][64]="9.472569367822474E-7";
+        results[50][65]="2.233814215925896E-39";
+        results[50][66]="1.991469553864102E+17";
+        results[50][67]="7.210781006414067E-44";
+        results[50][68]="4248511818920.849";
+        results[50][69]="3.202687624001662E-49";
+        results[50][70]="31193797.06347679";
+        results[50][71]="1.957255750929793E-54";
+        results[50][72]="760.2977091658982";
+        results[50][73]="3.708786859469685E-59";
+        results[50][74]="0.002123423112003558";
+        results[51][0]="6.779487936755711E+35";
+        results[51][1]="1.490728784815458E+30";
+        results[51][2]="3.344713975889266E+25";
+        results[51][3]="3.900301307403033E+20";
+        results[51][4]="2722286378148756";
+        results[51][5]="8.493364601705167E+30";
+        results[51][6]="5.278237211829022E+39";
+        results[51][7]="8.145083680620504E+25";
+        results[51][8]="7.781115946181321E+33";
+        results[51][9]="7.592381921196569E+20";
+        results[51][10]="2.770887658182901E+29";
+        results[51][11]="9200561969210697";
+        results[51][12]="1.235385111125618E+24";
+        results[51][13]="115758627151.1858";
+        results[51][14]="9.307848954420085E+18";
+        results[51][15]="9.998922084971854E+26";
+        results[51][16]="1.148676757275435E+43";
+        results[51][17]="1.183404352773304E+22";
+        results[51][18]="9.014957029568579E+37";
+        results[51][19]="7.627589343206385E+16";
+        results[51][20]="3.050732364091198E+33";
+        results[51][21]="1422167045577.915";
+        results[51][22]="1.752645136580379E+28";
+        results[51][23]="15587064.16428300";
+        results[51][24]="9.283548079903686E+22";
+        results[51][25]="9.293449673246033E+22";
+        results[51][26]="2.489225429658254E+47";
+        results[51][27]="1.083410706261310E+18";
+        results[51][28]="3.838944597143528E+42";
+        results[51][29]="18493997321370.88";
+        results[51][30]="8.651913529303709E+36";
+        results[51][31]="225651988.7241708";
+        results[51][32]="1.758979441596474E+32";
+        results[51][33]="970.9492576298560";
+        results[51][34]="4.653480341774795E+27";
+        results[51][35]="1.142324869654275E+19";
+        results[51][36]="2.407084905737968E+51";
+        results[51][37]="96649690895033.44";
+        results[51][38]="1.178043004892208E+46";
+        results[51][39]="1030090774.530830";
+        results[51][40]="2.135895731345520E+41";
+        results[51][41]="16491.57763724665";
+        results[51][42]="7.713516096621809E+35";
+        results[51][43]="0.2975023978573374";
+        results[51][44]="2.026279332645786E+31";
+        results[51][45]="2609546076992446";
+        results[51][46]="1.420790770352885E+55";
+        results[51][47]="9486370362.359466";
+        results[51][48]="1.176499662485828E+50";
+        results[51][49]="401754.0303139023";
+        results[51][50]="3.964973795970168E+45";
+        results[51][51]="1";
+        results[51][52]="7.104768881441538E+40";
+        results[51][53]="0.00002083005351866606";
+        results[51][54]="2.897404938618912E+35";
+        results[51][55]="105497912307.8994";
+        results[51][56]="1.217810771541752E+59";
+        results[51][57]="1058156.515955435";
+        results[51][58]="9.733804730118538E+53";
+        results[51][59]="20.76265399463438";
+        results[51][60]="5.027661345707404E+49";
+        results[51][61]="0.00009597934824093921";
+        results[51][62]="3.594485606829729E+44";
+        results[51][63]="8.163399552765810E-10";
+        results[51][64]="3.755848932392581E+39";
+        results[51][65]="8857014.831211825";
+        results[51][66]="7.896124596543564E+62";
+        results[51][67]="285.9055773891117";
+        results[51][68]="1.684523803389072E+58";
+        results[51][69]="0.001269857250584455";
+        results[51][70]="1.236825879534966E+53";
+        results[51][71]="7.760467764448543E-9";
+        results[51][72]="3.014560493978934E+48";
+        results[51][73]="1.470524271263579E-13";
+        results[51][74]="8.419316996851535E+42";
+        results[52][0]="0.000009542165339768479";
+        results[52][1]="2.098208695724657E-11";
+        results[52][2]="4.707702715884311E-16";
+        results[52][3]="5.489694840870986E-21";
+        results[52][4]="3.831632560574457E-26";
+        results[52][5]="1.195445586399130E-10";
+        results[52][6]="0.07429146957357580";
+        results[52][7]="1.146424861461206E-15";
+        results[52][8]="1.095196209197808E-7";
+        results[52][9]="1.068631794769388E-20";
+        results[52][10]="3.900039120795011E-12";
+        results[52][11]="1.294983992124446E-25";
+        results[52][12]="1.738811116505963E-17";
+        results[52][13]="1.629308835837862E-30";
+        results[52][14]="1.310084692372364E-22";
+        results[52][15]="1.407353603167891E-14";
+        results[52][16]="161.6768647148971";
+        results[52][17]="1.665647922572809E-19";
+        results[52][18]="0.001268859998122764";
+        results[52][19]="1.073587258148610E-24";
+        results[52][20]="4.293922033213574E-8";
+        results[52][21]="2.001707682980056E-29";
+        results[52][22]="2.466857354302527E-13";
+        results[52][23]="2.193887573879874E-34";
+        results[52][24]="1.306664331355432E-18";
+        results[52][25]="1.308057985886294E-18";
+        results[52][26]="3503598.035624204";
+        results[52][27]="1.524906333112822E-23";
+        results[52][28]="54.03334944745757";
+        results[52][29]="2.603039962310287E-28";
+        results[52][30]="0.0001217761432311118";
+        results[52][31]="3.176063746613903E-33";
+        results[52][32]="2.475772922312967E-9";
+        results[52][33]="1.366616245837476E-38";
+        results[52][34]="6.549798338873787E-14";
+        results[52][35]="1.607828331528359E-22";
+        results[52][36]="33879848111.95684";
+        results[52][37]="1.360349541383301E-27";
+        results[52][38]="165810.1796906287";
+        results[52][39]="1.449858245525120E-32";
+        results[52][40]="3.006284605435543";
+        results[52][41]="2.321198326426144E-37";
+        results[52][42]="0.00001085681494407283";
+        results[52][43]="4.187362077807307E-42";
+        results[52][44]="2.851998941075561E-10";
+        results[52][45]="3.672949986886802E-26";
+        results[52][46]="199977056827865.5";
+        results[52][47]="1.335211675518248E-31";
+        results[52][48]="1655929534.258291";
+        results[52][49]="5.654709351113861E-36";
+        results[52][50]="55807.21712605078";
+        results[52][51]="1.407505320281584E-41";
+        results[52][52]="1";
+        results[52][53]="2.931841114927259E-46";
+        results[52][54]="0.000004078112866116254";
+        results[52][55]="1.484888728519684E-30";
+        results[52][56]="1.714075140041236E+18";
+        results[52][57]="1.489360925897899E-35";
+        results[52][58]="13700381944223.89";
+        results[52][59]="2.922354596061357E-40";
+        results[52][60]="707646009.2657238";
+        results[52][61]="1.350914432862808E-45";
+        results[52][62]="5059.257615288420";
+        results[52][63]="1.149002830210218E-50";
+        results[52][64]="0.05286377354516463";
+        results[52][65]="1.246629549674354E-34";
+        results[52][66]="1.111383737924134E+22";
+        results[52][67]="4.024136212733528E-39";
+        results[52][68]="2.370976215411088E+17";
+        results[52][69]="1.787330836195764E-44";
+        results[52][70]="1740839005707.414";
+        results[52][71]="1.092289966633505E-49";
+        results[52][72]="42430099.33586029";
+        results[52][73]="2.069770735406687E-54";
+        results[52][74]="118.5023346620570";
+        results[53][0]="3.254666595398102E+40";
+        results[53][1]="7.156624842464271E+34";
+        results[53][2]="1.605715497990454E+30";
+        results[53][3]="1.872439407756647E+25";
+        results[53][4]="1.306903208726412E+20";
+        results[53][5]="4.077456927364187E+35";
+        results[53][6]="2.533952784662378E+44";
+        results[53][7]="3.910255762579582E+30";
+        results[53][8]="3.735523741793833E+38";
+        results[53][9]="3.644917145504665E+25";
+        results[53][10]="1.330235496370605E+34";
+        results[53][11]="4.416965112915320E+20";
+        results[53][12]="5.930782222996091E+28";
+        results[53][13]="5557288993398558";
+        results[53][14]="4.468470974440470E+23";
+        results[53][15]="4.800238307602860E+31";
+        results[53][16]="5.514516591357251E+47";
+        results[53][17]="5.681235296456829E+26";
+        results[53][18]="4.327860714083221E+42";
+        results[53][19]="3.661819369005083E+21";
+        results[53][20]="1.464582105541592E+38";
+        results[53][21]="6.827476675964822E+16";
+        results[53][22]="8.414021284245927E+32";
+        results[53][23]="748296885090.3456";
+        results[53][24]="4.456804718040974E+27";
+        results[53][25]="4.461558231196124E+27";
+        results[53][26]="1.195016338977540E+52";
+        results[53][27]="5.201190219172758E+22";
+        results[53][28]="1.842983549563809E+47";
+        results[53][29]="8.878516468907865E+17";
+        results[53][30]="4.153572395553678E+41";
+        results[53][31]="10833000910053.42";
+        results[53][32]="8.444430735716701E+36";
+        results[53][33]="46612902.68696511";
+        results[53][34]="2.234022268644081E+32";
+        results[53][35]="5.484022730093443E+23";
+        results[53][36]="1.155582679411242E+56";
+        results[53][37]="4.639915630001839E+18";
+        results[53][38]="5.655496774583657E+50";
+        results[53][39]="49452142482867.52";
+        results[53][40]="1.025391379542793E+46";
+        results[53][41]="791720367.9994558";
+        results[53][42]="3.703070704887838E+40";
+        results[53][43]="14282.36358541959";
+        results[53][44]="9.727672234879347E+35";
+        results[53][45]="1.252779343391509E+20";
+        results[53][46]="6.820869514711989E+59";
+        results[53][47]="455417474269022.8";
+        results[53][48]="5.648087564592924E+54";
+        results[53][49]="19287229864.95862";
+        results[53][50]="1.903487090139787E+50";
+        results[53][51]="48007.55788283925";
+        results[53][52]="3.410826033199997E+45";
+        results[53][53]="1";
+        results[53][54]="1.390973353007717E+40";
+        results[53][55]="5064697131640181";
+        results[53][56]="5.846412110513578E+63";
+        results[53][57]="50799510188.83404";
+        results[53][58]="4.672961940014202E+58";
+        results[53][59]="996764.3134487737";
+        results[53][60]="2.413657430693617E+54";
+        results[53][61]="4.607734116234075";
+        results[53][62]="1.725624758289108E+49";
+        results[53][63]="0.00003919048765501487";
+        results[53][64]="1.803091350210368E+44";
+        results[53][65]="425203652178.5674";
+        results[53][66]="3.790736586186758E+67";
+        results[53][67]="13725628.55553436";
+        results[53][68]="8.086987399622141E+62";
+        results[53][69]="60.96274546037631";
+        results[53][70]="5.937699000276846E+57";
+        results[53][71]="0.0003725611053996715";
+        results[53][72]="1.447216874060142E+53";
+        results[53][73]="7.059627907080629E-9";
+        results[53][74]="4.041908480603224E+47";
+        results[54][0]="2.339848271255880";
+        results[54][1]="0.000005145048125465107";
+        results[54][2]="1.154382644727447E-10";
+        results[54][3]="1.346136073496915E-15";
+        results[54][4]="9.395602050179328E-21";
+        results[54][5]="0.00002931369546761954";
+        results[54][6]="18217.11953851009";
+        results[54][7]="2.811165112634539E-10";
+        results[54][8]="0.02685546587730432";
+        results[54][9]="2.620407599917871E-15";
+        results[54][10]="9.563342773563720E-7";
+        results[54][11]="3.175449122274317E-20";
+        results[54][12]="4.263764083022794E-12";
+        results[54][13]="3.995251944533639E-25";
+        results[54][14]="3.212477769454207E-17";
+        results[54][15]="3.450992283369952E-9";
+        results[54][16]="39645019.65068670";
+        results[54][17]="4.084359548780881E-14";
+        results[54][18]="311.1390095809556";
+        results[54][19]="2.632558963898978E-19";
+        results[54][20]="0.01052918880419032";
+        results[54][21]="4.908416585552623E-24";
+        results[54][22]="6.049016874444212E-8";
+        results[54][23]="5.379663697167850E-29";
+        results[54][24]="3.204090652350726E-13";
+        results[54][25]="3.207508052939222E-13";
+        results[54][26]="859122381024.4411";
+        results[54][27]="3.739245045871056E-18";
+        results[54][28]="13249596.37493202";
+        results[54][29]="6.382952232485079E-23";
+        results[54][30]="29.86090557789883";
+        results[54][31]="7.788072206149096E-28";
+        results[54][32]="0.0006070878868712484";
+        results[54][33]="3.351099615688073E-33";
+        results[54][34]="1.606085597408052E-8";
+        results[54][35]="3.942579286824783E-17";
+        results[54][36]="8307726937489580";
+        results[54][37]="3.335732938354928E-22";
+        results[54][38]="40658555840.44592";
+        results[54][39]="3.555218536425345E-27";
+        results[54][40]="737175.4299430523";
+        results[54][41]="5.691844249118863E-32";
+        results[54][42]="2.662215416909782";
+        results[54][43]="1.026789158436190E-36";
+        results[54][44]="0.00006993428173045223";
+        results[54][45]="9.006494198343990E-21";
+        results[54][46]="4.903666558358682E+19";
+        results[54][47]="3.274092011067419E-26";
+        results[54][48]="406052894714338.1";
+        results[54][49]="1.386599522072340E-30";
+        results[54][50]="13684569053.92081";
+        results[54][51]="3.451364311115807E-36";
+        results[54][52]="245211.4575613350";
+        results[54][53]="7.189210331295627E-41";
+        results[54][54]="1";
+        results[54][55]="3.641117294367092E-25";
+        results[54][56]="4.203108634591608E+23";
+        results[54][57]="3.652083634743231E-30";
+        results[54][58]="3.359490625690135E+18";
+        results[54][59]="7.165948300112717E-35";
+        results[54][60]="173522909369510.1";
+        results[54][61]="3.312596971229334E-40";
+        results[54][62]="1240587934.023157";
+        results[54][63]="2.817486587379466E-45";
+        results[54][64]="12962.80296320216";
+        results[54][65]="3.056878489146789E-29";
+        results[54][66]="2.725240262863416E+27";
+        results[54][67]="9.867643061497388E-34";
+        results[54][68]="5.813905336242105E+22";
+        results[54][69]="4.382739994878830E-39";
+        results[54][70]="4.268736699691402E+17";
+        results[54][71]="2.678420147978238E-44";
+        results[54][72]="10404346502618.53";
+        results[54][73]="5.075314988468698E-49";
+        results[54][74]="29058130.20690411";
+        results[55][0]="6.426182081186150E+24";
+        results[55][1]="1.413041028209840E+19";
+        results[55][2]="317040773861723.4";
+        results[55][3]="3697041222.976872";
+        results[55][4]="25804.17297930660";
+        results[55][5]="8.050741873371843E+19";
+        results[55][6]="5.003167452664180E+28";
+        results[55][7]="772061124475030.9";
+        results[55][8]="7.375611304488999E+22";
+        results[55][9]="7196712953.937829";
+        results[55][10]="2.626485773572434E+18";
+        results[55][11]="87210.84396777946";
+        results[55][12]="11710043204647.52";
+        results[55][13]="1.097259885232042";
+        results[55][14]="88227802.34034201";
+        results[55][15]="9477838818070297";
+        results[55][16]="1.088814680922766E+32";
+        results[55][17]="112173248444.9072";
+        results[55][18]="8.545152062590683E+26";
+        results[55][19]="723008.5578324046";
+        results[55][20]="2.891746668111807E+22";
+        results[55][21]="13.48052311620413";
+        results[55][22]="1.661307885852018E+17";
+        results[55][23]="0.0001477476077326687";
+        results[55][24]="879974577393.4671";
+        results[55][25]="880913135619.4773";
+        results[55][26]="2.359502074688797E+36";
+        results[55][27]="10269499.01244810";
+        results[55][28]="3.638882052887863E+31";
+        results[55][29]="175.3020217821514";
+        results[55][30]="8.201028191015562E+25";
+        results[55][31]="0.002138923735908606";
+        results[55][32]="1.667312085250398E+21";
+        results[55][33]="9.203492622641725E-9";
+        results[55][34]="4.410969127231112E+16";
+        results[55][35]="108279381.5218219";
+        results[55][36]="2.281642217442943E+40";
+        results[55][37]="916.1289430349850";
+        results[55][38]="1.116650537551916E+35";
+        results[55][39]="0.009764086814575751";
+        results[55][40]="2.024585780533582E+30";
+        results[55][41]="1.563213648163519E-7";
+        results[55][42]="7.311534349712662E+24";
+        results[55][43]="2.819983745167070E-12";
+        results[55][44]="1.920681924711475E+20";
+        results[55][45]="24735.52338530067";
+        results[55][46]="1.346747759525569E+44";
+        results[55][47]="0.08991998187294129";
+        results[55][48]="1.115187624805477E+39";
+        results[55][49]="0.000003808170432239159";
+        results[55][50]="3.758343373088038E+34";
+        results[55][51]="9.478860558694889E-12";
+        results[55][52]="6.734511352893900E+29";
+        results[55][53]="1.974451727335874E-16";
+        results[55][54]="2.746409739524259E+24";
+        results[55][55]="1";
+        results[55][56]="1.154345849032090E+48";
+        results[55][57]="0.00001003011806401597";
+        results[55][58]="9.226537774235836E+42";
+        results[55][59]="1.968063020435687E-10";
+        results[55][60]="4.765650083230079E+38";
+        results[55][61]="9.097748584902804E-16";
+        results[55][62]="3.407162784737478E+33";
+        results[55][63]="7.737972604557934E-21";
+        results[55][64]="3.560116830967234E+28";
+        results[55][65]="0.00008395440855134944";
+        results[55][66]="7.484626400471738E+51";
+        results[55][67]="2.710059101024540E-9";
+        results[55][68]="1.596736624012738E+47";
+        results[55][69]="1.203679980773772E-14";
+        results[55][70]="1.172370004749711E+42";
+        results[55][71]="7.356039180945439E-20";
+        results[55][72]="2.857459856817670E+37";
+        results[55][73]="1.393889451548389E-24";
+        results[55][74]="7.980553181260552E+31";
+        results[56][0]="5.566946930657264E-24";
+        results[56][1]="1.224105435467771E-29";
+        results[56][2]="2.746497283526938E-34";
+        results[56][3]="3.202715395976701E-39";
+        results[56][4]="2.235393578184839E-44";
+        results[56][5]="6.974289273983464E-29";
+        results[56][6]="4.334201449989442E-20";
+        results[56][7]="6.688299915682963E-34";
+        results[56][8]="6.389429399060419E-26";
+        results[56][9]="6.234451278160885E-39";
+        results[56][10]="2.275302307167926E-30";
+        results[56][11]="7.555001305796269E-44";
+        results[56][12]="1.014431092247293E-35";
+        results[56][13]="9.505469146461484E-49";
+        results[56][14]="7.643099545454276E-41";
+        results[56][15]="8.210571230465625E-33";
+        results[56][16]="9.432309059158727E-17";
+        results[56][17]="9.717473193927414E-38";
+        results[56][18]="7.402592619669160E-22";
+        results[56][19]="6.263361699083869E-43";
+        results[56][20]="2.505095566061517E-26";
+        results[56][21]="1.167806262525866E-47";
+        results[56][22]="1.439176904603599E-31";
+        results[56][23]="1.279924970982950E-52";
+        results[56][24]="7.623144988404633E-37";
+        results[56][25]="7.631275638562877E-37";
+        results[56][26]="2.044016597510373E-12";
+        results[56][27]="8.896379729748234E-42";
+        results[56][28]="3.152332601134258E-17";
+        results[56][29]="1.518626518466200E-46";
+        results[56][30]="7.104481033905097E-23";
+        results[56][31]="1.852931456982391E-51";
+        results[56][32]="1.444378291521926E-27";
+        results[56][33]="7.972907452613771E-57";
+        results[56][34]="3.821185072852883E-32";
+        results[56][35]="9.380150811181354E-41";
+        results[56][36]="1.976567264789908E-8";
+        results[56][37]="7.936347185751581E-46";
+        results[56][38]="9.673448719794147E-14";
+        results[56][39]="8.458545437455212E-51";
+        results[56][40]="1.753881457824083E-18";
+        results[56][41]="1.354198700046664E-55";
+        results[56][42]="6.333920077629528E-24";
+        results[56][43]="2.442927955717607E-60";
+        results[56][44]="1.663870430445044E-28";
+        results[56][45]="2.142817371937639E-44";
+        results[56][46]="0.0001166676140131492";
+        results[56][47]="7.789691620439270E-50";
+        results[56][48]="9.660775630982277E-10";
+        results[56][49]="3.298985685643760E-54";
+        results[56][50]="3.255820927704967E-14";
+        results[56][51]="8.211456355686501E-60";
+        results[56][52]="5.834049958719679E-19";
+        results[56][53]="1.710450753551403E-64";
+        results[56][54]="2.379191419821972E-24";
+        results[56][55]="8.662915025323579E-49";
+        results[56][56]="1";
+        results[56][57]="8.689006048253338E-54";
+        results[56][58]="0.000007992871271614319";
+        results[56][59]="1.704916271051602E-58";
+        results[56][60]="4.128442171144841E-10";
+        results[56][61]="7.881302291277083E-64";
+        results[56][62]="2.951596168162563E-15";
+        results[56][63]="6.703339914156715E-69";
+        results[56][64]="3.084098958689342E-20";
+        results[56][65]="7.272899072816394E-53";
+        results[56][66]="6483.868250358015";
+        results[56][67]="2.347701170578040E-57";
+        results[56][68]="0.1383239369164440";
+        results[56][69]="1.042737739112631E-62";
+        results[56][70]="0.000001015614172938495";
+        results[56][71]="6.372474234748120E-68";
+        results[56][72]="2.475393192788476E-11";
+        results[56][73]="1.207514587345858E-72";
+        results[56][74]="6.913485406433592E-17";
+        results[57][0]="6.406885781574903E+29";
+        results[57][1]="1.408798001370755E+24";
+        results[57][2]="3.160887756637065E+19";
+        results[57][3]="368593988563342.1";
+        results[57][4]="2572668917.216598";
+        results[57][5]="8.026567406274776E+24";
+        results[57][6]="4.988144128246639E+33";
+        results[57][7]="7.697428081578381E+19";
+        results[57][8]="7.353464094256007E+27";
+        results[57][9]="717510293299212.7";
+        results[57][10]="2.618599060159830E+23";
+        results[57][11]="8694897050.180986";
+        results[57][12]="1.167488072414467E+18";
+        results[57][13]="109396.5074218388";
+        results[57][14]="8796287518974.268";
+        results[57][15]="9.449379117552936E+20";
+        results[57][16]="1.085545228853283E+37";
+        results[57][17]="1.118364188028252E+16";
+        results[57][18]="8.519492999037822E+31";
+        results[57][19]="72083753473.07911";
+        results[57][20]="2.883063439189447E+27";
+        results[57][21]="1344004.430472940";
+        results[57][22]="1.656319372562645E+22";
+        results[57][23]="14.73039567328003";
+        results[57][24]="8.773322225891460E+16";
+        results[57][25]="8.782679625475591E+16";
+        results[57][26]="2.352417049958506E+41";
+        results[57][27]="1023866214425.824";
+        results[57][28]="3.627955353728795E+36";
+        results[57][29]="17477563.14166077";
+        results[57][30]="8.176402449775297E+30";
+        results[57][31]="213.2501055578004";
+        results[57][32]="1.662305542775258E+26";
+        results[57][33]="0.0009175856718636401";
+        results[57][34]="4.397724033833556E+21";
+        results[57][35]="10795424423794.65";
+        results[57][36]="2.274790987384843E+45";
+        results[57][37]="91337802.52514549";
+        results[57][38]="1.113297501011488E+40";
+        results[57][39]="973.4767579262472";
+        results[57][40]="2.018506429946206E+35";
+        results[57][41]="0.01558519688588414";
+        results[57][42]="7.289579547366953E+29";
+        results[57][43]="2.811516003270229E-7";
+        results[57][44]="1.914914572742777E+25";
+        results[57][45]="2466124847.925947";
+        results[57][46]="1.342703795638417E+49";
+        results[57][47]="8964.997350882443";
+        results[57][48]="1.111838981044821E+44";
+        results[57][49]="0.3796735400255500";
+        results[57][50]="3.747057959937145E+39";
+        results[57][51]="9.450397790132930E-7";
+        results[57][52]="6.714289213658032E+34";
+        results[57][53]="1.968522917411524E-11";
+        results[57][54]="2.738162922904441E+29";
+        results[57][55]="99699.72373382105";
+        results[57][56]="1.150879622417825E+53";
+        results[57][57]="1";
+        results[57][58]="9.198832671109769E+47";
+        results[57][59]="0.00001962153394281874";
+        results[57][60]="4.751339967101001E+43";
+        results[57][61]="9.070430205145709E-11";
+        results[57][62]="3.396931883544830E+38";
+        results[57][63]="7.714737309343017E-16";
+        results[57][64]="3.549426645075597E+33";
+        results[57][65]="8.370231338805882";
+        results[57][66]="7.462151843778957E+56";
+        results[57][67]="0.0002701921436744741";
+        results[57][68]="1.591942002897441E+52";
+        results[57][69]="1.200065615470761E-9";
+        results[57][70]="1.168849655873646E+47";
+        results[57][71]="7.333950741154235E-15";
+        results[57][72]="2.848879583052055E+42";
+        results[57][73]="1.389703932348617E-19";
+        results[57][74]="7.956589474147437E+36";
+        results[58][0]="6.964890014465238E-19";
+        results[58][1]="1.531496497153692E-24";
+        results[58][2]="3.436183556816159E-29";
+        results[58][3]="4.006964815448415E-34";
+        results[58][4]="2.796734117467348E-39";
+        results[58][5]="8.725636929437082E-24";
+        results[58][6]="5.422583828394453E-15";
+        results[58][7]="8.367831394252054E-29";
+        results[58][8]="7.993910050511732E-21";
+        results[58][9]="7.800014620905704E-34";
+        results[58][10]="2.846664521232035E-25";
+        results[58][11]="9.452174380221672E-39";
+        results[58][12]="1.269169811166505E-30";
+        results[58][13]="1.189243367426543E-43";
+        results[58][14]="9.562395396755339E-36";
+        results[58][15]="1.027236765294149E-27";
+        results[58][16]="1.180090200208327E-11";
+        results[58][17]="1.215767508784710E-32";
+        results[58][18]="9.261493608634160E-17";
+        results[58][19]="7.836184878051788E-38";
+        results[58][20]="3.134162281529605E-21";
+        results[58][21]="1.461059765435212E-42";
+        results[58][22]="1.800575607560021E-26";
+        results[58][23]="1.601333147361503E-47";
+        results[58][24]="9.537429953960697E-32";
+        results[58][25]="9.547602331172774E-32";
+        results[58][26]="2.557299533609959E-7";
+        results[58][27]="1.113039285562200E-36";
+        results[58][28]="3.943930152271277E-12";
+        results[58][29]="1.899976199866263E-41";
+        results[58][30]="8.888521774566507E-18";
+        results[58][31]="2.318230075295776E-46";
+        results[58][32]="1.807083140011844E-22";
+        results[58][33]="9.975022969440973E-52";
+        results[58][34]="4.780741416946553E-27";
+        results[58][35]="1.173564604311067E-35";
+        results[58][36]="0.002472912671331814";
+        results[58][37]="9.929281876384678E-41";
+        results[58][38]="1.210259541417636E-8";
+        results[58][39]="1.058261186752084E-45";
+        results[58][40]="2.194307149738259E-13";
+        results[58][41]="1.694258113296445E-50";
+        results[58][42]="7.924461513753702E-19";
+        results[58][43]="3.056383460588637E-55";
+        results[58][44]="2.081693016068045E-23";
+        results[58][45]="2.680910650403675E-39";
+        results[58][46]="14.59645852517100";
+        results[58][47]="9.745798919724109E-45";
+        results[58][48]="0.0001208673992447659";
+        results[58][49]="4.127410005162593E-49";
+        results[58][50]="4.073405935195787E-9";
+        results[58][51]="1.027347504625585E-54";
+        results[58][52]="7.299066581290476E-14";
+        results[58][53]="2.139970350361897E-59";
+        results[58][54]="2.976641733579987E-19";
+        results[58][55]="1.083830169527293E-43";
+        results[58][56]="125111.4857249578";
+        results[58][57]="1.087094456170119E-48";
+        results[58][58]="1";
+        results[58][59]="2.133046077079208E-53";
+        results[58][60]="0.00005165155337615015";
+        results[58][61]="9.860414391091898E-59";
+        results[58][62]="3.692785818589105E-10";
+        results[58][63]="8.386648159795576E-64";
+        results[58][64]="3.858562028444187E-15";
+        results[58][65]="9.099232085277269E-48";
+        results[58][66]="811206390.0471738";
+        results[58][67]="2.937243814892411E-52";
+        results[58][68]="17305.91325894164";
+        results[58][69]="1.304584677618646E-57";
+        results[58][70]="0.1270649980996593";
+        results[58][71]="7.972697192533506E-63";
+        results[58][72]="0.000003097001201032130";
+        results[58][73]="1.510739440573996E-67";
+        results[58][74]="8.649564307367203E-12";
+        results[59][0]="3.265231862221327E+34";
+        results[59][1]="7.179856607930284E+28";
+        results[59][2]="1.610927955912394E+24";
+        results[59][3]="1.878517702221967E+19";
+        results[59][4]="131114566512174.5";
+        results[59][5]="4.090693128103987E+29";
+        results[59][6]="2.542178477372429E+38";
+        results[59][7]="3.922949196535957E+24";
+        results[59][8]="3.747649962375796E+32";
+        results[59][9]="3.656749239841227E+19";
+        results[59][10]="1.334553693809554E+28";
+        results[59][11]="443130342180164.7";
+        results[59][12]="5.950034670157650E+22";
+        results[59][13]="5575329010.496484";
+        results[59][14]="4.482976481149991E+17";
+        results[59][15]="4.815820794179703E+25";
+        results[59][16]="5.532417761102616E+41";
+        results[59][17]="5.699677666829715E+20";
+        results[59][18]="4.341909773142817E+36";
+        results[59][19]="3673706331174018";
+        results[59][20]="1.469336417627336E+32";
+        results[59][21]="68496399638.76680";
+        results[59][22]="8.441334797725325E+26";
+        results[59][23]="750725.9991093196";
+        results[59][24]="4.471272353863239E+21";
+        results[59][25]="4.476041297826234E+21";
+        results[59][26]="1.198895589312202E+46";
+        results[59][27]="5.218074271917703E+16";
+        results[59][28]="1.848966224710778E+41";
+        results[59][29]="890733782210.6083";
+        results[59][30]="4.167055681580780E+35";
+        results[59][31]="10868166.89150073";
+        results[59][32]="8.471842964059609E+30";
+        results[59][33]="46.76421703510423";
+        results[59][34]="2.241274329850788E+26";
+        results[59][35]="5.501824910965054E+17";
+        results[59][36]="1.159333920586464E+50";
+        results[59][37]="4654977678672.980";
+        results[59][38]="5.673855592818941E+44";
+        results[59][39]="49612673.54342235";
+        results[59][40]="1.028719994995578E+40";
+        results[59][41]="794.2904429033256";
+        results[59][42]="3.715091576739267E+34";
+        results[59][43]="0.01432872685419792";
+        results[59][44]="9.759250109207765E+29";
+        results[59][45]="125684610342532.4";
+        results[59][46]="6.843011354521704E+53";
+        results[59][47]="456895846.0132791";
+        results[59][48]="5.666422331123308E+48";
+        results[59][49]="19349.83988163200";
+        results[59][50]="1.909666171287554E+44";
+        results[59][51]="0.04816339954701486";
+        results[59][52]="3.421898223260666E+39";
+        results[59][53]="0.000001003246190205216";
+        results[59][54]="1.395488717081967E+34";
+        results[59][55]="5081138101.861297";
+        results[59][56]="5.865390676242383E+57";
+        results[59][57]="50964.41506123880";
+        results[59][58]="4.688131263293223E+52";
+        results[59][59]="1";
+        results[59][60]="2.421492621803881E+48";
+        results[59][61]="0.000004622691697590433";
+        results[59][62]="1.731226464477344E+43";
+        results[59][63]="3.931770743217822E-11";
+        results[59][64]="1.808944527690531E+38";
+        results[59][65]="426583.9441094915";
+        results[59][66]="3.803042038163392E+61";
+        results[59][67]="13.77018455651177";
+        results[59][68]="8.113239298908500E+56";
+        results[59][69]="0.00006116064212757286";
+        results[59][70]="5.956973900613066E+51";
+        results[59][71]="3.737705096108644E-10";
+        results[59][72]="1.451914815301539E+47";
+        results[59][73]="7.082544802045064E-15";
+        results[59][74]="4.055029284323338E+41";
+        results[60][0]="1.348437667255375E-14";
+        results[60][1]="2.965054092372860E-20";
+        results[60][2]="6.652623846164517E-25";
+        results[60][3]="7.757685013397121E-30";
+        results[60][4]="5.414617634246651E-35";
+        results[60][5]="1.689327108110964E-19";
+        results[60][6]="1.049839447984212E-10";
+        results[60][7]="1.620054160484525E-24";
+        results[60][8]="1.547661111428041E-16";
+        results[60][9]="1.510121982992930E-29";
+        results[60][10]="5.511285402205287E-21";
+        results[60][11]="1.829988405457360E-34";
+        results[60][12]="2.457176460742298E-26";
+        results[60][13]="2.302434853732143E-39";
+        results[60][14]="1.851327747515669E-31";
+        results[60][15]="1.988781940038362E-23";
+        results[60][16]="2.284713862551959E-7";
+        results[60][17]="2.353786922788046E-28";
+        results[60][18]="1.793071650950697E-12";
+        results[60][19]="1.517124726334002E-33";
+        results[60][20]="6.067895497169673E-17";
+        results[60][21]="2.828685044174972E-38";
+        results[60][22]="3.486004756618662E-22";
+        results[60][23]="3.100261352644838E-43";
+        results[60][24]="1.846494312475907E-27";
+        results[60][25]="1.848463735764689E-27";
+        results[60][26]="0.004951060261414672";
+        results[60][27]="2.154899926158156E-32";
+        results[60][28]="7.635646741444116E-8";
+        results[60][29]="3.678449292763319E-37";
+        results[60][30]="1.720862431732932E-13";
+        results[60][31]="4.488209789961917E-42";
+        results[60][32]="3.498603666092752E-18";
+        results[60][33]="1.931214516782934E-47";
+        results[60][34]="9.255755353824531E-23";
+        results[60][35]="2.272079981340803E-31";
+        results[60][36]="47.87683060222675";
+        results[60][37]="1.922358811568574E-36";
+        results[60][38]="0.0002343123221491472";
+        results[60][39]="2.048846777260200E-41";
+        results[60][40]="4.248288785737604E-9";
+        results[60][41]="3.280168751088831E-46";
+        results[60][42]="1.534215526112867E-14";
+        results[60][43]="5.917311795698881E-51";
+        results[60][44]="4.030262170254993E-19";
+        results[60][45]="5.190377588220942E-35";
+        results[60][46]="282594.7637793763";
+        results[60][47]="1.886835590161396E-40";
+        results[60][48]="2.340053519098534";
+        results[60][49]="7.990872946462834E-45";
+        results[60][50]="0.00007886318356258115";
+        results[60][51]="1.988996336942614E-50";
+        results[60][52]="1.413135928001109E-9";
+        results[60][53]="4.143090014694539E-55";
+        results[60][54]="5.762927809552455E-15";
+        results[60][55]="2.098349611355051E-39";
+        results[60][56]="2422221163.685803";
+        results[60][57]="2.104669434147318E-44";
+        results[60][58]="19360.50195272046";
+        results[60][59]="4.129684274053472E-49";
+        results[60][60]="1";
+        results[60][61]="1.909025720733676E-54";
+        results[60][62]="0.000007149418705177280";
+        results[60][63]="1.623697180745017E-59";
+        results[60][64]="7.470369768638670E-11";
+        results[60][65]="1.761657005552672E-43";
+        results[60][66]="15705362898567.62";
+        results[60][67]="5.686651461384062E-48";
+        results[60][68]="335051167.4433505";
+        results[60][69]="2.525741419852499E-53";
+        results[60][70]="2460.042143830875";
+        results[60][71]="1.543554195644939E-58";
+        results[60][72]="0.05995949780016016";
+        results[60][73]="2.924867388928466E-63";
+        results[60][74]="1.674599066629639E-7";
+        results[61][0]="7.063486115509977E+39";
+        results[61][1]="1.553176607402299E+34";
+        results[61][2]="3.484826722820572E+29";
+        results[61][3]="4.063688052571492E+24";
+        results[61][4]="2.836325134564299E+19";
+        results[61][5]="8.849158446444201E+34";
+        results[61][6]="5.499346795499110E+43";
+        results[61][7]="8.486287758668364E+29";
+        results[61][8]="8.107073124364424E+37";
+        results[61][9]="7.910432879932915E+24";
+        results[61][10]="2.886962361139478E+33";
+        results[61][11]="9.585980878005454E+19";
+        results[61][12]="1.287136382739755E+28";
+        results[61][13]="1206078487432465";
+        results[61][14]="9.697762200941783E+22";
+        results[61][15]="1.041778493835083E+31";
+        results[61][16]="1.196795746509847E+47";
+        results[61][17]="1.232978108793337E+26";
+        results[61][18]="9.392600798807385E+41";
+        results[61][19]="7.947115169045187E+20";
+        results[61][20]="3.178529985880788E+37";
+        results[61][21]="1.481742762003150E+16";
+        results[61][22]="1.826064844887958E+32";
+        results[61][23]="162400187644.0589";
+        results[61][24]="9.672443343331502E+26";
+        results[61][25]="9.682759722348257E+26";
+        results[61][26]="2.593501076303929E+51";
+        results[61][27]="1.128795648353017E+22";
+        results[61][28]="3.999761060584132E+46";
+        results[61][29]="1.926872567934611E+17";
+        results[61][30]="9.014349115587456E+40";
+        results[61][31]="2351047312362.565";
+        results[61][32]="1.832664499013753E+36";
+        results[61][33]="10116230.99578109";
+        results[61][34]="4.848418359846594E+31";
+        results[61][35]="1.190177773229581E+23";
+        results[61][36]="2.507919620057646E+55";
+        results[61][37]="1.006984238446915E+18";
+        results[61][38]="1.227392169756080E+50";
+        results[61][39]="10732421019831.98";
+        results[61][40]="2.225370113978822E+45";
+        results[61][41]="171824230.3109566";
+        results[61][42]="8.036641462972210E+39";
+        results[61][43]="3099.650115465570";
+        results[61][44]="2.111161796555619E+35";
+        results[61][45]="2.718862051908959E+19";
+        results[61][46]="1.480308833506809E+59";
+        results[61][47]="98837620136215.22";
+        results[61][48]="1.225784175500373E+54";
+        results[61][49]="4185838283.725054";
+        results[61][50]="4.131069723475097E+49";
+        results[61][51]="10418.90800810271";
+        results[61][52]="7.402393339457015E+44";
+        results[61][53]="0.2170264114148377";
+        results[61][54]="3.018779551769291E+39";
+        results[61][55]="1099173043382890";
+        results[61][56]="1.268825839997009E+63";
+        results[61][57]="11024835397.91414";
+        results[61][58]="1.014156160519400E+58";
+        results[61][59]="216324.1819741618";
+        results[61][60]="5.238274105681931E+53";
+        results[61][61]="1";
+        results[61][62]="3.745061487400818E+48";
+        results[61][63]="0.000008505370897365375";
+        results[61][64]="3.913184451892906E+43";
+        results[61][65]="92280422752.79732";
+        results[61][66]="8.226899579190449E+66";
+        results[61][67]="2978823.909820644";
+        results[61][68]="1.755089854497003E+62";
+        results[61][69]="13.23052587726166";
+        results[61][70]="1.288637506091553E+57";
+        results[61][71]="0.00008085559973763583";
+        results[61][72]="3.140842847162717E+52";
+        results[61][73]="1.532125710597750E-9";
+        results[61][74]="8.772008928125169E+46";
+        results[62][0]="1.886080145619249E-9";
+        results[62][1]="4.147265973142270E-15";
+        results[62][2]="9.305125522088941E-20";
+        results[62][3]="1.085079127870824E-24";
+        results[62][4]="7.573507522122931E-30";
+        results[62][5]="2.362887358782933E-14";
+        results[62][6]="0.00001468426303279687";
+        results[62][7]="2.265994239939194E-19";
+        results[62][8]="2.164736988067710E-11";
+        results[62][9]="2.112230441755173E-24";
+        results[62][10]="7.708718190213518E-16";
+        results[62][11]="2.559632441351024E-29";
+        results[62][12]="3.436889853664501E-21";
+        results[62][13]="3.220450429158424E-34";
+        results[62][14]="2.589480101613048E-26";
+        results[62][15]="2.781739358191706E-18";
+        results[62][16]="0.03195663810957770";
+        results[62][17]="3.292277344287504E-23";
+        results[62][18]="2.507996418858833E-7";
+        results[62][19]="2.122025284706531E-28";
+        results[62][20]="8.487257142703900E-12";
+        results[62][21]="3.956524524331703E-33";
+        results[62][22]="4.875927540926171E-17";
+        results[62][23]="4.336382411621481E-38";
+        results[62][24]="2.582719502969886E-22";
+        results[62][25]="2.585474165089977E-22";
+        results[62][26]="692.5122818487806";
+        results[62][27]="3.014091096102228E-27";
+        results[62][28]="0.01068009450322826";
+        results[62][29]="5.145102622258724E-32";
+        results[62][30]="2.406996292561188E-8";
+        results[62][31]="6.277726868495983E-37";
+        results[62][32]="4.893549826028827E-13";
+        results[62][33]="2.701218933204230E-42";
+        results[62][34]="1.294616490585723E-17";
+        results[62][35]="3.177992610357912E-26";
+        results[62][36]="6696604.657880305";
+        results[62][37]="2.688832324474842E-31";
+        results[62][38]="32.77361864111679";
+        results[62][39]="2.865752953840177E-36";
+        results[62][40]="0.0005942145733696068";
+        results[62][41]="4.588021608964494E-41";
+        results[62][42]="2.145930444669381E-9";
+        results[62][43]="8.276633443518753E-46";
+        results[62][44]="5.637188611343273E-14";
+        results[62][45]="7.259859580559060E-30";
+        results[62][46]="39526956726.52857";
+        results[62][47]="2.639145457790906E-35";
+        results[62][48]="327306.8224978871";
+        results[62][49]="1.117695476511428E-39";
+        results[62][50]="11.03071267954583";
+        results[62][51]="2.782039238382100E-45";
+        results[62][52]="0.0001976574580780646";
+        results[62][53]="5.795002622652810E-50";
+        results[62][54]="8.060694228719894E-10";
+        results[62][55]="2.934993316079701E-34";
+        results[62][56]="338799735135353.3";
+        results[62][57]="2.943832947737714E-39";
+        results[62][58]="2707982669.793906";
+        results[62][59]="5.776251810602371E-44";
+        results[62][60]="139871.5114105495";
+        results[62][61]="2.670183128806329E-49";
+        results[62][62]="1";
+        results[62][63]="2.271089787438537E-54";
+        results[62][64]="0.00001044891910335168";
+        results[62][65]="2.464056279536351E-38";
+        results[62][66]="2.196732845873822E+18";
+        results[62][67]="7.954005347687989E-43";
+        results[62][68]="46864113190170.53";
+        results[62][69]="3.532792698269964E-48";
+        results[62][70]="344089812.7912729";
+        results[62][71]="2.158992582889526E-53";
+        results[62][72]="8386.625580725921";
+        results[62][73]="4.091056223648521E-58";
+        results[62][74]="0.02342287024561831";
+        results[63][0]="8.304736149364119E+44";
+        results[63][1]="1.826112730584637E+39";
+        results[63][2]="4.097207241015242E+34";
+        results[63][3]="4.777790529781906E+29";
+        results[63][4]="3.334745972621699E+24";
+        results[63][5]="1.040420053778644E+40";
+        results[63][6]="6.465734254108293E+48";
+        results[63][7]="9.977563425596263E+34";
+        results[63][8]="9.531710283058522E+42";
+        results[63][9]="9.300514904509633E+29";
+        results[63][10]="3.394281561588036E+38";
+        results[63][11]="1.127050306645041E+25";
+        results[63][12]="1.513321874227095E+33";
+        results[63][13]="1.418019862962190E+20";
+        results[63][14]="1.140192746202962E+28";
+        results[63][15]="1.224847812524888E+36";
+        results[63][16]="1.407105887505231E+52";
+        results[63][17]="1.449646492400778E+31";
+        results[63][18]="1.104314075441065E+47";
+        results[63][19]="9.343643287216183E+25";
+        results[63][20]="3.737085688838532E+42";
+        results[63][21]="1.742125981198698E+21";
+        results[63][22]="2.146954985177189E+37";
+        results[63][23]="1.909383959897199E+16";
+        results[63][24]="1.137215938028950E+32";
+        results[63][25]="1.138428863266573E+32";
+        results[63][26]="3.049251005746606E+56";
+        results[63][27]="1.327156289801157E+27";
+        results[63][28]="4.702629795748353E+51";
+        results[63][29]="2.265477415607447E+22";
+        results[63][30]="1.059841978011769E+46";
+        results[63][31]="2.764191404152434E+17";
+        results[63][32]="2.154714381216979E+41";
+        results[63][33]="1189393280769.765";
+        results[63][34]="5.700419674053768E+36";
+        results[63][35]="1.399324953128441E+28";
+        results[63][36]="2.948630518669679E+60";
+        results[63][37]="1.183939243330163E+23";
+        results[63][38]="1.443078949251087E+55";
+        results[63][39]="1.261840447564310E+18";
+        results[63][40]="2.616429243159934E+50";
+        results[63][41]="20201850381878.22";
+        results[63][42]="9.448901829150850E+44";
+        results[63][43]="364434444.1728835";
+        results[63][44]="2.482151362981211E+40";
+        results[63][45]="3.196641374864857E+24";
+        results[63][46]="1.740440071773177E+64";
+        results[63][47]="1.162061259043167E+19";
+        results[63][48]="1.441188385893991E+59";
+        results[63][49]="492140593777240.2";
+        results[63][50]="4.857013025445766E+54";
+        results[63][51]="1224979854.944370";
+        results[63][52]="8.703198753801531E+49";
+        results[63][53]="25516.39593777902";
+        results[63][54]="3.549262681424497E+44";
+        results[63][55]="1.292328173158645E+20";
+        results[63][56]="1.491793662272907E+68";
+        results[63][57]="1296220415423529";
+        results[63][58]="1.192371470635743E+63";
+        results[63][59]="25433832878.60738";
+        results[63][60]="6.158783865974074E+58";
+        results[63][61]="117572.7680858409";
+        results[63][62]="4.403172457253908E+53";
+        results[63][63]="1";
+        results[63][64]="4.600839280395232E+48";
+        results[63][65]="1.084966474317800E+16";
+        results[63][66]="9.672593562896609E+71";
+        results[63][67]="350228572717.9005";
+        results[63][68]="2.063507724325885E+67";
+        results[63][69]="1555549.550621002";
+        results[63][70]="1.515086786504186E+62";
+        results[63][71]="9.506416676394638";
+        results[63][72]="3.692775876635344E+57";
+        results[63][73]="0.0001801362608504635";
+        results[63][74]="1.031349371353387E+52";
+        results[64][0]="0.0001805048088671923";
+        results[64][1]="3.969086115148465E-10";
+        results[64][2]="8.905347462307516E-15";
+        results[64][3]="1.038460645678428E-19";
+        results[64][4]="7.248125329722949E-25";
+        results[64][5]="2.261370133514570E-9";
+        results[64][6]="1.405337995973826";
+        results[64][7]="2.168639854061398E-14";
+        results[64][8]="0.000002071732938743234";
+        results[64][9]="2.021482242194446E-19";
+        results[64][10]="7.377526913516641E-11";
+        results[64][11]="2.449662415828232E-24";
+        results[64][12]="3.289230033910451E-16";
+        results[64][13]="3.082089541802851E-29";
+        results[64][14]="2.478227724801148E-21";
+        results[64][15]="2.662226906608371E-13";
+        results[64][16]="3058.367836279547";
+        results[64][17]="3.150830542109802E-18";
+        results[64][18]="0.02400244842602282";
+        results[64][19]="2.030856267253379E-23";
+        results[64][20]="8.122617333673738E-7";
+        results[64][21]="3.786539531215795E-28";
+        results[64][22]="4.666442043141217E-12";
+        results[64][23]="4.150077504409531E-33";
+        results[64][24]="2.471757583175691E-17";
+        results[64][25]="2.474393896169260E-17";
+        results[64][26]="66275973.14124528";
+        results[64][27]="2.884596068061627E-22";
+        results[64][28]="1022.124336267703";
+        results[64][29]="4.924052498988474E-27";
+        results[64][30]="0.002303584005917990";
+        results[64][31]="6.008015572139217E-32";
+        results[64][32]="4.683307218312307E-8";
+        results[64][33]="2.585165897530746E-37";
+        results[64][34]="1.238995610723459E-12";
+        results[64][35]="3.041455847178024E-21";
+        results[64][36]="640889702718.8438";
+        results[64][37]="2.573311457270591E-26";
+        results[64][38]="3136555.878837656";
+        results[64][39]="2.742631008523106E-31";
+        results[64][40]="56.86852080029998";
+        results[64][41]="4.390905474129667E-36";
+        results[64][42]="0.0002053734384814057";
+        results[64][43]="7.921042704660115E-41";
+        results[64][44]="5.394996894497005E-9";
+        results[64][45]="6.947952710467755E-25";
+        results[64][46]="3782875179294822";
+        results[64][47]="2.525759297863022E-30";
+        results[64][48]="31324467082.23605";
+        results[64][49]="1.069675691290314E-34";
+        results[64][50]="1055679.785673480";
+        results[64][51]="2.662513902983238E-40";
+        results[64][52]="18.91654592432077";
+        results[64][53]="5.546030709333330E-45";
+        results[64][54]="0.00007714380931645150";
+        results[64][55]="2.808896582554887E-29";
+        results[64][56]="3.242438110432659E+19";
+        results[64][57]="2.817356435263650E-34";
+        results[64][58]="259163904228646.2";
+        results[64][59]="5.528085492354452E-39";
+        results[64][60]="13386218232.43738";
+        results[64][61]="2.555463490907705E-44";
+        results[64][62]="95703.67902257296";
+        results[64][63]="2.173516480484612E-49";
+        results[64][64]="1";
+        results[64][65]="2.358192512703023E-33";
+        results[64][66]="2.102354151798515E+23";
+        results[64][67]="7.612275747389602E-38";
+        results[64][68]="4.485068046429608E+18";
+        results[64][69]="3.381012584485181E-43";
+        results[64][70]="32930660998313.20";
+        results[64][71]="2.066235331649750E-48";
+        results[64][72]="802630922.6602931";
+        results[64][73]="3.915291316913575E-53";
+        results[64][74]="2241.654855774030";
+        results[65][0]="7.654371214175933E+28";
+        results[65][1]="1.683105214594628E+23";
+        results[65][2]="3.776344558103940E+18";
+        results[65][3]="44036296446727.19";
+        results[65][4]="307359356.4002524";
+        results[65][5]="9.589421225506852E+23";
+        results[65][6]="5.959386218061519E+32";
+        results[65][7]="9.196195146831527E+18";
+        results[65][8]="8.785257893845823E+26";
+        results[65][9]="85721680113273.25";
+        results[65][10]="3.128466770111285E+22";
+        results[65][11]="1038788140.761402";
+        results[65][12]="1.394809802928366E+17";
+        results[65][13]="13069.71133696832";
+        results[65][14]="1050901362569.648";
+        results[65][15]="1.128926876100059E+20";
+        results[65][16]="1.296911859318036E+36";
+        results[65][17]="1336121001630285";
+        results[65][18]="1.017832441445189E+31";
+        results[65][19]="8611918901.080548";
+        results[65][20]="3.444425037361932E+26";
+        results[65][21]="160569.5680407179";
+        results[65][22]="1.978821499094838E+21";
+        results[65][23]="1.759855262899042";
+        results[65][24]="1.048157675788096E+16";
+        results[65][25]="1.049275613776351E+16";
+        results[65][26]="2.810456431535270E+40";
+        results[65][27]="122322331723.2581";
+        results[65][28]="4.334354938206963E+35";
+        results[65][29]="2088062.137617592";
+        results[65][30]="9.768430666746378E+29";
+        results[65][31]="25.47720569790407";
+        results[65][32]="1.985973237165517E+25";
+        results[65][33]="0.0001096248878581826";
+        results[65][34]="5.254005362366659E+20";
+        results[65][35]="1289740269632.112";
+        results[65][36]="2.717715789811575E+44";
+        results[65][37]="10912219.60636705";
+        results[65][38]="1.330067779429277E+39";
+        results[65][39]="116.3022524136263";
+        results[65][40]="2.411530038110238E+34";
+        results[65][41]="0.001861979227937033";
+        results[65][42]="8.708934379831493E+28";
+        results[65][43]="3.358946592354670E-8";
+        results[65][44]="2.287767799039069E+24";
+        results[65][45]="294630428.7305122";
+        results[65][46]="1.604141798821501E+48";
+        results[65][47]="1071.057296746282";
+        results[65][48]="1.328325270880074E+43";
+        results[65][49]="0.04535998166087906";
+        results[65][50]="4.476648025921479E+38";
+        results[65][51]="1.129048577943026E-7";
+        results[65][52]="8.021629202205431E+33";
+        results[65][53]="2.351814230372703E-12";
+        results[65][54]="3.271310925672783E+28";
+        results[65][55]="11911.22678671919";
+        results[65][56]="1.374967519812914E+52";
+        results[65][57]="0.1194710109580630";
+        results[65][58]="1.098993838851543E+47";
+        results[65][59]="0.000002344204496696504";
+        results[65][60]="5.676473892750065E+42";
+        results[65][61]="1.083653466433309E-11";
+        results[65][62]="4.058348862827780E+37";
+        results[65][63]="9.216874656230971E-17";
+        results[65][64]="4.240535896086675E+32";
+        results[65][65]="1";
+        results[65][66]="8.915108246988459E+55";
+        results[65][67]="0.00003228012855771563";
+        results[65][68]="1.901909204727609E+51";
+        results[65][69]="1.433730522963019E-10";
+        results[65][70]="1.396436500452086E+46";
+        results[65][71]="8.761945093623320E-16";
+        results[65][72]="3.403585238850141E+41";
+        results[65][73]="1.660293337300849E-20";
+        results[65][74]="9.505817882546773E+35";
+        results[66][0]="8.585842148087876E-28";
+        results[66][1]="1.887924597172652E-33";
+        results[66][2]="4.235893108061360E-38";
+        results[66][3]="4.939513377372926E-43";
+        results[66][4]="3.447623381399535E-48";
+        results[66][5]="1.075637104994903E-32";
+        results[66][6]="6.684592102484691E-24";
+        results[66][7]="1.031529275030174E-37";
+        results[66][8]="9.854347979244672E-30";
+        results[66][9]="9.615326896589304E-43";
+        results[66][10]="3.509174183238983E-34";
+        results[66][11]="1.165199694700630E-47";
+        results[66][12]="1.564546121354764E-39";
+        results[66][13]="1.466018243960560E-52";
+        results[66][14]="1.178786991088576E-44";
+        results[66][15]="1.266307536401941E-36";
+        results[66][16]="1.454734842682516E-20";
+        results[66][17]="1.498715399312880E-41";
+        results[66][18]="1.141693867585976E-25";
+        results[66][19]="9.659915126649943E-47";
+        results[66][20]="3.863581845487368E-30";
+        results[66][21]="1.801094990573543E-51";
+        results[66][22]="2.219627002020180E-35";
+        results[66][23]="1.974014464146888E-56";
+        results[66][24]="1.175709421298576E-40";
+        results[66][25]="1.176963402694295E-40";
+        results[66][26]="3.152464730290456E-16";
+        results[66][27]="1.372079040819037E-45";
+        results[66][28]="4.861808536840948E-21";
+        results[66][29]="2.342161283709532E-50";
+        results[66][30]="1.095716439567200E-26";
+        results[66][31]="2.857756181088471E-55";
+        results[66][32]="2.227649044907988E-31";
+        results[66][33]="1.229652908535508E-60";
+        results[66][34]="5.893372482764269E-36";
+        results[66][35]="1.446690532409171E-44";
+        results[66][36]="3.048438352646615E-12";
+        results[66][37]="1.224014258049331E-49";
+        results[66][38]="1.491925552197951E-17";
+        results[66][39]="1.304552330622721E-54";
+        results[66][40]="2.704992436771430E-22";
+        results[66][41]="2.088566034591912E-59";
+        results[66][42]="9.768736552103434E-28";
+        results[66][43]="3.767701411241225E-64";
+        results[66][44]="2.566169401041071E-32";
+        results[66][45]="3.304844097995546E-48";
+        results[66][46]="1.799352015005968E-8";
+        results[66][47]="1.201395728546636E-53";
+        results[66][48]="1.489970995392888E-13";
+        results[66][49]="5.087990005752511E-58";
+        results[66][50]="5.021417465608115E-18";
+        results[66][51]="1.266444048309139E-63";
+        results[66][52]="8.997792264513616E-23";
+        results[66][53]="2.638009730467547E-68";
+        results[66][54]="3.669401240055428E-28";
+        results[66][55]="1.336072031513787E-52";
+        results[66][56]="0.0001542289203585813";
+        results[66][57]="1.340096021811295E-57";
+        results[66][58]="1.232731906786197E-9";
+        results[66][59]="2.629473957860669E-62";
+        results[66][60]="6.367251788185060E-14";
+        results[66][61]="1.215524743403277E-67";
+        results[66][62]="4.552214903502375E-19";
+        results[66][63]="1.033848877756975E-72";
+        results[66][64]="4.756572526776819E-24";
+        results[66][65]="1.121691371877399E-56";
+        results[66][66]="1";
+        results[66][67]="3.620834168628286E-61";
+        results[66][68]="0.00002133355145037165";
+        results[66][69]="1.608203157204890E-66";
+        results[66][70]="1.566370773931775E-10";
+        results[66][71]="9.828198212380789E-72";
+        results[66][72]="3.817772195867480E-15";
+        results[66][73]="1.862336711235894E-76";
+        results[66][74]="1.066259390149060E-20";
+        results[67][0]="2.371233187776874E+33";
+        results[67][1]="5.214059825026099E+27";
+        results[67][2]="1.169866641439169E+23";
+        results[67][3]="1.364192102518798E+18";
+        results[67][4]="9521627395340.313";
+        results[67][5]="2.970688672556348E+28";
+        results[67][6]="1.846146990216091E+37";
+        results[67][7]="2.848871909041218E+23";
+        results[67][8]="2.721568434319621E+31";
+        results[67][9]="2.655555722462696E+18";
+        results[67][10]="9.691618063161386E+26";
+        results[67][11]="32180421428746.45";
+        results[67][12]="4.320954919477782E+21";
+        results[67][13]="404884116.6663938";
+        results[67][14]="3.255567463712780E+16";
+        results[67][15]="3.497281226998773E+24";
+        results[67][16]="4.017678730737416E+40";
+        results[67][17]="4.139143991453913E+19";
+        results[67][18]="3.153123878132466E+35";
+        results[67][19]="266787007544990.6";
+        results[67][20]="1.067041920605562E+31";
+        results[67][21]="4974254292.501521";
+        results[67][22]="6.130153712234388E+25";
+        results[67][23]="54518.22348701272";
+        results[67][24]="3.247067848301876E+20";
+        results[67][25]="3.250531087260965E+20";
+        results[67][26]="8.706459847302905E+44";
+        results[67][27]="3789400389299890";
+        results[67][28]="1.342731622167273E+40";
+        results[67][29]="64685682211.09210";
+        results[67][30]="3.026143668938864E+34";
+        results[67][31]="789253.5388250330";
+        results[67][32]="6.152308946399247E+29";
+        results[67][33]="3.396048676267737";
+        results[67][34]="1.627628388459699E+25";
+        results[67][35]="3.995461998628989E+16";
+        results[67][36]="8.419160366577858E+48";
+        results[67][37]="338047588219.9918";
+        results[67][38]="4.120391828834159E+43";
+        results[67][39]="3602905.490468613";
+        results[67][40]="7.470633314853486E+38";
+        results[67][41]="57.68190249329044";
+        results[67][42]="2.697924317203462E+33";
+        results[67][43]="0.001040561714724588";
+        results[67][44]="7.087232614171990E+28";
+        results[67][45]="9127300351475.501";
+        results[67][46]="4.969440552113530E+52";
+        results[67][47]="33180081.51148695";
+        results[67][48]="4.114993744541877E+47";
+        results[67][49]="1405.198296524041";
+        results[67][50]="1.386812328803897E+43";
+        results[67][51]="0.003497658244837316";
+        results[67][52]="2.485005345583759E+38";
+        results[67][53]="7.285640842996488E-8";
+        results[67][54]="1.013413227219280E+33";
+        results[67][55]="368995642.7968486";
+        results[67][56]="4.259485885734702E+56";
+        results[67][57]="3701.069862359855";
+        results[67][58]="3.404552236793557E+51";
+        results[67][59]="0.07262066792903739";
+        results[67][60]="1.758504115806338E+47";
+        results[67][61]="3.357029587090330E-7";
+        results[67][62]="1.257228221867707E+42";
+        results[67][63]="2.855278175163260E-12";
+        results[67][64]="1.313667598474634E+37";
+        results[67][65]="30978.81094903443";
+        results[67][66]="2.761794529736332E+60";
+        results[67][67]="1";
+        results[67][68]="5.891888569548503E+55";
+        results[67][69]="0.000004441526682273164";
+        results[67][70]="4.325994234983640E+50";
+        results[67][71]="2.714346406011766E-11";
+        results[67][72]="1.054390236632627E+46";
+        results[67][73]="5.143391341618445E-16";
+        results[67][74]="2.944789350993672E+40";
+        results[68][0]="4.024572358737908E-23";
+        results[68][1]="8.849556069295544E-29";
+        results[68][2]="1.985554593624666E-33";
+        results[68][3]="2.315373222720905E-38";
+        results[68][4]="1.616056937083241E-43";
+        results[68][5]="5.041997379091630E-28";
+        results[68][6]="3.133370511719575E-19";
+        results[68][7]="4.835244040026928E-33";
+        results[68][8]="4.619178387700187E-25";
+        results[68][9]="4.507138400728770E-38";
+        results[68][10]="1.644908580459467E-29";
+        results[68][11]="5.461817725994849E-43";
+        results[68][12]="7.333734962012186E-35";
+        results[68][13]="6.871890258736175E-48";
+        results[68][14]="5.525507526633783E-40";
+        results[68][15]="5.935755888314043E-32";
+        results[68][16]="6.818999856009313E-16";
+        results[68][17]="7.025156607418828E-37";
+        results[68][18]="5.351635287926178E-21";
+        results[68][19]="4.528038919877851E-42";
+        results[68][20]="1.811035473617807E-25";
+        results[68][21]="8.442546449724692E-47";
+        results[68][22]="1.040439519497590E-30";
+        results[68][23]="9.253098194827277E-52";
+        results[68][24]="5.511081565737588E-36";
+        results[68][25]="5.516959543432190E-36";
+        results[68][26]="1.477702733941909E-11";
+        results[68][27]="6.431554746104564E-41";
+        results[68][28]="2.278949451126784E-16";
+        results[68][29]="1.097876876786368E-45";
+        results[68][30]="5.136118297584773E-22";
+        results[68][31]="1.339559513912385E-50";
+        results[68][32]="1.044199813655115E-26";
+        results[68][33]="5.763939076885797E-56";
+        results[68][34]="2.762490106944477E-31";
+        results[68][35]="6.781292537131541E-40";
+        results[68][36]="1.428940867974192E-7";
+        results[68][37]="5.737508172967645E-45";
+        results[68][38]="6.993329524475215E-13";
+        results[68][39]="6.115026528318585E-50";
+        results[68][40]="1.267952240893443E-17";
+        results[68][41]="9.790053191333628E-55";
+        results[68][42]="4.579048441525779E-23";
+        results[68][43]="1.766091979577825E-59";
+        results[68][44]="1.202879608212802E-27";
+        results[68][45]="1.549129832266147E-43";
+        results[68][46]="0.0008434376335284867";
+        results[68][47]="5.631484899930744E-49";
+        results[68][48]="6.984167633124823E-9";
+        results[68][49]="2.384970930690432E-53";
+        results[68][50]="2.353765371550753E-13";
+        results[68][51]="5.936395781336616E-59";
+        results[68][52]="4.217672001516121E-18";
+        results[68][53]="1.236554418332251E-63";
+        results[68][54]="1.720014245444119E-23";
+        results[68][55]="6.262773615644344E-48";
+        results[68][56]="7.229406726646745";
+        results[68][57]="6.281635877311693E-53";
+        results[68][58]="0.00005778371733623009";
+        results[68][59]="1.232553315830994E-57";
+        results[68][60]="2.984618760264661E-9";
+        results[68][61]="5.697713979929495E-63";
+        results[68][62]="2.133828919245919E-14";
+        results[68][63]="4.846117066640417E-68";
+        results[68][64]="2.229620575759295E-19";
+        results[68][65]="5.257874547924172E-52";
+        results[68][66]="46874.52074382950";
+        results[68][67]="1.697248663473332E-56";
+        results[68][68]="1";
+        results[68][69]="7.538375225269271E-62";
+        results[68][70]="0.000007342287933519324";
+        results[68][71]="4.606920809807113E-67";
+        results[68][72]="1.789562419904057E-10";
+        results[68][73]="8.729614080282214E-72";
+        results[68][74]="4.998039790184512E-16";
+        results[69][0]="5.338779562533849E+38";
+        results[69][1]="1.173934144274364E+33";
+        results[69][2]="2.633929108448886E+28";
+        results[69][3]="3.071448625904928E+23";
+        results[69][4]="2.143773543755267E+18";
+        results[69][5]="6.688440450921611E+33";
+        results[69][6]="4.156559494698874E+42";
+        results[69][7]="6.414172677182188E+28";
+        results[69][8]="6.127551693389194E+36";
+        results[69][9]="5.978925519149620E+23";
+        results[69][10]="2.182046570122424E+32";
+        results[69][11]="7.245351369200056E+18";
+        results[69][12]="9.728535318099962E+26";
+        results[69][13]="91158771663435.09";
+        results[69][14]="7.329838806791966E+21";
+        results[69][15]="7.874052048267494E+29";
+        results[69][16]="9.045715624703119E+45";
+        results[69][17]="9.319191997593739E+24";
+        results[69][18]="7.099189318657215E+40";
+        results[69][19]="6.006651015061551E+19";
+        results[69][20]="2.402421502642987E+36";
+        results[69][21]="1119942454101324";
+        results[69][22]="1.380190675584772E+31";
+        results[69][23]="12274658554.81710";
+        results[69][24]="7.310702108942491E+25";
+        results[69][25]="7.318499515570511E+25";
+        results[69][26]="1.960240356553922E+50";
+        results[69][27]="8.531751941115174E+20";
+        results[69][28]="3.023130824647137E+45";
+        results[69][29]="1.456383960705739E+16";
+        results[69][30]="6.813296160116931E+39";
+        results[69][31]="177698704811.3589";
+        results[69][32]="1.385178878009241E+35";
+        results[69][33]="764612.9178559042";
+        results[69][34]="3.664569651142300E+30";
+        results[69][35]="8.995695139186061E+21";
+        results[69][36]="1.895555508014859E+54";
+        results[69][37]="7.611067373954845E+16";
+        results[69][38]="9.276971914362904E+48";
+        results[69][39]="811186276297.3776";
+        results[69][40]="1.681996720782961E+44";
+        results[69][41]="12986953.95065576";
+        results[69][42]="6.074317481804861E+38";
+        results[69][43]="234.2801899350586";
+        results[69][44]="1.595674893152901E+34";
+        results[69][45]="2.054991673899878E+18";
+        results[69][46]="1.118858651001097E+58";
+        results[69][47]="7470422646319.768";
+        results[69][48]="9.264818245864578E+52";
+        results[69][49]="316377317.3157802";
+        results[69][50]="3.122377569719179E+48";
+        results[69][51]="787.4900895669555";
+        results[69][52]="5.594935082798914E+43";
+        results[69][53]="0.01640346071109881";
+        results[69][54]="2.281677674624746E+38";
+        results[69][55]="83078560412474.54";
+        results[69][56]="9.590139135570173E+61";
+        results[69][57]="833287769.5256027";
+        results[69][58]="7.665274758748302E+56";
+        results[69][59]="16350.38425388234";
+        results[69][60]="3.959233483443444E+52";
+        results[69][61]="0.07558278554283523";
+        results[69][62]="2.830621792469476E+47";
+        results[69][63]="6.428596244978392E-7";
+        results[69][64]="2.957693812169788E+42";
+        results[69][65]="6974811402.726853";
+        results[69][66]="6.218119865763931E+65";
+        results[69][67]="225147.8087458437";
+        results[69][68]="1.326545800808529E+61";
+        results[69][69]="1";
+        results[69][70]="9.739881226537191E+55";
+        results[69][71]="0.000006111291454907054";
+        results[69][72]="2.373936513408476E+51";
+        results[69][73]="1.158023290087738E-10";
+        results[69][74]="6.630128695943206E+45";
+        results[70][0]="5.481360027253576E-18";
+        results[70][1]="1.205285893092693E-23";
+        results[70][2]="2.704272308036475E-28";
+        results[70][3]="3.153476469031765E-33";
+        results[70][4]="2.201026371773776E-38";
+        results[70][5]="6.867065722216763E-23";
+        results[70][6]="4.267566922042078E-14";
+        results[70][7]="6.585473198283149E-28";
+        results[70][8]="6.291197552485674E-20";
+        results[70][9]="6.138602083626537E-33";
+        results[70][10]="2.240321539216762E-24";
+        results[70][11]="7.438849818270307E-38";
+        results[70][12]="9.988351081318820E-30";
+        results[70][13]="9.359330934659115E-43";
+        results[70][14]="7.525593625126715E-35";
+        results[70][15]="8.084340933043336E-27";
+        results[70][16]="9.287295619229160E-11";
+        results[70][17]="9.568075606715566E-32";
+        results[70][18]="7.288784281388184E-16";
+        results[70][19]="6.167068032304013E-37";
+        results[70][20]="2.466581929251223E-20";
+        results[70][21]="1.149852270323317E-41";
+        results[70][22]="1.417050827913914E-25";
+        results[70][23]="1.260247252438118E-46";
+        results[70][24]="7.505945851807534E-31";
+        results[70][25]="7.513951500384414E-31";
+        results[70][26]="0.000002012591643533670";
+        results[70][27]="8.759605730991504E-36";
+        results[70][28]="3.103868265262150E-11";
+        results[70][29]="1.495278973975256E-40";
+        results[70][30]="6.995255898556019E-17";
+        results[70][31]="1.824444268654967E-45";
+        results[70][32]="1.422172248091892E-21";
+        results[70][33]="7.850331026344006E-51";
+        results[70][34]="3.762437719628292E-26";
+        results[70][35]="9.235939258352015E-35";
+        results[70][36]="0.01946179284866684";
+        results[70][37]="7.814332841367511E-40";
+        results[70][38]="9.524727970077244E-8";
+        results[70][39]="8.328502755118070E-45";
+        results[70][40]="1.726917075949764E-12";
+        results[70][41]="1.333379088368309E-49";
+        results[70][42]="6.236541637956356E-18";
+        results[70][43]="2.405370091133565E-54";
+        results[70][44]="1.638289888797966E-22";
+        results[70][45]="2.109873443118451E-38";
+        results[70][46]="114.8739522564880";
+        results[70][47]="7.669931976137371E-44";
+        results[70][48]="0.0009512249718838192";
+        results[70][49]="3.248266687829637E-48";
+        results[70][50]="3.205765550006891E-8";
+        results[70][51]="8.085212450243923E-54";
+        results[70][52]="5.744356581633671E-13";
+        results[70][53]="1.684154080483660E-58";
+        results[70][54]="2.342613448311986E-18";
+        results[70][55]="8.529730340665701E-43";
+        results[70][56]="984625.8812110530";
+        results[70][57]="8.555420237109612E-48";
+        results[70][58]="7.869987919219759";
+        results[70][59]="1.678704685775246E-52";
+        results[70][60]="0.0004064971010792362";
+        results[70][61]="7.760134213639389E-58";
+        results[70][62]="2.906217978056231E-9";
+        results[70][63]="6.600281970033780E-63";
+        results[70][64]="3.036683654941584E-14";
+        results[70][65]="7.161084658530892E-47";
+        results[70][66]="6384184489.665129";
+        results[70][67]="2.311607333900624E-51";
+        results[70][68]="136197.3282789357";
+        results[70][69]="1.026706565245795E-56";
+        results[70][70]="1";
+        results[70][71]="6.274503058883598E-62";
+        results[70][72]="0.00002437336203793195";
+        results[70][73]="1.188950114640616E-66";
+        results[70][74]="6.807196660549431E-11";
+        results[71][0]="8.735926934473208E+43";
+        results[71][1]="1.920926457094031E+38";
+        results[71][2]="4.309938624075892E+33";
+        results[71][3]="5.025858525269176E+28";
+        results[71][4]="3.507889550962140E+23";
+        results[71][5]="1.094439775990578E+39";
+        results[71][6]="6.801442093489699E+47";
+        results[71][7]="1.049560919244317E+34";
+        results[71][8]="1.002660687778045E+42";
+        results[71][9]="9.783407587849290E+28";
+        results[71][10]="3.570516291397545E+37";
+        results[71][11]="1.185567964261042E+24";
+        results[71][12]="1.591895164857249E+32";
+        results[71][13]="1.491644971215360E+19";
+        results[71][14]="1.199392773340319E+27";
+        results[71][15]="1.288443221267910E+35";
+        results[71][16]="1.480164330477132E+51";
+        results[71][17]="1.524913689087910E+30";
+        results[71][18]="1.161651243610208E+46";
+        results[71][19]="9.828775242323811E+24";
+        results[71][20]="3.931119175659616E+41";
+        results[71][21]="1.832579025832696E+20";
+        results[71][22]="2.258427184775404E+36";
+        results[71][23]="2008521217714331";
+        results[71][24]="1.196261406101385E+31";
+        results[71][25]="1.197537307714907E+31";
+        results[71][26]="3.207571379990312E+55";
+        results[71][27]="1.396063664131845E+26";
+        results[71][28]="4.946795365519211E+50";
+        results[71][29]="2.383103426586433E+21";
+        results[71][30]="1.114870107307058E+45";
+        results[71][31]="2.907711178930534E+16";
+        results[71][32]="2.266589456958420E+40";
+        results[71][33]="125114785229.5539";
+        results[71][34]="5.996391561721113E+35";
+        results[71][35]="1.471979401663617E+27";
+        results[71][36]="3.101726569582645E+59";
+        results[71][37]="1.245410635397457E+22";
+        results[71][38]="1.518005152072067E+54";
+        results[71][39]="1.327356553492530E+17";
+        results[71][40]="2.752277048466415E+49";
+        results[71][41]="2125075206522.494";
+        results[71][42]="9.939498920359126E+43";
+        results[71][43]="38335627.03787325";
+        results[71][44]="2.611027317101128E+39";
+        results[71][45]="3.362614414748335E+23";
+        results[71][46]="1.830805582186251E+63";
+        results[71][47]="1.222396722761668E+18";
+        results[71][48]="1.516016428642984E+58";
+        results[71][49]="51769305988793.17";
+        results[71][50]="5.109194337658483E+53";
+        results[71][51]="128858211.9471067";
+        results[71][52]="9.155078143600022E+48";
+        results[71][53]="2684.123451177847";
+        results[71][54]="3.733544196771496E+43";
+        results[71][55]="1.359427234414859E+19";
+        results[71][56]="1.569249185107967E+67";
+        results[71][57]="136352156606197.4";
+        results[71][58]="1.254280672965365E+62";
+        results[71][59]="2675438469.025040";
+        results[71][60]="6.478554512834406E+57";
+        results[71][61]="12367.72719817611";
+        results[71][62]="4.631789881656898E+52";
+        results[71][63]="0.1051921069779213";
+        results[71][64]="4.839719777715578E+47";
+        results[71][65]="1141299094338961";
+        results[71][66]="1.017480496822173E+71";
+        results[71][67]="36841281488.06609";
+        results[71][68]="2.170647252870554E+66";
+        results[71][69]="163631.5347383819";
+        results[71][70]="1.593751713267834E+61";
+        results[71][71]="1";
+        results[71][72]="3.884508750605123E+56";
+        results[71][73]="0.00001894891282198470";
+        results[71][74]="1.084898134030173E+51";
+        results[72][0]="2.248914211639332E-13";
+        results[72][1]="4.945094941013564E-19";
+        results[72][2]="1.109519607441867E-23";
+        results[72][3]="1.293820878762663E-28";
+        results[72][4]="9.030458614401850E-34";
+        results[72][5]="2.817447060249479E-18";
+        results[72][6]="1.750914344685201E-9";
+        results[72][7]="2.701914158594232E-23";
+        results[72][8]="2.581177575212958E-15";
+        results[72][9]="2.518570098812429E-28";
+        results[72][10]="9.191680391610227E-20";
+        results[72][11]="3.052040915280100E-33";
+        results[72][12]="4.098060442286985E-25";
+        results[72][13]="3.839983552574039E-38";
+        results[72][14]="3.087630509658344E-30";
+        results[72][15]="3.316875579356586E-22";
+        results[72][16]="0.000003810428616608354";
+        results[72][17]="3.925628147575576E-27";
+        results[72][18]="2.990471429442005E-11";
+        results[72][19]="2.530249221550267E-32";
+        results[72][20]="1.011999052659421E-15";
+        results[72][21]="4.717659666868350E-37";
+        results[72][22]="5.813932545327873E-21";
+        results[72][23]="5.170592593983595E-42";
+        results[72][24]="3.079569343009031E-26";
+        results[72][25]="3.082853932375250E-26";
+        results[72][26]="0.08257341110354408";
+        results[72][27]="3.593925908686312E-31";
+        results[72][28]="0.000001273467427444617";
+        results[72][29]="6.134890097017279E-36";
+        results[72][30]="2.870041436084768E-12";
+        results[72][31]="7.485402571116811E-41";
+        results[72][32]="5.834944911902525E-17";
+        results[72][33]="3.220865063312414E-46";
+        results[72][34]="1.543667924750332E-21";
+        results[72][35]="3.789357924433339E-30";
+        results[72][36]="798.4861841537783";
+        results[72][37]="3.206095584682231E-35";
+        results[72][38]="0.003907843306661606";
+        results[72][39]="3.417051263652724E-40";
+        results[72][40]="7.085264122619546E-8";
+        results[72][41]="5.470640801598023E-45";
+        results[72][42]="2.558753129030992E-13";
+        results[72][43]="9.868848160504565E-50";
+        results[72][44]="6.721640971189435E-18";
+        results[72][45]="8.656472750188841E-34";
+        results[72][46]="4713094.241069868";
+        results[72][47]="3.146850222878877E-39";
+        results[72][48]="39.02723680071055";
+        results[72][49]="1.332711787062614E-43";
+        results[72][50]="0.001315274251052358";
+        results[72][51]="3.317233148902893E-49";
+        results[72][52]="2.356817484881160E-8";
+        results[72][53]="6.909814402554038E-54";
+        results[72][54]="9.611367708181607E-14";
+        results[72][55]="3.499611718478145E-38";
+        results[72][56]="40397622604.49307";
+        results[72][57]="3.510151871454961E-43";
+        results[72][58]="322892.9971569699";
+        results[72][59]="6.887456409020225E-48";
+        results[72][60]="16.67792487743833";
+        results[72][61]="3.183858755949381E-53";
+        results[72][62]="0.0001192374680822991";
+        results[72][63]="2.707989960417380E-58";
+        results[72][64]="1.245902658080421E-9";
+        results[72][65]="2.938078319842043E-42";
+        results[72][66]="261932862595217.9";
+        results[72][67]="9.484154587713828E-47";
+        results[72][68]="5587958200.718210";
+        results[72][69]="4.212412566013441E-52";
+        results[72][70]="41028.39807014366";
+        results[72][71]="2.574328091922103E-57";
+        results[72][72]="1";
+        results[72][73]="4.878071858901815E-62";
+        results[72][74]="0.000002792883743307747";
+        results[73][0]="4.610252322411714E+48";
+        results[73][1]="1.013739666829516E+43";
+        results[73][2]="2.274504434405050E+38";
+        results[73][3]="2.652320253137757E+33";
+        results[73][4]="1.851235257619769E+28";
+        results[73][5]="5.775739148057081E+43";
+        results[73][6]="3.589357425085942E+52";
+        results[73][7]="5.538897820177879E+38";
+        results[73][8]="5.291388995229049E+46";
+        results[73][9]="5.163044275816442E+33";
+        results[73][10]="1.884285565584005E+42";
+        results[73][11]="6.256654275624378E+28";
+        results[73][12]="8.400984161003253E+36";
+        results[73][13]="7.871929040091104E+23";
+        results[73][14]="6.329612598928488E+31";
+        results[73][15]="6.799562768440446E+39";
+        results[73][16]="7.811341708004652E+55";
+        results[73][17]="8.047499629206652E+34";
+        results[73][18]="6.130437426797644E+50";
+        results[73][19]="5.186986364157197E+29";
+        results[73][20]="2.074588242919507E+46";
+        results[73][21]="9.671156562114322E+24";
+        results[73][22]="1.191850533058106E+41";
+        results[73][23]="1.059966466985920E+20";
+        results[73][24]="6.313087285479891E+35";
+        results[73][25]="6.319820661824533E+35";
+        results[73][26]="1.692746919110240E+60";
+        results[73][27]="7.367513256550102E+30";
+        results[73][28]="2.610595875336918E+55";
+        results[73][29]="1.257646519868694E+26";
+        results[73][30]="5.883557108424581E+49";
+        results[73][31]="1.534500267243291E+21";
+        results[73][32]="1.196158047826734E+45";
+        results[73][33]="6602742141723014";
+        results[73][34]="3.164504274231525E+40";
+        results[73][35]="7.768146993403301E+31";
+        results[73][36]="1.636888933271145E+64";
+        results[73][37]="6.572464853775255E+26";
+        results[73][38]="8.011040877822095E+58";
+        results[73][39]="7.004921949677867E+21";
+        results[73][40]="1.452472273381932E+54";
+        results[73][41]="1.121476058540394E+17";
+        results[73][42]="5.245419098043044E+48";
+        results[73][43]="2023104301445.511";
+        results[73][44]="1.377929880004403E+44";
+        results[73][45]="1.774568518172187E+28";
+        results[73][46]="9.661797483505934E+67";
+        results[73][47]="6.451012436678859E+22";
+        results[73][48]="8.000545692964971E+62";
+        results[73][49]="2.732046237963053E+18";
+        results[73][50]="2.696299458262718E+58";
+        results[73][51]="6800295782542.430";
+        results[73][52]="4.831452986040559E+53";
+        results[73][53]="141650525.0931179";
+        results[73][54]="1.970321058440780E+48";
+        results[73][55]="7.174170081344397E+23";
+        results[73][56]="8.281473453650119E+71";
+        results[73][57]="7.195777292721534E+18";
+        results[73][58]="6.619275125431665E+66";
+        results[73][59]="141192188394099.9";
+        results[73][60]="3.418958424526566E+62";
+        results[73][61]="652687957.0540302";
+        results[73][62]="2.444356531253368E+57";
+        results[73][63]="5551.353154988210";
+        results[73][64]="2.554088365481576E+52";
+        results[73][65]="6.023032060260553E+19";
+        results[73][66]="5.369598279230475E+75";
+        results[73][67]="1944242492124535";
+        results[73][68]="1.145526011577904E+71";
+        results[73][69]="8635404905.580393";
+        results[73][70]="8.410781812340964E+65";
+        results[73][71]="52773.47620913591";
+        results[73][72]="2.049990301342397E+61";
+        results[73][73]="1";
+        results[73][74]="5.725384586557730E+55";
+        results[74][0]="8.052301557585906E-8";
+        results[74][1]="1.770605365462456E-13";
+        results[74][2]="3.972666639277327E-18";
+        results[74][3]="4.632562604379404E-23";
+        results[74][4]="3.233381495395381E-28";
+        results[74][5]="1.008794965777072E-12";
+        results[74][6]="0.0006269198812448631";
+        results[74][7]="9.674280804091849E-18";
+        results[74][8]="9.241980019390084E-10";
+        results[74][9]="9.017812162240471E-23";
+        results[74][10]="3.291107413129942E-14";
+        results[74][11]="1.092791965506384E-27";
+        results[74][12]="1.467322244295588E-19";
+        results[74][13]="1.374917076937174E-32";
+        results[74][14]="1.105534921407618E-24";
+        results[74][15]="1.187616773274011E-16";
+        results[74][16]="1.364334847713883";
+        results[74][17]="1.405582368754908E-21";
+        results[74][18]="0.00001070746835276518";
+        results[74][19]="9.059629594726956E-27";
+        results[74][20]="3.623491507959662E-10";
+        results[74][21]="1.689171516062104E-31";
+        results[74][22]="2.081695150848690E-15";
+        results[74][23]="1.851345444067719E-36";
+        results[74][24]="1.102648597668354E-20";
+        results[74][25]="1.103824654270814E-20";
+        results[74][26]="29565.64565260007";
+        results[74][27]="1.286815434870144E-25";
+        results[74][28]="0.4559686490696489";
+        results[74][29]="2.196614918797670E-30";
+        results[74][30]="0.000001027626532239985";
+        results[74][31]="2.680169766841597E-35";
+        results[74][32]="2.089218688706290E-11";
+        results[74][33]="1.153239933824738E-40";
+        results[74][34]="5.527147087483460E-16";
+        results[74][35]="1.356790426208511E-24";
+        results[74][36]="285900258.4934282";
+        results[74][37]="1.147951679823628E-29";
+        results[74][38]="1399.214455677041";
+        results[74][39]="1.223484963110475E-34";
+        results[74][40]="0.02536899052671676";
+        results[74][41]="1.958778561659312E-39";
+        results[74][42]="9.161688649454979E-8";
+        results[74][43]="3.533569266587664E-44";
+        results[74][44]="2.406702744894305E-12";
+        results[74][45]="3.099474788713032E-28";
+        results[74][46]="1687536852317.355";
+        results[74][47]="1.126738708841461E-33";
+        results[74][48]="13973813.58756047";
+        results[74][49]="4.771812612164872E-38";
+        results[74][50]="470.9377016512027";
+        results[74][51]="1.187744802071186E-43";
+        results[74][52]="0.008438652308849302";
+        results[74][53]="2.474078779366023E-48";
+        results[74][54]="3.441377655339997E-8";
+        results[74][55]="1.253045969730694E-32";
+        results[74][56]="1.446448413805017E+16";
+        results[74][57]="1.256819901603824E-37";
+        results[74][58]="115612759725.7422";
+        results[74][59]="2.466073435932954E-42";
+        results[74][60]="5971578.629938194";
+        results[74][61]="1.139989719793558E-47";
+        results[74][62]="42.69331595631704";
+        results[74][63]="9.696035386027837E-53";
+        results[74][64]="0.0004460990046813902";
+        results[74][65]="1.051987332763925E-36";
+        results[74][66]="9.378580946051059E+19";
+        results[74][67]="3.395828634270787E-41";
+        results[74][68]="2000784391440555";
+        results[74][69]="1.508266348754094E-46";
+        results[74][70]="14690335094.84779";
+        results[74][71]="9.217455248864755E-52";
+        results[74][72]="358052.8557252626";
+        results[74][73]="1.746607559512835E-56";
+        results[74][74]="1";
+    }
+
+    public static int mcDivideTests() {
+        int failures = 0;
+        for(int i=0; i<value.length; i++) {
+            for(int j=0; j<value.length; j++) {
+                BigDecimal v1 = new BigDecimal(value[i]);
+                BigDecimal v2 = new BigDecimal(value[j]);
+                BigDecimal res1  = v1.divide(v2, MathContext.DECIMAL64);
+                if(!res1.toString().equals(results[i][j])) {
+                    failures++;
+                    System.err.println("Unexpected result from " + v1 + " / " + v2 +
+                                       "; expected " + results[i][j] + " got " + res1);
+
+                }
+            }
+        }
+        for (int mpc = 1; mpc < 23; mpc++) {
+            for (int i = 0; i < value.length; i++) {
+                for (int j = 0; j < value.length; j++) {
+                    BigDecimal v1 = new BigDecimal(value[i]);
+                    BigDecimal v2 = new BigDecimal(value[j]);
+                    BigDecimal res1 = v1.divide(v2, new MathContext(mpc, RoundingMode.HALF_EVEN));
+                    BigDecimal res2 = v1.divide(v2, new MathContext(128, RoundingMode.HALF_EVEN)).round(new MathContext(mpc, RoundingMode.HALF_EVEN));
+                    if (!res1.equals(res2)) {
+                        failures++;
+                        System.err.println("Unexpected result from " + v1 + " / " + v2 +
+                                           "; expected " + res2 + " got " + res1);
+
+                    }
+                }
+            }
+        }
+        return failures;
+    }
+
+    public static void main(String argv[]) {
+        int failures = 0;
+        failures += mcDivideTests();
+        if (failures > 0) {
+            throw new RuntimeException("Incurred " + failures +
+                                       " failures while testing DECIMAL64 divide.");
+        }
+    }
+
+}
--- a/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java	Thu Apr 21 16:42:06 2011 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 6274390
  * @summary Verify {float, double}Value methods work with condensed representation
+ * @run main FloatDoubleValueTests
+ * @run main/othervm -XX:+AggressiveOpts FloatDoubleValueTests
  */
 import java.math.*;
 
@@ -64,6 +66,7 @@
 
     static void checkDouble(BigDecimal bd, double d) {
         double dbd = bd.doubleValue();
+
         if (d != dbd ) {
             String message = String.format("Bad conversion:"+
                                            "got %g (%a)\texpected %g (%a)",
@@ -156,9 +159,29 @@
         }
     }
 
+    static void testFloatValue1() {
+        checkFloat(new BigDecimal("85070591730234615847396907784232501249"), 8.507059e+37f);
+        checkFloat(new BigDecimal("7784232501249e12"), 7.7842326e24f);
+        checkFloat(new BigDecimal("907784232501249e-12"),907.78424f);
+        checkFloat(new BigDecimal("7784e8"),7.7839997e11f);
+        checkFloat(new BigDecimal("9077e-8"),9.077e-5f);
+
+    }
+
+    static void testDoubleValue1() {
+        checkDouble(new BigDecimal("85070591730234615847396907784232501249"), 8.507059173023462e37);
+        checkDouble(new BigDecimal("7784232501249e12"), 7.784232501249e24);
+        checkDouble(new BigDecimal("907784232501249e-12"), 907.784232501249);
+        checkDouble(new BigDecimal("7784e8"), 7.784e11);
+        checkDouble(new BigDecimal("9077e-8"), 9.077e-5);
+
+    }
+
     public static void main(String[] args) throws Exception {
         testFloatDoubleValue();
         testDoubleValue();
         testFloatValue();
+        testFloatValue1();
+        testDoubleValue1();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigDecimal/RangeTests.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,245 @@
+/*
+ * 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 7036582
+ * @summary Some new tests for the add method and constructor with MathContext.
+ * @run main RangeTests
+ * @run main/othervm -XX:+AggressiveOpts RangeTests
+ * @author Sergey V. Kuksenko
+ */
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.math.MathContext;
+
+public class RangeTests {
+
+
+    private static int addTest(BigDecimal arg1, BigDecimal arg2, BigDecimal expectedResult) {
+        int failures = 0;
+        BigDecimal result = arg1.add(arg2);
+        if (!result.equals(expectedResult)) {
+            System.out.println("Sum:" +
+                    arg1 + " + " +
+                    arg2 + " == " +
+                    result + "; expected  " +
+                    expectedResult
+            );
+            failures++;
+        }
+        result = arg2.add(arg1);
+        if (!result.equals(expectedResult)) {
+            System.out.println("Sum:" +
+                    arg2 + " + " +
+                    arg1 + " == " +
+                    result + "; expected  " +
+                    expectedResult
+            );
+            failures++;
+        }
+        return failures;
+    }
+
+    /*
+     *  Test BigDecimal.add(BigDecimal) when values are withing different ranges:
+     *  1. within 32 bits
+     *  2. within 64 bits
+     *  3. outside 64 bits.
+     */
+    private static int addBoundaryTest() {
+        int failures = 0;
+        failures += addTest(
+                new BigDecimal("85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(0),
+                new BigDecimal("85070591730234615847396907784232501249") );
+        failures += addTest(
+                new BigDecimal("-85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(0),
+                new BigDecimal("-85070591730234615847396907784232501249") );
+        failures += addTest(
+                new BigDecimal("85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(1),
+                new BigDecimal("85070591730234615847396907784232501250") );
+        failures += addTest(
+                new BigDecimal("85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(-1),
+                new BigDecimal("85070591730234615847396907784232501248") );
+        failures += addTest(
+                new BigDecimal("-85070591730234615847396907784232501250"),
+                BigDecimal.valueOf(-1),
+                new BigDecimal("-85070591730234615847396907784232501251") );
+        failures += addTest(
+                new BigDecimal("-85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(1),
+                new BigDecimal("-85070591730234615847396907784232501248") );
+        failures += addTest(
+                new BigDecimal("147573952589676412927"),
+                BigDecimal.valueOf(Integer.MAX_VALUE),
+                new BigDecimal("147573952591823896574") );
+        failures += addTest(
+                new BigDecimal("-147573952589676412927"),
+                BigDecimal.valueOf(Integer.MAX_VALUE),
+                new BigDecimal("-147573952587528929280") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(999),
+                new BigDecimal("79228162514264337593543951334") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Integer.MAX_VALUE/2),
+                new BigDecimal("79228162514264337594617692158") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Integer.MIN_VALUE/2),
+                new BigDecimal("79228162514264337592470208511") );
+        failures += addTest(
+                new BigDecimal("-79228162514264337593543950335"),
+                BigDecimal.valueOf(Integer.MAX_VALUE/2),
+                new BigDecimal("-79228162514264337592470208512") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(-(Integer.MIN_VALUE/2)),
+                new BigDecimal("79228162514264337594617692159") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Long.MAX_VALUE/2),
+                new BigDecimal("79228162518876023611971338238") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Long.MIN_VALUE/2),
+                new BigDecimal("79228162509652651575116562431") );
+        failures += addTest(
+                new BigDecimal("-79228162514264337593543950335"),
+                BigDecimal.valueOf(Long.MAX_VALUE/2),
+                new BigDecimal("-79228162509652651575116562432") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(-(Long.MIN_VALUE/2)),
+                new BigDecimal("79228162518876023611971338239") );
+        failures += addTest(
+                new BigDecimal("-9223372036854775808"),
+                BigDecimal.valueOf(1),
+                new BigDecimal("-9223372036854775807") );
+        failures += addTest(
+                new BigDecimal("-9223372036854775808"),
+                BigDecimal.valueOf(Long.MAX_VALUE/2),
+                new BigDecimal("-4611686018427387905") );
+        failures += addTest(
+                new BigDecimal("9223372036854775808"),
+                BigDecimal.valueOf(-1),
+                new BigDecimal("9223372036854775807") );
+        failures += addTest(
+                new BigDecimal("9223372036854775808"),
+                BigDecimal.valueOf(-Long.MAX_VALUE/2),
+                new BigDecimal("4611686018427387905") );
+
+        return failures;
+    }
+
+    private static int testRoundingFromBigInteger(BigInteger bi, int scale, MathContext mc) {
+        int failures = 0;
+        BigDecimal bd1 = new BigDecimal(bi,scale, mc);
+        BigDecimal bd2 = (new BigDecimal(bi,scale)).round(mc);
+        if (!bd1.equals(bd2)) {
+            System.out.println("new BigDecimal(BigInteger,int,MathContext):" +
+                    "BigInteger == " +
+                    bi + ";  scale == " + scale + "; result == " +
+                    bd1 + "; expected  == " +
+                    bd2
+            );
+            failures++;
+        }
+        return failures;
+    }
+
+    private static int roundingConstructorTest() {
+        int failures = 0;
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                7, MathContext.DECIMAL64);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                0, MathContext.DECIMAL64);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                -7, MathContext.DECIMAL64);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                7, MathContext.DECIMAL128);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                177, MathContext.DECIMAL128);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                177, MathContext.DECIMAL32);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                177, MathContext.UNLIMITED);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                0, MathContext.UNLIMITED);
+        return failures;
+    }
+
+    private static int minLongConstructorTest(MathContext mc) {
+        int failures = 0;
+        BigDecimal bd1 = new BigDecimal(Long.MIN_VALUE,mc);
+        BigDecimal bd2 = new BigDecimal(Long.MIN_VALUE).round(mc);
+        if (!bd1.equals(bd2)) {
+            System.out.println("new BigDecimal(long,MathContext):" +
+                    "long == " +
+                    Long.MIN_VALUE + "; result == " +
+                    bd1 + "; expected  == " +
+                    bd2
+            );
+            failures++;
+        }
+        return failures;
+    }
+
+    private static int minLongConstructorTest() {
+        int failures = 0;
+        failures+=minLongConstructorTest(MathContext.UNLIMITED);
+        failures+=minLongConstructorTest(MathContext.DECIMAL32);
+        failures+=minLongConstructorTest(MathContext.DECIMAL64);
+        failures+=minLongConstructorTest(MathContext.DECIMAL128);
+        return failures;
+    }
+
+    public static void main(String argv[]) {
+        int failures = 0;
+
+        failures += addBoundaryTest();
+        failures += roundingConstructorTest();
+        failures += minLongConstructorTest();
+        if (failures > 0) {
+            throw new RuntimeException("Incurred " + failures +
+                                       " failures while testing.");
+        }
+    }
+
+
+
+}
--- a/jdk/test/java/math/BigDecimal/StrippingZerosTest.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/math/BigDecimal/StrippingZerosTest.java	Thu Apr 21 16:42:06 2011 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 4108852
  * @summary A few tests of stripTrailingZeros
+ * @run main StrippingZerosTest
+ * @run main/othervm -XX:+AggressiveOpts StrippingZerosTest
  * @author Joseph D. Darcy
  */
 
@@ -53,6 +55,11 @@
             {new BigDecimal("10000000e2"),      new BigDecimal("1e9")},
             {new BigDecimal("1000000e3"),       new BigDecimal("1e9")},
             {new BigDecimal("100000e4"),        new BigDecimal("1e9")},
+            // BD value which larger than Long.MaxValue
+            {new BigDecimal("1.0000000000000000000000000000"),    new BigDecimal("1")},
+            {new BigDecimal("-1.0000000000000000000000000000"),   new BigDecimal("-1")},
+            {new BigDecimal("1.00000000000000000000000000001"),   new BigDecimal("1.00000000000000000000000000001")},
+            {new BigDecimal("1000000000000000000000000000000e4"), new BigDecimal("1e34")},
         };
 
         for(int i = 0; i < testCases.length; i++) {
--- a/jdk/test/java/math/BigDecimal/ToPlainStringTests.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/math/BigDecimal/ToPlainStringTests.java	Thu Apr 21 16:42:06 2011 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 4984872
  * @summary Basic tests of toPlainString method
+ * @run main ToPlainStringTests
+ * @run main/othervm -XX:+AggressiveOpts ToPlainStringTests
  * @author Joseph D. Darcy
  */
 
@@ -60,6 +62,11 @@
             {"8e-8",                    "0.00000008"},
             {"9e-9",                    "0.000000009"},
             {"9000e-12",                "0.000000009000"},
+
+            {"9000e-22",                 "0.0000000000000000009000"},
+            {"12345678901234567890",     "12345678901234567890"},
+            {"12345678901234567890e22",  "123456789012345678900000000000000000000000"},
+            {"12345678901234567890e-22", "0.0012345678901234567890"},
         };
 
         int errors = 0;
@@ -73,8 +80,8 @@
                                    s + "'' from BigDecimal " +
                                    bd);
             }
-
-            if (!(s=("-"+bd.toPlainString())).equals("-"+testCase[1])) {
+            bd = new BigDecimal("-"+testCase[0]);
+            if (bd.signum()!=0 && !(s=(bd.toPlainString())).equals("-"+testCase[1])) {
                 errors++;
                 System.err.println("Unexpected plain result ``" +
                                    s + "'' from BigDecimal " +
--- a/jdk/test/java/net/URL/Equals.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/net/URL/Equals.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 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
@@ -23,16 +23,19 @@
 
 /*
  * @test
- * @bug 4052976
- * @summary Test URL.equals involving anchors
- *
+ * @bug 4052976 7030649
+ * @summary Test URL.equals with anchors, and jar URLs
  */
 
 import java.net.*;
 
 public class Equals {
+    public static void main(String[] args) throws Exception {
+        anchors();
+        jarURLs();
+    }
 
-    public static void main(String[] args) throws Exception {
+    static void anchors() throws Exception {
         URL url1, url2;
 
         url1 = new URL(null, "http://JavaSoft/Test#bar");
@@ -45,4 +48,74 @@
         if (url1.equals(null))
             throw new RuntimeException("URL.equals fails given null");
     }
+
+    static final String HTTP_URL1A = "http://localhost/xyz";
+    static final String HTTP_URL1B = "http://LOCALHOST/xyz";
+    static final String FILE_URL1A = "file:///c:/foo/xyz";
+    static final String FILE_URL1B = "file:/c:/foo/xyz";
+
+    static void jarURLs() throws Exception {
+        int failed = 0;
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1A, "!/abc", "!/abc", true);
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/abc", true);
+        failed = compareJarURLS(HTTP_URL1B, HTTP_URL1A, "!/", "!/", true);
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/", false);
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/xy", false);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1A, "!/abc", "!/abc", true);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/abc", true);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/", "!/", true);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/", false);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/xy", false);
+
+        failed = (new URL("jar:file://xzy!/abc")).equals(
+                      new URL("file://xzy!/abc")) ? 1 : 0;
+
+        if (failed > 0)
+            throw new RuntimeException("Some jar URL tests failed. Check output");
+    }
+
+    static int compareJarURLS(String urlStr1, String urlStr2,
+                                  String entry1,  String entry2,
+                                  boolean expectEqual) throws Exception {
+        int failed = 0;
+
+        URL url1 = new URL(urlStr1);
+        URL url2 = new URL(urlStr2);
+
+        if (!url1.equals(url2)) {
+            System.out.println("Urls are not equal, so the test cannot run.");
+            System.out.println("url1: " + url1 + ", url2:" + url2);
+            return 1;
+        }
+
+        URL jarUrl1 = new URL("jar:" + urlStr1 + entry1);
+        URL jarUrl2 = new URL("jar:" + urlStr2 + entry2);
+        jarUrl2.openConnection();
+
+        boolean equal = jarUrl1.equals(jarUrl2);
+        if (expectEqual && !equal) {
+            System.out.println("URLs should be equal, but are not. " +
+                                jarUrl1 + ", " + jarUrl2);
+            failed++;
+        } else if (!expectEqual && equal) {
+            System.out.println("URLs should NOT be equal, but are. " +
+                                jarUrl1 + ", " + jarUrl2);
+            failed++;
+        }
+
+        if (expectEqual) {
+            // hashCode MUST produce the same integer result for equal urls
+            int hash1 = jarUrl1.hashCode();
+            int hash2 = jarUrl2.hashCode();
+            if (hash1 != hash2) {
+                System.out.println("jarUrl1.hashCode = " + hash1);
+                System.out.println("jarUrl2.hashCode = " + hash2);
+                System.out.println("Equal urls should have same hashCode. " +
+                                    jarUrl1 + ", " + jarUrl2);
+                failed++;
+            }
+        }
+
+        return failed;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6597112
+ * @summary GC'ing objects whilst being exported to RMI should not cause exceptions
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.rmi.Remote;
+import java.rmi.server.UnicastRemoteObject;
+
+public class GcDuringExport {
+    private static final long MAX_EXPORT_ITERATIONS = 50000;
+
+    public static void main(String[] args) throws Exception {
+        Thread gcInducingThread = new Thread() {
+            public void run() {
+                while (true) {
+                    System.gc();
+                    try { Thread.sleep(1); } catch (InterruptedException e) { }
+                }
+            }
+        };
+        gcInducingThread.setDaemon(true);
+        gcInducingThread.start();
+
+        long i = 0;
+        try {
+            while (i < MAX_EXPORT_ITERATIONS) {
+                i++;
+                UnicastRemoteObject.exportObject(new Remote() { }, 0);
+            }
+        } catch (Throwable e) {
+            throw new RuntimeException("Test FAILED on iteration " + i + ".", e);
+        }
+
+        System.out.println("Test successfully exported " + i + " objects.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/SignedObject/Correctness.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,71 @@
+/*
+ * 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 6618658
+ * @summary Deserialization allows creation of mutable SignedObject
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.security.SignedObject;
+
+
+public class Correctness {
+
+    public static void main(String[] args) throws Exception {
+
+        String SIGALG = "SHA1withRSA";
+        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
+        KeyPair kp = kpg.generateKeyPair();
+
+        SignedObject so1 = new SignedObject("Hello", kp.getPrivate(),
+                Signature.getInstance(SIGALG));
+
+        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(byteOut);
+        out.writeObject(so1);
+        out.close();
+
+        byte[] data = byteOut.toByteArray();
+
+        SignedObject so2 = (SignedObject)new ObjectInputStream(
+                new ByteArrayInputStream(data)).readObject();
+
+        if (!so2.getObject().equals("Hello")) {
+            throw new Exception("Content changed");
+        }
+        if (!so2.getAlgorithm().equals(SIGALG)) {
+            throw new Exception("Signature algorithm unknown");
+        }
+        if (!so2.verify(kp.getPublic(), Signature.getInstance(SIGALG))) {
+            throw new Exception("Not verified");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumMap/DistinctEntrySetElements.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Sets from Map.entrySet() return distinct objects for each Entry
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.EnumMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class DistinctEntrySetElements {
+    static enum TestEnum { e00, e01, e02 }
+
+    public static void main(String[] args) throws Exception {
+        final EnumMap<TestEnum, String> enumMap = new EnumMap<>(TestEnum.class);
+
+        for (TestEnum e : TestEnum.values()) {
+            enumMap.put(e, e.name());
+        }
+
+        Set<Map.Entry<TestEnum, String>> entrySet = enumMap.entrySet();
+        HashSet<Map.Entry<TestEnum, String>> hashSet = new HashSet<>(entrySet);
+
+        if (false == hashSet.equals(entrySet)) {
+            throw new RuntimeException("Test FAILED: Sets are not equal.");
+        }
+        if (hashSet.hashCode() != entrySet.hashCode()) {
+            throw new RuntimeException("Test FAILED: Set's hashcodes are not equal.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumMap/EntrySetIteratorRemoveInvalidatesEntry.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Iterator.remove() from Map.entrySet().iterator() invalidates returned Entry.
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class EntrySetIteratorRemoveInvalidatesEntry {
+    static enum TestEnum { e00, e01, e02 }
+
+    public static void main(String[] args) throws Exception {
+        final EnumMap<TestEnum, String> enumMap = new EnumMap<>(TestEnum.class);
+
+        for (TestEnum e : TestEnum.values()) {
+            enumMap.put(e, e.name());
+        }
+
+        Iterator<Map.Entry<TestEnum, String>> entrySetIterator =
+            enumMap.entrySet().iterator();
+        Map.Entry<TestEnum, String> entry = entrySetIterator.next();
+
+        entrySetIterator.remove();
+
+        try {
+            entry.getKey();
+            throw new RuntimeException("Test FAILED: Entry not invalidated by removal.");
+        } catch (Exception e) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumMap/SimpleSerialization.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary A serialized EnumMap can be successfully de-serialized.
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.EnumMap;
+
+public class SimpleSerialization {
+    private enum TestEnum { e00, e01, e02, e03, e04, e05, e06, e07 }
+    public static void main(final String[] args) throws Exception {
+        final EnumMap<TestEnum, String> enumMap = new EnumMap<>(TestEnum.class);
+
+        enumMap.put(TestEnum.e01, TestEnum.e01.name());
+        enumMap.put(TestEnum.e04, TestEnum.e04.name());
+        enumMap.put(TestEnum.e05, TestEnum.e05.name());
+
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+        oos.writeObject(enumMap);
+        oos.close();
+
+        final byte[] data = baos.toByteArray();
+        final ByteArrayInputStream bais = new ByteArrayInputStream(data);
+        final ObjectInputStream ois = new ObjectInputStream(bais);
+
+        final Object deserializedObject = ois.readObject();
+        ois.close();
+
+        if (false == enumMap.equals(deserializedObject)) {
+            throw new RuntimeException(getFailureText(enumMap, deserializedObject));
+        }
+    }
+
+    private static String getFailureText(final Object orig, final Object copy) {
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+
+        pw.println("Test FAILED: Deserialized object is not equal to the original object");
+        pw.print("\tOriginal: ");
+        printObject(pw, orig).println();
+        pw.print("\tCopy:     ");
+        printObject(pw, copy).println();
+
+        pw.close();
+        return sw.toString();
+    }
+
+    private static PrintWriter printObject(final PrintWriter pw, final Object o) {
+        pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o));
+        return pw;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/IdentityHashMap/DistinctEntrySetElements.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Sets from Map.entrySet() return distinct objects for each Entry
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.IdentityHashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class DistinctEntrySetElements {
+    public static void main(String[] args) throws Exception {
+        final IdentityHashMap<String, String> identityHashMap =
+            new IdentityHashMap<>();
+
+        identityHashMap.put("One", "Un");
+        identityHashMap.put("Two", "Deux");
+        identityHashMap.put("Three", "Trois");
+
+        Set<Map.Entry<String, String>> entrySet = identityHashMap.entrySet();
+        HashSet<Map.Entry<String, String>> hashSet = new HashSet<>(entrySet);
+
+        // NB: These comparisons are valid in this case because none of the
+        //     keys put into 'identityHashMap' above are equal to any other.
+        if (false == hashSet.equals(entrySet)) {
+            throw new RuntimeException("Test FAILED: Sets are not equal.");
+        }
+        if (hashSet.hashCode() != entrySet.hashCode()) {
+            throw new RuntimeException("Test FAILED: Set's hashcodes are not equal.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/IdentityHashMap/EntrySetIteratorRemoveInvalidatesEntry.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Iterator.remove() from Map.entrySet().iterator() invalidates returned Entry.
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class EntrySetIteratorRemoveInvalidatesEntry {
+    public static void main(String[] args) throws Exception {
+        final IdentityHashMap<String, String> identityHashMap =
+            new IdentityHashMap<>();
+
+        identityHashMap.put("One", "Un");
+        identityHashMap.put("Two", "Deux");
+        identityHashMap.put("Three", "Trois");
+
+        Iterator<Map.Entry<String, String>> entrySetIterator =
+            identityHashMap.entrySet().iterator();
+        Map.Entry<String, String> entry = entrySetIterator.next();
+
+        entrySetIterator.remove();
+
+        try {
+            entry.getKey();
+            throw new RuntimeException("Test FAILED: Entry not invalidated by removal.");
+        } catch (Exception e) { }
+    }
+}
--- a/jdk/test/java/util/PriorityQueue/NoNulls.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/PriorityQueue/NoNulls.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Martin Buchholz with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/Random/DistinctSeeds.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/Random/DistinctSeeds.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/ResourceBundle/Bug4168625Test.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/ResourceBundle/Bug4168625Test.java	Thu Apr 21 16:42:06 2011 -0700
@@ -282,7 +282,7 @@
         thread1.start();            //start thread 1
         loader.waitForNotify(1);    //wait for thread1 to do getBundle & block in loader
         thread2.start();            //start second thread
-        thread2.join(1000);         //wait until thread2 blocks somewhere in getBundle
+        thread2.join();             //wait until thread2 terminates.
 
             //Thread1 should be blocked inside getBundle at the class loader
             //Thread2 should have completed its getBundle call and terminated
@@ -292,7 +292,6 @@
 
         thread1.ping();             //continue thread1
         thread1.join();
-        thread2.join();
     }
 
     /**
@@ -318,8 +317,7 @@
         loader.waitForNotify(3);    //wait for thread1 to do getBundle(en) & block in loader
         causeResourceBundleCacheFlush();    //cause a cache flush
         thread1.ping();             //kick thread 1
-        thread1.ping();             //kick thread 1
-        thread1.join(1000);         //wait until thread2 blocks somewhere in getBundle
+        thread1.join();             //wait until thread1 terminates
 
         ResourceBundle bundle = (ResourceBundle)thread1.bundle;
         String s1 = bundle.getString("Bug4168625Resource3_en_US");
--- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/DistinctEntrySetElements.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Sets from Map.entrySet() return distinct objects for each Entry
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class DistinctEntrySetElements {
+    public static void main(String[] args) throws Exception {
+        final ConcurrentHashMap<String, String> concurrentHashMap =
+            new ConcurrentHashMap<>();
+
+        concurrentHashMap.put("One", "Un");
+        concurrentHashMap.put("Two", "Deux");
+        concurrentHashMap.put("Three", "Trois");
+
+        Set<Map.Entry<String, String>> entrySet = concurrentHashMap.entrySet();
+        HashSet<Map.Entry<String, String>> hashSet = new HashSet<>(entrySet);
+
+        if (false == hashSet.equals(entrySet)) {
+            throw new RuntimeException("Test FAILED: Sets are not equal.");
+        }
+        if (hashSet.hashCode() != entrySet.hashCode()) {
+            throw new RuntimeException("Test FAILED: Set's hashcodes are not equal.");
+        }
+    }
+}
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /*
  * @test
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 import java.util.*;
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/Phaser/Arrive.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/Arrive.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/Basic.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/Basic.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/FickleRegister.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/FickleRegister.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java	Thu Apr 21 16:42:06 2011 -0700
@@ -29,7 +29,7 @@
  * Written by Martin Buchholz and Doug Lea with assistance from
  * members of JCP JSR-166 Expert Group and released to the public
  * domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Semaphore/RacingReleases.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/Semaphore/RacingReleases.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/forkjoin/Integrate.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/forkjoin/Integrate.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/forkjoin/NQueensCS.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/forkjoin/NQueensCS.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 import java.util.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 7031076
+ * @summary Allow stale InputStreams from ZipFiles to be GC'd
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+public class ClearStaleZipFileInputStreams {
+    private static final int ZIP_ENTRY_NUM = 5;
+
+    private static final byte[][] data;
+
+    static {
+        data = new byte[ZIP_ENTRY_NUM][];
+        Random r = new Random();
+        for (int i = 0; i < ZIP_ENTRY_NUM; i++) {
+            data[i] = new byte[1000];
+            r.nextBytes(data[i]);
+        }
+    }
+
+    private static File createTestFile(int compression) throws Exception {
+        File tempZipFile =
+            File.createTempFile("test-data" + compression, ".zip");
+        tempZipFile.deleteOnExit();
+
+        ZipOutputStream zos =
+            new ZipOutputStream(new FileOutputStream(tempZipFile));
+        zos.setLevel(compression);
+
+        try {
+            for (int i = 0; i < ZIP_ENTRY_NUM; i++) {
+                String text = "Entry" + i;
+                ZipEntry entry = new ZipEntry(text);
+                zos.putNextEntry(entry);
+                try {
+                    zos.write(data[i], 0, data[i].length);
+                } finally {
+                    zos.closeEntry();
+                }
+            }
+        } finally {
+            zos.close();
+        }
+
+        return tempZipFile;
+    }
+
+    private static void startGcInducingThread(final int sleepMillis) {
+        final Thread gcInducingThread = new Thread() {
+            public void run() {
+                while (true) {
+                    System.gc();
+                    try {
+                        Thread.sleep(sleepMillis);
+                    } catch (InterruptedException e) { }
+                }
+            }
+        };
+
+        gcInducingThread.setDaemon(true);
+        gcInducingThread.start();
+    }
+
+    public static void main(String[] args) throws Exception {
+        startGcInducingThread(500);
+        runTest(ZipOutputStream.DEFLATED);
+        runTest(ZipOutputStream.STORED);
+    }
+
+    private static void runTest(int compression) throws Exception {
+        ReferenceQueue<InputStream> rq = new ReferenceQueue<>();
+
+        System.out.println("Testing with a zip file with compression level = "
+                + compression);
+        File f = createTestFile(compression);
+        try {
+            ZipFile zf = new ZipFile(f);
+            try {
+                Set<Object> refSet = createTransientInputStreams(zf, rq);
+
+                System.out.println("Waiting for 'stale' input streams from ZipFile to be GC'd ...");
+                System.out.println("(The test will hang on failure)");
+                while (false == refSet.isEmpty()) {
+                    refSet.remove(rq.remove());
+                }
+                System.out.println("Test PASSED.");
+                System.out.println();
+            } finally {
+                zf.close();
+            }
+        } finally {
+            f.delete();
+        }
+    }
+
+    private static Set<Object> createTransientInputStreams(ZipFile zf,
+            ReferenceQueue<InputStream> rq) throws Exception {
+        Enumeration<? extends ZipEntry> zfe = zf.entries();
+        Set<Object> refSet = new HashSet<>();
+
+        while (zfe.hasMoreElements()) {
+            InputStream is = zf.getInputStream(zfe.nextElement());
+            refSet.add(new WeakReference<InputStream>(is, rq));
+        }
+
+        return refSet;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/Cipher/GCMAPI.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,138 @@
+/*
+ * 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 7031343
+ * @summary Provide API changes to support GCM AEAD ciphers
+ * @author Brad Wetmore
+ */
+
+import javax.crypto.*;
+import javax.crypto.spec.*;
+import java.nio.ByteBuffer;
+
+/*
+ * At this point in time, we can't really do any testing since only the API
+ * is available, the underlying implementation doesn't exist yet.  Test
+ * what we can...
+ */
+public class GCMAPI {
+
+    // 16 elements
+    private static byte[] bytes = new byte[] {
+        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
+
+    private static int failed = 0;
+    private static Cipher c;
+
+    public static void main(String[] args) throws Exception {
+        c = Cipher.getInstance("AES");
+        c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(new byte[16], "AES"));
+
+        updateAADFail((byte[]) null);
+        updateAADPass(bytes);
+
+        updateAADFail(null, 2, 4);
+        updateAADFail(bytes, -2, 4);
+        updateAADFail(bytes, 2, -4);
+        updateAADFail(bytes, 2, 15);  // one too many
+
+        updateAADPass(bytes, 2, 14);  // ok.
+        updateAADPass(bytes, 4, 4);
+        updateAADPass(bytes, 0, 0);
+
+        ByteBuffer bb = ByteBuffer.wrap(bytes);
+
+        updateAADFail((ByteBuffer) null);
+        updateAADPass(bb);
+
+        if (failed != 0) {
+            throw new Exception("Test(s) failed");
+        }
+    }
+
+    private static void updateAADPass(byte[] src) {
+        try {
+            c.updateAAD(src);
+        } catch (UnsupportedOperationException e) {
+            // swallow
+        }catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void updateAADFail(byte[] src) {
+        try {
+            c.updateAAD(src);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+
+    private static void updateAADPass(byte[] src, int offset, int len) {
+        try {
+            c.updateAAD(src, offset, len);
+        } catch (UnsupportedOperationException e) {
+            // swallow
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void updateAADFail(byte[] src, int offset, int len) {
+        try {
+            c.updateAAD(src, offset, len);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+
+    private static void updateAADPass(ByteBuffer src) {
+        try {
+            c.updateAAD(src);
+        } catch (UnsupportedOperationException e) {
+            // swallow
+        }catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void updateAADFail(ByteBuffer src) {
+        try {
+            c.updateAAD(src);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/spec/GCMParameterSpec/GCMParameterSpecTest.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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 7031343
+ * @summary Provide API changes to support GCM AEAD ciphers
+ * @author Brad Wetmore
+ */
+
+import javax.crypto.AEADBadTagException;
+import javax.crypto.spec.GCMParameterSpec;
+import java.util.Arrays;
+
+public class GCMParameterSpecTest {
+
+    // 16 elements
+    private static byte[] bytes = new byte[] {
+        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
+
+    private static int failed = 0;
+
+    public static void main(String[] args) throws Exception {
+        newGCMParameterSpecFail(-1, bytes);
+        newGCMParameterSpecFail(128, null);
+        newGCMParameterSpecPass(128, bytes);
+
+        newGCMParameterSpecFail(-1, bytes, 2, 4);
+        newGCMParameterSpecFail(128, null, 2, 4);
+        newGCMParameterSpecFail(128, bytes, -2, 4);
+        newGCMParameterSpecFail(128, bytes, 2, -4);
+        newGCMParameterSpecFail(128, bytes, 2, 15);  // one too many
+
+        newGCMParameterSpecPass(128, bytes, 2, 14);  // ok.
+        newGCMParameterSpecPass(96, bytes, 4, 4);
+        newGCMParameterSpecPass(96, bytes, 0, 0);
+
+        // Might as well check the Exception constructors.
+        try {
+            new AEADBadTagException();
+            new AEADBadTagException("Bad Tag Seen");
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+
+        if (failed != 0) {
+            throw new Exception("Test(s) failed");
+        }
+    }
+
+    private static void newGCMParameterSpecPass(
+            int tLen, byte[] src) {
+        try {
+            GCMParameterSpec gcmps = new GCMParameterSpec(tLen, src);
+            if (gcmps.getTLen() != tLen) {
+                throw new Exception("tLen's not equal");
+            }
+            if (!Arrays.equals(gcmps.getIV(), src)) {
+                throw new Exception("IV's not equal");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void newGCMParameterSpecFail(
+            int tLen, byte[] src) {
+        try {
+            new GCMParameterSpec(tLen, src);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+
+    private static void newGCMParameterSpecPass(
+            int tLen, byte[] src, int offset, int len) {
+        try {
+            GCMParameterSpec gcmps =
+                new GCMParameterSpec(tLen, src, offset, len);
+            if (gcmps.getTLen() != tLen) {
+                throw new Exception("tLen's not equal");
+            }
+            if (!Arrays.equals(gcmps.getIV(),
+                    Arrays.copyOfRange(src, offset, offset + len))) {
+                System.out.println(offset + " " + len);
+                System.out.println(Arrays.copyOfRange(src, offset, len)[0]);
+                throw new Exception("IV's not equal");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void newGCMParameterSpecFail(
+            int tLen, byte[] src, int offset, int len) {
+        try {
+            new GCMParameterSpec(tLen, src, offset, len);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sample/chatserver/ChatTest.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,399 @@
+/*
+ * 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
+ * @summary Test chat server chatserver test
+ *
+ * @library ../../../src/share/sample/nio/chatserver
+ * @build ChatTest ChatServer Client ClientReader DataReader MessageReader NameReader
+ * @run main ChatTest
+ */
+
+import java.io.*;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+
+public class ChatTest {
+    public static int listeningPort = 0;
+
+    public static void main(String[] args) throws Throwable {
+        testStartStop();
+        testPortOpen();
+        testAsksForName();
+        testUseName();
+        testConnectDisconnectConnect();
+        testUsernameAndMessage();
+        testDontReceiveMessageInNameState();
+    }
+
+    private static ChatServer startServer() throws IOException {
+        ChatServer server = new ChatServer(0);
+        InetSocketAddress address = (InetSocketAddress) server.getSocketAddress();
+        listeningPort = address.getPort();
+        server.run();
+        return server;
+    }
+
+    public static void testStartStop() throws Exception {
+        ChatServer server = startServer();
+        server.shutdown();
+    }
+
+    public static void testPortOpen() throws Exception {
+        ChatServer server = startServer();
+        try {
+            Socket socket = new Socket("localhost", listeningPort);
+            if (!socket.isConnected()) {
+                throw new RuntimeException("Failed to connect to server: port not open");
+            }
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testAsksForName() throws Exception {
+        ChatServer server = startServer();
+        try {
+            Socket socket = new Socket("localhost", listeningPort);
+
+            Reader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            String string = readAvailableString(reader);
+            if (!string.equals("Name: ")) {
+                throw new RuntimeException("Server doesn't send Name: ");
+            }
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testUseName() throws Throwable {
+        ChatServer server = startServer();
+        try {
+            performTestUseName();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testConnectDisconnectConnect() throws Exception {
+        ChatServer server = startServer();
+        try {
+            performTestConnectDisconnectConnect();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testUsernameAndMessage() throws Exception {
+        ChatServer server = startServer();
+        try {
+            performTestUsernameAndMessage();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testDontReceiveMessageInNameState() throws Exception {
+        ChatServer server = startServer();
+        try {
+            performDontReceiveMessageInNameState();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    private static void assertEqual(List<Exception> exception, Object value, Object expected) {
+        if (expected == value) {
+            return;
+        }
+        if (expected == null) {
+            exception.add(new RuntimeException("Expected null, but was: " + value));
+            return;
+        }
+        if (!expected.equals(value)) {
+            exception.add(new RuntimeException("Expected: " + expected + " but was: " + value));
+            return;
+        }
+    }
+
+    private static void performDontReceiveMessageInNameState() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                writer.write("Ignore this!\n");
+                barrier2.await();
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                barrier1.await();
+                barrier2.await();
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                string = readAvailableString(reader, true);
+                assertEqual(exceptions, string, null);
+                writer.write("testClient2\n");
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+
+    }
+
+    private static void waitForJoin(BufferedReader reader, String s) throws IOException {
+        String joined;
+        do {
+            joined = readAvailableString(reader);
+        } while (!(joined != null && joined.contains("Welcome " + s)));
+    }
+
+    private static void performTestUsernameAndMessage() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                barrier2.await();
+                string = readAvailableString(reader);
+                assertEqual(exceptions, string, "testClient2: Hello world!\n");
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                barrier1.await();
+                writer.write("testClient2\nHello world!\n");
+                barrier2.await();
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
+    private static void performTestConnectDisconnectConnect() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = new ArrayList<Exception>();
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                writer.write("testClient1\n");
+            }
+        };
+
+        ChatConnection chatConnection2 = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                readAvailableString(reader);
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                writer.write("Good morning!\n");
+                barrier2.await();
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "testClient2: Hello world!\n");
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                readAvailableString(reader);
+                writer.write("testClient2\n");
+                waitForJoin(reader, "testClient2");
+                barrier1.await();
+                writer.write("Hello world!\n");
+                barrier2.await();
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "testClient1: Good morning!\n");
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        chatConnection2.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
+    private static void performTestUseName() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = new ArrayList<Exception>();
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                if (!"Name: ".equals(string)) {
+                    exceptions.add(new RuntimeException("Expected Name: "));
+                }
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                barrier2.await();
+                string = readAvailableString(reader);
+                if (!"testClient2: Hello world!\n".equals(string)) {
+                    exceptions.add(new RuntimeException("testClient2: Hello world!\n"));
+                }
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                if (!"Name: ".equals(string)) {
+                    exceptions.add(new RuntimeException("Expected Name: "));
+                }
+                writer.write("testClient2\n");
+                waitForJoin(reader, "testClient2");
+                barrier1.await();
+                writer.write("Hello world!\n");
+                barrier2.await();
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
+    private static String readAvailableString(Reader reader) throws IOException {
+        return readAvailableString(reader, false);
+    }
+
+    private static String readAvailableString(Reader reader, boolean now) throws IOException {
+        StringBuilder builder = new StringBuilder();
+        int bytes;
+        if (now && !reader.ready()) {
+            return null;
+        }
+        do {
+            char[] buf = new char[256];
+            bytes = reader.read(buf);
+            builder.append(buf, 0, bytes);
+        } while (bytes == 256);
+        return builder.toString();
+    }
+
+    private abstract static class ChatConnection implements Runnable {
+        public Exception exception;
+
+        @Override
+        public void run() {
+            try (Socket socket = new Socket("localhost", listeningPort);
+            BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            Writer writer = new FlushingWriter(new OutputStreamWriter(socket.getOutputStream()))) {
+                socket.setTcpNoDelay(true);
+
+                run(socket, reader, writer);
+            } catch (Exception e) {
+                exception = e;
+            }
+        }
+
+        public abstract void run(Socket socket, BufferedReader reader, Writer writer) throws Exception;
+    }
+
+    private static class FlushingWriter extends Writer {
+        public final Writer delegate;
+
+        private FlushingWriter(Writer delegate) {
+            this.delegate = delegate;
+        }
+
+        @Override
+        public void write(char[] cbuf, int off, int len) throws IOException {
+            delegate.write(cbuf, off, len);
+        }
+
+        @Override
+        public void flush() throws IOException {
+            delegate.flush();
+        }
+
+        @Override
+        public void close() throws IOException {
+            delegate.close();
+        }
+
+        @Override
+        public void write(String str) throws IOException {
+            super.write(str);
+            flush();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sample/mergesort/MergeSortTest.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,102 @@
+/*
+ * 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
+ * @summary Test MergeSort
+ *
+ * @library ../../../src/share/sample/forkjoin/mergesort
+ * @build MergeSortTest MergeDemo MergeSort
+ * @run main MergeSortTest
+ */
+
+import java.util.Arrays;
+import java.util.Random;
+
+public class MergeSortTest {
+    private Random random;
+    private MergeSort target;
+
+    public MergeSortTest(Random random, MergeSort target) {
+        this.random = random;
+        this.target = target;
+    }
+
+    public static void main(String[] args) {
+        MergeSortTest test = new MergeSortTest(new Random(), new MergeSort(Runtime.getRuntime().availableProcessors() * 4));
+        test.run();
+    }
+
+    private int[] generateArray(int elements) {
+        int[] array = new int[elements];
+        for (int i = 0; i < array.length; ++i) {
+            array[i] = random.nextInt(10);
+        }
+        return array;
+    }
+
+    private void run() {
+        testSort();
+        testSortSingle();
+        testSortEmpty();
+        testLong();
+    }
+
+    public void testLong() {
+        for (int i = 0; i < 1000; ++i) {
+            int elements = 1 + i * 100;
+
+            int[] array = generateArray(elements);
+            int[] copy = Arrays.copyOf(array, array.length);
+            Arrays.sort(copy);
+            target.sort(array);
+            assertEqual(copy, array);
+        }
+   }
+
+    private void testSortEmpty() {
+        int[] array = { };
+        target.sort(array);
+        assertEqual(new int[] { }, array);
+    }
+
+    private void testSortSingle() {
+        int[] array = { 1 };
+        target.sort(array);
+        assertEqual(new int[] { 1 }, array);
+    }
+
+    private void testSort() {
+        int[] array = { 7, 3, 9, 0, -6, 12, 54, 3, -6, 88, 1412};
+        target.sort(array);
+        assertEqual(new int[] { -6, -6, 0, 3, 3, 7, 9, 12, 54, 88, 1412 }, array);
+    }
+
+    private void assertEqual(int[] expected, int[] array) {
+        if (!Arrays.equals(expected, array)) {
+            throw new RuntimeException("Invalid sorted array!");
+        }
+    }
+
+
+}
--- a/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	Thu Apr 21 16:42:06 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 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
@@ -26,16 +26,16 @@
 
 # @test
 # @bug 4763315
-# @build CanonicalName Lookup 
+# @build CanonicalName Lookup
 # @run shell/timeout=120 cname.sh
 # @summary Test DNS provider's handling of CNAME records
 
 
 # The host that we try to resolve
 
-HOST=webcache.sfbay.sun.com
+HOST=www-proxy.us.oracle.com
 
-# fail gracefully if DNS is not configured or there 
+# fail gracefully if DNS is not configured or there
 # isn't a CNAME record.
 
 CLASSPATH=${TESTCLASSES}
@@ -43,7 +43,7 @@
 JAVA="${TESTJAVA}/bin/java"
 
 sh -xc "$JAVA CanonicalName $HOST" 2>&1
-if [ $? != 0 ]; then 
+if [ $? != 0 ]; then
     echo "DNS not configured or host doesn't resolve to CNAME record"
     exit 0
 fi
@@ -70,7 +70,7 @@
 go "$np $sm" "$HOST"
 
 
-# 
+#
 # Results
 #
 echo ''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/KrbCredSubKey.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,352 @@
+/*
+ * 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 7030180
+ * @run main/othervm KrbCredSubKey
+ * @summary AES 128/256 decrypt exception
+ */
+
+import java.io.FileOutputStream;
+import java.security.PrivilegedExceptionAction;
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSManager;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+import sun.security.krb5.EncryptedData;
+
+public class KrbCredSubKey {
+
+    public static void main(String[] args) throws Exception {
+
+        // We don't care about clock difference
+        new FileOutputStream("krb5.conf").write(
+                "[libdefaults]\nclockskew=999999999".getBytes());
+        System.setProperty("java.security.krb5.conf", "krb5.conf");
+        Config.refresh();
+
+        Subject subj = new Subject();
+        KerberosPrincipal kp = new KerberosPrincipal(princ);
+        KerberosKey kk = new KerberosKey(
+                kp, key, EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, 0);
+        subj.getPrincipals().add(kp);
+        subj.getPrivateCredentials().add(kk);
+
+        Subject.doAs(subj, new PrivilegedExceptionAction() {
+            public Object run() throws Exception {
+                GSSManager man = GSSManager.getInstance();
+                GSSContext ctxt = man.createContext(man.createCredential(
+                        null, GSSCredential.INDEFINITE_LIFETIME,
+                        GSSUtil.GSS_KRB5_MECH_OID, GSSCredential.ACCEPT_ONLY));
+                return ctxt.acceptSecContext(token, 0, token.length);
+            }
+        });
+    }
+
+    // All following data generated by myself on a test machine
+
+    private static String princ = "server/host.rabbit.hole@RABBIT.HOLE";
+
+    // A aes-128 key for princ
+    private static byte[] key = {
+            (byte)0x83, (byte)0xA1, (byte)0xD6, (byte)0xE2,
+            (byte)0xC7, (byte)0x76, (byte)0xD5, (byte)0x24,
+            (byte)0x63, (byte)0x9F, (byte)0xF9, (byte)0xFF,
+            (byte)0x76, (byte)0x6D, (byte)0x26, (byte)0x30,
+    };
+
+    // A JGSS token generated by the first call of an initiator's
+    // initSecContext, targetting princ, using the authenticator
+    // subkey to encrypt the KRB_CRED inside AP_REQ
+    private static byte[] token = {
+            (byte)0x60, (byte)0x82, (byte)0x04, (byte)0x1C,
+            (byte)0x06, (byte)0x09, (byte)0x2A, (byte)0x86,
+            (byte)0x48, (byte)0x86, (byte)0xF7, (byte)0x12,
+            (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x01,
+            (byte)0x00, (byte)0x6E, (byte)0x82, (byte)0x04,
+            (byte)0x0B, (byte)0x30, (byte)0x82, (byte)0x04,
+            (byte)0x07, (byte)0xA0, (byte)0x03, (byte)0x02,
+            (byte)0x01, (byte)0x05, (byte)0xA1, (byte)0x03,
+            (byte)0x02, (byte)0x01, (byte)0x0E, (byte)0xA2,
+            (byte)0x07, (byte)0x03, (byte)0x05, (byte)0x00,
+            (byte)0x20, (byte)0x00, (byte)0x00, (byte)0x00,
+            (byte)0xA3, (byte)0x82, (byte)0x01, (byte)0x04,
+            (byte)0x61, (byte)0x82, (byte)0x01, (byte)0x00,
+            (byte)0x30, (byte)0x81, (byte)0xFD, (byte)0xA0,
+            (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x05,
+            (byte)0xA1, (byte)0x0D, (byte)0x1B, (byte)0x0B,
+            (byte)0x52, (byte)0x41, (byte)0x42, (byte)0x42,
+            (byte)0x49, (byte)0x54, (byte)0x2E, (byte)0x48,
+            (byte)0x4F, (byte)0x4C, (byte)0x45, (byte)0xA2,
+            (byte)0x25, (byte)0x30, (byte)0x23, (byte)0xA0,
+            (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x00,
+            (byte)0xA1, (byte)0x1C, (byte)0x30, (byte)0x1A,
+            (byte)0x1B, (byte)0x06, (byte)0x73, (byte)0x65,
+            (byte)0x72, (byte)0x76, (byte)0x65, (byte)0x72,
+            (byte)0x1B, (byte)0x10, (byte)0x68, (byte)0x6F,
+            (byte)0x73, (byte)0x74, (byte)0x2E, (byte)0x72,
+            (byte)0x61, (byte)0x62, (byte)0x62, (byte)0x69,
+            (byte)0x74, (byte)0x2E, (byte)0x68, (byte)0x6F,
+            (byte)0x6C, (byte)0x65, (byte)0xA3, (byte)0x81,
+            (byte)0xBF, (byte)0x30, (byte)0x81, (byte)0xBC,
+            (byte)0xA0, (byte)0x03, (byte)0x02, (byte)0x01,
+            (byte)0x11, (byte)0xA2, (byte)0x81, (byte)0xB4,
+            (byte)0x04, (byte)0x81, (byte)0xB1, (byte)0xA7,
+            (byte)0xE8, (byte)0x58, (byte)0xBA, (byte)0x98,
+            (byte)0x69, (byte)0x45, (byte)0xB3, (byte)0x68,
+            (byte)0xBF, (byte)0xFD, (byte)0x25, (byte)0x74,
+            (byte)0xC4, (byte)0x2E, (byte)0x09, (byte)0x7B,
+            (byte)0x3C, (byte)0x7F, (byte)0xA5, (byte)0x6C,
+            (byte)0xC3, (byte)0x86, (byte)0xC9, (byte)0xEE,
+            (byte)0x58, (byte)0xD3, (byte)0x7C, (byte)0xD6,
+            (byte)0x19, (byte)0xA1, (byte)0x3B, (byte)0xF7,
+            (byte)0x17, (byte)0xD6, (byte)0x18, (byte)0xA9,
+            (byte)0x58, (byte)0x43, (byte)0x55, (byte)0xD6,
+            (byte)0xBA, (byte)0x85, (byte)0xF7, (byte)0x6B,
+            (byte)0x20, (byte)0x01, (byte)0xEF, (byte)0xB4,
+            (byte)0x74, (byte)0x0B, (byte)0x31, (byte)0x07,
+            (byte)0x55, (byte)0xD8, (byte)0x8C, (byte)0x85,
+            (byte)0x25, (byte)0x12, (byte)0x66, (byte)0x85,
+            (byte)0xA8, (byte)0x5A, (byte)0x84, (byte)0xB2,
+            (byte)0x6C, (byte)0xDE, (byte)0xEE, (byte)0xF9,
+            (byte)0x15, (byte)0xF2, (byte)0xBC, (byte)0xB0,
+            (byte)0x43, (byte)0xA5, (byte)0x21, (byte)0x31,
+            (byte)0xFA, (byte)0x2F, (byte)0x2C, (byte)0x37,
+            (byte)0x39, (byte)0xD8, (byte)0xAA, (byte)0xE0,
+            (byte)0x78, (byte)0x08, (byte)0x18, (byte)0xFB,
+            (byte)0x03, (byte)0x43, (byte)0x22, (byte)0xE6,
+            (byte)0x2C, (byte)0xF2, (byte)0x98, (byte)0xDC,
+            (byte)0x2A, (byte)0xDE, (byte)0x8C, (byte)0x95,
+            (byte)0x0B, (byte)0xB6, (byte)0xE6, (byte)0x0F,
+            (byte)0xB5, (byte)0x4E, (byte)0xAD, (byte)0xAC,
+            (byte)0xD1, (byte)0x4C, (byte)0xE8, (byte)0x22,
+            (byte)0x93, (byte)0x38, (byte)0xA2, (byte)0x44,
+            (byte)0x0E, (byte)0x83, (byte)0x9E, (byte)0x4D,
+            (byte)0xC0, (byte)0x1A, (byte)0x02, (byte)0xB2,
+            (byte)0xB8, (byte)0xCE, (byte)0xDF, (byte)0xB5,
+            (byte)0xFB, (byte)0xF2, (byte)0x75, (byte)0x5E,
+            (byte)0x74, (byte)0xC1, (byte)0x90, (byte)0x82,
+            (byte)0x60, (byte)0x00, (byte)0xA5, (byte)0xC3,
+            (byte)0xBF, (byte)0x66, (byte)0x97, (byte)0x0E,
+            (byte)0xF3, (byte)0x9F, (byte)0xB3, (byte)0xD9,
+            (byte)0x51, (byte)0x51, (byte)0x38, (byte)0xBC,
+            (byte)0xD9, (byte)0xC1, (byte)0xD0, (byte)0x1E,
+            (byte)0x90, (byte)0x9B, (byte)0x43, (byte)0xEE,
+            (byte)0xD9, (byte)0xD6, (byte)0x3E, (byte)0x31,
+            (byte)0xEA, (byte)0x8E, (byte)0xB1, (byte)0xDC,
+            (byte)0xDE, (byte)0xFD, (byte)0xA4, (byte)0x77,
+            (byte)0x6C, (byte)0x4A, (byte)0x81, (byte)0x1F,
+            (byte)0xA4, (byte)0x82, (byte)0x02, (byte)0xE8,
+            (byte)0x30, (byte)0x82, (byte)0x02, (byte)0xE4,
+            (byte)0xA0, (byte)0x03, (byte)0x02, (byte)0x01,
+            (byte)0x11, (byte)0xA2, (byte)0x82, (byte)0x02,
+            (byte)0xDB, (byte)0x04, (byte)0x82, (byte)0x02,
+            (byte)0xD7, (byte)0x81, (byte)0x78, (byte)0x25,
+            (byte)0x75, (byte)0x92, (byte)0x7A, (byte)0xEC,
+            (byte)0xBE, (byte)0x31, (byte)0xF1, (byte)0x50,
+            (byte)0xE7, (byte)0xC1, (byte)0x32, (byte)0xA5,
+            (byte)0xCB, (byte)0x34, (byte)0x46, (byte)0x95,
+            (byte)0x2B, (byte)0x84, (byte)0xB7, (byte)0x06,
+            (byte)0x0E, (byte)0x15, (byte)0x02, (byte)0x74,
+            (byte)0xCA, (byte)0x18, (byte)0x5D, (byte)0xE8,
+            (byte)0x0E, (byte)0x1B, (byte)0xB7, (byte)0x77,
+            (byte)0x5A, (byte)0x6C, (byte)0xFB, (byte)0x94,
+            (byte)0x82, (byte)0x2B, (byte)0xE6, (byte)0x14,
+            (byte)0x0C, (byte)0xDA, (byte)0x22, (byte)0xA2,
+            (byte)0x42, (byte)0xD7, (byte)0xB0, (byte)0xFC,
+            (byte)0xCA, (byte)0x4A, (byte)0xEA, (byte)0xB8,
+            (byte)0x92, (byte)0xB5, (byte)0x8C, (byte)0x71,
+            (byte)0xED, (byte)0x2B, (byte)0x46, (byte)0xC5,
+            (byte)0xE5, (byte)0x47, (byte)0x76, (byte)0x29,
+            (byte)0x27, (byte)0x0F, (byte)0xFF, (byte)0x03,
+            (byte)0x72, (byte)0x13, (byte)0xAA, (byte)0xDB,
+            (byte)0x4E, (byte)0xFF, (byte)0x48, (byte)0x36,
+            (byte)0xAB, (byte)0x73, (byte)0xD7, (byte)0xDA,
+            (byte)0xF1, (byte)0x80, (byte)0x1B, (byte)0x5B,
+            (byte)0x9A, (byte)0x88, (byte)0x07, (byte)0x47,
+            (byte)0x43, (byte)0x27, (byte)0xD5, (byte)0x00,
+            (byte)0x04, (byte)0xEE, (byte)0xAF, (byte)0x53,
+            (byte)0x5C, (byte)0xCC, (byte)0x2C, (byte)0xC7,
+            (byte)0x2F, (byte)0x94, (byte)0x12, (byte)0x86,
+            (byte)0xEF, (byte)0xAC, (byte)0xB1, (byte)0x6C,
+            (byte)0xB0, (byte)0xB5, (byte)0x3D, (byte)0x92,
+            (byte)0xBD, (byte)0xBE, (byte)0x7B, (byte)0x1A,
+            (byte)0x39, (byte)0x4A, (byte)0x1E, (byte)0x91,
+            (byte)0xA4, (byte)0xDF, (byte)0x82, (byte)0x12,
+            (byte)0x2E, (byte)0x67, (byte)0x17, (byte)0x92,
+            (byte)0xB3, (byte)0x93, (byte)0x38, (byte)0x32,
+            (byte)0x94, (byte)0xF5, (byte)0xF7, (byte)0x09,
+            (byte)0x07, (byte)0x5E, (byte)0x21, (byte)0x12,
+            (byte)0x70, (byte)0x37, (byte)0xAF, (byte)0x5A,
+            (byte)0x2D, (byte)0xAC, (byte)0xFF, (byte)0x22,
+            (byte)0x46, (byte)0xA0, (byte)0x12, (byte)0x74,
+            (byte)0x1C, (byte)0xA1, (byte)0x68, (byte)0xC3,
+            (byte)0x64, (byte)0xDB, (byte)0xC3, (byte)0x9F,
+            (byte)0xAB, (byte)0x0E, (byte)0x19, (byte)0xFE,
+            (byte)0xD9, (byte)0xA4, (byte)0xAA, (byte)0x7B,
+            (byte)0x73, (byte)0xAD, (byte)0xC8, (byte)0xA8,
+            (byte)0xD5, (byte)0x29, (byte)0xAD, (byte)0x1F,
+            (byte)0xEF, (byte)0x54, (byte)0xAE, (byte)0x72,
+            (byte)0x02, (byte)0xD9, (byte)0x06, (byte)0x0D,
+            (byte)0x1A, (byte)0x94, (byte)0x7B, (byte)0xBC,
+            (byte)0x32, (byte)0x9A, (byte)0xBC, (byte)0x4B,
+            (byte)0x33, (byte)0xC2, (byte)0x02, (byte)0xA3,
+            (byte)0xF4, (byte)0xB1, (byte)0xED, (byte)0x76,
+            (byte)0x0D, (byte)0x59, (byte)0xCD, (byte)0x56,
+            (byte)0xCB, (byte)0xDC, (byte)0xCE, (byte)0xED,
+            (byte)0xFF, (byte)0x25, (byte)0x84, (byte)0x5E,
+            (byte)0x41, (byte)0xF9, (byte)0x42, (byte)0xBE,
+            (byte)0x73, (byte)0xAC, (byte)0xA2, (byte)0x20,
+            (byte)0x97, (byte)0xB7, (byte)0x88, (byte)0x77,
+            (byte)0x65, (byte)0x43, (byte)0x9F, (byte)0xEE,
+            (byte)0xF4, (byte)0x3A, (byte)0x7E, (byte)0x9B,
+            (byte)0x5B, (byte)0x54, (byte)0xD3, (byte)0x0D,
+            (byte)0x50, (byte)0x6D, (byte)0xF6, (byte)0x14,
+            (byte)0xB7, (byte)0x5A, (byte)0x34, (byte)0x0F,
+            (byte)0x1F, (byte)0xC7, (byte)0x39, (byte)0x99,
+            (byte)0x9B, (byte)0x96, (byte)0xE3, (byte)0xAD,
+            (byte)0x86, (byte)0xE3, (byte)0x6A, (byte)0x71,
+            (byte)0x63, (byte)0x04, (byte)0xAD, (byte)0x9C,
+            (byte)0x17, (byte)0x68, (byte)0x44, (byte)0xFE,
+            (byte)0x21, (byte)0x62, (byte)0xD5, (byte)0x99,
+            (byte)0x4A, (byte)0xDF, (byte)0x48, (byte)0xDE,
+            (byte)0x9A, (byte)0xD4, (byte)0xBB, (byte)0xA1,
+            (byte)0x9B, (byte)0xE7, (byte)0x2A, (byte)0x08,
+            (byte)0x80, (byte)0x3A, (byte)0x08, (byte)0xA4,
+            (byte)0xBA, (byte)0xBE, (byte)0x1E, (byte)0x81,
+            (byte)0x63, (byte)0x20, (byte)0xAC, (byte)0x9C,
+            (byte)0x42, (byte)0x2F, (byte)0xCA, (byte)0x06,
+            (byte)0x95, (byte)0x92, (byte)0x97, (byte)0x09,
+            (byte)0x3C, (byte)0x0C, (byte)0x5A, (byte)0x99,
+            (byte)0xFB, (byte)0xAB, (byte)0xEB, (byte)0xDE,
+            (byte)0xC4, (byte)0x09, (byte)0xD3, (byte)0xA3,
+            (byte)0xF0, (byte)0x65, (byte)0xDC, (byte)0x5F,
+            (byte)0xAA, (byte)0xBB, (byte)0x28, (byte)0xC0,
+            (byte)0x3E, (byte)0xBF, (byte)0x77, (byte)0xAE,
+            (byte)0xCC, (byte)0x3A, (byte)0xD3, (byte)0x31,
+            (byte)0x0D, (byte)0x9B, (byte)0x96, (byte)0xEF,
+            (byte)0x2C, (byte)0xED, (byte)0x60, (byte)0x63,
+            (byte)0xC5, (byte)0x8F, (byte)0xCA, (byte)0xB0,
+            (byte)0xA2, (byte)0x0B, (byte)0x49, (byte)0x5A,
+            (byte)0xB2, (byte)0x8F, (byte)0xEF, (byte)0xE4,
+            (byte)0x19, (byte)0xC0, (byte)0xC6, (byte)0x2D,
+            (byte)0xD3, (byte)0x4F, (byte)0xB2, (byte)0xED,
+            (byte)0xA3, (byte)0xA4, (byte)0x6F, (byte)0xAE,
+            (byte)0xD4, (byte)0xE9, (byte)0xA2, (byte)0x5A,
+            (byte)0xFB, (byte)0xB0, (byte)0x14, (byte)0xBD,
+            (byte)0x06, (byte)0x12, (byte)0xD7, (byte)0x91,
+            (byte)0x15, (byte)0x46, (byte)0x78, (byte)0xE4,
+            (byte)0xD1, (byte)0x73, (byte)0xCA, (byte)0xA5,
+            (byte)0xA5, (byte)0x64, (byte)0xC8, (byte)0x6F,
+            (byte)0xD1, (byte)0xBD, (byte)0xEA, (byte)0x74,
+            (byte)0xE4, (byte)0xCA, (byte)0x40, (byte)0x16,
+            (byte)0x9E, (byte)0x46, (byte)0x7C, (byte)0x25,
+            (byte)0x6C, (byte)0x32, (byte)0xB4, (byte)0x14,
+            (byte)0xF9, (byte)0x26, (byte)0x8A, (byte)0x3A,
+            (byte)0xDD, (byte)0x51, (byte)0x26, (byte)0x79,
+            (byte)0x43, (byte)0x27, (byte)0x2E, (byte)0xED,
+            (byte)0xC7, (byte)0x82, (byte)0x7C, (byte)0xCE,
+            (byte)0x43, (byte)0x03, (byte)0x60, (byte)0x2A,
+            (byte)0x9C, (byte)0xB2, (byte)0x71, (byte)0x41,
+            (byte)0xAB, (byte)0x3D, (byte)0xA6, (byte)0xB5,
+            (byte)0x51, (byte)0xBC, (byte)0x80, (byte)0x1F,
+            (byte)0x96, (byte)0x73, (byte)0x23, (byte)0x11,
+            (byte)0xED, (byte)0xC0, (byte)0x1D, (byte)0x0B,
+            (byte)0xA0, (byte)0x13, (byte)0xB3, (byte)0x2F,
+            (byte)0x16, (byte)0x59, (byte)0x64, (byte)0x45,
+            (byte)0xE8, (byte)0x68, (byte)0xFB, (byte)0xF9,
+            (byte)0x6F, (byte)0xB0, (byte)0x2B, (byte)0xFB,
+            (byte)0x39, (byte)0xBB, (byte)0x53, (byte)0x8F,
+            (byte)0xD2, (byte)0xAF, (byte)0x38, (byte)0x5E,
+            (byte)0xEF, (byte)0x5B, (byte)0xE2, (byte)0x98,
+            (byte)0xE8, (byte)0x46, (byte)0x3C, (byte)0x03,
+            (byte)0x71, (byte)0x46, (byte)0x8D, (byte)0x41,
+            (byte)0x92, (byte)0x32, (byte)0x85, (byte)0x8D,
+            (byte)0xBA, (byte)0x33, (byte)0x05, (byte)0xB1,
+            (byte)0xE4, (byte)0x56, (byte)0x3E, (byte)0xF5,
+            (byte)0x20, (byte)0x35, (byte)0xA6, (byte)0x74,
+            (byte)0xA2, (byte)0xBE, (byte)0x54, (byte)0x08,
+            (byte)0xB4, (byte)0xFC, (byte)0x1D, (byte)0x13,
+            (byte)0x84, (byte)0xBE, (byte)0x1C, (byte)0xC5,
+            (byte)0x3E, (byte)0x43, (byte)0x14, (byte)0x6F,
+            (byte)0xC0, (byte)0x3D, (byte)0xF4, (byte)0xDC,
+            (byte)0x66, (byte)0x4E, (byte)0xF0, (byte)0x3E,
+            (byte)0xD4, (byte)0xC6, (byte)0xE9, (byte)0x8D,
+            (byte)0x7D, (byte)0xB9, (byte)0xDC, (byte)0x9F,
+            (byte)0xBE, (byte)0x54, (byte)0x63, (byte)0x93,
+            (byte)0x49, (byte)0x2F, (byte)0x6A, (byte)0xC3,
+            (byte)0x34, (byte)0xC5, (byte)0xF7, (byte)0x76,
+            (byte)0xE8, (byte)0xD5, (byte)0x5B, (byte)0xD9,
+            (byte)0x41, (byte)0xCA, (byte)0x74, (byte)0x25,
+            (byte)0x25, (byte)0x09, (byte)0xF4, (byte)0xD3,
+            (byte)0x00, (byte)0x9F, (byte)0x7D, (byte)0xFB,
+            (byte)0x3D, (byte)0xAB, (byte)0x87, (byte)0xF7,
+            (byte)0xCE, (byte)0x42, (byte)0x0F, (byte)0x60,
+            (byte)0xEB, (byte)0x03, (byte)0x47, (byte)0x98,
+            (byte)0x0F, (byte)0xEB, (byte)0xA4, (byte)0x05,
+            (byte)0xE2, (byte)0x58, (byte)0x8F, (byte)0x44,
+            (byte)0x09, (byte)0xD3, (byte)0x66, (byte)0x1E,
+            (byte)0x69, (byte)0x89, (byte)0xB7, (byte)0xEE,
+            (byte)0x8B, (byte)0xA4, (byte)0x8E, (byte)0x05,
+            (byte)0x2D, (byte)0x2E, (byte)0xB3, (byte)0x5A,
+            (byte)0xAE, (byte)0xAB, (byte)0x80, (byte)0xD6,
+            (byte)0x5C, (byte)0x93, (byte)0x40, (byte)0x91,
+            (byte)0x53, (byte)0xE6, (byte)0x13, (byte)0xD5,
+            (byte)0x2F, (byte)0x64, (byte)0xF0, (byte)0x68,
+            (byte)0xD2, (byte)0x85, (byte)0x94, (byte)0xE5,
+            (byte)0x2D, (byte)0x73, (byte)0x10, (byte)0x59,
+            (byte)0x18, (byte)0xCD, (byte)0xED, (byte)0xBC,
+            (byte)0x05, (byte)0x97, (byte)0xFD, (byte)0xE7,
+            (byte)0x6F, (byte)0x5D, (byte)0x7C, (byte)0x46,
+            (byte)0x28, (byte)0x5F, (byte)0xC2, (byte)0xB4,
+            (byte)0x31, (byte)0xA5, (byte)0x2B, (byte)0x82,
+            (byte)0xAB, (byte)0x32, (byte)0x49, (byte)0xA5,
+            (byte)0xCD, (byte)0x91, (byte)0x37, (byte)0x97,
+            (byte)0xA1, (byte)0x85, (byte)0x8F, (byte)0xBB,
+            (byte)0x6E, (byte)0x1E, (byte)0x9F, (byte)0xFC,
+            (byte)0x10, (byte)0x3B, (byte)0x8A, (byte)0xF6,
+            (byte)0x9A, (byte)0x66, (byte)0xBD, (byte)0x75,
+            (byte)0x4F, (byte)0x1D, (byte)0xBA, (byte)0x64,
+            (byte)0x15, (byte)0xDD, (byte)0x9F, (byte)0x00,
+            (byte)0x6C, (byte)0x2F, (byte)0x87, (byte)0x20,
+            (byte)0x25, (byte)0xA2, (byte)0x09, (byte)0x9F,
+            (byte)0x5D, (byte)0x64, (byte)0xC9, (byte)0xA8,
+            (byte)0x32, (byte)0x59, (byte)0x90, (byte)0x1D,
+            (byte)0x78, (byte)0xFE, (byte)0x5A, (byte)0xA2,
+            (byte)0x1F, (byte)0x9B, (byte)0x22, (byte)0xBE,
+            (byte)0x8F, (byte)0xEA, (byte)0x59, (byte)0x5B,
+            (byte)0x96, (byte)0xE3, (byte)0x4A, (byte)0xB2,
+            (byte)0x71, (byte)0x65, (byte)0xB7, (byte)0x3C,
+            (byte)0xC6, (byte)0x1B, (byte)0xD6, (byte)0x80,
+            (byte)0x90, (byte)0xD2, (byte)0xF2, (byte)0x6F,
+            (byte)0xA2, (byte)0x68, (byte)0x53, (byte)0xC0,
+            (byte)0x44, (byte)0xAF, (byte)0xD4, (byte)0x68,
+            (byte)0x12, (byte)0xFF, (byte)0xB4, (byte)0x36,
+            (byte)0x34, (byte)0x43, (byte)0xAC, (byte)0x1C,
+    };
+}
--- a/jdk/test/sun/security/krb5/auto/Context.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/Context.java	Thu Apr 21 16:42:06 2011 -0700
@@ -44,6 +44,7 @@
 import com.sun.security.jgss.AuthorizationDataEntry;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import javax.security.auth.kerberos.KeyTab;
 
 /**
  * Context of a JGSS subject, encapsulating Subject and GSSContext.
@@ -107,15 +108,19 @@
         return out;
     }
 
+    public static Context fromUserPass(
+            String user, char[] pass, boolean storeKey) throws Exception {
+        return fromUserPass(null, user, pass, storeKey);
+    }
     /**
      * Logins with a username and a password, using Krb5LoginModule directly
      * @param storeKey true if key should be saved, used on acceptor side
      */
-    public static Context fromUserPass(String user, char[] pass, boolean storeKey)
-            throws Exception {
+    public static Context fromUserPass(Subject s,
+            String user, char[] pass, boolean storeKey) throws Exception {
         Context out = new Context();
         out.name = user;
-        out.s = new Subject();
+        out.s = s == null ? new Subject() : s;
         Krb5LoginModule krb5 = new Krb5LoginModule();
         Map<String, String> map = new HashMap<>();
         Map<String, Object> shared = new HashMap<>();
@@ -198,12 +203,25 @@
      * @throws java.lang.Exception
      */
     public void startAsServer(final Oid mech) throws Exception {
+        startAsServer(null, mech);
+    }
+
+    /**
+     * Starts as a server with the specified service name
+     * @param name the service name
+     * @param mech GSS mech
+     * @throws java.lang.Exception
+     */
+    public void startAsServer(final String name, final Oid mech) throws Exception {
         doAs(new Action() {
             @Override
             public byte[] run(Context me, byte[] dummy) throws Exception {
                 GSSManager m = GSSManager.getInstance();
                 me.x = (ExtendedGSSContext)m.createContext(m.createCredential(
-                        null,
+                        name == null ? null :
+                          (name.indexOf('@') < 0 ?
+                            m.createName(name, null) :
+                            m.createName(name, GSSName.NT_HOSTBASED_SERVICE)),
                         GSSCredential.INDEFINITE_LIFETIME,
                         mech,
                         GSSCredential.ACCEPT_ONLY));
@@ -230,6 +248,14 @@
     }
 
     /**
+     * Accesses the internal subject.
+     * @return the subject
+     */
+    public Subject s() {
+        return s;
+    }
+
+    /**
      * Disposes the GSSContext within
      * @throws org.ietf.jgss.GSSException
      */
@@ -297,7 +323,7 @@
         } catch (Exception e) {
             ;// Don't care
         }
-        System.out.println("=====================================");
+        System.out.println("====== Private Credentials Set ======");
         for (Object o : s.getPrivateCredentials()) {
             System.out.println("    " + o.getClass());
             if (o instanceof KerberosTicket) {
@@ -315,6 +341,8 @@
                 for (Object k : map.keySet()) {
                     System.out.println("        " + k + ": " + map.get(k));
                 }
+            } else {
+                System.out.println("        " + o);
             }
         }
         if (x != null && x instanceof ExtendedGSSContext) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/DynamicKeytab.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,140 @@
+/*
+ * 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 6894072
+ * @run main/othervm DynamicKeytab
+ * @summary always refresh keytab
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import org.ietf.jgss.GSSException;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.KrbException;
+import sun.security.krb5.internal.Krb5;
+
+public class DynamicKeytab {
+
+    Context c, s;
+    public static void main(String[] args)
+            throws Exception {
+        new DynamicKeytab().go();
+    }
+
+    void go() throws Exception {
+        OneKDC k = new OneKDC(null);
+        k.writeJAASConf();
+
+        new File(OneKDC.KTAB).delete();
+
+
+        // Starts with no keytab
+        c = Context.fromJAAS("client");
+        s = Context.fromJAAS("com.sun.security.jgss.krb5.accept");
+
+        // Test 1: read new key 1 from keytab
+        k.addPrincipal(OneKDC.SERVER, "pass1".toCharArray());
+        k.writeKtab(OneKDC.KTAB);
+        connect();
+
+        // Test 2: service key cached, find 1 in keytab (now contains 1 and 2)
+        k.addPrincipal(OneKDC.SERVER, "pass2".toCharArray());
+        k.appendKtab(OneKDC.KTAB);
+        connect();
+
+        // Test 3: re-login. Now find 2 in keytab
+        c = Context.fromJAAS("client");
+        connect();
+
+        // Test 4: re-login, KDC use 3 this time.
+        c = Context.fromJAAS("client");
+        // Put 3 and 4 into keytab but keep the real key back to 3.
+        k.addPrincipal(OneKDC.SERVER, "pass3".toCharArray());
+        k.appendKtab(OneKDC.KTAB);
+        k.addPrincipal(OneKDC.SERVER, "pass4".toCharArray());
+        k.appendKtab(OneKDC.KTAB);
+        k.addPrincipal(OneKDC.SERVER, "pass3".toCharArray());
+        connect();
+
+        // Test 5: invalid keytab file, should ignore
+        new FileOutputStream(OneKDC.KTAB).write("BADBADBAD".getBytes());
+        connect();
+
+        // Test 6: delete keytab file, identical to revoke all
+        new File(OneKDC.KTAB).delete();
+        try {
+            connect();
+            throw new Exception("Should not success");
+        } catch (GSSException gsse) {
+            System.out.println(gsse);
+            KrbException ke = (KrbException)gsse.getCause();
+            // KrbApReq.authenticate(*) if (dkey == null)...
+            // This should have been Krb5.KRB_AP_ERR_NOKEY
+            if (ke.returnCode() != Krb5.API_INVALID_ARG) {
+                throw new Exception("Not expected failure code: " +
+                        ke.returnCode());
+            }
+        }
+
+        // Test 7: 3 revoked, should fail (now contains only 5)
+        k.addPrincipal(OneKDC.SERVER, "pass5".toCharArray());
+        k.writeKtab(OneKDC.KTAB);   // overwrite keytab, which means
+                                    // old key is revoked
+        try {
+            connect();
+            throw new Exception("Should not success");
+        } catch (GSSException gsse) {
+            System.out.println(gsse);
+            KrbException ke = (KrbException)gsse.getCause();
+            if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
+                throw new Exception("Not expected failure code: " +
+                        ke.returnCode());
+            }
+        }
+
+        // Test 8: an empty KDC means revoke all
+        KDC.create("EMPTY.REALM").writeKtab(OneKDC.KTAB);
+        try {
+            connect();
+            throw new Exception("Should not success");
+        } catch (GSSException gsse) {
+            System.out.println(gsse);
+            KrbException ke = (KrbException)gsse.getCause();
+            // KrbApReq.authenticate(*) if (dkey == null)...
+            // This should have been Krb5.KRB_AP_ERR_NOKEY
+            if (ke.returnCode() != Krb5.API_INVALID_ARG) {
+                throw new Exception("Not expected failure code: " +
+                        ke.returnCode());
+            }
+        }
+    }
+
+    void connect() throws Exception {
+        Thread.sleep(2000);     // make sure ktab timestamp is different
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+        Context.handshake(c, s);
+    }
+}
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Thu Apr 21 16:42:06 2011 -0700
@@ -228,7 +228,33 @@
     }
 
     /**
-     * Write all principals' keys from multiple KDCsinto one keytab file.
+     * Writes or appends KDC keys into a keytab. See doc for writeMultiKtab.
+     * @param append true if append, otherwise, overwrite.
+     */
+    private static void writeKtab0(String tab, boolean append, KDC... kdcs)
+            throws IOException, KrbException {
+        KeyTab ktab = append ? KeyTab.getInstance(tab) : KeyTab.create(tab);
+        for (KDC kdc: kdcs) {
+            for (String name : kdc.passwords.keySet()) {
+                char[] pass = kdc.passwords.get(name);
+                int kvno = 0;
+                if (Character.isDigit(pass[pass.length-1])) {
+                    kvno = pass[pass.length-1] - '0';
+                }
+                ktab.addEntry(new PrincipalName(name,
+                        name.indexOf('/') < 0 ?
+                            PrincipalName.KRB_NT_UNKNOWN :
+                            PrincipalName.KRB_NT_SRV_HST),
+                            pass,
+                            kvno,
+                            true);
+            }
+        }
+        ktab.save();
+    }
+
+    /**
+     * Writes all principals' keys from multiple KDCs into one keytab file.
      * Note that the keys for the krbtgt principals will not be written.
      * <p>
      * Attention: This method references krb5.conf settings. If you need to
@@ -252,17 +278,16 @@
      */
     public static void writeMultiKtab(String tab, KDC... kdcs)
             throws IOException, KrbException {
-        KeyTab ktab = KeyTab.create(tab);
-        for (KDC kdc: kdcs) {
-            for (String name : kdc.passwords.keySet()) {
-                ktab.addEntry(new PrincipalName(name,
-                        name.indexOf('/') < 0 ?
-                            PrincipalName.KRB_NT_UNKNOWN :
-                            PrincipalName.KRB_NT_SRV_HST),
-                            kdc.passwords.get(name), -1, true);
-            }
-        }
-        ktab.save();
+        writeKtab0(tab, false, kdcs);
+    }
+
+    /**
+     * Appends all principals' keys from multiple KDCs to one keytab file.
+     * See writeMultiKtab for details.
+     */
+    public static void appendMultiKtab(String tab, KDC... kdcs)
+            throws IOException, KrbException {
+        writeKtab0(tab, true, kdcs);
     }
 
     /**
@@ -273,6 +298,13 @@
     }
 
     /**
+     * Appends keys in this KDC to a ktab.
+     */
+    public void appendKtab(String tab) throws IOException, KrbException {
+        KDC.appendMultiKtab(tab, this);
+    }
+
+    /**
      * Adds a new principal to this realm with a given password.
      * @param user the principal's name. For a service principal, use the
      *        form of host/f.q.d.n
@@ -691,7 +723,10 @@
                     new KerberosTime(new Date()),
                     body.from,
                     till, body.rtime,
-                    body.addresses,
+                    body.addresses != null  // always set caddr
+                            ? body.addresses
+                            : new HostAddresses(
+                                new InetAddress[]{InetAddress.getLocalHost()}),
                     null);
             EncryptionKey skey = keyForUser(body.sname, e3, true);
             if (skey == null) {
@@ -716,7 +751,10 @@
                     till, body.rtime,
                     body.crealm,
                     body.sname,
-                    body.addresses
+                    body.addresses != null  // always set caddr
+                            ? body.addresses
+                            : new HostAddresses(
+                                new InetAddress[]{InetAddress.getLocalHost()})
                     );
             EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_TGS_REP_PART_SESSKEY);
             TGSRep tgsRep = new TGSRep(null,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/KeyTabCompat.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,90 @@
+/*
+ * 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 6894072
+ * @compile -XDignore.symbol.file KeyTabCompat.java
+ * @run main/othervm KeyTabCompat
+ * @summary always refresh keytab
+ */
+
+import javax.security.auth.kerberos.KerberosKey;
+import sun.security.jgss.GSSUtil;
+
+/*
+ * There are 2 compat issues to check:
+ *
+ * 1. If there is only KerberosKeys in private credential set and no
+ *    KerberosPrincipal. JAAS login should go on.
+ * 2. Even if KeyTab is used, user can still get KerberosKeys from
+ *    private credentials set.
+ */
+public class KeyTabCompat {
+
+    public static void main(String[] args)
+            throws Exception {
+        OneKDC kdc = new OneKDC("aes128-cts");
+        kdc.writeJAASConf();
+        kdc.addPrincipal(OneKDC.SERVER, "pass1".toCharArray());
+        kdc.writeKtab(OneKDC.KTAB);
+
+        Context c, s;
+
+        // Part 1
+        c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        s = Context.fromUserPass(OneKDC.USER2, OneKDC.PASS2, true);
+
+        s.s().getPrincipals().clear();
+
+        c.startAsClient(OneKDC.USER2, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+        Context.handshake(c, s);
+
+        // Part 2
+        c = Context.fromJAAS("client");
+        s = Context.fromJAAS("server");
+
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+        s.status();
+
+        if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) {
+            throw new Exception("There should be one KerberosKey");
+        }
+
+        Thread.sleep(2000);     // make sure ktab timestamp is different
+
+        kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray());
+        kdc.writeKtab(OneKDC.KTAB);
+
+        Context.handshake(c, s);
+        s.status();
+
+        if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) {
+            throw new Exception("There should be only one KerberosKey");
+        }
+
+    }
+}
--- a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java	Thu Apr 21 16:42:06 2011 -0700
@@ -28,7 +28,6 @@
  * @summary Krb5LoginModule a little too restrictive, and the doc is not clear.
  */
 import com.sun.security.auth.module.Krb5LoginModule;
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import javax.security.auth.Subject;
@@ -36,7 +35,6 @@
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
 
 public class LoginModuleOptions {
 
@@ -61,10 +59,12 @@
         // 1. ccache -> keytab
         login(null, "useTicketCache", "true", "ticketCache", "krbcc_non_exists",
                 "useKeyTab", "true", "principal", "dummy");
+
         // 2. keytab -> shared
         login(null, "useKeyTab", "true", "principal", "dummy",
                 "keyTab", "ktab_non_exist",
                 "tryFirstPass", "true", NAME, OneKDC.USER, PWD, OneKDC.PASS);
+
         // 3. shared -> callback
         // 3.1. useFirstPass, no callback
         boolean failed = false;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/NoAddresses.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,81 @@
+/*
+ * 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 7032354
+ * @run main/othervm NoAddresses 1
+ * @run main/othervm NoAddresses 2
+ * @run main/othervm/fail NoAddresses 3
+ * @summary no-addresses should not be used on acceptor side
+ */
+
+import java.net.InetAddress;
+import org.ietf.jgss.ChannelBinding;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+
+public class NoAddresses {
+
+    public static void main(String[] args)
+            throws Exception {
+
+        OneKDC kdc = new OneKDC(null);
+        kdc.writeJAASConf();
+        KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
+                "noaddresses = false",
+                "default_keytab_name = " + OneKDC.KTAB);
+        Config.refresh();
+
+        Context c = Context.fromJAAS("client");
+        Context s = Context.fromJAAS("server");
+
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+        InetAddress initiator = InetAddress.getLocalHost();
+        InetAddress acceptor = InetAddress.getLocalHost();
+        switch (args[0]) {
+            case "1":
+                // no initiator host address available, should be OK
+                break;
+            case "2":
+                // correct initiator host address, still fine
+                c.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                s.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                break;
+            case "3":
+                // incorrect initiator host address, fail
+                initiator = InetAddress.getByAddress(new byte[]{1,1,1,1});
+                c.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                s.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                break;
+        }
+
+        Context.handshake(c, s);
+    }
+}
--- a/jdk/test/sun/security/krb5/auto/SSL.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/SSL.java	Thu Apr 21 16:42:06 2011 -0700
@@ -48,7 +48,7 @@
 public class SSL {
 
     private static String krb5Cipher;
-    private static final int LOOP_LIMIT = 1;
+    private static final int LOOP_LIMIT = 3;
     private static int loopCount = 0;
     private static volatile String server;
     private static volatile int port;
@@ -98,13 +98,13 @@
         fos.close();
         f.deleteOnExit();
 
-        final Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        Context c;
         final Context s = Context.fromJAAS("ssl");
 
-        c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
+        // There's no keytab file when server starts.
         s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
 
-        new Thread(new Runnable() {
+        Thread server = new Thread(new Runnable() {
             public void run() {
                 try {
                     s.doAs(new JsseServerAction(), null);
@@ -112,12 +112,57 @@
                     e.printStackTrace();
                 }
             }
-        }).start();
+        });
+        server.setDaemon(true);
+        server.start();
 
         // Warm the server
         Thread.sleep(2000);
 
+        // Now create the keytab
+
+        /*
+        // Add 3 versions of keys into keytab
+        KeyTab ktab = KeyTab.create(OneKDC.KTAB);
+        PrincipalName service = new PrincipalName(
+                "host/" + server, PrincipalName.KRB_NT_SRV_HST);
+        ktab.addEntry(service, "pass1".toCharArray(), 1);
+        ktab.addEntry(service, "pass2".toCharArray(), 2);
+        ktab.addEntry(service, "pass3".toCharArray(), 3);
+        ktab.save();
+
+        // and use the middle one as the  real key
+        kdc.addPrincipal("host/" + server, "pass2".toCharArray());
+         */
+        c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
         c.doAs(new JsseClientAction(), null);
+
+        // Add another version of key, make sure it can be loaded
+        Thread.sleep(2000);
+        ktab = KeyTab.getInstance(OneKDC.KTAB);
+        ktab.addEntry(service, "pass4".toCharArray(), 4, true);
+        ktab.save();
+        kdc.addPrincipal("host/" + server, "pass4".toCharArray());
+
+        c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
+        c.doAs(new JsseClientAction(), null);
+
+        // Revoke the old key
+        /*Thread.sleep(2000);
+        ktab = KeyTab.create(OneKDC.KTAB);
+        ktab.addEntry(service, "pass5".toCharArray(), 5, false);
+        ktab.save();
+
+        c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
+        c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
+        try {
+            c.doAs(new JsseClientAction(), null);
+            throw new Exception("Should fail this time.");
+        } catch (SSLException e) {
+            // Correct behavior.
+        }*/
     }
 
     // Following codes copied from
@@ -126,6 +171,7 @@
         public byte[] run(Context s, byte[] input) throws Exception {
             SSLSocketFactory sslsf =
                 (SSLSocketFactory) SSLSocketFactory.getDefault();
+            System.out.println("Connecting " + server + ":" + port);
             SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(server, port);
 
             // Enable only a KRB5 cipher suite.
@@ -154,6 +200,9 @@
             System.out.println("Server is: " + peer.toString());
 
             sslSocket.close();
+            // This line should not be needed. It's the server's duty to
+            // forget the old key
+            //sslSocket.getSession().invalidate();
             return null;
         }
     }
@@ -165,6 +214,7 @@
             SSLServerSocket sslServerSocket =
                 (SSLServerSocket) sslssf.createServerSocket(0); // any port
             port = sslServerSocket.getLocalPort();
+            System.out.println("Listening on " + port);
 
             // Enable only a KRB5 cipher suite.
             String enabledSuites[] = {krb5Cipher};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/TwoPrinces.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,102 @@
+/*
+ * 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 6894072
+ * @compile -XDignore.symbol.file TwoPrinces.java
+ * @run main/othervm TwoPrinces
+ * @summary always refresh keytab
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+
+public class TwoPrinces {
+
+    public static void main(String[] args)
+            throws Exception {
+
+        KDC k1 = KDC.create("R1");
+        k1.addPrincipal("u1", "hello".toCharArray());
+        k1.addPrincipalRandKey("krbtgt/R1");
+        k1.addPrincipalRandKey("host/same.host");
+
+        KDC k2 = KDC.create("R2");
+        k2.addPrincipal("u2", "hello".toCharArray());
+        k2.addPrincipalRandKey("krbtgt/R2");
+        k2.addPrincipalRandKey("host/same.host");
+
+        System.setProperty("java.security.krb5.conf", "krb5.conf");
+
+        // R1 is the default realm now
+        KDC.saveConfig("krb5.conf", k1, k2);
+        Config.refresh();
+
+        k1.writeKtab("ktab1");
+        k2.writeKtab("ktab2");
+
+        // A JAAS config file with 2 Krb5LoginModules, after commit, the
+        // subject with have principals and keytabs from both sides
+        System.setProperty("java.security.auth.login.config", "jaas.conf");
+        File f = new File("jaas.conf");
+        FileOutputStream fos = new FileOutputStream(f);
+        fos.write((
+                "me {\n"
+                + "  com.sun.security.auth.module.Krb5LoginModule required"
+                + "    isInitiator=true principal=\"host/same.host@R1\""
+                + "    useKeyTab=true keyTab=ktab1 storeKey=true;\n"
+                + "  com.sun.security.auth.module.Krb5LoginModule required"
+                + "    isInitiator=true principal=\"host/same.host@R2\""
+                + "    useKeyTab=true keyTab=ktab2 storeKey=true;\n"
+                + "};\n"
+                ).getBytes());
+        fos.close();
+
+        /*
+         * This server side context will be able to act as services in both
+         * realms. Please note that we still don't support a single instance
+         * of server to accept connections from two realms at the same time.
+         * Therefore, we must call startAsServer in a given realm to start
+         * working there. The same Subject never changes anyway.
+         */
+        Context s = Context.fromJAAS("me");
+
+        // Default realm still R1
+        s.startAsServer("host@same.host", GSSUtil.GSS_KRB5_MECH_OID);
+        Context c1 = Context.fromUserPass("u1", "hello".toCharArray(), false);
+        c1.startAsClient("host@same.host", GSSUtil.GSS_KRB5_MECH_OID);
+        Context.handshake(c1, s);
+
+        KDC.saveConfig("krb5.conf", k2, k1);
+        Config.refresh();
+
+        // Default realm now R2
+        s.startAsServer("host@same.host", GSSUtil.GSS_KRB5_MECH_OID);
+        Context c2 = Context.fromUserPass("u2", "hello".toCharArray(), false);
+        c2.startAsClient("host@same.host", GSSUtil.GSS_KRB5_MECH_OID);
+        Context.handshake(c2, s);
+    }
+}
--- a/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java	Thu Apr 21 16:42:06 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
@@ -44,7 +44,6 @@
                 KeyTab.getInstance("ktab").getClass();
             }
         };
-        KeyTab.refresh();
         for (int i=0; i<10; i++) {
             new Thread(t).start();
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/PublicKeyInterop.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+/**
+ * @see PublicKeyInterop.sh
+ */
+
+import java.security.*;
+import java.util.*;
+import javax.crypto.*;
+
+import sun.misc.HexDumpEncoder;
+
+/*
+ * Confirm interoperability of RSA public keys between SunMSCAPI and SunJCE
+ * security providers.
+ */
+public class PublicKeyInterop {
+
+    public static void main(String[] arg) throws Exception {
+        PrivateKey privKey = null;
+        Certificate cert = null;
+        KeyStore ks = KeyStore.getInstance("Windows-MY");
+        ks.load(null, null);
+        System.out.println("Loaded keystore: Windows-MY");
+
+        PublicKey myPuKey =
+            (PublicKey) ks.getCertificate("6888925").getPublicKey();
+        System.out.println("Public key is a " + myPuKey.getClass().getName());
+        PrivateKey myPrKey = (PrivateKey) ks.getKey("6888925", null);
+        System.out.println("Private key is a " + myPrKey.getClass().getName());
+        System.out.println();
+
+        byte[] plain = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05};
+        HexDumpEncoder hde = new HexDumpEncoder();
+        System.out.println("Plaintext:\n" + hde.encode(plain) + "\n");
+
+        Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding");
+        rsa.init(Cipher.ENCRYPT_MODE, myPuKey);
+        byte[] encrypted = rsa.doFinal(plain);
+        System.out.println("Encrypted plaintext using RSA Cipher from " +
+            rsa.getProvider().getName() + " JCE provider\n");
+        System.out.println(hde.encode(encrypted) + "\n");
+
+        Cipher rsa2 = Cipher.getInstance("RSA/ECB/PKCS1Padding", "SunMSCAPI");
+        rsa2.init(Cipher.ENCRYPT_MODE, myPuKey);
+        byte[] encrypted2 = rsa2.doFinal(plain);
+        System.out.println("Encrypted plaintext using RSA Cipher from " +
+            rsa2.getProvider().getName() + " JCE provider\n");
+        System.out.println(hde.encode(encrypted2) + "\n");
+
+        Cipher rsa3 = Cipher.getInstance("RSA/ECB/PKCS1Padding", "SunMSCAPI");
+        rsa3.init(Cipher.DECRYPT_MODE, myPrKey);
+        byte[] decrypted = rsa3.doFinal(encrypted);
+        System.out.println("Decrypted first ciphertext using RSA Cipher from " +
+            rsa3.getProvider().getName() + " JCE provider\n");
+        System.out.println(hde.encode(decrypted) + "\n");
+        if (! Arrays.equals(plain, decrypted)) {
+            throw new Exception("First decrypted ciphertext does not match " +
+                "original plaintext");
+        }
+
+        decrypted = rsa3.doFinal(encrypted2);
+        System.out.println("Decrypted second ciphertext using RSA Cipher from "
+            + rsa3.getProvider().getName() + " JCE provider\n");
+        System.out.println(hde.encode(decrypted) + "\n");
+        if (! Arrays.equals(plain, decrypted)) {
+            throw new Exception("Second decrypted ciphertext does not match " +
+                "original plaintext");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/PublicKeyInterop.sh	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+#
+# 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 6888925
+# @run shell PublicKeyInterop.sh
+# @summary SunMSCAPI's Cipher can't use RSA public keys obtained from other
+#          sources.
+#
+
+# set a few environment variables so that the shell-script can run stand-alone
+# in the source directory
+if [ "${TESTSRC}" = "" ] ; then
+   TESTSRC="."
+fi
+
+if [ "${TESTCLASSES}" = "" ] ; then
+   TESTCLASSES="."
+fi
+
+if [ "${TESTJAVA}" = "" ] ; then
+   echo "TESTJAVA not set.  Test cannot execute."
+   echo "FAILED!!!"
+   exit 1
+fi
+
+OS=`uname -s`
+case "$OS" in
+    Windows* | CYGWIN* )
+
+        echo "Creating a temporary RSA keypair in the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+	    -genkeypair \
+	    -storetype Windows-My \
+	    -keyalg RSA \
+	    -alias 6888925 \
+	    -dname "cn=6888925,c=US" \
+	    -noprompt
+
+        echo
+	echo "Running the test..."
+        ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\PublicKeyInterop.java
+        ${TESTJAVA}/bin/java PublicKeyInterop
+
+        rc=$?
+
+        echo
+        echo "Removing the temporary RSA keypair from the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+	    -delete \
+	    -storetype Windows-My \
+	    -alias 6888925
+
+	echo done.
+        exit $rc
+        ;;
+
+    * )
+        echo "This test is not intended for '$OS' - passing test"
+        exit 0
+        ;;
+esac
--- a/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Thu Apr 21 16:42:06 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
@@ -22,27 +22,44 @@
  */
 /**
  * @test
- * @bug 6581254
- * @summary Allow "~" in config to support windows short path
+ * @bug 6581254 6986789
+ * @summary Allow '~' and '+' in config file
  * @author Valerie Peng
  */
 
 import java.security.*;
 import java.io.*;
+import java.lang.reflect.*;
 
 public class ConfigShortPath {
 
-    public static void main(String[] args) {
-        String testSrc = System.getProperty("test.src", ".");
-        String configFile = testSrc + File.separator + "csp.cfg";
-        System.out.println("Testing against " + configFile);
+    private static final String[] configNames = { "csp.cfg", "cspPlus.cfg" };
+
+    public static void main(String[] args) throws Exception {
+        Constructor cons = null;
         try {
-            Provider p = new sun.security.pkcs11.SunPKCS11(configFile);
-        } catch (ProviderException pe) {
-            String cause = pe.getCause().getMessage();
-            if (cause.indexOf("Unexpected token") != -1) {
-                // re-throw to indicate test failure
-                throw pe;
+            Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11");
+            cons = clazz.getConstructor(String.class);
+        } catch (Exception ex) {
+            System.out.println("Skipping test - no PKCS11 provider available");
+            return;
+        }
+        String testSrc = System.getProperty("test.src", ".");
+        for (int i = 0; i < configNames.length; i++) {
+            String configFile = testSrc + File.separator + configNames[i];
+
+            System.out.println("Testing against " + configFile);
+            try {
+                Object obj = cons.newInstance(configFile);
+            } catch (InvocationTargetException ite) {
+                Throwable cause = ite.getCause();
+                if (cause instanceof ProviderException) {
+                    String causeMsg = cause.getCause().getMessage();
+                    // Indicate failure if due to parsing config
+                    if (causeMsg.indexOf("Unexpected token") != -1) {
+                        throw (ProviderException) cause;
+                    }
+                }
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Provider/cspPlus.cfg	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,4 @@
+showInfo = false
+name = NSS
+nssSecmodDirectory = /export/local/38289.JDK7.PIT.JSN-TL+7-b112_pit_security_oel5.5-x64-32/results/ResultDir/KeytoolNSS/db
+nssLibraryDirectory = /export/local/common/testbase/7/security/tools/lib/nss/Linux2.6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,112 @@
+/*
+ * 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 6976117
+ * @summary SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets
+ *          without TLSv1.1 enabled
+ */
+
+import javax.net.ssl.*;
+
+public class SSLContextVersion {
+    static enum ContextVersion {
+        TLS_CV_01("SSL", "TLSv1", "TLSv1.2"),
+        TLS_CV_02("TLS", "TLSv1", "TLSv1.2"),
+        TLS_CV_03("SSLv3", "TLSv1", "TLSv1.2"),
+        TLS_CV_04("TLSv1", "TLSv1", "TLSv1.2"),
+        TLS_CV_05("TLSv1.1", "TLSv1.1", "TLSv1.2"),
+        TLS_CV_06("TLSv1.2", "TLSv1.2", "TLSv1.2"),
+        TLS_CV_07("Default", "TLSv1", "TLSv1.2");
+
+        final String contextVersion;
+        final String defaultProtocolVersion;
+        final String supportedProtocolVersion;
+
+        ContextVersion(String contextVersion, String defaultProtocolVersion,
+                String supportedProtocolVersion) {
+            this.contextVersion = contextVersion;
+            this.defaultProtocolVersion = defaultProtocolVersion;
+            this.supportedProtocolVersion = supportedProtocolVersion;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+            SSLContext context = SSLContext.getInstance(cv.contextVersion);
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            String[] ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No default protocols or cipher suites");
+            }
+
+            boolean isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tdefault protocol version " + protocol);
+                if (protocol.equals(cv.defaultProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched default protocol");
+            }
+
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No default protocols or cipher suites");
+            }
+
+            isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tsupported protocol version " + protocol);
+                if (protocol.equals(cv.supportedProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched default protocol");
+            }
+            System.out.println("\t... Success");
+        }
+    }
+}
--- a/jdk/test/tools/launcher/ExecutionEnvironment.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Thu Apr 21 16:42:06 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
@@ -30,7 +30,7 @@
  */
 
 /*
- * This test tests for various things as follows:
+ * This tests for various things as follows:
  * Ensures that:
  *   1. uneccessary execs do not occur
  *   2. the environment is pristine,  users environment variable wrt.
@@ -84,7 +84,9 @@
     static int errors = 0;
     static int passes = 0;
 
-    private static void createTestJar() {
+    static final String LIBJVM = TestHelper.isWindows ? "jvm.dll" : "libjvm.so";
+
+    static void createTestJar() {
         try {
             List<String> codeList = new ArrayList<String>();
             codeList.add("static void printValue(String name, boolean property) {\n");
@@ -127,6 +129,7 @@
                 testJarFile.getAbsolutePath());
 
         if (!tr.isNotZeroOutput()) {
+            System.out.println(tr);
             throw new RuntimeException("Error: No output at all. Did the test execute ?");
         }
 
@@ -177,7 +180,6 @@
 
         Map<String, String> env = new HashMap<String, String>();
 
-
         if (TestHelper.isLinux) {
             for (String x : LD_PATH_STRINGS) {
                 String pairs[] = x.split("=");
@@ -209,7 +211,7 @@
             verifyJavaLibraryPathOverride(tr, true);
 
             // try changing the model from 32 to 64 bit
-            if (TestHelper.java64Cmd != null && TestHelper.is32Bit) {
+            if (TestHelper.dualModePresent() && TestHelper.is32Bit) {
                 // verify the override occurs
                 env.clear();
                 for (String x : LD_PATH_STRINGS) {
@@ -326,7 +328,7 @@
         File symLink = null;
         String libPathPrefix = TestHelper.isSDK ? "jre/lib" : "/lib";
         symLink = new File(TestHelper.JAVAHOME, libPathPrefix +
-                TestHelper.getJreArch() + "/libjvm.so");
+                TestHelper.getJreArch() + "/" + LIBJVM);
         if (symLink.exists()) {
             System.out.println("FAIL: The symlink exists " +
                     symLink.getAbsolutePath());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/Test7029048.java	Thu Apr 21 16:42:06 2011 -0700
@@ -0,0 +1,313 @@
+/*
+ * 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 7029048
+ * @summary Checks for LD_LIBRARY_PATH on *nixes
+ * @compile -XDignore.symbol.file ExecutionEnvironment.java TestHelper.java Test7029048.java
+ * @run main Test7029048
+ */
+
+/*
+ * 7029048: test for LD_LIBRARY_PATH set to different paths pointing which may
+ * contain a libjvm.so and may not, but we test to ensure that the launcher
+ * behaves correctly in all cases.
+ */
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Test7029048 {
+
+    static int passes = 0;
+    static int errors = 0;
+
+    private static final String LIBJVM = ExecutionEnvironment.LIBJVM;
+    private static final String LD_LIBRARY_PATH =
+            ExecutionEnvironment.LD_LIBRARY_PATH;
+    private static final String LD_LIBRARY_PATH_32 =
+            ExecutionEnvironment.LD_LIBRARY_PATH_32;
+    private static final String LD_LIBRARY_PATH_64 =
+            ExecutionEnvironment.LD_LIBRARY_PATH_64;
+
+    private static final File libDir =
+            new File(System.getProperty("sun.boot.library.path"));
+    private static final File srcServerDir = new File(libDir, "server");
+    private static final File srcLibjvmSo = new File(srcServerDir, LIBJVM);
+
+    private static final File dstLibDir = new File("lib");
+    private static final File dstLibArchDir =
+            new File(dstLibDir, TestHelper.getJreArch());
+
+    private static final File dstServerDir = new File(dstLibArchDir, "server");
+    private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM);
+
+    private static final File dstClientDir = new File(dstLibArchDir, "client");
+    private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM);
+
+    // used primarily to test the solaris variants in dual mode
+    private static final File dstOtherArchDir;
+    private static final File dstOtherServerDir;
+    private static final File dstOtherServerLibjvm;
+
+    private static final Map<String, String> env = new HashMap<>();
+
+    static {
+        if (TestHelper.isDualMode) {
+            dstOtherArchDir = new File(dstLibDir, TestHelper.getComplementaryJreArch());
+            dstOtherServerDir = new File(dstOtherArchDir, "server");
+            dstOtherServerLibjvm = new File(dstOtherServerDir, LIBJVM);
+        } else {
+            dstOtherArchDir = null;
+            dstOtherServerDir = null;
+            dstOtherServerLibjvm = null;
+        }
+    }
+
+    static String getValue(String name, List<String> in) {
+        for (String x : in) {
+            String[] s = x.split("=");
+            if (name.equals(s[0].trim())) {
+                return s[1].trim();
+            }
+        }
+        return null;
+    }
+
+    static void run(boolean want32, String dflag, Map<String, String> env,
+            int nLLPComponents, String caseID) {
+        final boolean want64 = want32 == false;
+        env.put(ExecutionEnvironment.JLDEBUG_KEY, "true");
+        List<String> cmdsList = new ArrayList<>();
+
+        // only for a dual-mode system
+        if (want64 && TestHelper.isDualMode) {
+            cmdsList.add(TestHelper.java64Cmd);
+        } else {
+            cmdsList.add(TestHelper.javaCmd); // a 32-bit java command for all
+        }
+
+        /*
+         * empty or null strings can confuse the ProcessBuilder. A null flag
+         * indicates that the appropriate data model is enforced on the chosen
+         * launcher variant.
+         */
+
+        if (dflag != null) {
+            cmdsList.add(dflag);
+        } else {
+            cmdsList.add(want32 ? "-d32" : "-d64");
+        }
+        cmdsList.add("-server");
+        cmdsList.add("-jar");
+        cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath());
+        String[] cmds = new String[cmdsList.size()];
+        TestHelper.TestResult tr = TestHelper.doExec(env, cmdsList.toArray(cmds));
+        analyze(tr, nLLPComponents, caseID);
+    }
+
+    // no cross launch, ie. no change to the data model.
+    static void run(Map<String, String> env, int nLLPComponents, String caseID)
+            throws IOException {
+        boolean want32 = TestHelper.is32Bit;
+        run(want32, null, env, nLLPComponents, caseID);
+    }
+
+    static void analyze(TestHelper.TestResult tr, int nLLPComponents, String caseID) {
+        String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput);
+       /*
+        * the envValue can never be null, since the test code should always
+        * print a "null" string.
+        */
+        if (envValue == null) {
+            System.out.println(tr);
+            throw new RuntimeException("NPE, likely a program crash ??");
+        }
+        String values[] = envValue.split(File.pathSeparator);
+        if (values.length == nLLPComponents) {
+            System.out.println(caseID + " :OK");
+            passes++;
+        } else {
+            System.out.println("FAIL: test7029048, " + caseID);
+            System.out.println(" expected " + nLLPComponents
+                    + " but got " + values.length);
+            System.out.println(envValue);
+            System.out.println(tr);
+            errors++;
+        }
+    }
+
+    /*
+     * A crucial piece, specifies what we should expect, given the conditions.
+     * That is for a given enum type, the value indicates how many absolute
+     * environment variables that can be expected. This value is used to base
+     * the actual expected values by adding the set environment variable usually
+     * it is 1, but it could be more if the test wishes to set more paths in
+     * the future.
+     */
+    private static enum LLP_VAR {
+        LLP_SET_NON_EXISTENT_PATH(0),   // env set, but the path does not exist
+        LLP_SET_EMPTY_PATH(0),          // env set, with a path but no libjvm.so
+        LLP_SET_WITH_JVM(3);            // env set, with a libjvm.so
+        private final int value;
+        LLP_VAR(int i) {
+            this.value = i;
+        }
+    }
+
+    /*
+     * test for 7029048
+     */
+    static void test7029048() throws IOException {
+        String desc = null;
+        for (LLP_VAR v : LLP_VAR.values()) {
+            switch (v) {
+                case LLP_SET_WITH_JVM:
+                    // copy the files into the directory structures
+                    TestHelper.copyFile(srcLibjvmSo, dstServerLibjvm);
+                    // does not matter if it is client or a server
+                    TestHelper.copyFile(srcLibjvmSo, dstClientLibjvm);
+                    // does not matter if the arch do not match either
+                    if (TestHelper.isDualMode) {
+                        TestHelper.copyFile(srcLibjvmSo, dstOtherServerLibjvm);
+                    }
+                    desc = "LD_LIBRARY_PATH should be set";
+                    break;
+                case LLP_SET_EMPTY_PATH:
+                    if (!dstClientDir.exists()) {
+                        Files.createDirectories(dstClientDir.toPath());
+                    } else {
+                        Files.deleteIfExists(dstClientLibjvm.toPath());
+                    }
+
+                    if (!dstServerDir.exists()) {
+                        Files.createDirectories(dstServerDir.toPath());
+                    } else {
+                        Files.deleteIfExists(dstServerLibjvm.toPath());
+                    }
+
+                    if (TestHelper.isDualMode) {
+                        if (!dstOtherServerDir.exists()) {
+                            Files.createDirectories(dstOtherServerDir.toPath());
+                        } else {
+                            Files.deleteIfExists(dstOtherServerLibjvm.toPath());
+                        }
+                    }
+
+                    desc = "LD_LIBRARY_PATH should not be set";
+                    break;
+                case LLP_SET_NON_EXISTENT_PATH:
+                    if (dstLibDir.exists()) {
+                        TestHelper.recursiveDelete(dstLibDir);
+                    }
+                    desc = "LD_LIBRARY_PATH should not be set";
+                    break;
+                default:
+                    throw new RuntimeException("unknown case");
+            }
+
+            /*
+             * Case 1: set the server path
+             */
+            env.clear();
+            env.put(LD_LIBRARY_PATH, dstServerDir.getAbsolutePath());
+            run(env, v.value + 1, "Case 1: " + desc);
+
+            /*
+             * Case 2: repeat with client path
+             */
+            env.clear();
+            env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath());
+            run(env, v.value + 1, "Case 2: " + desc);
+
+            if (!TestHelper.isDualMode) {
+                continue; // nothing more to do for Linux
+            }
+
+            // Tests applicable only to solaris.
+
+            // initialize test variables for dual mode operations
+            final File dst32ServerDir = TestHelper.is32Bit
+                    ? dstServerDir
+                    : dstOtherServerDir;
+
+            final File dst64ServerDir = TestHelper.is64Bit
+                    ? dstServerDir
+                    : dstOtherServerDir;
+
+            /*
+             * Case 3: set the appropriate LLP_XX flag,
+             * java32 -d32, LLP_32 is relevant, LLP_64 is ignored
+             * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
+             */
+            env.clear();
+            env.put(LD_LIBRARY_PATH_32, dst32ServerDir.getAbsolutePath());
+            env.put(LD_LIBRARY_PATH_64, dst64ServerDir.getAbsolutePath());
+            run(TestHelper.is32Bit, null, env, v.value + 1, "Case 3: " + desc);
+
+            /*
+             * Case 4: we are in dual mode environment, running 64-bit then
+             * we have the following scenarios:
+             * java32 -d64, LLP_64 is relevant, LLP_32 is ignored
+             * java64 -d32, LLP_32 is relevant, LLP_64 is ignored
+             */
+            if (TestHelper.dualModePresent()) {
+                run(true, "-d64", env, v.value + 1, "Case 4A: " + desc);
+                run(false,"-d32", env, v.value + 1, "Case 4B: " + desc);
+            }
+        }
+        return;
+    }
+
+    public static void main(String... args) throws Exception {
+        if (TestHelper.isWindows) {
+            System.out.println("Warning: noop on windows");
+            return;
+        }
+        // create our test jar first
+        ExecutionEnvironment.createTestJar();
+
+        // run the tests
+        test7029048();
+        if (errors > 0) {
+            throw new Exception("Test7029048: FAIL: with "
+                    + errors + " errors and passes " + passes);
+        } else if (TestHelper.dualModePresent() && passes < 15) {
+            throw new Exception("Test7029048: FAIL: " +
+                    "all tests did not run, expected " + 15 + " got " + passes);
+        } else if (TestHelper.isSolaris && passes < 9) {
+            throw new Exception("Test7029048: FAIL: " +
+                    "all tests did not run, expected " + 9 + " got " + passes);
+        } else if (TestHelper.isLinux && passes < 6) {
+             throw new Exception("Test7029048: FAIL: " +
+                    "all tests did not run, expected " + 6 + " got " + passes);
+        } else {
+            System.out.println("Test7029048: PASS " + passes);
+        }
+    }
+}
--- a/jdk/test/tools/launcher/TestHelper.java	Thu Apr 21 15:33:10 2011 -0700
+++ b/jdk/test/tools/launcher/TestHelper.java	Thu Apr 21 16:42:06 2011 -0700
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2008, 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
@@ -22,20 +21,28 @@
  * questions.
  */
 
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.FileVisitResult;
+import java.nio.file.SimpleFileVisitor;
 import javax.tools.ToolProvider;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import javax.tools.JavaCompiler;
 
+import static java.nio.file.StandardCopyOption.*;
+
 /**
- * This class provides some common utilites for the launcher tests.
+ * This class provides some common utilities for the launcher tests.
  */
 public enum TestHelper {
     INSTANCE;
@@ -101,6 +108,13 @@
     }
 
     /*
+     * is a dual mode available in the test jdk
+     */
+    static boolean dualModePresent() {
+        return isDualMode && java64Cmd != null;
+    }
+
+    /*
      * usually the jre/lib/arch-name is the same as os.arch, except for x86.
      */
     static String getJreArch() {
@@ -109,6 +123,27 @@
     }
 
     /*
+     * get the complementary jre arch ie. if sparc then return sparcv9 and
+     * vice-versa.
+     */
+    static String getComplementaryJreArch() {
+        String arch = System.getProperty("os.arch");
+        if (arch != null) {
+            switch (arch) {
+                case "sparc":
+                    return "sparcv9";
+                case "sparcv9":
+                    return "sparc";
+                case "x86":
+                    return "amd64";
+                case "amd64":
+                    return "i386";
+            }
+        }
+        return null;
+    }
+
+    /*
      * A convenience method to create a jar with jar file name and defs
      */
     static void createJar(File jarName, String... mainDefs)
@@ -168,6 +203,44 @@
         }
     }
 
+   static void copyFile(File src, File dst) throws IOException {
+        Path parent = dst.toPath().getParent();
+        if (parent != null) {
+            Files.createDirectories(parent);
+        }
+        Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING);
+    }
+
+    static void recursiveDelete(File target) throws IOException {
+        if (!target.exists()) {
+            return;
+        }
+        Files.walkFileTree(target.toPath(), new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+                try {
+                    Files.deleteIfExists(dir);
+                } catch (IOException ex) {
+                    System.out.println("Error: could not delete: " + dir.toString());
+                    System.out.println(ex.getMessage());
+                    return FileVisitResult.TERMINATE;
+                }
+                return FileVisitResult.CONTINUE;
+            }
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                try {
+                    Files.deleteIfExists(file);
+                } catch (IOException ex) {
+                    System.out.println("Error: could not delete: " + file.toString());
+                    System.out.println(ex.getMessage());
+                    return FileVisitResult.TERMINATE;
+                }
+                return FileVisitResult.CONTINUE;
+            }
+        });
+    }
+
     static TestResult doExec(String...cmds) {
         return doExec(null, cmds);
     }
@@ -187,7 +260,7 @@
         }
         BufferedReader rdr = null;
         try {
-            List<String> outputList = new ArrayList<String>();
+            List<String> outputList = new ArrayList<>();
             pb.redirectErrorStream(true);
             Process p = pb.start();
             rdr = new BufferedReader(new InputStreamReader(p.getInputStream()));
@@ -198,7 +271,9 @@
             }
             p.waitFor();
             p.destroy();
-            return new TestHelper.TestResult(cmdStr, p.exitValue(), outputList);
+
+            return new TestHelper.TestResult(cmdStr, p.exitValue(), outputList,
+                    env, new Throwable("current stack of the test"));
         } catch (Exception ex) {
             ex.printStackTrace();
             throw new RuntimeException(ex.getMessage());
@@ -213,11 +288,16 @@
         StringBuilder status;
         int exitValue;
         List<String> testOutput;
+        Map<String, String> env;
+        Throwable t;
 
-        public TestResult(String str, int rv, List<String> oList) {
+        public TestResult(String str, int rv, List<String> oList,
+                Map<String, String> env, Throwable t) {
             status = new StringBuilder("Executed command: " + str + "\n");
             exitValue = rv;
             testOutput = oList;
+            this.env = env;
+            this.t = t;
         }
 
         void appendStatus(String x) {
@@ -262,11 +342,21 @@
 
         @Override
         public String toString() {
-            status = status.append("++++Test Output Begin++++\n");
+            status.append("++++Begin Test Info++++\n");
+            status.append("++++Test Environment++++\n");
+            for (String x : env.keySet()) {
+                status.append(x).append("=").append(env.get(x)).append("\n");
+            }
+            status.append("++++Test Output++++\n");
             for (String x : testOutput) {
                 appendStatus(x);
             }
-            status = status.append("++++Test Output End++++\n");
+            status.append("++++Test Stack Trace++++\n");
+            status.append(t.toString());
+            for (StackTraceElement e : t.getStackTrace()) {
+                status.append(e.toString());
+            }
+            status.append("++++End of Test Info++++\n");
             return status.toString();
         }