changeset 4026:e2c6bd53428a

Merge
author lana
date Mon, 18 Apr 2011 14:00:34 -0700
parents 745a56cb4c16 b38b204748c1
children ead0ccd4a34e
files src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java
diffstat 302 files changed, 15367 insertions(+), 2437 deletions(-) [+]
line wrap: on
line diff
--- a/make/com/sun/java/pack/Makefile	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/com/sun/java/pack/Makefile	Mon Apr 18 14:00:34 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/make/com/sun/java/pack/mapfile-vers-unpack200	Mon Apr 18 14:00:34 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/make/common/Mapfile-vers.gmk	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/common/Mapfile-vers.gmk	Mon Apr 18 14:00:34 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/make/common/Program.gmk	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/common/Program.gmk	Mon Apr 18 14:00:34 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/make/common/Release.gmk	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/common/Release.gmk	Mon Apr 18 14:00:34 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/make/docs/Makefile	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/docs/Makefile	Mon Apr 18 14:00:34 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/make/java/main/java/Makefile	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/java/main/java/Makefile	Mon Apr 18 14:00:34 2011 -0700
@@ -61,5 +61,4 @@
 
 ifeq ($(PLATFORM), solaris)
 LDFLAGS += -R$(OPENWIN_LIB)
-LDFLAGS += -M mapfile-$(ARCH)
 endif
--- a/make/java/main/java/mapfile-amd64	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/java/main/java/mapfile-amd64	Mon Apr 18 14:00:34 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/make/java/main/java/mapfile-i586	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/java/main/java/mapfile-i586	Mon Apr 18 14:00:34 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/make/java/main/java/mapfile-sparc	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/java/main/java/mapfile-sparc	Mon Apr 18 14:00:34 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/make/java/main/java/mapfile-sparcv9	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/java/main/java/mapfile-sparcv9	Mon Apr 18 14:00:34 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/make/javax/crypto/Defs-jce.gmk	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/javax/crypto/Defs-jce.gmk	Mon Apr 18 14:00:34 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/make/jpda/jdwp/jdwp.spec	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/jpda/jdwp/jdwp.spec	Mon Apr 18 14:00:34 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/make/mksample/Makefile	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/mksample/Makefile	Mon Apr 18 14:00:34 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/make/mksample/forkjoin/Makefile	Mon Apr 18 14:00:34 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/make/mksample/forkjoin/mergesort/Makefile	Mon Apr 18 14:00:34 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/make/mksample/nio/Makefile	Mon Apr 18 13:57:44 2011 -0700
+++ b/make/mksample/nio/Makefile	Mon Apr 18 14:00:34 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/make/mksample/nio/chatserver/Makefile	Mon Apr 18 14:00:34 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/src/share/bin/jli_util.h	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/bin/jli_util.h	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/beans/TypeResolver.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/beans/TypeResolver.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/java/util/jar/pack/package.html	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/java/util/jar/pack/package.html	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/Accessible.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/Accessible.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/ArrayType.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/ArrayType.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/ClassType.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/ClassType.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/LocalVariable.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/LocalVariable.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/Method.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/Method.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/ObjectReference.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/ObjectReference.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/ReferenceType.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/ReferenceType.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/jdi/TypeComponent.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/jdi/TypeComponent.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Mon Apr 18 14:00:34 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/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Mon Apr 18 14:00:34 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/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Mon Apr 18 14:00:34 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/src/share/classes/java/io/Console.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/io/Console.java	Mon Apr 18 14:00:34 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/src/share/classes/java/io/PrintStream.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/io/PrintStream.java	Mon Apr 18 14:00:34 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/src/share/classes/java/io/PrintWriter.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/io/PrintWriter.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/AssertionError.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/AssertionError.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Byte.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Byte.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Character.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Character.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Class.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Class.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/ClassLoader.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/ClassLoader.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Double.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Double.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Enum.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Enum.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Error.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Error.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Exception.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Exception.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Float.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Float.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Integer.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Integer.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Long.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Long.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Math.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Math.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Object.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Object.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Override.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Override.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Package.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Package.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/RuntimeException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/RuntimeException.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/SafeVarargs.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/SafeVarargs.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Short.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Short.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/StrictMath.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/StrictMath.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/String.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/String.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/Throwable.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/Throwable.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/annotation/Annotation.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/annotation/Annotation.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/instrument/Instrumentation.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/instrument/Instrumentation.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/invoke/package-info.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/invoke/package-info.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/reflect/Constructor.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/reflect/Constructor.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/reflect/Field.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/reflect/Field.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/reflect/GenericDeclaration.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/reflect/GenericDeclaration.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/reflect/Method.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/reflect/Method.java	Mon Apr 18 14:00:34 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/src/share/classes/java/lang/reflect/Modifier.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/lang/reflect/Modifier.java	Mon Apr 18 14:00:34 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/src/share/classes/java/math/BigDecimal.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/math/BigDecimal.java	Mon Apr 18 14:00:34 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/src/share/classes/java/math/BigInteger.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/math/BigInteger.java	Mon Apr 18 14:00:34 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/src/share/classes/java/security/SecureClassLoader.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/security/SecureClassLoader.java	Mon Apr 18 14:00:34 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/src/share/classes/java/sql/DriverManager.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/sql/DriverManager.java	Mon Apr 18 14:00:34 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/src/share/classes/java/sql/ResultSet.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/sql/ResultSet.java	Mon Apr 18 14:00:34 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/src/share/classes/java/sql/SQLPermission.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/sql/SQLPermission.java	Mon Apr 18 14:00:34 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/src/share/classes/java/sql/Timestamp.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/sql/Timestamp.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/AbstractQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/AbstractQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/ArrayDeque.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/ArrayDeque.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/Deque.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/Deque.java	Mon Apr 18 14:00:34 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;
--- a/src/share/classes/java/util/EnumMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/EnumMap.java	Mon Apr 18 14:00:34 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;
+            lastReturnedEntry = new Entry(index++);
+            return lastReturnedEntry;
         }
 
-        public K getKey() {
-            checkLastReturnedIndexForEntryUse();
-            return keyUniverse[lastReturnedIndex];
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public V getValue() {
-            checkLastReturnedIndexForEntryUse();
-            return unmaskNull(vals[lastReturnedIndex]);
-        }
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
 
-        public V setValue(V value) {
-            checkLastReturnedIndexForEntryUse();
-            V oldValue = unmaskNull(vals[lastReturnedIndex]);
-            vals[lastReturnedIndex] = maskNull(value);
-            return oldValue;
-        }
+            private Entry(int index) {
+                this.index = index;
+            }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return o == this;
+            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 int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = unmaskNull(vals[index]);
+                vals[index] = maskNull(value);
+                return oldValue;
+            }
 
-            Object value = vals[lastReturnedIndex];
-            return keyUniverse[lastReturnedIndex].hashCode()
-                ^ (value == NULL ? 0 : value.hashCode());
-        }
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return o == this;
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
+                if (!(o instanceof Map.Entry))
+                    return false;
 
-            return keyUniverse[lastReturnedIndex] + "="
-                + unmaskNull(vals[lastReturnedIndex]);
-        }
+                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))));
+            }
 
-        private void checkLastReturnedIndexForEntryUse() {
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
+            public int hashCode() {
+                if (index < 0)
+                    return super.hashCode();
+
+                return entryHashCode(index);
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
+
+                return keyUniverse[index] + "="
+                    + unmaskNull(vals[index]);
+            }
+
+            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;
 
-        EnumMap em = (EnumMap)o;
+        Map<K,V> m = (Map<K,V>)o;
+        if (size != m.size())
+            return false;
+
+        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/src/share/classes/java/util/Formatter.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/Formatter.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/IdentityHashMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/IdentityHashMap.java	Mon Apr 18 14:00:34 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 void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public V getValue() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
 
-            return (V) traversalTable[lastReturnedIndex+1];
-        }
+            private Entry(int index) {
+                this.index = index;
+            }
 
-        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;
-        }
+            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];
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            return e.getKey()   == getKey() &&
-                   e.getValue() == getValue();
-        }
+            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;
+            }
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return super.equals(o);
 
-            return System.identityHashCode(getKey()) ^
-                   System.identityHashCode(getValue());
-        }
+                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 String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
+            public int hashCode() {
+                if (lastReturnedIndex < 0)
+                    return super.hashCode();
 
-            return getKey() + "=" + getValue();
+                return (System.identityHashCode(unmaskNull(traversalTable[index])) ^
+                       System.identityHashCode(traversalTable[index+1]));
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
+
+                return (unmaskNull(traversalTable[index]) + "="
+                        + traversalTable[index+1]);
+            }
+
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
--- a/src/share/classes/java/util/NavigableMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/NavigableMap.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/NavigableSet.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/NavigableSet.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/Properties.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/Properties.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/PropertyResourceBundle.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/PropertyResourceBundle.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/Queue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/Queue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/BlockingDeque.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/BlockingDeque.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/BlockingQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/BlockingQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/BrokenBarrierException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/BrokenBarrierException.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Callable.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Callable.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/CancellationException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/CancellationException.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/CompletionService.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/CompletionService.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Mon Apr 18 14:00:34 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));
+        Segment(float lf, int threshold, HashEntry<K,V>[] tab) {
+            this.loadFactor = lf;
+            this.threshold = threshold;
+            this.table = tab;
         }
 
-        @SuppressWarnings("unchecked")
-        static final <K,V> Segment<K,V>[] newArray(int i) {
-            return new Segment[i];
+        final V put(K key, int hash, V value, boolean onlyIfAbsent) {
+            HashEntry<K,V> node = tryLock() ? null :
+                scanAndLockForPut(key, hash, value);
+            V oldValue;
+            try {
+                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();
+            }
+            return oldValue;
         }
 
         /**
-         * Sets table to new HashEntry array.
-         * Call only while holding lock or in constructor.
+         * Doubles size of table and repacks entries, also adding the
+         * given node to new table
          */
-        void setTable(HashEntry<K,V>[] newTable) {
-            threshold = (int)(newTable.length * loadFactor);
-            table = newTable;
-        }
-
-        /**
-         * 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();
-            try {
-                return e.value;
-            } 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();
-            }
-        }
-
-        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() {
+        @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() {
+        /*
+         * 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.
+         */
+        long sum = 0L;
         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.
-         */
-        int[] mc = new int[segments.length];
-        int mcsum = 0;
-        for (int i = 0; i < segments.length; ++i) {
-            if (segments[i].count != 0)
+        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) { // 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;
-            else
-                mcsum += mc[i] = segments[i].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;
-            }
         }
         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/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ConcurrentMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentMap.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/CountDownLatch.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/CountDownLatch.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/CyclicBarrier.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/CyclicBarrier.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/DelayQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/DelayQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Delayed.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Delayed.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Exchanger.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Exchanger.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ExecutionException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ExecutionException.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Executor.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Executor.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ExecutorService.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ExecutorService.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Executors.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Executors.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ForkJoinPool.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ForkJoinPool.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ForkJoinTask.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ForkJoinTask.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Future.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Future.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/FutureTask.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/FutureTask.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Phaser.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Phaser.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/RecursiveAction.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/RecursiveAction.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/RecursiveTask.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/RecursiveTask.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/RejectedExecutionException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/RejectedExecutionException.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/RunnableFuture.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/RunnableFuture.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ScheduledFuture.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ScheduledFuture.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/Semaphore.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/Semaphore.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/SynchronousQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/SynchronousQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ThreadFactory.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ThreadFactory.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/TimeUnit.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/TimeUnit.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/TimeoutException.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/TimeoutException.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/TransferQueue.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/TransferQueue.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/atomic/package-info.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/package-info.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/Condition.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/Condition.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/Lock.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/Lock.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/LockSupport.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/ReentrantLock.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/ReentrantLock.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/locks/package-info.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/locks/package-info.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/concurrent/package-info.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/concurrent/package-info.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/jar/JarFile.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/jar/JarFile.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/jar/JarInputStream.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/jar/JarInputStream.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/jar/JarVerifier.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/jar/JarVerifier.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/jar/Pack200.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/jar/Pack200.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/logging/FileHandler.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/logging/FileHandler.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/regex/Pattern.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/regex/Pattern.java	Mon Apr 18 14:00:34 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/src/share/classes/java/util/zip/ZipFile.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/java/util/zip/ZipFile.java	Mon Apr 18 14:00:34 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 {
+        if (closeRequested)
+            return;
+        closeRequested = true;
+
         synchronized (this) {
-            closeRequested = true;
+            // 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();
+                        }
+                    }
+                }
+            }
 
-            if (streams.size() !=0) {
-                Set<InputStream> copy = streams;
-                streams = new HashSet<>();
-                for (InputStream is: copy)
-                    is.close();
+            // 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/src/share/classes/javax/crypto/AEADBadTagException.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/crypto/Cipher.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/crypto/Cipher.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/crypto/CipherSpi.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/crypto/CipherSpi.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/crypto/spec/GCMParameterSpec.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/management/remote/package.html	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/management/remote/package.html	Mon Apr 18 14:00:34 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>
--- a/src/share/classes/javax/sql/rowset/BaseRowSet.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/sql/rowset/BaseRowSet.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/sql/rowset/RowSetProvider.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/sql/rowset/RowSetProvider.java	Mon Apr 18 14:00:34 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/src/share/classes/javax/swing/plaf/LayerUI.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/javax/swing/plaf/LayerUI.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/misc/FloatingDecimal.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/misc/FloatingDecimal.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/misc/FpUtils.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/misc/FpUtils.java	Mon Apr 18 14:00:34 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
--- a/src/share/classes/sun/net/www/protocol/jar/Handler.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/net/www/protocol/jar/Handler.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/nio/ch/IOUtil.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/nio/ch/IOUtil.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/rmi/transport/ObjectTable.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/rmi/transport/ObjectTable.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/krb5/KrbApReq.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/krb5/KrbApReq.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/krb5/internal/NetClient.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/krb5/internal/NetClient.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/pkcs/PKCS7.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/pkcs/PKCS7.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/pkcs/SignerInfo.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/pkcs/SignerInfo.java	Mon Apr 18 14:00:34 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 {
+            throws NoSuchAlgorithmException, SignatureException {
 
-        try {
-
-            ContentInfo content = block.getContentInfo();
-            if (data == null) {
-                data = content.getContentBytes();
+        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());
             }
-
-            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();
-
-            // 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)");
-            }
-
-            // 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/src/share/classes/sun/security/pkcs11/Config.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/pkcs11/Config.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/pkcs11/SessionManager.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/pkcs11/SessionManager.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java	Mon Apr 18 14:00:34 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/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Mon Apr 18 14:00:34 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);
+        }
 
-        return issuerSelector.match(cert);
+        matched = 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/src/share/classes/sun/security/ssl/CipherSuiteList.java	Mon Apr 18 13:57:44 2011 -0700
+++ b/src/share/classes/sun/security/ssl/CipherSuiteList.java	Mon Apr 18 14:00:34 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 =