Merge
authorjrose
Thu, 26 Jan 2012 19:39:08 -0800
changeset 11573 e1deb7ec91fa
parent 11572 84afef481892 (current diff)
parent 11561 5d25e03c3634 (diff)
child 11587 16b0200f252d
child 11631 33813f69207b
Merge
jdk/test/java/io/File/BlockIsDirectory.java
--- a/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 0ff7113a0882ec82d642cb9f0297b4e497807ced jdk8-b19
 6561530ea757c3f3a6fb171c9cc7b3885cdeca85 jdk8-b20
 b3a426170188f52981cf4573a2f14d487fddab0d jdk8-b21
+e8f03541af27e38aafb619b96863e17f65ffe53b jdk8-b22
--- a/.hgtags-top-repo	Thu Jan 26 12:15:24 2012 -0800
+++ b/.hgtags-top-repo	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 237bc29afbfc6f56a4fe4a6008e2befb59c44bac jdk8-b19
 5a5eaf6374bcbe23530899579fed17a05b7705f3 jdk8-b20
 cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21
+7ad075c809952e355d25030605da6af30456ed74 jdk8-b22
--- a/corba/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/corba/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 e1366c5d84ef984095a332bcee70b3938232d07d jdk8-b19
 51d8b6cb18c0978ecfa4f33e1537d35ee01b69fa jdk8-b20
 f157fc2a71a38ce44007a6f18d5b011824dce705 jdk8-b21
+a11d0062c445d5f36651c78650ab88aa594bcbff jdk8-b22
--- a/hotspot/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/hotspot/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -211,3 +211,5 @@
 fe2c8764998112b7fefcd7d41599714813ae4327 jdk8-b20
 9952d1c439d64c5fd4ad1236a63a62bd5a49d4c3 jdk8-b21
 513351373923f74a7c91755748b95c9771e59f96 hs23-b10
+24727fb37561779077fdfa5a33342246f20e5c0f jdk8-b22
+dcc292399a39113957eebbd3e487b7e05e2c79fc hs23-b11
--- a/hotspot/make/hotspot_version	Thu Jan 26 12:15:24 2012 -0800
+++ b/hotspot/make/hotspot_version	Thu Jan 26 19:39:08 2012 -0800
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=23
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=11
+HS_BUILD_NUMBER=12
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/jaxp/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/jaxp/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 dffeb62b1a7fc8b316bf58fe5479323f3661894e jdk8-b19
 f052abb8f37444ba77858913887d0d92795dd6b8 jdk8-b20
 d41eeadf5c1344b88c5051a997aec9e1ad7ce1db jdk8-b21
+cf9d6ec44f891236ad18451021d6dcd57dc82f7b jdk8-b22
--- a/jaxws/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/jaxws/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 b73b733214aa43648d69a2da51e6b48fda902a2d jdk8-b19
 2b2818e3386f4510c390f6aea90d77e1c6a5bf9e jdk8-b20
 c266cab0e3fff05f2048c23046c14d60f7102175 jdk8-b21
+8d3df89b0f2d3c603b2edb0f5e24af1245397cc6 jdk8-b22
--- a/jdk/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 3778f85773055e81eab6c5ef828935ecca241810 jdk8-b19
 39e938cd1b82ec3aab0a9aa66fd8a0457cd0c9c2 jdk8-b20
 664fa4fb0ee411ef048903c479f8b962fcdb2f4b jdk8-b21
+dda27c73d8db4a9c7a23872b6f0c5106edcb2021 jdk8-b22
--- a/jdk/make/com/oracle/Makefile	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/make/com/oracle/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 # 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,15 +25,24 @@
 
 BUILDDIR = ../..
 PRODUCT = oracle
+#SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
+#SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
+#SUBDIRS_MAKEFLAGS += JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation,-path
 include $(BUILDDIR)/common/Defs.gmk
 
-#
-# Files to compile
-#
-AUTO_FILES_JAVA_DIRS = com/oracle
+# build com/oracle/security/ucrypto on Solaris platform for non-OpenJDK builds
+UCRYPTO =
+ifndef OPENJDK
+  ifeq ($(PLATFORM), solaris)
+    UCRYPTO = security/ucrypto
+  endif
+endif
 
-#
-# Rules
-#
-include $(BUILDDIR)/common/Classes.gmk
+
+SUBDIRS = net nio util $(UCRYPTO)
 
+include $(BUILDDIR)/common/Subdirs.gmk
+
+all build clean clobber::
+	$(SUBDIRS-loop)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/net/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# 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.
+#
+
+BUILDDIR = ../../..
+PACKAGE = com.oracle.net
+PRODUCT = oracle
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Files
+#
+AUTO_FILES_JAVA_DIRS = com/oracle/net
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/nio/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# 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.
+#
+
+BUILDDIR = ../../..
+PACKAGE = com.oracle.nio
+PRODUCT = oracle
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Files
+#
+AUTO_FILES_JAVA_DIRS = com/oracle/nio
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/security/ucrypto/FILES_c.gmk	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+ifndef OPENJDK
+FILES_c = \
+        nativeFunc.c \
+	nativeCrypto.c
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/security/ucrypto/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,270 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# 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 ucrypto.jar and its native libraries.
+#
+# This file was modified from make/sun/security/pkcs11/Makefile.
+#
+#
+# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Oracle
+# JDK builds respectively.)
+#
+# This Makefile does the "real" build of the Ucrypto provider files.
+# Since the sources are unavailable for OpenJDK, this Makefile is only
+# useful for JDK.
+#
+#
+# Main Targets (JDK on Solaris):
+#
+#     all                      The usual, ucrypto.jar plus the native libraries.
+#                                  builds and installs the prebuilt/signed jar.
+#
+#     clobber/clean            Cleans up the temp directory, ucrypto.jar, the
+#                              native libraries, and the config file from the
+#                              build area
+#
+#     jar                      Builds, signs and installs ucrypto.jar
+#                              (Can only be done on machines with access to
+#                               the signing keystore)
+#
+# Other lesser-used Targets (JDK on Solaris):
+#
+#     build-jar                Builds ucrypto.jar (no sign/install)
+#
+#     sign                     Builds/signs ucrypto.jar (no install)
+#
+#     release                  Builds all targets in preparation
+#                              for workspace integration.
+#                              (Can only be done on machines with access to
+#                               the signing keystore)
+#
+#     install-prebuilt         Installs the pre-built jar files
+#
+# NOTE: None of the above target will update the prebuilt provider binary
+# under the closed workspace. To update it, you must explicitly copy the
+# binary from either the tmp/signed or lib/ext directory.
+#
+# This makefile was written to support parallel target execution.
+#
+
+BUILDDIR = ../../../..
+
+include $(BUILDDIR)/common/Defs.gmk
+
+ifndef OPENJDK
+  ifneq ($(PLATFORM), solaris)
+    all:
+  else
+    PACKAGE = com.oracle.security.ucrypto
+  LIBRARY = j2ucrypto
+  PRODUCT = oracle
+
+  #
+  # The following is for when we need to do postprocessing
+  # (signing/obfuscation) against a read-only build.  If the OUTPUTDIR
+  # isn't writable, the build currently crashes out.
+  #
+  ifdef ALT_JCE_BUILD_DIR
+    # =====================================================
+    # Where to place the output, in case we're building from a read-only
+    # build area.  (e.g. a release engineering build.)
+    JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR}
+    IGNORE_WRITABLE_OUTPUTDIR_TEST=true
+  else
+    JCE_BUILD_DIR=${TEMPDIR}
+  endif
+
+  JAVAC_MAX_WARNINGS=false
+  JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
+  JAVAC_WARNINGS_FATAL=true
+
+  #
+  # C and Java Files
+  #
+  include FILES_c.gmk
+
+  #
+  # Subdirectories of these are automatically included.
+  #
+  AUTO_FILES_JAVA_DIRS = com/oracle/security/ucrypto
+
+  #
+  # Java files that define native methods
+  #
+  FILES_export = \
+      com/oracle/security/ucrypto/UcryptoProvider.java \
+      com/oracle/security/ucrypto/NativeCipher.java \
+      com/oracle/security/ucrypto/NativeDigest.java \
+      com/oracle/security/ucrypto/NativeKey.java \
+      com/oracle/security/ucrypto/NativeRSASignature.java \
+      com/oracle/security/ucrypto/NativeRSACipher.java
+
+  #
+  # Find native code
+  #
+  vpath %.c \
+    $(CLOSED_PLATFORM_SRC)/native/com/oracle/security/ucrypto
+
+  #
+  # Find include files
+  #
+  OTHER_INCLUDES += \
+    -I$(CLOSED_PLATFORM_SRC)/native/com/oracle/security/ucrypto
+
+  #
+  # Rules
+  #
+  CLASSDESTDIR = $(TEMPDIR)/classes
+  JAVAHFLAGS = -bootclasspath \
+    "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
+
+  include $(BUILDDIR)/common/Mapfile-vers.gmk
+  include $(BUILDDIR)/common/Library.gmk
+
+  #
+  # Libraries to link
+  #
+  OTHER_LDLIBS = -ldl
+
+  # Default config file
+  UCRYPTO_CFG_SRC   = $(CLOSED_SRC)/share/lib/security/ucrypto-solaris.cfg
+  UCRYPTO_CFG_BUILD = $(LIBDIR)/security/ucrypto-solaris.cfg
+
+  #
+  # We use a variety of subdirectories in the $(TEMPDIR) depending on what
+  # part of the build we're doing.  Build is initially done in the unsigned
+  # area and when files are signed, they will be placed in the appropriate area.
+  #
+  UNSIGNED_DIR = $(TEMPDIR)/unsigned
+
+  #
+  # Rules
+  #
+  all: ucrypto-cfg build-jar install-prebuilt
+	$(build-warning)
+
+  ucrypto-cfg: $(UCRYPTO_CFG_BUILD)
+
+  $(UCRYPTO_CFG_BUILD): $(UCRYPTO_CFG_SRC)
+	$(install-file)
+
+  include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
+
+
+  # =====================================================
+  # Build the unsigned ucrypto.jar file.
+  #
+
+  JAR_DESTFILE = $(EXTDIR)/ucrypto.jar
+
+  #
+  # The ucrypto.jar needs to be in the extension class directory,
+  # therefore none of its classes can appear in $(CLASSBINDIR).
+  # Currently no one is using any of the internals, so these files
+  # should not have been built.
+  #
+
+  #
+  # Since the -C option to jar is used below, each directory entry must be
+  # preceded with the appropriate directory to "cd" into.
+  #
+  JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
+
+  build-jar: $(UNSIGNED_DIR)/ucrypto.jar
+
+  #
+  # Build ucrypto.jar.
+  #
+  $(UNSIGNED_DIR)/ucrypto.jar: build
+	$(prep-target)
+	$(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \
+	    $(BOOT_JAR_JFLAGS)
+	@$(java-vm-cleanup)
+
+  #
+  # Sign ucrypto.jar
+  #
+  SIGNED_DIR = $(JCE_BUILD_DIR)/signed
+
+  sign: $(SIGNED_DIR)/ucrypto.jar
+
+  ifndef ALT_JCE_BUILD_DIR
+    $(SIGNED_DIR)/ucrypto.jar: $(UNSIGNED_DIR)/ucrypto.jar
+  else
+    #
+    # We have to remove the build dependency, otherwise, we'll try to rebuild it
+    # which we can't do on a read-only filesystem.
+    #
+    $(SIGNED_DIR)/ucrypto.jar:
+	@if [ ! -r $(UNSIGNED_DIR)/ucrypto.jar ] ; then \
+            $(ECHO) "Couldn't find $(UNSIGNED_DIR)/ucrypto.jar"; \
+            exit 1; \
+        fi
+  endif
+	$(call sign-file, $(UNSIGNED_DIR)/ucrypto.jar)
+
+
+  # =====================================================
+  # Create the Release Engineering files.  Signed builds, etc.
+  #
+
+  release: $(SIGNED_DIR)/ucrypto.jar
+	$(RM) $(JCE_BUILD_DIR)/release/ucrypto.jar
+	$(MKDIR) -p $(JCE_BUILD_DIR)/release
+	$(CP) $(SIGNED_DIR)/ucrypto.jar $(JCE_BUILD_DIR)/release
+	$(release-warning)
+
+
+  # =====================================================
+  # Install routines.
+  #
+
+  #
+  # Install ucrypto.jar, depending on which type is requested.
+  #
+  jar: $(JAR_DESTFILE)
+	$(release-warning)
+
+  $(JAR_DESTFILE): $(SIGNED_DIR)/ucrypto.jar
+	$(install-file)
+
+  install-prebuilt:
+	@$(ECHO) "\n>>>Installing prebuilt OracleUcrypto provider..."
+	$(RM) $(JAR_DESTFILE)
+	$(CP) $(PREBUILT_DIR)/ucrypto/ucrypto.jar $(JAR_DESTFILE)
+
+
+  # =====================================================
+  # Support routines.
+  #
+  clobber clean::
+	$(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR)
+	$(RM) -r $(UCRYPTO_CFG_BUILD)
+
+  .PHONY: build-jar jar sign release install-prebuilt
+
+  endif #ifneq ($(PLATFORM), solaris)
+endif #ifndef OPENJDK
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/security/ucrypto/mapfile-vers	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,69 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# 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 public interface.
+
+SUNWprivate_1.1 {
+	global:
+                JNI_OnLoad;
+                Java_com_oracle_security_ucrypto_UcryptoProvider_loadLibraries;
+                Java_com_oracle_security_ucrypto_UcryptoProvider_getMechList;
+		Java_com_oracle_security_ucrypto_NativeDigest_nativeInit;
+                Java_com_oracle_security_ucrypto_NativeDigest_nativeUpdate;
+                Java_com_oracle_security_ucrypto_NativeDigest_nativeDigest;
+                Java_com_oracle_security_ucrypto_NativeDigest_nativeClone;
+                Java_com_oracle_security_ucrypto_NativeDigest_nativeFree;
+		Java_com_oracle_security_ucrypto_NativeCipher_nativeInit;
+		Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
+		Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
+                Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
+                Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
+                Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
+		Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
+		Java_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII;
+		Java_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI;
+		Java_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal;
+		Java_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic;
+
+                JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeInit;
+                JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeUpdate;
+                JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeDigest;
+                JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeClone;
+                JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeFree;
+                JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeInit;
+                JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
+                JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
+                JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
+                JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
+                JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
+		JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
+		JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII;
+		JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI;
+		JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal;
+                JavaCritical_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic;
+
+	local:
+		*;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/oracle/util/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# 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.
+#
+
+BUILDDIR = ../../..
+PACKAGE = com.oracle.util
+PRODUCT = oracle
+include $(BUILDDIR)/common/Defs.gmk
+
+#
+# Files
+#
+AUTO_FILES_JAVA_DIRS = com/oracle/util
+
+#
+# Rules
+#
+include $(BUILDDIR)/common/Classes.gmk
+
--- a/jdk/make/javax/sound/jsoundalsa/Makefile	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/make/javax/sound/jsoundalsa/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -65,7 +65,7 @@
 	$(MIDIFILES_export) \
 	$(PORTFILES_export)
 
-LDFLAGS += -lasound
+OTHER_LDLIBS += -lasound
 
 CPPFLAGS += \
 	-DUSE_DAUDIO=TRUE \
--- a/jdk/make/sun/awt/Makefile	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/make/sun/awt/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -367,7 +367,8 @@
 FONTCONFIGS_SRC	= $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs
 _FONTCONFIGS	= \
 	fontconfig.properties				\
-	fontconfig.RedHat.5.5.properties		\
+	fontconfig.RedHat.5.properties			\
+	fontconfig.RedHat.6.properties			\
 	fontconfig.Turbo.properties			\
 	fontconfig.SuSE.10.properties                   \
 	fontconfig.SuSE.11.properties
--- a/jdk/make/sun/security/pkcs11/mapfile-vers	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/make/sun/security/pkcs11/mapfile-vers	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -47,8 +47,8 @@
 		Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseSession;
 #		Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseAllSessions;
 		Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetSessionInfo;
-#		Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOperationState;
-#		Java_sun_security_pkcs11_wrapper_PKCS11_C_1SetOperationState;
+		Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOperationState;
+		Java_sun_security_pkcs11_wrapper_PKCS11_C_1SetOperationState;
 		Java_sun_security_pkcs11_wrapper_PKCS11_C_1Login;
 		Java_sun_security_pkcs11_wrapper_PKCS11_C_1Logout;
 		Java_sun_security_pkcs11_wrapper_PKCS11_C_1CreateObject;
--- a/jdk/src/share/bin/java.c	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/bin/java.c	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1225,14 +1225,7 @@
                 "checkAndLoadMain",
                 "(ZILjava/lang/String;)Ljava/lang/Class;"));
 
-    switch (mode) {
-        case LM_CLASS:
-            str = NewPlatformString(env, name);
-            break;
-        default:
-            str = (*env)->NewStringUTF(env, name);
-            break;
-    }
+    str = NewPlatformString(env, name);
     result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str);
 
     if (JLI_IsTraceLauncher()) {
--- a/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Thu Jan 26 19:39:08 2012 -0800
@@ -154,7 +154,7 @@
      * @see #resolve(Type)
      */
     public static Type resolve(Type actual, Type formal) {
-        return new TypeResolver(actual).resolve(formal);
+        return getTypeResolver(actual).resolve(formal);
     }
 
     /**
@@ -169,7 +169,7 @@
      * @see #resolve(Type[])
      */
     public static Type[] resolve(Type actual, Type[] formals) {
-        return new TypeResolver(actual).resolve(formals);
+        return getTypeResolver(actual).resolve(formals);
     }
 
     /**
@@ -228,9 +228,20 @@
         return classes;
     }
 
+    public static TypeResolver getTypeResolver(Type type) {
+        synchronized (CACHE) {
+            TypeResolver resolver = CACHE.get(type);
+            if (resolver == null) {
+                resolver = new TypeResolver(type);
+                CACHE.put(type, resolver);
+            }
+            return resolver;
+        }
+    }
 
-    private final Map<TypeVariable<?>, Type> map
-        = new HashMap<TypeVariable<?>, Type>();
+    private static final WeakCache<Type, TypeResolver> CACHE = new WeakCache<>();
+
+    private final Map<TypeVariable<?>, Type> map = new HashMap<>();
 
     /**
      * Constructs the type resolver for the given actual type.
--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Thu Jan 26 19:39:08 2012 -0800
@@ -802,8 +802,11 @@
      */
     protected Object readResolve() throws java.io.ObjectStreamException {
         synchronized (AWTKeyStroke.class) {
-            return getCachedStroke(keyChar, keyCode, modifiers, onKeyRelease);
+            if (getClass().equals(getAWTKeyStrokeClass())) {
+                return  getCachedStroke(keyChar, keyCode, modifiers, onKeyRelease);
+            }
         }
+        return this;
     }
 
     private static int mapOldModifiers(int modifiers) {
--- a/jdk/src/share/classes/java/lang/Class.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/Class.java	Thu Jan 26 19:39:08 2012 -0800
@@ -3118,4 +3118,9 @@
     AnnotationType getAnnotationType() {
         return annotationType;
     }
+
+    /* Backing store of user-defined values pertaining to this class.
+     * Maintained by the ClassValue class.
+     */
+    transient ClassValue.ClassValueMap classValueMap;
 }
--- a/jdk/src/share/classes/java/lang/ClassValue.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/ClassValue.java	Thu Jan 26 19:39:08 2012 -0800
@@ -25,9 +25,14 @@
 
 package java.lang;
 
+import java.lang.ClassValue.ClassValueMap;
 import java.util.WeakHashMap;
+import java.lang.ref.WeakReference;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import static java.lang.ClassValue.ClassValueMap.probeHomeLocation;
+import static java.lang.ClassValue.ClassValueMap.probeBackupLocations;
+
 /**
  * Lazily associate a computed value with (potentially) every type.
  * For example, if a dynamic language needs to construct a message dispatch
@@ -92,14 +97,22 @@
      * @see #computeValue
      */
     public T get(Class<?> type) {
-        ClassValueMap map = getMap(type);
-        if (map != null) {
-            Object x = map.get(this);
-            if (x != null) {
-                return (T) map.unmaskNull(x);
-            }
-        }
-        return setComputedValue(type);
+        // non-racing this.hashCodeForCache : final int
+        Entry<?>[] cache;
+        Entry<T> e = probeHomeLocation(cache = getCacheCarefully(type), this);
+        // racing e : current value <=> stale value from current cache or from stale cache
+        // invariant:  e is null or an Entry with readable Entry.version and Entry.value
+        if (match(e))
+            // invariant:  No false positive matches.  False negatives are OK if rare.
+            // The key fact that makes this work: if this.version == e.version,
+            // then this thread has a right to observe (final) e.value.
+            return e.value();
+        // The fast path can fail for any of these reasons:
+        // 1. no entry has been computed yet
+        // 2. hash code collision (before or after reduction mod cache.length)
+        // 3. an entry has been removed (either on this type or another)
+        // 4. the GC has somehow managed to delete e.version and clear the reference
+        return getFromBackup(cache, type);
     }
 
     /**
@@ -157,83 +170,582 @@
      */
     public void remove(Class<?> type) {
         ClassValueMap map = getMap(type);
-        if (map != null) {
-            synchronized (map) {
-                map.remove(this);
+        map.removeEntry(this);
+    }
+
+    // Possible functionality for JSR 292 MR 1
+    /*public*/ void put(Class<?> type, T value) {
+        ClassValueMap map = getMap(type);
+        map.changeEntry(this, value);
+    }
+
+    /// --------
+    /// Implementation...
+    /// --------
+
+    /** Return the cache, if it exists, else a dummy empty cache. */
+    private static Entry<?>[] getCacheCarefully(Class<?> type) {
+        // racing type.classValueMap{.cacheArray} : null => new Entry[X] <=> new Entry[Y]
+        ClassValueMap map = type.classValueMap;
+        if (map == null)  return EMPTY_CACHE;
+        Entry<?>[] cache = map.getCache();
+        return cache;
+        // invariant:  returned value is safe to dereference and check for an Entry
+    }
+
+    /** Initial, one-element, empty cache used by all Class instances.  Must never be filled. */
+    private static final Entry<?>[] EMPTY_CACHE = { null };
+
+    /**
+     * Slow tail of ClassValue.get to retry at nearby locations in the cache,
+     * or take a slow lock and check the hash table.
+     * Called only if the first probe was empty or a collision.
+     * This is a separate method, so compilers can process it independently.
+     */
+    private T getFromBackup(Entry<?>[] cache, Class<?> type) {
+        Entry<T> e = probeBackupLocations(cache, this);
+        if (e != null)
+            return e.value();
+        return getFromHashMap(type);
+    }
+
+    // Hack to suppress warnings on the (T) cast, which is a no-op.
+    @SuppressWarnings("unchecked")
+    Entry<T> castEntry(Entry<?> e) { return (Entry<T>) e; }
+
+    /** Called when the fast path of get fails, and cache reprobe also fails.
+     */
+    private T getFromHashMap(Class<?> type) {
+        // The fail-safe recovery is to fall back to the underlying classValueMap.
+        ClassValueMap map = getMap(type);
+        for (;;) {
+            Entry<T> e = map.startEntry(this);
+            if (!e.isPromise())
+                return e.value();
+            try {
+                // Try to make a real entry for the promised version.
+                e = makeEntry(e.version(), computeValue(type));
+            } finally {
+                // Whether computeValue throws or returns normally,
+                // be sure to remove the empty entry.
+                e = map.finishEntry(this, e);
             }
+            if (e != null)
+                return e.value();
+            // else try again, in case a racing thread called remove (so e == null)
         }
     }
 
-    /// Implementation...
-    // FIXME: Use a data structure here similar that of ThreadLocal (7030453).
+    /** Check that e is non-null, matches this ClassValue, and is live. */
+    boolean match(Entry<?> e) {
+        // racing e.version : null (blank) => unique Version token => null (GC-ed version)
+        // non-racing this.version : v1 => v2 => ... (updates are read faithfully from volatile)
+        return (e != null && e.get() == this.version);
+        // invariant:  No false positives on version match.  Null is OK for false negative.
+        // invariant:  If version matches, then e.value is readable (final set in Entry.<init>)
+    }
+
+    /** Internal hash code for accessing Class.classValueMap.cacheArray. */
+    final int hashCodeForCache = nextHashCode.getAndAdd(HASH_INCREMENT) & HASH_MASK;
+
+    /** Value stream for hashCodeForCache.  See similar structure in ThreadLocal. */
+    private static final AtomicInteger nextHashCode = new AtomicInteger();
 
-    private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
+    /** Good for power-of-two tables.  See similar structure in ThreadLocal. */
+    private static final int HASH_INCREMENT = 0x61c88647;
+
+    /** Mask a hash code to be positive but not too large, to prevent wraparound. */
+    static final int HASH_MASK = (-1 >>> 2);
+
+    /**
+     * Private key for retrieval of this object from ClassValueMap.
+     */
+    static class Identity {
+    }
+    /**
+     * This ClassValue's identity, expressed as an opaque object.
+     * The main object {@code ClassValue.this} is incorrect since
+     * subclasses may override {@code ClassValue.equals}, which
+     * could confuse keys in the ClassValueMap.
+     */
+    final Identity identity = new Identity();
 
-    /** Slow path for {@link #get}. */
-    private T setComputedValue(Class<?> type) {
-        ClassValueMap map = getMap(type);
-        if (map == null) {
-            map = initializeMap(type);
+    /**
+     * Current version for retrieving this class value from the cache.
+     * Any number of computeValue calls can be cached in association with one version.
+     * But the version changes when a remove (on any type) is executed.
+     * A version change invalidates all cache entries for the affected ClassValue,
+     * by marking them as stale.  Stale cache entries do not force another call
+     * to computeValue, but they do require a synchronized visit to a backing map.
+     * <p>
+     * All user-visible state changes on the ClassValue take place under
+     * a lock inside the synchronized methods of ClassValueMap.
+     * Readers (of ClassValue.get) are notified of such state changes
+     * when this.version is bumped to a new token.
+     * This variable must be volatile so that an unsynchronized reader
+     * will receive the notification without delay.
+     * <p>
+     * If version were not volatile, one thread T1 could persistently hold onto
+     * a stale value this.value == V1, while while another thread T2 advances
+     * (under a lock) to this.value == V2.  This will typically be harmless,
+     * but if T1 and T2 interact causally via some other channel, such that
+     * T1's further actions are constrained (in the JMM) to happen after
+     * the V2 event, then T1's observation of V1 will be an error.
+     * <p>
+     * The practical effect of making this.version be volatile is that it cannot
+     * be hoisted out of a loop (by an optimizing JIT) or otherwise cached.
+     * Some machines may also require a barrier instruction to execute
+     * before this.version.
+     */
+    private volatile Version<T> version = new Version<>(this);
+    Version<T> version() { return version; }
+    void bumpVersion() { version = new Version<>(this); }
+    static class Version<T> {
+        private final ClassValue<T> classValue;
+        private final Entry<T> promise = new Entry<>(this);
+        Version(ClassValue<T> classValue) { this.classValue = classValue; }
+        ClassValue<T> classValue() { return classValue; }
+        Entry<T> promise() { return promise; }
+        boolean isLive() { return classValue.version() == this; }
+    }
+
+    /** One binding of a value to a class via a ClassValue.
+     *  States are:<ul>
+     *  <li> promise if value == Entry.this
+     *  <li> else dead if version == null
+     *  <li> else stale if version != classValue.version
+     *  <li> else live </ul>
+     *  Promises are never put into the cache; they only live in the
+     *  backing map while a computeValue call is in flight.
+     *  Once an entry goes stale, it can be reset at any time
+     *  into the dead state.
+     */
+    static class Entry<T> extends WeakReference<Version<T>> {
+        final Object value;  // usually of type T, but sometimes (Entry)this
+        Entry(Version<T> version, T value) {
+            super(version);
+            this.value = value;  // for a regular entry, value is of type T
         }
-        T value = computeValue(type);
-        STORE_BARRIER.lazySet(0);
-        // All stores pending from computeValue are completed.
-        synchronized (map) {
-            // Warm up the table with a null entry.
-            map.preInitializeEntry(this);
+        private void assertNotPromise() { assert(!isPromise()); }
+        /** For creating a promise. */
+        Entry(Version<T> version) {
+            super(version);
+            this.value = this;  // for a promise, value is not of type T, but Entry!
+        }
+        /** Fetch the value.  This entry must not be a promise. */
+        @SuppressWarnings("unchecked")  // if !isPromise, type is T
+        T value() { assertNotPromise(); return (T) value; }
+        boolean isPromise() { return value == this; }
+        Version<T> version() { return get(); }
+        ClassValue<T> classValueOrNull() {
+            Version<T> v = version();
+            return (v == null) ? null : v.classValue();
+        }
+        boolean isLive() {
+            Version<T> v = version();
+            if (v == null)  return false;
+            if (v.isLive())  return true;
+            clear();
+            return false;
+        }
+        Entry<T> refreshVersion(Version<T> v2) {
+            assertNotPromise();
+            @SuppressWarnings("unchecked")  // if !isPromise, type is T
+            Entry<T> e2 = new Entry<>(v2, (T) value);
+            clear();
+            // value = null -- caller must drop
+            return e2;
         }
-        STORE_BARRIER.lazySet(0);
-        // All stores pending from table expansion are completed.
-        synchronized (map) {
-            value = (T) map.initializeEntry(this, value);
-            // One might fear a possible race condition here
-            // if the code for map.put has flushed the write
-            // to map.table[*] before the writes to the Map.Entry
-            // are done.  This is not possible, since we have
-            // warmed up the table with an empty entry.
+        static final Entry<?> DEAD_ENTRY = new Entry<>(null, null);
+    }
+
+    /** Return the backing map associated with this type. */
+    private static ClassValueMap getMap(Class<?> type) {
+        // racing type.classValueMap : null (blank) => unique ClassValueMap
+        // if a null is observed, a map is created (lazily, synchronously, uniquely)
+        // all further access to that map is synchronized
+        ClassValueMap map = type.classValueMap;
+        if (map != null)  return map;
+        return initializeMap(type);
+    }
+
+    private static final Object CRITICAL_SECTION = new Object();
+    private static ClassValueMap initializeMap(Class<?> type) {
+        ClassValueMap map;
+        synchronized (CRITICAL_SECTION) {  // private object to avoid deadlocks
+            // happens about once per type
+            if ((map = type.classValueMap) == null)
+                type.classValueMap = map = new ClassValueMap(type);
         }
-        return value;
+            return map;
+        }
+
+    static <T> Entry<T> makeEntry(Version<T> explicitVersion, T value) {
+        // Note that explicitVersion might be different from this.version.
+        return new Entry<>(explicitVersion, value);
+
+        // As soon as the Entry is put into the cache, the value will be
+        // reachable via a data race (as defined by the Java Memory Model).
+        // This race is benign, assuming the value object itself can be
+        // read safely by multiple threads.  This is up to the user.
+        //
+        // The entry and version fields themselves can be safely read via
+        // a race because they are either final or have controlled states.
+        // If the pointer from the entry to the version is still null,
+        // or if the version goes immediately dead and is nulled out,
+        // the reader will take the slow path and retry under a lock.
     }
 
-    // Replace this map by a per-class slot.
-    private static final WeakHashMap<Class<?>, ClassValueMap> ROOT
-        = new WeakHashMap<Class<?>, ClassValueMap>();
+    // The following class could also be top level and non-public:
+
+    /** A backing map for all ClassValues, relative a single given type.
+     *  Gives a fully serialized "true state" for each pair (ClassValue cv, Class type).
+     *  Also manages an unserialized fast-path cache.
+     */
+    static class ClassValueMap extends WeakHashMap<ClassValue.Identity, Entry<?>> {
+        private final Class<?> type;
+        private Entry<?>[] cacheArray;
+        private int cacheLoad, cacheLoadLimit;
+
+        /** Number of entries initially allocated to each type when first used with any ClassValue.
+         *  It would be pointless to make this much smaller than the Class and ClassValueMap objects themselves.
+         *  Must be a power of 2.
+         */
+        private static final int INITIAL_ENTRIES = 32;
+
+        /** Build a backing map for ClassValues, relative the given type.
+         *  Also, create an empty cache array and install it on the class.
+         */
+        ClassValueMap(Class<?> type) {
+            this.type = type;
+            sizeCache(INITIAL_ENTRIES);
+        }
+
+        Entry<?>[] getCache() { return cacheArray; }
 
-    private static ClassValueMap getMap(Class<?> type) {
-        type.getClass();  // test for null
-        return ROOT.get(type);
-    }
-
-    private static ClassValueMap initializeMap(Class<?> type) {
-        synchronized (ClassValue.class) {
-            ClassValueMap map = ROOT.get(type);
-            if (map == null)
-                ROOT.put(type, map = new ClassValueMap());
-            return map;
+        /** Initiate a query.  Store a promise (placeholder) if there is no value yet. */
+        synchronized
+        <T> Entry<T> startEntry(ClassValue<T> classValue) {
+            @SuppressWarnings("unchecked")  // one map has entries for all value types <T>
+            Entry<T> e = (Entry<T>) get(classValue.identity);
+            Version<T> v = classValue.version();
+            if (e == null) {
+                e = v.promise();
+                // The presence of a promise means that a value is pending for v.
+                // Eventually, finishEntry will overwrite the promise.
+                put(classValue.identity, e);
+                // Note that the promise is never entered into the cache!
+                return e;
+            } else if (e.isPromise()) {
+                // Somebody else has asked the same question.
+                // Let the races begin!
+                if (e.version() != v) {
+                    e = v.promise();
+                    put(classValue.identity, e);
+                }
+                return e;
+            } else {
+                // there is already a completed entry here; report it
+                if (e.version() != v) {
+                    // There is a stale but valid entry here; make it fresh again.
+                    // Once an entry is in the hash table, we don't care what its version is.
+                    e = e.refreshVersion(v);
+                    put(classValue.identity, e);
+                }
+                // Add to the cache, to enable the fast path, next time.
+                checkCacheLoad();
+                addToCache(classValue, e);
+                return e;
+            }
         }
-    }
 
-    static class ClassValueMap extends WeakHashMap<ClassValue, Object> {
-        /** Make sure this table contains an Entry for the given key, even if it is empty. */
-        void preInitializeEntry(ClassValue key) {
-            if (!this.containsKey(key))
-                this.put(key, null);
+        /** Finish a query.  Overwrite a matching placeholder.  Drop stale incoming values. */
+        synchronized
+        <T> Entry<T> finishEntry(ClassValue<T> classValue, Entry<T> e) {
+            @SuppressWarnings("unchecked")  // one map has entries for all value types <T>
+            Entry<T> e0 = (Entry<T>) get(classValue.identity);
+            if (e == e0) {
+                // We can get here during exception processing, unwinding from computeValue.
+                assert(e.isPromise());
+                remove(classValue.identity);
+                return null;
+            } else if (e0 != null && e0.isPromise() && e0.version() == e.version()) {
+                // If e0 matches the intended entry, there has not been a remove call
+                // between the previous startEntry and now.  So now overwrite e0.
+                Version<T> v = classValue.version();
+                if (e.version() != v)
+                    e = e.refreshVersion(v);
+                put(classValue.identity, e);
+                // Add to the cache, to enable the fast path, next time.
+                checkCacheLoad();
+                addToCache(classValue, e);
+                return e;
+            } else {
+                // Some sort of mismatch; caller must try again.
+                return null;
+            }
+        }
+
+        /** Remove an entry. */
+        synchronized
+        void removeEntry(ClassValue<?> classValue) {
+            // make all cache elements for this guy go stale:
+            if (remove(classValue.identity) != null) {
+                classValue.bumpVersion();
+                removeStaleEntries(classValue);
+            }
         }
-        /** Make sure this table contains a non-empty Entry for the given key. */
-        Object initializeEntry(ClassValue key, Object value) {
-            Object prior = this.get(key);
-            if (prior != null) {
-                return unmaskNull(prior);
+
+        /** Change the value for an entry. */
+        synchronized
+        <T> void changeEntry(ClassValue<T> classValue, T value) {
+            @SuppressWarnings("unchecked")  // one map has entries for all value types <T>
+            Entry<T> e0 = (Entry<T>) get(classValue.identity);
+            Version<T> version = classValue.version();
+            if (e0 != null) {
+                if (e0.version() == version && e0.value() == value)
+                    // no value change => no version change needed
+                    return;
+                classValue.bumpVersion();
+                removeStaleEntries(classValue);
             }
-            this.put(key, maskNull(value));
-            return value;
+            Entry<T> e = makeEntry(version, value);
+            put(classValue.identity, e);
+            // Add to the cache, to enable the fast path, next time.
+            checkCacheLoad();
+            addToCache(classValue, e);
+        }
+
+        /// --------
+        /// Cache management.
+        /// --------
+
+        // Statics do not need synchronization.
+
+        /** Load the cache entry at the given (hashed) location. */
+        static Entry<?> loadFromCache(Entry<?>[] cache, int i) {
+            // non-racing cache.length : constant
+            // racing cache[i & (mask)] : null <=> Entry
+            return cache[i & (cache.length-1)];
+            // invariant:  returned value is null or well-constructed (ready to match)
+        }
+
+        /** Look in the cache, at the home location for the given ClassValue. */
+        static <T> Entry<T> probeHomeLocation(Entry<?>[] cache, ClassValue<T> classValue) {
+            return classValue.castEntry(loadFromCache(cache, classValue.hashCodeForCache));
+        }
+
+        /** Given that first probe was a collision, retry at nearby locations. */
+        static <T> Entry<T> probeBackupLocations(Entry<?>[] cache, ClassValue<T> classValue) {
+            if (PROBE_LIMIT <= 0)  return null;
+            // Probe the cache carefully, in a range of slots.
+            int mask = (cache.length-1);
+            int home = (classValue.hashCodeForCache & mask);
+            Entry<?> e2 = cache[home];  // victim, if we find the real guy
+            if (e2 == null) {
+                return null;   // if nobody is at home, no need to search nearby
+            }
+            // assume !classValue.match(e2), but do not assert, because of races
+            int pos2 = -1;
+            for (int i = home + 1; i < home + PROBE_LIMIT; i++) {
+                Entry<?> e = cache[i & mask];
+                if (e == null) {
+                    break;   // only search within non-null runs
+                }
+                if (classValue.match(e)) {
+                    // relocate colliding entry e2 (from cache[home]) to first empty slot
+                    cache[home] = e;
+                    if (pos2 >= 0) {
+                        cache[i & mask] = Entry.DEAD_ENTRY;
+                    } else {
+                        pos2 = i;
+                    }
+                    cache[pos2 & mask] = ((entryDislocation(cache, pos2, e2) < PROBE_LIMIT)
+                                          ? e2                  // put e2 here if it fits
+                                          : Entry.DEAD_ENTRY);
+                    return classValue.castEntry(e);
+                }
+                // Remember first empty slot, if any:
+                if (!e.isLive() && pos2 < 0)  pos2 = i;
+            }
+            return null;
         }
 
-        Object maskNull(Object x) {
-            return x == null ? this : x;
+        /** How far out of place is e? */
+        private static int entryDislocation(Entry<?>[] cache, int pos, Entry<?> e) {
+            ClassValue<?> cv = e.classValueOrNull();
+            if (cv == null)  return 0;  // entry is not live!
+            int mask = (cache.length-1);
+            return (pos - cv.hashCodeForCache) & mask;
+        }
+
+        /// --------
+        /// Below this line all functions are private, and assume synchronized access.
+        /// --------
+
+        private void sizeCache(int length) {
+            assert((length & (length-1)) == 0);  // must be power of 2
+            cacheLoad = 0;
+            cacheLoadLimit = (int) ((double) length * CACHE_LOAD_LIMIT / 100);
+            cacheArray = new Entry<?>[length];
+        }
+
+        /** Make sure the cache load stays below its limit, if possible. */
+        private void checkCacheLoad() {
+            if (cacheLoad >= cacheLoadLimit) {
+                reduceCacheLoad();
+            }
+        }
+        private void reduceCacheLoad() {
+            removeStaleEntries();
+            if (cacheLoad < cacheLoadLimit)
+                return;  // win
+            Entry<?>[] oldCache = getCache();
+            if (oldCache.length > HASH_MASK)
+                return;  // lose
+            sizeCache(oldCache.length * 2);
+            for (Entry<?> e : oldCache) {
+                if (e != null && e.isLive()) {
+                    addToCache(e);
+                }
+            }
+        }
+
+        /** Remove stale entries in the given range.
+         *  Should be executed under a Map lock.
+         */
+        private void removeStaleEntries(Entry<?>[] cache, int begin, int count) {
+            if (PROBE_LIMIT <= 0)  return;
+            int mask = (cache.length-1);
+            int removed = 0;
+            for (int i = begin; i < begin + count; i++) {
+                Entry<?> e = cache[i & mask];
+                if (e == null || e.isLive())
+                    continue;  // skip null and live entries
+                Entry<?> replacement = null;
+                if (PROBE_LIMIT > 1) {
+                    // avoid breaking up a non-null run
+                    replacement = findReplacement(cache, i);
+                }
+                cache[i & mask] = replacement;
+                if (replacement == null)  removed += 1;
+            }
+            cacheLoad = Math.max(0, cacheLoad - removed);
         }
-        Object unmaskNull(Object x) {
-            return x == this ? null : x;
+
+        /** Clearing a cache slot risks disconnecting following entries
+         *  from the head of a non-null run, which would allow them
+         *  to be found via reprobes.  Find an entry after cache[begin]
+         *  to plug into the hole, or return null if none is needed.
+         */
+        private Entry<?> findReplacement(Entry<?>[] cache, int home1) {
+            Entry<?> replacement = null;
+            int haveReplacement = -1, replacementPos = 0;
+            int mask = (cache.length-1);
+            for (int i2 = home1 + 1; i2 < home1 + PROBE_LIMIT; i2++) {
+                Entry<?> e2 = cache[i2 & mask];
+                if (e2 == null)  break;  // End of non-null run.
+                if (!e2.isLive())  continue;  // Doomed anyway.
+                int dis2 = entryDislocation(cache, i2, e2);
+                if (dis2 == 0)  continue;  // e2 already optimally placed
+                int home2 = i2 - dis2;
+                if (home2 <= home1) {
+                    // e2 can replace entry at cache[home1]
+                    if (home2 == home1) {
+                        // Put e2 exactly where he belongs.
+                        haveReplacement = 1;
+                        replacementPos = i2;
+                        replacement = e2;
+                    } else if (haveReplacement <= 0) {
+                        haveReplacement = 0;
+                        replacementPos = i2;
+                        replacement = e2;
+                    }
+                    // And keep going, so we can favor larger dislocations.
+                }
+            }
+            if (haveReplacement >= 0) {
+                if (cache[(replacementPos+1) & mask] != null) {
+                    // Be conservative, to avoid breaking up a non-null run.
+                    cache[replacementPos & mask] = (Entry<?>) Entry.DEAD_ENTRY;
+                } else {
+                    cache[replacementPos & mask] = null;
+                    cacheLoad -= 1;
+                }
+            }
+            return replacement;
+        }
+
+        /** Remove stale entries in the range near classValue. */
+        private void removeStaleEntries(ClassValue<?> classValue) {
+            removeStaleEntries(getCache(), classValue.hashCodeForCache, PROBE_LIMIT);
+        }
+
+        /** Remove all stale entries, everywhere. */
+        private void removeStaleEntries() {
+            Entry[] cache = getCache();
+            removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1);
         }
+
+        /** Add the given entry to the cache, in its home location, unless it is out of date. */
+        private <T> void addToCache(Entry<T> e) {
+            ClassValue<T> classValue = e.classValueOrNull();
+            if (classValue != null)
+                addToCache(classValue, e);
+        }
+
+        /** Add the given entry to the cache, in its home location. */
+        private <T> void addToCache(ClassValue<T> classValue, Entry<T> e) {
+            if (PROBE_LIMIT <= 0)  return;  // do not fill cache
+            // Add e to the cache.
+            Entry<?>[] cache = getCache();
+            int mask = (cache.length-1);
+            int home = classValue.hashCodeForCache & mask;
+            Entry<?> e2 = placeInCache(cache, home, e, false);
+            if (e2 == null)  return;  // done
+            if (PROBE_LIMIT > 1) {
+                // try to move e2 somewhere else in his probe range
+                int dis2 = entryDislocation(cache, home, e2);
+                int home2 = home - dis2;
+                for (int i2 = home2; i2 < home2 + PROBE_LIMIT; i2++) {
+                    if (placeInCache(cache, i2 & mask, e2, true) == null) {
+                        return;
+                    }
+                }
+            }
+            // Note:  At this point, e2 is just dropped from the cache.
+        }
+
+        /** Store the given entry.  Update cacheLoad, and return any live victim.
+         *  'Gently' means return self rather than dislocating a live victim.
+         */
+        private Entry<?> placeInCache(Entry<?>[] cache, int pos, Entry<?> e, boolean gently) {
+            Entry<?> e2 = overwrittenEntry(cache[pos]);
+            if (gently && e2 != null) {
+                // do not overwrite a live entry
+                return e;
+            } else {
+                cache[pos] = e;
+                return e2;
+            }
+        }
+
+        /** Note an entry that is about to be overwritten.
+         *  If it is not live, quietly replace it by null.
+         *  If it is an actual null, increment cacheLoad,
+         *  because the caller is going to store something
+         *  in its place.
+         */
+        private <T> Entry<T> overwrittenEntry(Entry<T> e2) {
+            if (e2 == null)  cacheLoad += 1;
+            else if (e2.isLive())  return e2;
+            return null;
+        }
+
+        /** Percent loading of cache before resize. */
+        private static final int CACHE_LOAD_LIMIT = 67;  // 0..100
+        /** Maximum number of probes to attempt. */
+        private static final int PROBE_LIMIT      =  6;       // 1..
+        // N.B.  Set PROBE_LIMIT=0 to disable all fast paths.
     }
 }
--- a/jdk/src/share/classes/java/lang/Math.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/Math.java	Thu Jan 26 19:39:08 2012 -0800
@@ -818,8 +818,9 @@
         return (a >= b) ? a : b;
     }
 
-    private static long negativeZeroFloatBits = Float.floatToIntBits(-0.0f);
-    private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d);
+    // Use raw bit-wise conversions on guaranteed non-NaN arguments.
+    private static long negativeZeroFloatBits  = Float.floatToRawIntBits(-0.0f);
+    private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
 
     /**
      * Returns the greater of two {@code float} values.  That is,
@@ -836,9 +837,12 @@
      * @return  the larger of {@code a} and {@code b}.
      */
     public static float max(float a, float b) {
-        if (a != a) return a;   // a is NaN
-        if ((a == 0.0f) && (b == 0.0f)
-            && (Float.floatToIntBits(a) == negativeZeroFloatBits)) {
+        if (a != a)
+            return a;   // a is NaN
+        if ((a == 0.0f) &&
+            (b == 0.0f) &&
+            (Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
+            // Raw conversion ok since NaN can't map to -0.0.
             return b;
         }
         return (a >= b) ? a : b;
@@ -859,9 +863,12 @@
      * @return  the larger of {@code a} and {@code b}.
      */
     public static double max(double a, double b) {
-        if (a != a) return a;   // a is NaN
-        if ((a == 0.0d) && (b == 0.0d)
-            && (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
+        if (a != a)
+            return a;   // a is NaN
+        if ((a == 0.0d) &&
+            (b == 0.0d) &&
+            (Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
+            // Raw conversion ok since NaN can't map to -0.0.
             return b;
         }
         return (a >= b) ? a : b;
@@ -910,9 +917,12 @@
      * @return  the smaller of {@code a} and {@code b}.
      */
     public static float min(float a, float b) {
-        if (a != a) return a;   // a is NaN
-        if ((a == 0.0f) && (b == 0.0f)
-            && (Float.floatToIntBits(b) == negativeZeroFloatBits)) {
+        if (a != a)
+            return a;   // a is NaN
+        if ((a == 0.0f) &&
+            (b == 0.0f) &&
+            (Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
+            // Raw conversion ok since NaN can't map to -0.0.
             return b;
         }
         return (a <= b) ? a : b;
@@ -933,9 +943,12 @@
      * @return  the smaller of {@code a} and {@code b}.
      */
     public static double min(double a, double b) {
-        if (a != a) return a;   // a is NaN
-        if ((a == 0.0d) && (b == 0.0d)
-            && (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) {
+        if (a != a)
+            return a;   // a is NaN
+        if ((a == 0.0d) &&
+            (b == 0.0d) &&
+            (Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
+            // Raw conversion ok since NaN can't map to -0.0.
             return b;
         }
         return (a <= b) ? a : b;
@@ -1900,7 +1913,7 @@
     /**
      * Returns a floating-point power of two in the normal range.
      */
-    public static float powerOfTwoF(int n) {
+    static float powerOfTwoF(int n) {
         assert(n >= FloatConsts.MIN_EXPONENT && n <= FloatConsts.MAX_EXPONENT);
         return Float.intBitsToFloat(((n + FloatConsts.EXP_BIAS) <<
                                      (FloatConsts.SIGNIFICAND_WIDTH-1))
--- a/jdk/src/share/classes/java/lang/Object.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/Object.java	Thu Jan 26 19:39:08 2012 -0800
@@ -58,8 +58,7 @@
      *
      * @return The {@code Class} object that represents the runtime
      *         class of this object.
-     * @see    Class Literals, section 15.8.2 of
-     *         <cite>The Java&trade; Language Specification</cite>.
+     * @jls 15.8.2 Class Literals
      */
     public final native Class<?> getClass();
 
@@ -92,7 +91,7 @@
      * objects. (This is typically implemented by converting the internal
      * address of the object into an integer, but this implementation
      * technique is not required by the
-     * Java<font size="-2"><sup>TM</sup></font> programming language.)
+     * Java&trade; programming language.)
      *
      * @return  a hash code value for this object.
      * @see     java.lang.Object#equals(java.lang.Object)
@@ -203,7 +202,7 @@
      * exception at run time.
      *
      * @return     a clone of this instance.
-     * @exception  CloneNotSupportedException  if the object's class does not
+     * @throws  CloneNotSupportedException  if the object's class does not
      *               support the {@code Cloneable} interface. Subclasses
      *               that override the {@code clone} method can also
      *               throw this exception to indicate that an instance cannot
@@ -264,7 +263,7 @@
      * <p>
      * Only one thread at a time can own an object's monitor.
      *
-     * @exception  IllegalMonitorStateException  if the current thread is not
+     * @throws  IllegalMonitorStateException  if the current thread is not
      *               the owner of this object's monitor.
      * @see        java.lang.Object#notifyAll()
      * @see        java.lang.Object#wait()
@@ -288,7 +287,7 @@
      * description of the ways in which a thread can become the owner of
      * a monitor.
      *
-     * @exception  IllegalMonitorStateException  if the current thread is not
+     * @throws  IllegalMonitorStateException  if the current thread is not
      *               the owner of this object's monitor.
      * @see        java.lang.Object#notify()
      * @see        java.lang.Object#wait()
@@ -368,11 +367,11 @@
      * a monitor.
      *
      * @param      timeout   the maximum time to wait in milliseconds.
-     * @exception  IllegalArgumentException      if the value of timeout is
+     * @throws  IllegalArgumentException      if the value of timeout is
      *               negative.
-     * @exception  IllegalMonitorStateException  if the current thread is not
+     * @throws  IllegalMonitorStateException  if the current thread is not
      *               the owner of the object's monitor.
-     * @exception  InterruptedException if any thread interrupted the
+     * @throws  InterruptedException if any thread interrupted the
      *             current thread before or while the current thread
      *             was waiting for a notification.  The <i>interrupted
      *             status</i> of the current thread is cleared when
@@ -433,12 +432,12 @@
      * @param      timeout   the maximum time to wait in milliseconds.
      * @param      nanos      additional time, in nanoseconds range
      *                       0-999999.
-     * @exception  IllegalArgumentException      if the value of timeout is
+     * @throws  IllegalArgumentException      if the value of timeout is
      *                      negative or the value of nanos is
      *                      not in the range 0-999999.
-     * @exception  IllegalMonitorStateException  if the current thread is not
+     * @throws  IllegalMonitorStateException  if the current thread is not
      *               the owner of this object's monitor.
-     * @exception  InterruptedException if any thread interrupted the
+     * @throws  InterruptedException if any thread interrupted the
      *             current thread before or while the current thread
      *             was waiting for a notification.  The <i>interrupted
      *             status</i> of the current thread is cleared when
@@ -489,9 +488,9 @@
      * description of the ways in which a thread can become the owner of
      * a monitor.
      *
-     * @exception  IllegalMonitorStateException  if the current thread is not
+     * @throws  IllegalMonitorStateException  if the current thread is not
      *               the owner of the object's monitor.
-     * @exception  InterruptedException if any thread interrupted the
+     * @throws  InterruptedException if any thread interrupted the
      *             current thread before or while the current thread
      *             was waiting for a notification.  The <i>interrupted
      *             status</i> of the current thread is cleared when
@@ -510,7 +509,7 @@
      * system resources or to perform other cleanup.
      * <p>
      * The general contract of {@code finalize} is that it is invoked
-     * if and when the Java<font size="-2"><sup>TM</sup></font> virtual
+     * if and when the Java&trade; virtual
      * machine has determined that there is no longer any
      * means by which this object can be accessed by any thread that has
      * not yet died, except as a result of an action taken by the
@@ -549,6 +548,9 @@
      * ignored.
      *
      * @throws Throwable the {@code Exception} raised by this method
+     * @see java.lang.ref.WeakReference
+     * @see java.lang.ref.PhantomReference
+     * @jls 12.6 Finalization of Class Instances
      */
     protected void finalize() throws Throwable { }
 }
--- a/jdk/src/share/classes/java/lang/StrictMath.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/StrictMath.java	Thu Jan 26 19:39:08 2012 -0800
@@ -161,6 +161,8 @@
      *          in radians.
      */
     public static strictfp double toRadians(double angdeg) {
+        // Do not delegate to Math.toRadians(angdeg) because
+        // this method has the strictfp modifier.
         return angdeg / 180.0 * PI;
     }
 
@@ -176,6 +178,8 @@
      *          in degrees.
      */
     public static strictfp double toDegrees(double angrad) {
+        // Do not delegate to Math.toDegrees(angrad) because
+        // this method has the strictfp modifier.
         return angrad * 180.0 / PI;
     }
 
@@ -708,7 +712,7 @@
      * @return  the absolute value of the argument.
      */
     public static int abs(int a) {
-        return (a < 0) ? -a : a;
+        return Math.abs(a);
     }
 
     /**
@@ -725,7 +729,7 @@
      * @return  the absolute value of the argument.
      */
     public static long abs(long a) {
-        return (a < 0) ? -a : a;
+        return Math.abs(a);
     }
 
     /**
@@ -744,7 +748,7 @@
      * @return  the absolute value of the argument.
      */
     public static float abs(float a) {
-        return (a <= 0.0F) ? 0.0F - a : a;
+        return Math.abs(a);
     }
 
     /**
@@ -763,7 +767,7 @@
      * @return  the absolute value of the argument.
      */
     public static double abs(double a) {
-        return (a <= 0.0D) ? 0.0D - a : a;
+        return Math.abs(a);
     }
 
     /**
@@ -777,7 +781,7 @@
      * @return  the larger of {@code a} and {@code b}.
      */
     public static int max(int a, int b) {
-        return (a >= b) ? a : b;
+        return Math.max(a, b);
     }
 
     /**
@@ -791,13 +795,9 @@
      * @return  the larger of {@code a} and {@code b}.
         */
     public static long max(long a, long b) {
-        return (a >= b) ? a : b;
+        return Math.max(a, b);
     }
 
-    // Use raw bit-wise conversions on guaranteed non-NaN arguments.
-    private static long negativeZeroFloatBits  = Float.floatToRawIntBits(-0.0f);
-    private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
-
     /**
      * Returns the greater of two {@code float} values.  That is,
      * the result is the argument closer to positive infinity. If the
@@ -813,15 +813,7 @@
      * @return  the larger of {@code a} and {@code b}.
      */
     public static float max(float a, float b) {
-        if (a != a)
-            return a;   // a is NaN
-        if ((a == 0.0f) &&
-            (b == 0.0f) &&
-            (Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
-            // Raw conversion ok since NaN can't map to -0.0.
-            return b;
-        }
-        return (a >= b) ? a : b;
+        return Math.max(a, b);
     }
 
     /**
@@ -839,15 +831,7 @@
      * @return  the larger of {@code a} and {@code b}.
      */
     public static double max(double a, double b) {
-        if (a != a)
-            return a;   // a is NaN
-        if ((a == 0.0d) &&
-            (b == 0.0d) &&
-            (Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
-            // Raw conversion ok since NaN can't map to -0.0.
-            return b;
-        }
-        return (a >= b) ? a : b;
+        return Math.max(a, b);
     }
 
     /**
@@ -861,7 +845,7 @@
      * @return  the smaller of {@code a} and {@code b}.
      */
     public static int min(int a, int b) {
-        return (a <= b) ? a : b;
+        return Math.min(a, b);
     }
 
     /**
@@ -875,7 +859,7 @@
      * @return  the smaller of {@code a} and {@code b}.
      */
     public static long min(long a, long b) {
-        return (a <= b) ? a : b;
+        return Math.min(a, b);
     }
 
     /**
@@ -893,15 +877,7 @@
      * @return  the smaller of {@code a} and {@code b.}
      */
     public static float min(float a, float b) {
-        if (a != a)
-            return a;   // a is NaN
-        if ((a == 0.0f) &&
-            (b == 0.0f) &&
-            (Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
-            // Raw conversion ok since NaN can't map to -0.0.
-            return b;
-        }
-        return (a <= b) ? a : b;
+        return Math.min(a, b);
     }
 
     /**
@@ -919,15 +895,7 @@
      * @return  the smaller of {@code a} and {@code b}.
      */
     public static double min(double a, double b) {
-        if (a != a)
-            return a;   // a is NaN
-        if ((a == 0.0d) &&
-            (b == 0.0d) &&
-            (Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
-            // Raw conversion ok since NaN can't map to -0.0.
-            return b;
-        }
-        return (a <= b) ? a : b;
+        return Math.min(a, b);
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/Throwable.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Thu Jan 26 19:39:08 2012 -0800
@@ -625,7 +625,7 @@
      *          at Resource2.close(Resource2.java:20)
      *          at Foo4.main(Foo4.java:5)
      *  Caused by: java.lang.Exception: Rats, you caught me
-     *          at Resource2$CloseFailException.<init>(Resource2.java:45)
+     *          at Resource2$CloseFailException.&lt;init&gt;(Resource2.java:45)
      *          ... 2 more
      * </pre>
      */
--- a/jdk/src/share/classes/java/lang/invoke/AdapterMethodHandle.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/invoke/AdapterMethodHandle.java	Thu Jan 26 19:39:08 2012 -0800
@@ -378,6 +378,7 @@
     }
 
     /** Construct an adapter conversion descriptor for a single-argument conversion. */
+    @SuppressWarnings("cast")  // some (int) casts below provide clarity but trigger warnings
     private static long makeConv(int convOp, int argnum, int src, int dest) {
         assert(src  == (src  & CONV_TYPE_MASK));
         assert(dest == (dest & CONV_TYPE_MASK));
@@ -390,6 +391,7 @@
                 insertStackMove(stackMove)
                 );
     }
+    @SuppressWarnings("cast")  // some (int) casts below provide clarity but trigger warnings
     private static long makeDupConv(int convOp, int argnum, int stackMove) {
         // simple argument motion, requiring one slot to specify
         assert(convOp == OP_DUP_ARGS || convOp == OP_DROP_ARGS);
@@ -401,6 +403,7 @@
                 insertStackMove(stackMove)
                 );
     }
+    @SuppressWarnings("cast")  // some (int) casts below provide clarity but trigger warnings
     private static long makeSwapConv(int convOp, int srcArg, byte srcType, int destSlot, byte destType) {
         // more complex argument motion, requiring two slots to specify
         assert(convOp == OP_SWAP_ARGS || convOp == OP_ROT_ARGS);
@@ -411,6 +414,7 @@
                 (int)  destSlot << CONV_VMINFO_SHIFT
                 );
     }
+    @SuppressWarnings("cast")  // some (int) casts below provide clarity but trigger warnings
     private static long makeSpreadConv(int convOp, int argnum, int src, int dest, int stackMove) {
         // spreading or collecting, at a particular slot location
         assert(convOp == OP_SPREAD_ARGS || convOp == OP_COLLECT_ARGS || convOp == OP_FOLD_ARGS);
--- a/jdk/src/share/classes/java/lang/invoke/MemberName.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/invoke/MemberName.java	Thu Jan 26 19:39:08 2012 -0800
@@ -353,7 +353,7 @@
         assert(isResolved());
     }
     /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
-    public MemberName(Constructor ctor) {
+    public MemberName(Constructor<?> ctor) {
         Object[] typeInfo = { void.class, ctor.getParameterTypes() };
         init(ctor.getDeclaringClass(), CONSTRUCTOR_NAME, typeInfo, flagsMods(IS_CONSTRUCTOR, ctor.getModifiers()));
         // fill in vmtarget, vmindex while we have ctor in hand:
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Thu Jan 26 19:39:08 2012 -0800
@@ -275,7 +275,7 @@
  * generates a single invokevirtual instruction with
  * the symbolic type descriptor indicated in the following comment.
  * In these examples, the helper method {@code assertEquals} is assumed to
- * be a method which calls {@link Objects.equals java.util.Objects#equals}
+ * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
  * on its arguments, and asserts that the result is true.
  *
  * <h3>Exceptions</h3>
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -112,7 +112,7 @@
         assert(cookedConstructor.type().equals(ctype));
         ctype = ctype.dropParameterTypes(0, 1);
         cookedConstructor = AdapterMethodHandle.makeCollectArguments(cookedConstructor, returner, 0, true);
-        MethodHandle allocator = new AllocateObject(allocateClass);
+        AllocateObject allocator = new AllocateObject(allocateClass);
         // allocate() => new C(void)
         assert(allocator.type().equals(MethodType.methodType(allocateClass)));
         ctype = ctype.dropParameterTypes(0, 1);
@@ -120,19 +120,19 @@
         return fold;
     }
 
-    static final class AllocateObject<C> extends BoundMethodHandle {
+    static final class AllocateObject /*<C>*/ extends BoundMethodHandle {
         private static final Unsafe unsafe = Unsafe.getUnsafe();
 
-        private final Class<C> allocateClass;
+        private final Class<?> /*<C>*/ allocateClass;
 
         // for allocation only:
-        private AllocateObject(Class<C> allocateClass) {
+        private AllocateObject(Class<?> /*<C>*/ allocateClass) {
             super(ALLOCATE.asType(MethodType.methodType(allocateClass, AllocateObject.class)));
             this.allocateClass = allocateClass;
         }
         @SuppressWarnings("unchecked")
-        private C allocate() throws InstantiationException {
-            return (C) unsafe.allocateInstance(allocateClass);
+        private Object /*C*/ allocate() throws InstantiationException {
+            return unsafe.allocateInstance(allocateClass);
         }
         static final MethodHandle ALLOCATE;
         static {
@@ -148,8 +148,8 @@
     MethodHandle accessField(MemberName member, boolean isSetter,
                              Class<?> lookupClass) {
         // Use sun. misc.Unsafe to dig up the dirt on the field.
-        MethodHandle mh = new FieldAccessor(member, isSetter);
-        return mh;
+        FieldAccessor accessor = new FieldAccessor(member, isSetter);
+        return accessor;
     }
 
     static
@@ -175,7 +175,7 @@
         return mhs[isSetter ? 1 : 0];
     }
 
-    static final class FieldAccessor<C,V> extends BoundMethodHandle {
+    static final class FieldAccessor /*<C,V>*/ extends BoundMethodHandle {
         private static final Unsafe unsafe = Unsafe.getUnsafe();
         final Object base;  // for static refs only
         final long offset;
@@ -190,26 +190,24 @@
         @Override
         String debugString() { return addTypeString(name, this); }
 
-        int getFieldI(C obj) { return unsafe.getInt(obj, offset); }
-        void setFieldI(C obj, int x) { unsafe.putInt(obj, offset, x); }
-        long getFieldJ(C obj) { return unsafe.getLong(obj, offset); }
-        void setFieldJ(C obj, long x) { unsafe.putLong(obj, offset, x); }
-        float getFieldF(C obj) { return unsafe.getFloat(obj, offset); }
-        void setFieldF(C obj, float x) { unsafe.putFloat(obj, offset, x); }
-        double getFieldD(C obj) { return unsafe.getDouble(obj, offset); }
-        void setFieldD(C obj, double x) { unsafe.putDouble(obj, offset, x); }
-        boolean getFieldZ(C obj) { return unsafe.getBoolean(obj, offset); }
-        void setFieldZ(C obj, boolean x) { unsafe.putBoolean(obj, offset, x); }
-        byte getFieldB(C obj) { return unsafe.getByte(obj, offset); }
-        void setFieldB(C obj, byte x) { unsafe.putByte(obj, offset, x); }
-        short getFieldS(C obj) { return unsafe.getShort(obj, offset); }
-        void setFieldS(C obj, short x) { unsafe.putShort(obj, offset, x); }
-        char getFieldC(C obj) { return unsafe.getChar(obj, offset); }
-        void setFieldC(C obj, char x) { unsafe.putChar(obj, offset, x); }
-        @SuppressWarnings("unchecked")
-        V getFieldL(C obj) { return (V) unsafe.getObject(obj, offset); }
-        @SuppressWarnings("unchecked")
-        void setFieldL(C obj, V x) { unsafe.putObject(obj, offset, x); }
+        int getFieldI(Object /*C*/ obj) { return unsafe.getInt(obj, offset); }
+        void setFieldI(Object /*C*/ obj, int x) { unsafe.putInt(obj, offset, x); }
+        long getFieldJ(Object /*C*/ obj) { return unsafe.getLong(obj, offset); }
+        void setFieldJ(Object /*C*/ obj, long x) { unsafe.putLong(obj, offset, x); }
+        float getFieldF(Object /*C*/ obj) { return unsafe.getFloat(obj, offset); }
+        void setFieldF(Object /*C*/ obj, float x) { unsafe.putFloat(obj, offset, x); }
+        double getFieldD(Object /*C*/ obj) { return unsafe.getDouble(obj, offset); }
+        void setFieldD(Object /*C*/ obj, double x) { unsafe.putDouble(obj, offset, x); }
+        boolean getFieldZ(Object /*C*/ obj) { return unsafe.getBoolean(obj, offset); }
+        void setFieldZ(Object /*C*/ obj, boolean x) { unsafe.putBoolean(obj, offset, x); }
+        byte getFieldB(Object /*C*/ obj) { return unsafe.getByte(obj, offset); }
+        void setFieldB(Object /*C*/ obj, byte x) { unsafe.putByte(obj, offset, x); }
+        short getFieldS(Object /*C*/ obj) { return unsafe.getShort(obj, offset); }
+        void setFieldS(Object /*C*/ obj, short x) { unsafe.putShort(obj, offset, x); }
+        char getFieldC(Object /*C*/ obj) { return unsafe.getChar(obj, offset); }
+        void setFieldC(Object /*C*/ obj, char x) { unsafe.putChar(obj, offset, x); }
+        Object /*V*/ getFieldL(Object /*C*/ obj) { return unsafe.getObject(obj, offset); }
+        void setFieldL(Object /*C*/ obj, Object /*V*/ x) { unsafe.putObject(obj, offset, x); }
         // cast (V) is OK here, since we wrap convertArguments around the MH.
 
         static Object staticBase(final MemberName field) {
@@ -244,8 +242,9 @@
         void setStaticS(short x) { unsafe.putShort(base, offset, x); }
         char getStaticC() { return unsafe.getChar(base, offset); }
         void setStaticC(char x) { unsafe.putChar(base, offset, x); }
-        V getStaticL() { return (V) unsafe.getObject(base, offset); }
-        void setStaticL(V x) { unsafe.putObject(base, offset, x); }
+        @SuppressWarnings("unchecked")  // (V) is for internal clarity but triggers warning
+        Object /*V*/ getStaticL() { return unsafe.getObject(base, offset); }
+        void setStaticL(Object /*V*/ x) { unsafe.putObject(base, offset, x); }
 
         static String fname(Class<?> vclass, boolean isSetter, boolean isStatic) {
             String stem;
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java	Thu Jan 26 19:39:08 2012 -0800
@@ -150,7 +150,7 @@
         }
         return intfc.cast(Proxy.newProxyInstance(
                 intfc.getClassLoader(),
-                new Class[]{ intfc, WrapperInstance.class },
+                new Class<?>[]{ intfc, WrapperInstance.class },
                 new InvocationHandler() {
                     private Object getArg(String name) {
                         if ((Object)name == "getWrapperInstanceTarget")  return target;
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Jan 26 19:39:08 2012 -0800
@@ -948,10 +948,11 @@
         public MethodHandle unreflect(Method m) throws IllegalAccessException {
             MemberName method = new MemberName(m);
             assert(method.isMethod());
-            if (!m.isAccessible())  checkMethod(method.getDeclaringClass(), method, method.isStatic());
+            if (m.isAccessible())
+                return MethodHandleImpl.findMethod(method, true, /*no lookupClass*/ null);
+            checkMethod(method.getDeclaringClass(), method, method.isStatic());
             MethodHandle mh = MethodHandleImpl.findMethod(method, true, lookupClassOrNull());
-            if (!m.isAccessible())  mh = restrictProtectedReceiver(method, mh);
-            return mh;
+            return restrictProtectedReceiver(method, mh);
         }
 
         /**
@@ -1006,11 +1007,17 @@
          *                                is set and {@code asVarargsCollector} fails
          * @throws NullPointerException if the argument is null
          */
+        @SuppressWarnings("rawtypes")  // Will be Constructor<?> after JSR 292 MR
         public MethodHandle unreflectConstructor(Constructor c) throws IllegalAccessException {
             MemberName ctor = new MemberName(c);
             assert(ctor.isConstructor());
-            if (!c.isAccessible())  checkAccess(c.getDeclaringClass(), ctor);
-            MethodHandle rawCtor = MethodHandleImpl.findMethod(ctor, false, lookupClassOrNull());
+            MethodHandle rawCtor;
+            if (c.isAccessible()) {
+                rawCtor = MethodHandleImpl.findMethod(ctor, false, /*no lookupClass*/ null);
+            } else {
+                checkAccess(c.getDeclaringClass(), ctor);
+                rawCtor = MethodHandleImpl.findMethod(ctor, false, lookupClassOrNull());
+            }
             MethodHandle allocator = MethodHandleImpl.makeAllocator(rawCtor);
             return fixVarargs(allocator, rawCtor);
         }
@@ -1225,7 +1232,7 @@
                                                 ? "expected a static field"
                                                 : "expected a non-static field", this);
             if (trusted)
-                return MethodHandleImpl.accessField(field, isSetter, lookupClassOrNull());
+                return MethodHandleImpl.accessField(field, isSetter, /*no lookupClass*/ null);
             checkAccess(refc, field);
             MethodHandle mh = MethodHandleImpl.accessField(field, isSetter, lookupClassOrNull());
             return restrictProtectedReceiver(field, mh);
--- a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java	Thu Jan 26 19:39:08 2012 -0800
@@ -92,7 +92,7 @@
             (System.getSecurityManager() == null))
         {
             BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
-            if (!followLinks || !cached.isSymbolicLink())
+            if (cached != null && (!followLinks || !cached.isSymbolicLink()))
                 attrs = cached;
         }
         IOException exc = null;
--- a/jdk/src/share/classes/java/nio/file/Files.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/nio/file/Files.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1431,7 +1431,7 @@
      * <li>It is <i>transitive</i>: for three {@code Paths}
      *     {@code f}, {@code g}, and {@code h}, if {@code isSameFile(f,g)} returns
      *     {@code true} and {@code isSameFile(g,h)} returns {@code true}, then
-     *     {@code isSameFile(g,h)} will return return {@code true}.
+     *     {@code isSameFile(f,h)} will return return {@code true}.
      * </ul>
      *
      * @param   path
--- a/jdk/src/share/classes/java/nio/file/Path.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/java/nio/file/Path.java	Thu Jan 26 19:39:08 2012 -0800
@@ -72,7 +72,7 @@
  * directory and is UTF-8 encoded.
  * <pre>
  *     Path path = FileSystems.getDefault().getPath("logs", "access.log");
- *     BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
+ *     BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
  * </pre>
  *
  * <a name="interop"><h4>Interoperability</h4></a>
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1932,20 +1932,22 @@
             else {
                 Rectangle   beginRect = getPathBounds(tree, getPathForRow
                                                       (tree, beginRow));
-                Rectangle   visRect = tree.getVisibleRect();
-                Rectangle   testRect = beginRect;
-                int         beginY = beginRect.y;
-                int         maxY = beginY + visRect.height;
-
-                for(int counter = beginRow + 1; counter <= endRow; counter++) {
-                    testRect = getPathBounds(tree,
-                                             getPathForRow(tree, counter));
-                    if((testRect.y + testRect.height) > maxY)
-                        counter = endRow;
+                if (beginRect != null) {
+                    Rectangle   visRect = tree.getVisibleRect();
+                    Rectangle   testRect = beginRect;
+                    int         beginY = beginRect.y;
+                    int         maxY = beginY + visRect.height;
+
+                    for(int counter = beginRow + 1; counter <= endRow; counter++) {
+                            testRect = getPathBounds(tree,
+                                    getPathForRow(tree, counter));
+                        if((testRect.y + testRect.height) > maxY)
+                                counter = endRow;
+                            }
+                        tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1,
+                                                      testRect.y + testRect.height-
+                                                      beginY));
                 }
-                tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1,
-                                                  testRect.y + testRect.height-
-                                                  beginY));
             }
         }
     }
@@ -3485,7 +3487,7 @@
             }
 
             Rectangle bounds = getPathBounds(tree, path);
-            if (y > (bounds.y + bounds.height)) {
+            if (bounds == null || y > (bounds.y + bounds.height)) {
                 return false;
             }
 
--- a/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Thu Jan 26 19:39:08 2012 -0800
@@ -55,9 +55,9 @@
     private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
 
     private static EnumMap<Wrapper, MethodHandle>[] newWrapperCaches(int n) {
-        @SuppressWarnings("unchecked")
+        @SuppressWarnings("unchecked")  // generic array creation
         EnumMap<Wrapper, MethodHandle>[] caches
-                = (EnumMap<Wrapper, MethodHandle>[]) new EnumMap[n];  // unchecked warning expected here
+                = (EnumMap<Wrapper, MethodHandle>[]) new EnumMap<?,?>[n];
         for (int i = 0; i < n; i++)
             caches[i] = new EnumMap<>(Wrapper.class);
         return caches;
@@ -1097,7 +1097,7 @@
     }
 
     private static MethodHandle buildNewArray(int nargs) {
-        return MethodHandles.insertArguments(NEW_ARRAY, 0, (int) nargs);
+        return MethodHandles.insertArguments(NEW_ARRAY, 0, nargs);
     }
 
     private static final MethodHandle[] FILLERS = new MethodHandle[MAX_ARITY+1];
@@ -1122,7 +1122,7 @@
         }
         MethodHandle leftFill = filler(leftLen);  // recursive fill
         MethodHandle rightFill = FILL_ARRAYS[rightLen];
-        rightFill = MethodHandles.insertArguments(rightFill, 1, (int) leftLen);  // [leftLen..nargs-1]
+        rightFill = MethodHandles.insertArguments(rightFill, 1, leftLen);  // [leftLen..nargs-1]
 
         // Combine the two fills: right(left(newArray(nargs), x1..x20), x21..x23)
         MethodHandle mh = filler(0);  // identity function produces result
--- a/jdk/src/share/classes/sun/invoke/util/Wrapper.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/invoke/util/Wrapper.java	Thu Jan 26 19:39:08 2012 -0800
@@ -31,7 +31,7 @@
     BYTE(Byte.class, byte.class, 'B', (Byte)(byte)0, new byte[0], Format.signed(8)),
     SHORT(Short.class, short.class, 'S', (Short)(short)0, new short[0], Format.signed(16)),
     CHAR(Character.class, char.class, 'C', (Character)(char)0, new char[0], Format.unsigned(16)),
-    INT(Integer.class, int.class, 'I', (Integer)(int)0, new int[0], Format.signed(32)),
+    INT(Integer.class, int.class, 'I', (Integer)/*(int)*/0, new int[0], Format.signed(32)),
     LONG(Long.class, long.class, 'J', (Long)(long)0, new long[0], Format.signed(64)),
     FLOAT(Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)),
     DOUBLE(Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)),
@@ -539,7 +539,7 @@
         switch (basicTypeChar) {
             case 'L': throw newIllegalArgumentException("cannot wrap to object type");
             case 'V': return null;
-            case 'I': return Integer.valueOf((int)x);
+            case 'I': return Integer.valueOf(x);
             case 'J': return Long.valueOf(x);
             case 'F': return Float.valueOf(x);
             case 'D': return Double.valueOf(x);
--- a/jdk/src/share/classes/sun/management/Agent.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/Agent.java	Thu Jan 26 19:39:08 2012 -0800
@@ -216,11 +216,8 @@
                     adaptorClass.getMethod("initialize",
                         String.class, Properties.class);
             initializeMethod.invoke(null,snmpPort,props);
-        } catch (ClassNotFoundException x) {
-            // The SNMP packages are not present: throws an exception.
-            throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
-        } catch (NoSuchMethodException x) {
-            // should not happen...
+        } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException x) {
+            // snmp runtime doesn't exist - initialization fails
             throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
         } catch (InvocationTargetException x) {
             final Throwable cause = x.getCause();
@@ -230,9 +227,6 @@
                 throw (Error) cause;
             // should not happen...
             throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,cause);
-        } catch (IllegalAccessException x) {
-            // should not happen...
-            throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
         }
     }
 
@@ -273,8 +267,8 @@
                 } catch (IOException e) {
                     error(CONFIG_FILE_CLOSE_FAILED, fname);
                 }
-            }
-        }
+             }
+         }
     }
 
     public static void startAgent() throws Exception {
@@ -309,7 +303,7 @@
                 // invoke the premain(String args) method
                 Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
                 Method premain = clz.getMethod("premain",
-                                               new Class[] { String.class });
+                                               new Class<?>[] { String.class });
                 premain.invoke(null, /* static */
                                new Object[] { args });
             } catch (ClassNotFoundException ex) {
--- a/jdk/src/share/classes/sun/management/ConnectorAddressLink.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/ConnectorAddressLink.java	Thu Jan 26 19:39:08 2012 -0800
@@ -117,11 +117,11 @@
         } catch (IllegalArgumentException iae) {
             throw new IOException(iae.getMessage());
         }
-        List counters =
+        List<Counter> counters =
                 new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
-        Iterator i = counters.iterator();
+        Iterator<Counter> i = counters.iterator();
         if (i.hasNext()) {
-            Counter c = (Counter) i.next();
+            Counter c = i.next();
             return (String) c.getValue();
         } else {
             return null;
@@ -167,13 +167,13 @@
         } catch (IllegalArgumentException iae) {
             throw new IOException(iae.getMessage());
         }
-        List counters = new PerfInstrumentation(bb).getAllCounters();
-        Map<String, String> properties = new HashMap<String, String>();
-        for (Object c : counters) {
-            String name = ((Counter) c).getName();
+        List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
+        Map<String, String> properties = new HashMap<>();
+        for (Counter c : counters) {
+            String name =  c.getName();
             if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
                     !name.equals(CONNECTOR_ADDRESS_COUNTER)) {
-                properties.put(name, ((Counter) c).getValue().toString());
+                properties.put(name, c.getValue().toString());
             }
         }
         return properties;
--- a/jdk/src/share/classes/sun/management/Flag.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/Flag.java	Thu Jan 26 19:39:08 2012 -0800
@@ -91,7 +91,7 @@
         Flag[] flags = new Flag[numFlags];
         int count = getFlags(names, flags, numFlags);
 
-        List<Flag> result = new ArrayList<Flag>();
+        List<Flag> result = new ArrayList<>();
         for (Flag f : flags) {
             if (f != null) {
                 result.add(f);
--- a/jdk/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java	Thu Jan 26 19:39:08 2012 -0800
@@ -69,11 +69,7 @@
                         Field f = cl.getDeclaredField("builder");
                         f.setAccessible(true);
                         return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
-                    } catch(ClassNotFoundException e) {
-                        return null;
-                    } catch(NoSuchFieldException e) {
-                        return null;
-                    } catch(IllegalAccessException e) {
+                    } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
                         return null;
                     }
                 }
@@ -82,7 +78,7 @@
         synchronized(compositeTypeByBuilder) {
             gict = compositeTypeByBuilder.get(builder);
             if(gict == null) {
-                OpenType[] gcNotifInfoItemTypes = new OpenType[] {
+                OpenType<?>[] gcNotifInfoItemTypes = new OpenType<?>[] {
                     SimpleType.STRING,
                     SimpleType.STRING,
                     SimpleType.STRING,
@@ -141,7 +137,7 @@
         GC_INFO
     };
     private static HashMap<GcInfoBuilder,CompositeType> compositeTypeByBuilder =
-        new HashMap<GcInfoBuilder,CompositeType>();
+        new HashMap<>();
 
     public static String getGcName(CompositeData cd) {
         String gcname = getString(cd, GC_NAME);
@@ -195,7 +191,7 @@
     private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
         if (baseGcNotifInfoCompositeType == null) {
             try {
-                OpenType[] baseGcNotifInfoItemTypes = new OpenType[] {
+                OpenType<?>[] baseGcNotifInfoItemTypes = new OpenType<?>[] {
                     SimpleType.STRING,
                     SimpleType.STRING,
                     SimpleType.STRING,
--- a/jdk/src/share/classes/sun/management/GarbageCollectorImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/GarbageCollectorImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,14 +70,11 @@
     private String[] poolNames = null;
     synchronized String[] getAllPoolNames() {
         if (poolNames == null) {
-            List pools = ManagementFactory.getMemoryPoolMXBeans();
+            List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
             poolNames = new String[pools.size()];
             int i = 0;
-            for (ListIterator iter = pools.listIterator();
-                 iter.hasNext();
-                 i++) {
-                MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
-                poolNames[i] = p.getName();
+            for (MemoryPoolMXBean m : pools) {
+                poolNames[i++] = m.getName();
             }
         }
         return poolNames;
--- a/jdk/src/share/classes/sun/management/GcInfoBuilder.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/GcInfoBuilder.java	Thu Jan 26 19:39:08 2012 -0800
@@ -104,7 +104,7 @@
         int itemCount = numGcInfoItems + gcExtItemCount;
         allItemNames = new String[itemCount];
         String[] allItemDescs = new String[itemCount];
-        OpenType[] allItemTypes = new OpenType[itemCount];
+        OpenType<?>[] allItemTypes = new OpenType<?>[itemCount];
 
         System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
         System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
--- a/jdk/src/share/classes/sun/management/GcInfoCompositeData.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/GcInfoCompositeData.java	Thu Jan 26 19:39:08 2012 -0800
@@ -76,11 +76,7 @@
                                 Field f = cl.getDeclaredField("builder");
                                 f.setAccessible(true);
                                 return (GcInfoBuilder)f.get(info);
-                            } catch(ClassNotFoundException e) {
-                                return null;
-                            } catch(NoSuchFieldException e) {
-                                return null;
-                            } catch(IllegalAccessException e) {
+                            } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
                                 return null;
                             }
                         }
@@ -92,11 +88,7 @@
                                 Field f = cl.getDeclaredField("extAttributes");
                                 f.setAccessible(true);
                                 return (Object[])f.get(info);
-                            } catch(ClassNotFoundException e) {
-                                return null;
-                            } catch(NoSuchFieldException e) {
-                                return null;
-                            } catch(IllegalAccessException e) {
+                            } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
                                 return null;
                             }
                         }
@@ -180,10 +172,7 @@
             Method m = GcInfo.class.getMethod("getMemoryUsageBeforeGc");
             memoryUsageMapType =
                 MappedMXBeanType.getMappedType(m.getGenericReturnType());
-        } catch (NoSuchMethodException e) {
-            // Should never reach here
-            throw new AssertionError(e);
-        } catch (OpenDataException e) {
+        } catch (NoSuchMethodException | OpenDataException e) {
             // Should never reach here
             throw new AssertionError(e);
         }
@@ -197,7 +186,7 @@
     static synchronized OpenType[] getBaseGcInfoItemTypes() {
         if (baseGcInfoItemTypes == null) {
             OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
-            baseGcInfoItemTypes = new OpenType[] {
+            baseGcInfoItemTypes = new OpenType<?>[] {
                 SimpleType.LONG,
                 SimpleType.LONG,
                 SimpleType.LONG,
@@ -225,10 +214,7 @@
         try {
             TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
             return cast(memoryUsageMapType.toJavaTypeData(td));
-        } catch (InvalidObjectException e) {
-            // Should never reach here
-            throw new AssertionError(e);
-        } catch (OpenDataException e) {
+        } catch (InvalidObjectException | OpenDataException e) {
             // Should never reach here
             throw new AssertionError(e);
         }
@@ -244,10 +230,7 @@
             TabularData td = (TabularData) cd.get(MEMORY_USAGE_AFTER_GC);
             //return (Map<String,MemoryUsage>)
             return cast(memoryUsageMapType.toJavaTypeData(td));
-        } catch (InvalidObjectException e) {
-            // Should never reach here
-            throw new AssertionError(e);
-        } catch (OpenDataException e) {
+        } catch (InvalidObjectException | OpenDataException e) {
             // Should never reach here
             throw new AssertionError(e);
         }
--- a/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/HotSpotDiagnostic.java	Thu Jan 26 19:39:08 2012 -0800
@@ -48,7 +48,7 @@
 
     public List<VMOption> getDiagnosticOptions() {
         List<Flag> allFlags = Flag.getAllFlags();
-        List<VMOption> result = new ArrayList<VMOption>();
+        List<VMOption> result = new ArrayList<>();
         for (Flag flag : allFlags) {
             if (flag.isWriteable() && flag.isExternal()) {
                 result.add(flag.getVMOption());
--- a/jdk/src/share/classes/sun/management/HotspotCompilation.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/HotspotCompilation.java	Thu Jan 26 19:39:08 2012 -0800
@@ -120,13 +120,13 @@
         // current implementation.  We first look up in the SUN_CI namespace
         // since most counters are in SUN_CI namespace.
 
-        if ((c = (Counter) counters.get(SUN_CI + name)) != null) {
+        if ((c = counters.get(SUN_CI + name)) != null) {
             return c;
         }
-        if ((c = (Counter) counters.get(COM_SUN_CI + name)) != null) {
+        if ((c = counters.get(COM_SUN_CI + name)) != null) {
             return c;
         }
-        if ((c = (Counter) counters.get(JAVA_CI + name)) != null) {
+        if ((c = counters.get(JAVA_CI + name)) != null) {
             return c;
         }
 
@@ -136,10 +136,8 @@
 
     private void initCompilerCounters() {
         // Build a tree map of the current list of performance counters
-        ListIterator iter = getInternalCompilerCounters().listIterator();
-        counters = new TreeMap<String, Counter>();
-        while (iter.hasNext()) {
-            Counter c = (Counter) iter.next();
+        counters = new TreeMap<>();
+        for (Counter c: getInternalCompilerCounters()) {
             counters.put(c.getName(), c);
         }
 
@@ -200,7 +198,7 @@
     }
 
     public java.util.List<CompilerThreadStat> getCompilerThreadStats() {
-        List<CompilerThreadStat> list = new ArrayList<CompilerThreadStat>(threads.length);
+        List<CompilerThreadStat> list = new ArrayList<>(threads.length);
         int i = 0;
         if (threads[0] == null) {
             // no adaptor thread
--- a/jdk/src/share/classes/sun/management/HotspotThread.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/HotspotThread.java	Thu Jan 26 19:39:08 2012 -0800
@@ -58,7 +58,7 @@
         String[] names = new String[count];
         long[] times = new long[count];
         int numThreads = getInternalThreadTimes0(names, times);
-        Map<String, Long> result = new HashMap<String, Long>(numThreads);
+        Map<String, Long> result = new HashMap<>(numThreads);
         for (int i = 0; i < numThreads; i++) {
             result.put(names[i], new Long(times[i]));
         }
--- a/jdk/src/share/classes/sun/management/LazyCompositeData.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/LazyCompositeData.java	Thu Jan 26 19:39:08 2012 -0800
@@ -81,7 +81,7 @@
         return compositeData().toString();
     }
 
-    public Collection values() {
+    public Collection<?> values() {
         return compositeData().values();
     }
 
@@ -153,16 +153,15 @@
 
         // We can't use CompositeType.isValue() since it returns false
         // if the type name doesn't match.
-        Set allItems = type1.keySet();
+        Set<String> allItems = type1.keySet();
 
         // Check all items in the type1 exist in type2
         if (!type2.keySet().containsAll(allItems))
             return false;
 
-        for (Iterator iter = allItems.iterator(); iter.hasNext(); ) {
-            String item = (String) iter.next();
-            OpenType ot1 = type1.getType(item);
-            OpenType ot2 = type2.getType(item);
+        for (String item: allItems) {
+            OpenType<?> ot1 = type1.getType(item);
+            OpenType<?> ot2 = type2.getType(item);
             if (ot1 instanceof CompositeType) {
                 if (! (ot2 instanceof CompositeType))
                     return false;
@@ -183,8 +182,8 @@
     protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
         if (type1 == type2) return true;
 
-        List list1 = type1.getIndexNames();
-        List list2 = type2.getIndexNames();
+        List<String> list1 = type1.getIndexNames();
+        List<String> list2 = type2.getIndexNames();
 
         // check if the list of index names are the same
         if (!list1.equals(list2))
--- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java	Thu Jan 26 19:39:08 2012 -0800
@@ -110,7 +110,7 @@
 
     public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
         MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools();
-        List<MemoryPoolMXBean> list = new ArrayList<MemoryPoolMXBean>(pools.length);
+        List<MemoryPoolMXBean> list = new ArrayList<>(pools.length);
         for (MemoryPoolMXBean p : pools) {
             list.add(p);
         }
@@ -119,7 +119,7 @@
 
     public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
         MemoryManagerMXBean[]  mgrs = MemoryImpl.getMemoryManagers();
-        List<MemoryManagerMXBean> result = new ArrayList<MemoryManagerMXBean>(mgrs.length);
+        List<MemoryManagerMXBean> result = new ArrayList<>(mgrs.length);
         for (MemoryManagerMXBean m : mgrs) {
             result.add(m);
         }
@@ -128,7 +128,7 @@
 
     public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
         MemoryManagerMXBean[]  mgrs = MemoryImpl.getMemoryManagers();
-        List<GarbageCollectorMXBean> result = new ArrayList<GarbageCollectorMXBean>(mgrs.length);
+        List<GarbageCollectorMXBean> result = new ArrayList<>(mgrs.length);
         for (MemoryManagerMXBean m : mgrs) {
             if (GarbageCollectorMXBean.class.isInstance(m)) {
                  result.add(GarbageCollectorMXBean.class.cast(m));
--- a/jdk/src/share/classes/sun/management/MappedMXBeanType.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/MappedMXBeanType.java	Thu Jan 26 19:39:08 2012 -0800
@@ -62,18 +62,18 @@
 @SuppressWarnings("unchecked")
 public abstract class MappedMXBeanType {
     private static final WeakHashMap<Type,MappedMXBeanType> convertedTypes =
-        new WeakHashMap<Type,MappedMXBeanType>();
+        new WeakHashMap<>();
 
     boolean  isBasicType = false;
-    OpenType openType = inProgress;
-    Class    mappedTypeClass;
+    OpenType<?> openType = inProgress;
+    Class<?>    mappedTypeClass;
 
     static synchronized MappedMXBeanType newMappedType(Type javaType)
             throws OpenDataException {
 
         MappedMXBeanType mt = null;
         if (javaType instanceof Class) {
-            final Class c = (Class) javaType;
+            final Class<?> c = (Class<?>) javaType;
             if (c.isEnum()) {
                 mt = new EnumMXBeanType(c);
             } else if (c.isArray()) {
@@ -85,7 +85,7 @@
             final ParameterizedType pt = (ParameterizedType) javaType;
             final Type rawType = pt.getRawType();
             if (rawType instanceof Class) {
-                final Class rc = (Class) rawType;
+                final Class<?> rc = (Class<?>) rawType;
                 if (rc == List.class) {
                     mt = new ListMXBeanType(pt);
                 } else if (rc == Map.class) {
@@ -106,7 +106,7 @@
     }
 
     // basic types do not require data mapping
-    static synchronized MappedMXBeanType newBasicType(Class c, OpenType ot)
+    static synchronized MappedMXBeanType newBasicType(Class<?> c, OpenType<?> ot)
             throws OpenDataException {
         MappedMXBeanType mt = new BasicMXBeanType(c, ot);
         convertedTypes.put(c, mt);
@@ -127,7 +127,7 @@
     }
 
     // Convert a class to an OpenType
-    public static synchronized OpenType toOpenType(Type t)
+    public static synchronized OpenType<?> toOpenType(Type t)
             throws OpenDataException {
         MappedMXBeanType mt = getMappedType(t);
         return mt.getOpenType();
@@ -152,7 +152,7 @@
     }
 
     // Return the mapped open type
-    OpenType getOpenType() {
+    OpenType<?> getOpenType() {
         return openType;
     }
 
@@ -168,7 +168,7 @@
     }
 
     // Return the mapped open type
-    Class getMappedTypeClass() {
+    Class<?> getMappedTypeClass() {
         return mappedTypeClass;
     }
 
@@ -192,8 +192,8 @@
     //   T <-> T (no conversion)
     //
     static class BasicMXBeanType extends MappedMXBeanType {
-        final Class basicType;
-        BasicMXBeanType(Class c, OpenType openType) {
+        final Class<?> basicType;
+        BasicMXBeanType(Class<?> c, OpenType<?> openType) {
             this.basicType = c;
             this.openType = openType;
             this.mappedTypeClass = c;
@@ -228,7 +228,7 @@
     //
     static class EnumMXBeanType extends MappedMXBeanType {
         final Class enumClass;
-        EnumMXBeanType(Class c) {
+        EnumMXBeanType(Class<?> c) {
             this.enumClass = c;
             this.openType = STRING;
             this.mappedTypeClass = String.class;
@@ -269,16 +269,16 @@
     //   E[] <-> openTypeData(E)[]
     //
     static class ArrayMXBeanType extends MappedMXBeanType {
-        final Class arrayClass;
+        final Class<?> arrayClass;
         protected MappedMXBeanType componentType;
         protected MappedMXBeanType baseElementType;
 
-        ArrayMXBeanType(Class c) throws OpenDataException {
+        ArrayMXBeanType(Class<?> c) throws OpenDataException {
             this.arrayClass = c;
             this.componentType = getMappedType(c.getComponentType());
 
             StringBuilder className = new StringBuilder();
-            Class et = c;
+            Class<?> et = c;
             int dim;
             for (dim = 0; et.isArray(); dim++) {
                 className.append('[');
@@ -299,7 +299,7 @@
                 throw ode;
             }
 
-            openType = new ArrayType(dim, baseElementType.getOpenType());
+            openType = new ArrayType<>(dim, baseElementType.getOpenType());
         }
 
         protected ArrayMXBeanType() {
@@ -395,7 +395,7 @@
                 throw ode;
             }
 
-            openType = new ArrayType(dim, baseElementType.getOpenType());
+            openType = new ArrayType<>(dim, baseElementType.getOpenType());
         }
 
         Type getJavaType() {
@@ -428,7 +428,7 @@
                 throw new OpenDataException("Element Type for " + pt +
                    " not supported");
             }
-            final Class et = (Class) argTypes[0];
+            final Class<?> et = (Class<?>) argTypes[0];
             if (et.isArray()) {
                 throw new OpenDataException("Element Type for " + pt +
                    " not supported");
@@ -445,7 +445,7 @@
                 ode.initCause(e);
                 throw ode;
             }
-            openType = new ArrayType(1, paramType.getOpenType());
+            openType = new ArrayType<>(1, paramType.getOpenType());
         }
 
         Type getJavaType() {
@@ -473,7 +473,7 @@
             throws OpenDataException, InvalidObjectException {
 
             final Object[] openArray = (Object[]) data;
-            List<Object> result = new ArrayList<Object>(openArray.length);
+            List<Object> result = new ArrayList<>(openArray.length);
             for (Object o : openArray) {
                 result.add(paramType.toJavaTypeData(o));
             }
@@ -514,7 +514,7 @@
             // FIXME: generate typeName for generic
             typeName = "Map<" + keyType.getName() + "," +
                                 valueType.getName() + ">";
-            final OpenType[] mapItemTypes = new OpenType[] {
+            final OpenType<?>[] mapItemTypes = new OpenType<?>[] {
                                                 keyType.getOpenType(),
                                                 valueType.getOpenType(),
                                             };
@@ -543,7 +543,7 @@
             final TabularData table = new TabularDataSupport(tabularType);
             final CompositeType rowType = tabularType.getRowType();
 
-            for (Map.Entry entry : map.entrySet()) {
+            for (Map.Entry<Object, Object> entry : map.entrySet()) {
                 final Object key = keyType.toOpenTypeData(entry.getKey());
                 final Object value = valueType.toOpenTypeData(entry.getValue());
                 final CompositeData row =
@@ -560,7 +560,7 @@
 
             final TabularData td = (TabularData) data;
 
-            Map<Object, Object> result = new HashMap<Object, Object>();
+            Map<Object, Object> result = new HashMap<>();
             for (CompositeData row : (Collection<CompositeData>) td.values()) {
                 Object key = keyType.toJavaTypeData(row.get(KEY));
                 Object value = valueType.toJavaTypeData(row.get(VALUE));
@@ -607,7 +607,7 @@
         final boolean isCompositeData;
         Method fromMethod = null;
 
-        CompositeDataMXBeanType(Class c) throws OpenDataException {
+        CompositeDataMXBeanType(Class<?> c) throws OpenDataException {
             this.javaClass = c;
             this.mappedTypeClass = COMPOSITE_DATA_CLASS;
 
@@ -639,8 +639,8 @@
                             return javaClass.getMethods();
                         }
                     });
-                final List<String> names = new ArrayList<String>();
-                final List<OpenType> types = new ArrayList<OpenType>();
+                final List<String> names = new ArrayList<>();
+                final List<OpenType<?>> types = new ArrayList<>();
 
                 /* Select public methods that look like "T getX()" or "boolean
                    isX()", where T is not void and X is not the empty
@@ -678,7 +678,7 @@
                                              c.getName(),
                                              nameArray, // field names
                                              nameArray, // field descriptions
-                                             types.toArray(new OpenType[0]));
+                                             types.toArray(new OpenType<?>[0]));
             }
         }
 
@@ -722,7 +722,7 @@
                 // so that no other classes are sent over the wire
                 CompositeData cd = (CompositeData) data;
                 CompositeType ct = cd.getCompositeType();
-                String[] itemNames = (String[]) ct.keySet().toArray(new String[0]);
+                String[] itemNames = ct.keySet().toArray(new String[0]);
                 Object[] itemValues = cd.getAll(itemNames);
                 return new CompositeDataSupport(ct, itemNames, itemValues);
             }
@@ -779,9 +779,9 @@
         }
         private static final long serialVersionUID = -3413063475064374490L;
     }
-    private static final OpenType inProgress;
+    private static final OpenType<?> inProgress;
     static {
-        OpenType t;
+        OpenType<?> t;
         try {
             t = new InProgress();
         } catch (OpenDataException e) {
@@ -799,8 +799,8 @@
     static {
         try {
             for (int i = 0; i < simpleTypes.length; i++) {
-                final OpenType t = simpleTypes[i];
-                Class c;
+                final OpenType<?> t = simpleTypes[i];
+                Class<?> c;
                 try {
                     c = Class.forName(t.getClassName(), false,
                                       String.class.getClassLoader());
@@ -816,7 +816,7 @@
                 if (c.getName().startsWith("java.lang.")) {
                     try {
                         final Field typeField = c.getField("TYPE");
-                        final Class primitiveType = (Class) typeField.get(null);
+                        final Class<?> primitiveType = (Class<?>) typeField.get(null);
                         MappedMXBeanType.newBasicType(primitiveType, t);
                     } catch (NoSuchFieldException e) {
                         // OK: must not be a primitive wrapper
--- a/jdk/src/share/classes/sun/management/MonitorInfoCompositeData.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/MonitorInfoCompositeData.java	Thu Jan 26 19:39:08 2012 -0800
@@ -92,7 +92,7 @@
             monitorInfoCompositeType = (CompositeType)
                 MappedMXBeanType.toOpenType(MonitorInfo.class);
             Set<String> s = monitorInfoCompositeType.keySet();
-            monitorInfoItemNames = (String[]) s.toArray(new String[0]);
+            monitorInfoItemNames =  s.toArray(new String[0]);
         } catch (OpenDataException e) {
             // Should never reach here
             throw new AssertionError(e);
--- a/jdk/src/share/classes/sun/management/NotificationEmitterSupport.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/NotificationEmitterSupport.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,7 +71,7 @@
            efficient solution would be to clone the listener list
            every time a notification is sent.  */
         synchronized (listenerLock) {
-            List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList.size() + 1);
+            List<ListenerInfo> newList = new ArrayList<>(listenerList.size() + 1);
             newList.addAll(listenerList);
             newList.add(new ListenerInfo(listener, filter, handback));
             listenerList = newList;
@@ -82,12 +82,12 @@
         throws ListenerNotFoundException {
 
         synchronized (listenerLock) {
-            List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList);
+            List<ListenerInfo> newList = new ArrayList<>(listenerList);
             /* We scan the list of listeners in reverse order because
                in forward order we would have to repeat the loop with
                the same index after a remove.  */
             for (int i=newList.size()-1; i>=0; i--) {
-                ListenerInfo li = (ListenerInfo)newList.get(i);
+                ListenerInfo li = newList.get(i);
 
                 if (li.listener == listener)
                     newList.remove(i);
@@ -106,10 +106,10 @@
         boolean found = false;
 
         synchronized (listenerLock) {
-            List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList);
+            List<ListenerInfo> newList = new ArrayList<>(listenerList);
             final int size = newList.size();
             for (int i = 0; i < size; i++) {
-                ListenerInfo li = (ListenerInfo) newList.get(i);
+                ListenerInfo li =  newList.get(i);
 
                 if (li.listener == listener) {
                     found = true;
@@ -148,7 +148,7 @@
 
         final int size = currentList.size();
         for (int i = 0; i < size; i++) {
-            ListenerInfo li = (ListenerInfo) currentList.get(i);
+            ListenerInfo li =  currentList.get(i);
 
             if (li.filter == null
                 || li.filter.isNotificationEnabled(notification)) {
--- a/jdk/src/share/classes/sun/management/RuntimeImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/RuntimeImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -128,7 +128,7 @@
 
     public Map<String,String> getSystemProperties() {
         Properties sysProps = System.getProperties();
-        Map<String,String> map = new HashMap<String, String>();
+        Map<String,String> map = new HashMap<>();
 
         // Properties.entrySet() does not include the entries in
         // the default properties.  So use Properties.stringPropertyNames()
--- a/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/ThreadInfoCompositeData.java	Thu Jan 26 19:39:08 2012 -0800
@@ -190,7 +190,7 @@
                                       threadInfoV6Attributes.length;
             String[] v5ItemNames = new String[numV5Attributes];
             String[] v5ItemDescs = new String[numV5Attributes];
-            OpenType[] v5ItemTypes = new OpenType[numV5Attributes];
+            OpenType<?>[] v5ItemTypes = new OpenType<?>[numV5Attributes];
             int i = 0;
             for (String n : itemNames) {
                 if (isV5Attribute(n)) {
--- a/jdk/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java	Thu Jan 26 19:39:08 2012 -0800
@@ -73,7 +73,7 @@
         buffer.position(prologue.getEntryOffset());
         nextEntry = buffer.position();
         // rebuild all the counters
-        map = new TreeMap<String, Counter>();
+        map = new TreeMap<>();
     }
 
     boolean hasNext() {
@@ -154,7 +154,7 @@
                 map.put(c.getName(), c);
             }
         }
-        return new ArrayList<Counter>(map.values());
+        return new ArrayList<>(map.values());
     }
 
     public synchronized List<Counter> findByPattern(String patternString) {
@@ -167,7 +167,8 @@
 
         Pattern pattern = Pattern.compile(patternString);
         Matcher matcher = pattern.matcher("");
-        List<Counter> matches = new ArrayList<Counter>();
+        List<Counter> matches = new ArrayList<>();
+
 
         for (Map.Entry<String,Counter> me: map.entrySet()) {
             String name = me.getKey();
--- a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Thu Jan 26 19:39:08 2012 -0800
@@ -234,14 +234,15 @@
                         "authenticated Subject is null");
             }
             final Set<Principal> principals = subject.getPrincipals();
-            for (Principal p: principals) {
-                if (properties.containsKey(p.getName())) {
+            for (Principal p1: principals) {
+                if (properties.containsKey(p1.getName())) {
                     return;
                 }
             }
-            final Set<String> principalsStr = new HashSet<String>();
-            for (Principal p: principals) {
-                principalsStr.add(p.getName());
+
+            final Set<String> principalsStr = new HashSet<>();
+            for (Principal p2: principals) {
+                principalsStr.add(p2.getName());
             }
             throw new SecurityException(
                     "Access denied! No entries found in the access file [" +
@@ -255,9 +256,9 @@
             if (fname == null) {
                 return p;
             }
-            FileInputStream fin = new FileInputStream(fname);
-            p.load(fin);
-            fin.close();
+            try (FileInputStream fin = new FileInputStream(fname)) {
+                p.load(fin);
+            }
             return p;
         }
         private final Map<String, Object> environment;
@@ -430,7 +431,7 @@
         try {
             // Export remote connector address and associated configuration
             // properties to the instrumentation buffer.
-            Map<String, String> properties = new HashMap<String, String>();
+            Map<String, String> properties = new HashMap<>();
             properties.put("remoteAddress", url.toString());
             properties.put("authenticate", useAuthenticationStr);
             properties.put("ssl", useSslStr);
@@ -456,7 +457,7 @@
         System.setProperty("java.rmi.server.randomIDs", "true");
 
         // This RMI server should not keep the VM alive
-        Map<String, Object> env = new HashMap<String, Object>();
+        Map<String, Object> env = new HashMap<>();
         env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter());
 
         // The local connector server need only be available via the
@@ -599,12 +600,9 @@
             try {
                 // Load the SSL keystore properties from the config file
                 Properties p = new Properties();
-                InputStream in = new FileInputStream(sslConfigFileName);
-                try {
+                try (InputStream in = new FileInputStream(sslConfigFileName)) {
                     BufferedInputStream bin = new BufferedInputStream(in);
                     p.load(bin);
-                } finally {
-                    in.close();
                 }
                 String keyStore =
                         p.getProperty("javax.net.ssl.keyStore");
@@ -628,11 +626,8 @@
                 KeyStore ks = null;
                 if (keyStore != null) {
                     ks = KeyStore.getInstance(KeyStore.getDefaultType());
-                    FileInputStream ksfis = new FileInputStream(keyStore);
-                    try {
+                    try (FileInputStream ksfis = new FileInputStream(keyStore)) {
                         ks.load(ksfis, keyStorePasswd);
-                    } finally {
-                        ksfis.close();
                     }
                 }
                 KeyManagerFactory kmf = KeyManagerFactory.getInstance(
@@ -642,11 +637,8 @@
                 KeyStore ts = null;
                 if (trustStore != null) {
                     ts = KeyStore.getInstance(KeyStore.getDefaultType());
-                    FileInputStream tsfis = new FileInputStream(trustStore);
-                    try {
+                    try (FileInputStream tsfis = new FileInputStream(trustStore)) {
                         ts.load(tsfis, trustStorePasswd);
-                    } finally {
-                        tsfis.close();
                     }
                 }
                 TrustManagerFactory tmf = TrustManagerFactory.getInstance(
@@ -689,7 +681,7 @@
 
         JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
 
-        Map<String, Object> env = new HashMap<String, Object>();
+        Map<String, Object> env = new HashMap<>();
 
         PermanentExporter exporter = new PermanentExporter();
 
--- a/jdk/src/share/classes/sun/management/snmp/AdaptorBootstrap.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/AdaptorBootstrap.java	Thu Jan 26 19:39:08 2012 -0800
@@ -118,21 +118,22 @@
     /**
      * Retrieve the Trap Target List from the ACL file.
      **/
+    @SuppressWarnings("unchecked")
     private static List<NotificationTarget> getTargetList(InetAddressAcl acl,
                                                           int defaultTrapPort) {
         final ArrayList<NotificationTarget> result =
-                new ArrayList<NotificationTarget>();
+                new ArrayList<>();
         if (acl != null) {
             if (log.isDebugOn())
                 log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing"));
 
-            final Enumeration td=acl.getTrapDestinations();
+            final Enumeration td = acl.getTrapDestinations();
             for (; td.hasMoreElements() ;) {
                 final InetAddress targetAddr = (InetAddress)td.nextElement();
                 final Enumeration tc =
                     acl.getTrapCommunities(targetAddr);
                 for (;tc.hasMoreElements() ;) {
-                    final String community = (String) tc.nextElement();
+                    final String community = (String)tc.nextElement();
                     final NotificationTarget target =
                         new NotificationTargetImpl(targetAddr,
                                                    defaultTrapPort,
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JVM_MANAGEMENT_MIB_IMPL.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JVM_MANAGEMENT_MIB_IMPL.java	Thu Jan 26 19:39:08 2012 -0800
@@ -90,14 +90,14 @@
         SnmpOidTable table = null;
         if(tableRef == null) {
             table =  new JVM_MANAGEMENT_MIBOidTable();
-            tableRef = new WeakReference<SnmpOidTable>(table);
+            tableRef = new WeakReference<>(table);
             return table;
         }
 
         table = tableRef.get();
         if(table == null) {
             table = new JVM_MANAGEMENT_MIBOidTable();
-            tableRef = new WeakReference<SnmpOidTable>(table);
+            tableRef = new WeakReference<>(table);
         }
 
         return table;
@@ -198,7 +198,7 @@
      * List of notification targets.
      */
     private ArrayList<NotificationTarget> notificationTargets =
-            new ArrayList<NotificationTarget>();
+            new ArrayList<>();
     private final NotificationEmitter emitter;
     private final NotificationHandler handler;
 
@@ -215,7 +215,7 @@
     }
 
     private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
-        final Iterator iterator = notificationTargets.iterator();
+        final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
         final SnmpAdaptorServer adaptor =
             (SnmpAdaptorServer) getSnmpAdaptor();
 
@@ -232,7 +232,7 @@
         while(iterator.hasNext()) {
             NotificationTarget target = null;
             try {
-                target = (NotificationTarget) iterator.next();
+                target = iterator.next();
                 SnmpPeer peer =
                     new SnmpPeer(target.getAddress(), target.getPort());
                 SnmpParameters p = new SnmpParameters();
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemGCTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -58,6 +58,8 @@
  */
 public class JvmMemGCTableMetaImpl extends  JvmMemGCTableMeta {
 
+    static final long serialVersionUID = 8250461197108867607L;
+
     /**
      * This class acts as a filter over the SnmpTableHandler
      * used for the JvmMemoryManagerTable. It filters out
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemManagerTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -61,12 +61,17 @@
  */
 public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
 
+    static final long serialVersionUID = 36176771566817592L;
+
     /**
      * A concrete implementation of {@link SnmpNamedListTableCache}, for the
      * jvmMemManagerTable.
      **/
     private static class JvmMemManagerTableCache
         extends SnmpNamedListTableCache {
+
+        static final long serialVersionUID = 6564294074653009240L;
+
         /**
          * Create a weak cache for the jvmMemManagerTable.
          * @param validity validity of the cached data, in ms.
@@ -87,7 +92,7 @@
          *        <code>MemoryManagerMXBean</code> in the list.
          * @return  <code>((MemoryManagerMXBean)item).getName()</code>
          **/
-        protected String getKey(Object context, List rawDatas,
+        protected String getKey(Object context, List<?> rawDatas,
                                 int rank, Object item) {
             if (item == null) return null;
             final String name = ((MemoryManagerMXBean)item).getName();
@@ -99,7 +104,7 @@
          * Call <code>getTableHandler(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object, Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
@@ -114,7 +119,7 @@
          * Call ManagementFactory.getMemoryManagerMXBeans() to
          * load the raw data of this table.
          **/
-        protected List   loadRawDatas(Map userData) {
+        protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
             return ManagementFactory.getMemoryManagerMXBeans();
         }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -64,13 +64,17 @@
 public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
     implements Serializable {
 
+    static final long serialVersionUID = 1896509775012355443L;
+
     /**
      * A concrete implementation of {@link SnmpTableCache}, for the
      * jvmMemMgrPoolRelTable.
      **/
+
     private static class JvmMemMgrPoolRelTableCache
         extends SnmpTableCache {
 
+        static final long serialVersionUID = 6059937161990659184L;
         final private JvmMemMgrPoolRelTableMetaImpl meta;
 
         /**
@@ -87,7 +91,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object,Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
@@ -101,7 +105,7 @@
                 return buildPoolIndexMap((SnmpCachedData)handler);
 
             // not optimizable... too bad.
-            final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>();
+            final Map<String, SnmpOid> m = new HashMap<>();
             SnmpOid index=null;
             while ((index = handler.getNext(index))!=null) {
                 final MemoryPoolMXBean mpm =
@@ -124,7 +128,7 @@
             final SnmpOid[] indexes = cached.indexes;
             final Object[]  datas   = cached.datas;
             final int len = indexes.length;
-            final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>(len);
+            final Map<String, SnmpOid> m = new HashMap<>(len);
             for (int i=0; i<len; i++) {
                 final SnmpOid index = indexes[i];
                 if (index == null) continue;
@@ -165,13 +169,13 @@
             final long time = System.currentTimeMillis();
 
             //     Build a Map poolname -> index
-            final Map poolIndexMap = buildPoolIndexMap(mpHandler);
+            final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);
 
             // For each memory manager, get the list of memory pools
             // For each memory pool, find its index in the memory pool table
             // Create a row in the relation table.
             final TreeMap<SnmpOid, Object> table =
-                    new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator);
+                    new TreeMap<>(SnmpCachedData.oidComparator);
             updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);
 
             return new SnmpCachedData(time,table);
@@ -207,7 +211,7 @@
         protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                                      MemoryManagerMXBean mmm,
                                      SnmpOid mmIndex,
-                                     Map poolIndexMap) {
+                                     Map<String, SnmpOid> poolIndexMap) {
 
             // The MemoryManager index is an int, so it's the first
             // and only subidentifier.
@@ -230,7 +234,7 @@
             for (int i = 0; i < mpList.length; i++) {
                 final String mpmName = mpList[i];
                 if (mpmName == null) continue;
-                final SnmpOid mpIndex = (SnmpOid)poolIndexMap.get(mpmName);
+                final SnmpOid mpIndex = poolIndexMap.get(mpmName);
                 if (mpIndex == null) continue;
 
                 // The MemoryPool index is an int, so it's the first
@@ -261,7 +265,7 @@
         protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                                      SnmpTableHandler mmHandler,
                                      SnmpTableHandler mpHandler,
-                                     Map poolIndexMap) {
+                                     Map<String, SnmpOid> poolIndexMap) {
             if (mmHandler instanceof SnmpCachedData) {
                 updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                               mpHandler,poolIndexMap);
@@ -280,7 +284,7 @@
         protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                                      SnmpCachedData mmHandler,
                                      SnmpTableHandler mpHandler,
-                                     Map poolIndexMap) {
+                                     Map<String, SnmpOid> poolIndexMap) {
 
             final SnmpOid[] indexes = mmHandler.indexes;
             final Object[]  datas   = mmHandler.datas;
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemPoolTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -61,11 +61,16 @@
  */
 public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
 
+    static final long serialVersionUID = -2525820976094284957L;
+
     /**
      * A concrete implementation of {@link SnmpNamedListTableCache}, for the
      * jvmMemPoolTable.
      **/
     private static class JvmMemPoolTableCache extends SnmpNamedListTableCache {
+
+        static final long serialVersionUID = -1755520683086760574L;
+
         /**
          * Create a weak cache for the jvmMemPoolTable.
          * @param validity validity of the cached data, in ms.
@@ -86,7 +91,7 @@
          *        <code>MemoryPoolMXBean</code> in the list.
          * @return  <code>((MemoryPoolMXBean)item).getName()</code>
          **/
-        protected String getKey(Object context, List rawDatas,
+        protected String getKey(Object context, List<?> rawDatas,
                                 int rank, Object item) {
             if (item == null) return null;
             final String name = ((MemoryPoolMXBean)item).getName();
@@ -98,7 +103,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object, Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
@@ -113,7 +118,7 @@
          * Call ManagementFactory.getMemoryPoolMXBeans() to
          * load the raw data of this table.
          **/
-        protected List   loadRawDatas(Map userData) {
+        protected List<MemoryPoolMXBean> loadRawDatas(Map<Object, Object> userData) {
             return ManagementFactory.getMemoryPoolMXBeans();
         }
     }
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -275,7 +275,7 @@
      */
     public EnumJvmMemoryGCCall getJvmMemoryGCCall()
         throws SnmpStatusException {
-        final Map m = JvmContextFactory.getUserData();
+        final Map<Object,Object> m = JvmContextFactory.getUserData();
 
         if (m != null) {
             final EnumJvmMemoryGCCall cached
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemoryMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -50,6 +50,8 @@
  * The class is used for representing SNMP metadata for the "JvmMemory" group.
  */
 public class JvmMemoryMetaImpl extends JvmMemoryMeta {
+
+    static final long serialVersionUID = -6500448253825893071L;
     /**
      * Constructor for the metadata associated to "JvmMemory".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmOSImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmOSImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -47,6 +47,8 @@
  */
 public class JvmOSImpl implements JvmOSMBean, Serializable {
 
+     static final long serialVersionUID = 1839834731763310809L;
+
     /**
      * Constructor for the "JvmOS" group.
      * If the group contains a table, the entries created through an
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTBootClassPathEntryImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTBootClassPathEntryImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -44,6 +44,8 @@
 public class JvmRTBootClassPathEntryImpl
     implements JvmRTBootClassPathEntryMBean, Serializable {
 
+    static final long serialVersionUID = -2282652055235913013L;
+
     private final String item;
     private final int index;
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTBootClassPathTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTBootClassPathTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,8 @@
 public class JvmRTBootClassPathTableMetaImpl
     extends JvmRTBootClassPathTableMeta {
 
+    static final long serialVersionUID = -8659886610487538299L;
+
     private SnmpTableCache cache;
 
      /**
@@ -78,6 +80,7 @@
      * JvmRTBootClassPathTable.
      **/
     private static class JvmRTBootClassPathTableCache extends SnmpTableCache {
+        static final long serialVersionUID = -2637458695413646098L;
         private JvmRTBootClassPathTableMetaImpl meta;
 
         JvmRTBootClassPathTableCache(JvmRTBootClassPathTableMetaImpl meta,
@@ -90,7 +93,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object,Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTClassPathEntryImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTClassPathEntryImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -44,6 +44,7 @@
 public class JvmRTClassPathEntryImpl implements JvmRTClassPathEntryMBean,
                                                 Serializable {
 
+    static final long serialVersionUID = 8524792845083365742L;
     private final String item;
     private final int index;
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTClassPathTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTClassPathTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,8 @@
   */
 public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
 
+    static final long serialVersionUID = -6914494148818455166L;
+
     private SnmpTableCache cache;
 
      /**
@@ -77,6 +79,7 @@
      * JvmRTClassPathTable.
      **/
     private static class JvmRTClassPathTableCache extends SnmpTableCache {
+        static final long serialVersionUID = 3805032372592117315L;
         private JvmRTClassPathTableMetaImpl meta;
 
         JvmRTClassPathTableCache(JvmRTClassPathTableMetaImpl meta,
@@ -89,7 +92,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object, Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTInputArgsEntryImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTInputArgsEntryImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -44,6 +44,7 @@
 public class JvmRTInputArgsEntryImpl implements JvmRTInputArgsEntryMBean,
                                                 Serializable {
 
+    static final long serialVersionUID = 1000306518436503395L;
     private final String item;
     private final int index;
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTInputArgsTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTInputArgsTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,7 @@
  */
 public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
 
+    static final long serialVersionUID = -2083438094888099238L;
     private SnmpTableCache cache;
 
      /**
@@ -77,6 +78,8 @@
      * JvmRTInputArgsTable.
      **/
     private static class JvmRTInputArgsTableCache extends SnmpTableCache {
+
+        static final long serialVersionUID = 1693751105464785192L;
         private JvmRTInputArgsTableMetaImpl meta;
 
         JvmRTInputArgsTableCache(JvmRTInputArgsTableMetaImpl meta,
@@ -89,7 +92,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object,Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTLibraryPathEntryImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTLibraryPathEntryImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -44,6 +44,7 @@
 public class JvmRTLibraryPathEntryImpl implements JvmRTLibraryPathEntryMBean,
                                                 Serializable {
 
+    static final long serialVersionUID = -3322438153507369765L;
     private final String item;
     private final int index;
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTLibraryPathTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRTLibraryPathTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,7 @@
   */
 public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
 
+    static final long serialVersionUID = 6713252710712502068L;
     private SnmpTableCache cache;
 
      /**
@@ -77,6 +78,7 @@
      * JvmRTLibraryPathTable.
      **/
     private static class JvmRTLibraryPathTableCache extends SnmpTableCache {
+        static final long serialVersionUID = 2035304445719393195L;
         private JvmRTLibraryPathTableMetaImpl meta;
 
         JvmRTLibraryPathTableCache(JvmRTLibraryPathTableMetaImpl meta,
@@ -89,7 +91,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object,Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmRuntimeMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmRuntimeMetaImpl extends JvmRuntimeMeta {
 
+     static final long serialVersionUID = -6570428414857608618L;
     /**
      * Constructor for the metadata associated to "JvmRuntime".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceEntryImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -53,6 +53,8 @@
 public class JvmThreadInstanceEntryImpl
     implements JvmThreadInstanceEntryMBean, Serializable {
 
+    static final long serialVersionUID = 910173589985461347L;
+
     public final static class ThreadStateMap {
         public final static class Byte0 {
             public final static byte inNative     = (byte)0x80; // bit 1
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceTableMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadInstanceTableMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -78,6 +78,8 @@
 public class JvmThreadInstanceTableMetaImpl
     extends JvmThreadInstanceTableMeta {
 
+    static final long serialVersionUID = -8432271929226397492L;
+
     /**
      * Maximum depth of the stacktrace that might be returned through
      * SNMP.
@@ -135,6 +137,7 @@
     private static class JvmThreadInstanceTableCache
         extends SnmpTableCache {
 
+        static final long serialVersionUID = 4947330124563406878L;
         final private JvmThreadInstanceTableMetaImpl meta;
 
         /**
@@ -151,7 +154,7 @@
          * Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
          **/
         public SnmpTableHandler getTableHandler() {
-            final Map userData = JvmContextFactory.getUserData();
+            final Map<Object, Object> userData = JvmContextFactory.getUserData();
             return getTableDatas(userData);
         }
 
@@ -172,7 +175,7 @@
 
             SnmpOid indexes[] = new SnmpOid[id.length];
             final TreeMap<SnmpOid, Object> table =
-                    new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator);
+                    new TreeMap<>(SnmpCachedData.oidComparator);
             for(int i = 0; i < id.length; i++) {
                 log.debug("", "Making index for thread id [" + id[i] +"]");
                 //indexes[i] = makeOid(id[i]);
@@ -277,7 +280,7 @@
 
         // Get the request contextual cache (userData).
         //
-        final Map m = JvmContextFactory.getUserData();
+        final Map<Object,Object> m = JvmContextFactory.getUserData();
 
         // Get the handler.
         //
--- a/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadingMetaImpl.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvminstr/JvmThreadingMetaImpl.java	Thu Jan 26 19:39:08 2012 -0800
@@ -66,6 +66,8 @@
  */
 public class JvmThreadingMetaImpl extends JvmThreadingMeta {
 
+    static final long serialVersionUID = -2104788458393251457L;
+
     /**
      * Constructor for the metadata associated to "JvmThreading".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmClassesVerboseLevel.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmClassesVerboseLevel.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = -620710366914810374L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "verbose");
         intTable.put(new Integer(1), "silent");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmJITCompilerTimeMonitoring.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmJITCompilerTimeMonitoring.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = 3953565918146461236L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "supported");
         intTable.put(new Integer(1), "unsupported");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer, String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String, Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemManagerState.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemManagerState.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,12 @@
  */
 public class EnumJvmMemManagerState extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = 8249515157795166343L;
+
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "valid");
         intTable.put(new Integer(1), "invalid");
@@ -70,11 +72,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer, String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String, Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolCollectThreshdSupport.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolCollectThreshdSupport.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = 8610091819732806282L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "supported");
         intTable.put(new Integer(1), "unsupported");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer, String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String, Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolState.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolState.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmMemPoolState extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = 3038175407527743027L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "valid");
         intTable.put(new Integer(1), "invalid");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolThreshdSupport.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolThreshdSupport.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = 7014693561120661029L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "supported");
         intTable.put(new Integer(1), "unsupported");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolType.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemPoolType.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmMemPoolType extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = -7214498472962396555L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "heap");
         intTable.put(new Integer(1), "nonheap");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCCall.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCCall.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmMemoryGCCall extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = -2869147994287351375L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "supported");
         intTable.put(new Integer(5), "failed");
@@ -76,11 +77,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer, String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String, Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCVerboseLevel.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmMemoryGCVerboseLevel.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = 1362427628755978190L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "verbose");
         intTable.put(new Integer(1), "silent");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmRTBootClassPathSupport.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmRTBootClassPathSupport.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmRTBootClassPathSupport extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = -5957542680437939894L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(2), "supported");
         intTable.put(new Integer(1), "unsupported");
@@ -70,11 +71,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer, String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String, Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadContentionMonitoring.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadContentionMonitoring.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmThreadContentionMonitoring extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = -6411827583604137210L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(3), "enabled");
         intTable.put(new Integer(4), "disabled");
@@ -72,11 +73,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadCpuTimeMonitoring.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/EnumJvmThreadCpuTimeMonitoring.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,10 +43,11 @@
  */
 public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serializable {
 
+    static final long serialVersionUID = -532837824105215699L;
     protected static Hashtable<Integer, String> intTable =
-            new Hashtable<Integer, String>();
+            new Hashtable<>();
     protected static Hashtable<String, Integer> stringTable =
-            new Hashtable<String, Integer>();
+            new Hashtable<>();
     static  {
         intTable.put(new Integer(3), "enabled");
         intTable.put(new Integer(4), "disabled");
@@ -72,11 +73,11 @@
         super(x);
     }
 
-    protected Hashtable getIntTable() {
+    protected Hashtable<Integer,String> getIntTable() {
         return intTable ;
     }
 
-    protected Hashtable getStringTable() {
+    protected Hashtable<String,Integer> getStringTable() {
         return stringTable ;
     }
 
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JVM_MANAGEMENT_MIB.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JVM_MANAGEMENT_MIB.java	Thu Jan 26 19:39:08 2012 -0800
@@ -53,6 +53,7 @@
  */
 public abstract class JVM_MANAGEMENT_MIB extends SnmpMib implements Serializable {
 
+    static final long serialVersionUID = 6895037919735816732L;
     /**
      * Default constructor. Initialize the Mib tree.
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JVM_MANAGEMENT_MIBOidTable.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JVM_MANAGEMENT_MIBOidTable.java	Thu Jan 26 19:39:08 2012 -0800
@@ -47,6 +47,7 @@
  */
 public class JVM_MANAGEMENT_MIBOidTable extends SnmpOidTableSupport implements Serializable {
 
+    static final long serialVersionUID = -5010870014488732061L;
     /**
      * Default constructor. Initialize the Mib tree.
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmClassLoadingMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmClassLoadingMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,7 @@
 public class JvmClassLoadingMeta extends SnmpMibGroup
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 5722857476941218568L;
     /**
      * Constructor for the metadata associated to "JvmClassLoading".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmCompilationMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmCompilationMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,7 @@
 public class JvmCompilationMeta extends SnmpMibGroup
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = -95492874115033638L;
     /**
      * Constructor for the metadata associated to "JvmCompilation".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemGCEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemGCEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmMemGCEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+     static final long serialVersionUID = 6082082529298387063L;
     /**
      * Constructor for the metadata associated to "JvmMemGCEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemGCTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemGCTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmMemGCTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = -8843296871149264612L;
     /**
      * Constructor for the table. Initialize metadata for "JvmMemGCTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemManagerEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemManagerEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmMemManagerEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 8166956416408970453L;
     /**
      * Constructor for the metadata associated to "JvmMemManagerEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemManagerTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemManagerTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmMemManagerTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = 5026520607518015233L;
     /**
      * Constructor for the table. Initialize metadata for "JvmMemManagerTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemMgrPoolRelEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemMgrPoolRelEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmMemMgrPoolRelEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 7414270971113459798L;
     /**
      * Constructor for the metadata associated to "JvmMemMgrPoolRelEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemMgrPoolRelTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemMgrPoolRelTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmMemMgrPoolRelTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = -310733366542788998L;
     /**
      * Constructor for the table. Initialize metadata for "JvmMemMgrPoolRelTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemPoolEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemPoolEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmMemPoolEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 7220682779249102830L;
     /**
      * Constructor for the metadata associated to "JvmMemPoolEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemPoolTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemPoolTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,8 @@
  */
 public class JvmMemPoolTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = -2799470815264898659L;
+
     /**
      * Constructor for the table. Initialize metadata for "JvmMemPoolTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmOSMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmOSMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,8 @@
 public class JvmOSMeta extends SnmpMibGroup
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = -2024138733580127133L;
+
     /**
      * Constructor for the metadata associated to "JvmOS".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTBootClassPathEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTBootClassPathEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmRTBootClassPathEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 7703840715080588941L;
     /**
      * Constructor for the metadata associated to "JvmRTBootClassPathEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTBootClassPathTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTBootClassPathTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmRTBootClassPathTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = 42471379600792135L;
     /**
      * Constructor for the table. Initialize metadata for "JvmRTBootClassPathTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTClassPathEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTClassPathEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmRTClassPathEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 3388703998226830801L;
     /**
      * Constructor for the metadata associated to "JvmRTClassPathEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTClassPathTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTClassPathTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmRTClassPathTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = -1518727175345404443L;
     /**
      * Constructor for the table. Initialize metadata for "JvmRTClassPathTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTInputArgsEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTInputArgsEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmRTInputArgsEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = -7729576810347358025L;
     /**
      * Constructor for the metadata associated to "JvmRTInputArgsEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTInputArgsTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTInputArgsTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmRTInputArgsTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = 5395531763015738645L;
     /**
      * Constructor for the table. Initialize metadata for "JvmRTInputArgsTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTLibraryPathEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTLibraryPathEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmRTLibraryPathEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = -5851555586263475792L;
     /**
      * Constructor for the metadata associated to "JvmRTLibraryPathEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTLibraryPathTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTLibraryPathTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmRTLibraryPathTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = -632403620113109468L;
     /**
      * Constructor for the table. Initialize metadata for "JvmRTLibraryPathTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRuntimeMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRuntimeMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,7 @@
 public class JvmRuntimeMeta extends SnmpMibGroup
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 1994595220765880109L;
     /**
      * Constructor for the metadata associated to "JvmRuntime".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadInstanceEntryMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadInstanceEntryMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -71,6 +71,7 @@
 public class JvmThreadInstanceEntryMeta extends SnmpMibEntry
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = -2015330111801477399L;
     /**
      * Constructor for the metadata associated to "JvmThreadInstanceEntry".
      */
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadInstanceTableMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadInstanceTableMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -68,6 +68,7 @@
  */
 public class JvmThreadInstanceTableMeta extends SnmpMibTable implements Serializable {
 
+    static final long serialVersionUID = 2519514732589115954L;
     /**
      * Constructor for the table. Initialize metadata for "JvmThreadInstanceTableMeta".
      * The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
--- a/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadingMeta.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmThreadingMeta.java	Thu Jan 26 19:39:08 2012 -0800
@@ -70,6 +70,7 @@
 public class JvmThreadingMeta extends SnmpMibGroup
      implements Serializable, SnmpStandardMetaServer {
 
+    static final long serialVersionUID = 5223833578005322854L;
     /**
      * Constructor for the metadata associated to "JvmThreading".
      */
--- a/jdk/src/share/classes/sun/management/snmp/util/MibLogger.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/util/MibLogger.java	Thu Jan 26 19:39:08 2012 -0800
@@ -32,7 +32,7 @@
     final Logger logger;
     final String className;
 
-    static String getClassName(Class clazz) {
+    static String getClassName(Class<?> clazz) {
         if (clazz == null) return null;
         if (clazz.isArray())
             return getClassName(clazz.getComponentType()) + "[]";
@@ -44,7 +44,7 @@
         else return fullname.substring(lastpoint+1,len);
     }
 
-    static String getLoggerName(Class clazz) {
+    static String getLoggerName(Class<?> clazz) {
         if (clazz == null) return "sun.management.snmp.jvminstr";
         Package p = clazz.getPackage();
         if (p == null) return "sun.management.snmp.jvminstr";
@@ -53,11 +53,11 @@
         else return pname;
     }
 
-    public MibLogger(Class clazz) {
+    public MibLogger(Class<?> clazz) {
         this(getLoggerName(clazz),getClassName(clazz));
     }
 
-    public MibLogger(Class clazz, String postfix) {
+    public MibLogger(Class<?> clazz, String postfix) {
         this(getLoggerName(clazz)+((postfix==null)?"":"."+postfix),
              getClassName(clazz));
     }
--- a/jdk/src/share/classes/sun/management/snmp/util/SnmpListTableCache.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/util/SnmpListTableCache.java	Thu Jan 26 19:39:08 2012 -0800
@@ -59,7 +59,7 @@
      *        <var>rawDatas</var> list iterator.
      * @param item The raw data object for which an index must be determined.
      **/
-    protected abstract SnmpOid getIndex(Object context, List rawDatas,
+    protected abstract SnmpOid getIndex(Object context, List<?> rawDatas,
                                         int rank, Object item);
 
     /**
@@ -75,7 +75,7 @@
      *        extracted.
      * @return By default <var>item</var> is returned.
      **/
-    protected Object getData(Object context, List rawDatas,
+    protected Object getData(Object context, List<?> rawDatas,
                              int rank, Object item) {
         return item;
     }
@@ -95,14 +95,14 @@
      *        computed.
      * @return the computed cached data.
      **/
-    protected SnmpCachedData updateCachedDatas(Object context, List rawDatas) {
+    protected SnmpCachedData updateCachedDatas(Object context, List<?> rawDatas) {
         final int size = ((rawDatas == null)?0:rawDatas.size());
         if (size == 0) return  null;
 
         final long time = System.currentTimeMillis();
-        final Iterator it  = rawDatas.iterator();
+        final Iterator<?> it  = rawDatas.iterator();
         final TreeMap<SnmpOid, Object> map =
-                new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator);
+                new TreeMap<>(SnmpCachedData.oidComparator);
         for (int rank=0; it.hasNext() ; rank++) {
             final Object  item  = it.next();
             final SnmpOid index = getIndex(context, rawDatas, rank, item);
--- a/jdk/src/share/classes/sun/management/snmp/util/SnmpNamedListTableCache.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/util/SnmpNamedListTableCache.java	Thu Jan 26 19:39:08 2012 -0800
@@ -55,7 +55,7 @@
      * This map associate an entry name with the SnmpOid index that's
      * been allocated for it.
      **/
-    protected TreeMap names = new TreeMap();
+    protected TreeMap<String, SnmpOid> names = new TreeMap<>();
 
     /**
      * The last allocate index.
@@ -80,7 +80,7 @@
      *        <var>rawDatas</var> list iterator.
      * @param item The raw data object for which a key name must be determined.
      **/
-    protected abstract String getKey(Object context, List rawDatas,
+    protected abstract String getKey(Object context, List<?> rawDatas,
                                      int rank, Object item);
 
     /**
@@ -97,7 +97,7 @@
      *        <var>rawDatas</var> list iterator.
      * @param item The raw data object for which an index must be determined.
      **/
-    protected SnmpOid makeIndex(Object context, List rawDatas,
+    protected SnmpOid makeIndex(Object context, List<?> rawDatas,
                                 int rank, Object item) {
 
         // check we are in the limits of an unsigned32.
@@ -151,7 +151,7 @@
      *        <var>rawDatas</var> list iterator.
      * @param item The raw data object for which an index must be determined.
      **/
-    protected SnmpOid getIndex(Object context, List rawDatas,
+    protected SnmpOid getIndex(Object context, List<?> rawDatas,
                                int rank, Object item) {
         final String key   = getKey(context,rawDatas,rank,item);
         final Object index = (names==null||key==null)?null:names.get(key);
@@ -174,8 +174,8 @@
      * @param rawDatas The table datas from which the cached data will be
      *        computed.
      **/
-    protected SnmpCachedData updateCachedDatas(Object context, List rawDatas) {
-        TreeMap ctxt = new TreeMap();
+    protected SnmpCachedData updateCachedDatas(Object context, List<?> rawDatas) {
+        TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
         final SnmpCachedData result =
             super.updateCachedDatas(context,rawDatas);
         names = ctxt;
@@ -191,7 +191,7 @@
      *        the {@link JvmContextFactory}.
      *
      **/
-    protected abstract List   loadRawDatas(Map userData);
+    protected abstract List<?>  loadRawDatas(Map<Object,Object> userData);
 
     /**
      *The name under which the raw data is to be found/put in
@@ -212,16 +212,16 @@
      *        the request contextual cache.
      *
      **/
-    protected List getRawDatas(Map<Object, Object> userData, String key) {
-        List rawDatas = null;
+    protected List<?> getRawDatas(Map<Object, Object> userData, String key) {
+        List<?> rawDatas = null;
 
         // Look for memory manager list in request contextual cache.
         if (userData != null)
-            rawDatas = (List) userData.get(key);
+            rawDatas =  (List<?>)userData.get(key);
 
         if (rawDatas == null) {
             // No list in contextual cache, get it from API
-            rawDatas =  loadRawDatas(userData);
+            rawDatas = loadRawDatas(userData);
 
 
             // Put list in cache...
@@ -250,12 +250,12 @@
             (context instanceof Map)?Util.<Map<Object, Object>>cast(context):null;
 
         // Look for memory manager list in request contextual cache.
-        final List rawDatas = getRawDatas(userData,getRawDatasKey());
+        final List<?> rawDatas = getRawDatas(userData,getRawDatasKey());
 
         log.debug("updateCachedDatas","rawDatas.size()=" +
               ((rawDatas==null)?"<no data>":""+rawDatas.size()));
 
-        TreeMap ctxt = new TreeMap();
+        TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
         final SnmpCachedData result =
             super.updateCachedDatas(ctxt,rawDatas);
         names = ctxt;
--- a/jdk/src/share/classes/sun/management/snmp/util/SnmpTableCache.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/management/snmp/util/SnmpTableCache.java	Thu Jan 26 19:39:08 2012 -0800
@@ -98,7 +98,7 @@
         final SnmpCachedData cached   = getCachedDatas();
         if (cached != null) return cached;
         final SnmpCachedData computedDatas = updateCachedDatas(context);
-        if (validity != 0) datas = new WeakReference<SnmpCachedData>(computedDatas);
+        if (validity != 0) datas = new WeakReference<>(computedDatas);
         return computedDatas;
     }
 
--- a/jdk/src/share/classes/sun/misc/VM.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/misc/VM.java	Thu Jan 26 19:39:08 2012 -0800
@@ -168,7 +168,7 @@
     //
     // The initial value of this field is arbitrary; during JRE initialization
     // it will be reset to the value specified on the command line, if any,
-    // otherwise to Runtime.getRuntime.maxDirectMemory().
+    // otherwise to Runtime.getRuntime().maxMemory().
     //
     private static long directMemory = 64 * 1024 * 1024;
 
--- a/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Thu Jan 26 19:39:08 2012 -0800
@@ -47,8 +47,6 @@
 
     private boolean inCache;
 
-    protected CookieHandler cookieHandler;
-
     // Http requests we send
     MessageHeader requests;
 
@@ -201,14 +199,6 @@
         }
         setConnectTimeout(to);
 
-        // get the cookieHandler if there is any
-        cookieHandler = java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<CookieHandler>() {
-                public CookieHandler run() {
-                    return CookieHandler.getDefault();
-                }
-            });
-
         capture = HttpCapture.getCapture(url);
         openServer();
     }
@@ -656,6 +646,7 @@
 
                 // we've finished parsing http headers
                 // check if there are any applicable cookies to set (in cache)
+                CookieHandler cookieHandler = httpuc.getCookieHandler();
                 if (cookieHandler != null) {
                     URI uri = ParseUtil.toURI(url);
                     // NOTE: That cast from Map shouldn't be necessary but
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Jan 26 19:39:08 2012 -0800
@@ -2633,8 +2633,7 @@
         if (filteredHeaders != null)
             return filteredHeaders;
 
-        filteredHeaders = new HashMap<>();
-        Map<String, List<String>> headers;
+        Map<String, List<String>> headers, tmpMap = new HashMap<>();
 
         if (cachedHeaders != null)
             headers = cachedHeaders.getHeaders();
@@ -2650,11 +2649,10 @@
                     filteredVals.add(fVal);
             }
             if (!filteredVals.isEmpty())
-                filteredHeaders.put(key,
-                                    Collections.unmodifiableList(filteredVals));
+                tmpMap.put(key, Collections.unmodifiableList(filteredVals));
         }
 
-        return filteredHeaders;
+        return filteredHeaders = Collections.unmodifiableMap(tmpMap);
     }
 
     /**
@@ -2905,6 +2903,10 @@
         return readTimeout < 0 ? 0 : readTimeout;
     }
 
+    public CookieHandler getCookieHandler() {
+        return cookieHandler;
+    }
+
     String getMethod() {
         return method;
     }
--- a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Thu Jan 26 19:39:08 2012 -0800
@@ -36,7 +36,6 @@
 import java.net.UnknownHostException;
 import java.net.InetSocketAddress;
 import java.net.Proxy;
-import java.net.CookieHandler;
 import java.security.Principal;
 import java.security.cert.*;
 import java.util.StringTokenizer;
@@ -268,13 +267,6 @@
             port = getDefaultPort();
         }
         setConnectTimeout(connectTimeout);
-        // get the cookieHandler if there is any
-        cookieHandler = java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<CookieHandler>() {
-                public CookieHandler run() {
-                    return CookieHandler.getDefault();
-                }
-            });
         openServer();
     }
 
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/CacheTable.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/CacheTable.java	Thu Jan 26 19:39:08 2012 -0800
@@ -31,8 +31,6 @@
 package sun.security.krb5.internal.rcache;
 
 import java.util.Hashtable;
-import sun.security.krb5.internal.KerberosTime;
-
 
 /**
  * This class implements Hashtable to store the replay caches.
@@ -60,12 +58,15 @@
             }
             rc = new ReplayCache(principal, this);
             rc.put(time, currTime);
-            super.put(principal, rc);
+            if (!rc.isEmpty()) {
+                super.put(principal, rc);
+            }
         }
         else {
             rc.put(time, currTime);
-            // re-insert the entry, since rc.put could have removed the entry
-            super.put(principal, rc);
+            if (rc.isEmpty()) {
+                super.remove(rc);
+            }
             if (DEBUG) {
                 System.out.println("replay cache found.");
             }
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/ReplayCache.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/ReplayCache.java	Thu Jan 26 19:39:08 2012 -0800
@@ -31,8 +31,6 @@
 
 package sun.security.krb5.internal.rcache;
 
-import sun.security.krb5.KrbException;
-import sun.security.krb5.Config;
 import sun.security.krb5.internal.Krb5;
 import java.util.LinkedList;
 import java.util.ListIterator;
@@ -48,10 +46,13 @@
 
     private static final long serialVersionUID = 2997933194993803994L;
 
+    // These 3 fields are now useless, keep for serialization compatibility
     private String principal;
     private CacheTable table;
     private int nap = 10 * 60 * 1000; //10 minutes break
+
     private boolean DEBUG = Krb5.DEBUG;
+
     /**
      * Constructs a ReplayCache for a client principal in specified <code>CacheTable</code>.
      * @param p client principal name.
@@ -125,20 +126,11 @@
         if (DEBUG) {
             printList();
         }
-
-        // if there are no entries in the replay cache,
-        // remove the replay cache from the table.
-        if (this.size() == 0) {
-            table.remove(principal);
-        }
-        if (DEBUG) {
-            printList();
-        }
     }
 
 
     /**
-     * Printes out the debug message.
+     * Prints out the debug message.
      */
     private void printList() {
         Object[] total = toArray();
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -870,7 +870,7 @@
     @Override
     protected int engineGetKeySize(Key key) throws InvalidKeyException {
         int n = P11SecretKeyFactory.convertKey
-                (token, key, keyAlgorithm).keyLength();
+                (token, key, keyAlgorithm).length();
         return n;
     }
 
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,13 +49,12 @@
  * @author  Andreas Sterbenz
  * @since   1.5
  */
-final class P11Digest extends MessageDigestSpi {
+final class P11Digest extends MessageDigestSpi implements Cloneable {
 
-    /* unitialized, fields uninitialized, no session acquired */
+    /* fields initialized, no session acquired */
     private final static int S_BLANK    = 1;
 
-    // data in buffer, all fields valid, session acquired
-    // but digest not initialized
+    /* data in buffer, session acquired, but digest not initialized */
     private final static int S_BUFFERED = 2;
 
     /* session initialized for digesting */
@@ -69,8 +68,8 @@
     // algorithm name
     private final String algorithm;
 
-    // mechanism id
-    private final long mechanism;
+    // mechanism id object
+    private final CK_MECHANISM mechanism;
 
     // length of the digest in bytes
     private final int digestLength;
@@ -81,11 +80,8 @@
     // current state, one of S_* above
     private int state;
 
-    // one byte buffer for the update(byte) method, initialized on demand
-    private byte[] oneByte;
-
     // buffer to reduce number of JNI calls
-    private final byte[] buffer;
+    private byte[] buffer;
 
     // offset into the buffer
     private int bufOfs;
@@ -94,7 +90,7 @@
         super();
         this.token = token;
         this.algorithm = algorithm;
-        this.mechanism = mechanism;
+        this.mechanism = new CK_MECHANISM(mechanism);
         switch ((int)mechanism) {
         case (int)CKM_MD2:
         case (int)CKM_MD5:
@@ -117,7 +113,6 @@
         }
         buffer = new byte[BUFFER_SIZE];
         state = S_BLANK;
-        engineReset();
     }
 
     // see JCA spec
@@ -125,44 +120,31 @@
         return digestLength;
     }
 
-    private void cancelOperation() {
-        token.ensureValid();
-        if (session == null) {
-            return;
-        }
-        if ((state != S_INIT) || (token.explicitCancel == false)) {
-            return;
-        }
-        // need to explicitly "cancel" active op by finishing it
-        try {
-            token.p11.C_DigestFinal(session.id(), buffer, 0, buffer.length);
-        } catch (PKCS11Exception e) {
-            throw new ProviderException("cancel() failed", e);
-        } finally {
-            state = S_BUFFERED;
-        }
-    }
-
     private void fetchSession() {
         token.ensureValid();
         if (state == S_BLANK) {
-            engineReset();
+            try {
+                session = token.getOpSession();
+                state = S_BUFFERED;
+            } catch (PKCS11Exception e) {
+                throw new ProviderException("No more session available", e);
+            }
         }
     }
 
     // see JCA spec
     protected void engineReset() {
-        try {
-            cancelOperation();
-            bufOfs = 0;
-            if (session == null) {
-                session = token.getOpSession();
+        token.ensureValid();
+
+        if (session != null) {
+            if (state == S_INIT && token.explicitCancel == true) {
+                session = token.killSession(session);
+            } else {
+                session = token.releaseSession(session);
             }
-            state = S_BUFFERED;
-        } catch (PKCS11Exception e) {
-            state = S_BLANK;
-            throw new ProviderException("reset() failed, ", e);
         }
+        state = S_BLANK;
+        bufOfs = 0;
     }
 
     // see JCA spec
@@ -180,18 +162,22 @@
     protected int engineDigest(byte[] digest, int ofs, int len)
             throws DigestException {
         if (len < digestLength) {
-            throw new DigestException("Length must be at least " + digestLength);
+            throw new DigestException("Length must be at least " +
+                    digestLength);
         }
+
         fetchSession();
         try {
             int n;
             if (state == S_BUFFERED) {
-                n = token.p11.C_DigestSingle(session.id(),
-                        new CK_MECHANISM(mechanism),
-                        buffer, 0, bufOfs, digest, ofs, len);
+                n = token.p11.C_DigestSingle(session.id(), mechanism, buffer, 0,
+                        bufOfs, digest, ofs, len);
+                bufOfs = 0;
             } else {
                 if (bufOfs != 0) {
-                    doUpdate(buffer, 0, bufOfs);
+                    token.p11.C_DigestUpdate(session.id(), 0, buffer, 0,
+                            bufOfs);
+                    bufOfs = 0;
                 }
                 n = token.p11.C_DigestFinal(session.id(), digest, ofs, len);
             }
@@ -202,36 +188,44 @@
         } catch (PKCS11Exception e) {
             throw new ProviderException("digest() failed", e);
         } finally {
-            state = S_BLANK;
-            bufOfs = 0;
-            session = token.releaseSession(session);
+            engineReset();
         }
     }
 
     // see JCA spec
     protected void engineUpdate(byte in) {
-        if (oneByte == null) {
-            oneByte = new byte[1];
-        }
-        oneByte[0] = in;
-        engineUpdate(oneByte, 0, 1);
+        byte[] temp = { in };
+        engineUpdate(temp, 0, 1);
     }
 
     // see JCA spec
     protected void engineUpdate(byte[] in, int ofs, int len) {
-        fetchSession();
         if (len <= 0) {
             return;
         }
-        if ((bufOfs != 0) && (bufOfs + len > buffer.length)) {
-            doUpdate(buffer, 0, bufOfs);
-            bufOfs = 0;
-        }
-        if (bufOfs + len > buffer.length) {
-            doUpdate(in, ofs, len);
-        } else {
-            System.arraycopy(in, ofs, buffer, bufOfs, len);
-            bufOfs += len;
+
+        fetchSession();
+        try {
+            if (state == S_BUFFERED) {
+                token.p11.C_DigestInit(session.id(), mechanism);
+                state = S_INIT;
+            }
+            if ((bufOfs != 0) && (bufOfs + len > buffer.length)) {
+                // process the buffered data
+                token.p11.C_DigestUpdate(session.id(), 0, buffer, 0, bufOfs);
+                bufOfs = 0;
+            }
+            if (bufOfs + len > buffer.length) {
+                // process the new data
+                token.p11.C_DigestUpdate(session.id(), 0, in, ofs, len);
+             } else {
+                // buffer the new data
+                System.arraycopy(in, ofs, buffer, bufOfs, len);
+                bufOfs += len;
+            }
+        } catch (PKCS11Exception e) {
+            engineReset();
+            throw new ProviderException("update() failed", e);
         }
     }
 
@@ -239,11 +233,7 @@
     // the master secret is sensitive. We may want to consider making this
     // method public in a future release.
     protected void implUpdate(SecretKey key) throws InvalidKeyException {
-        fetchSession();
-        if (bufOfs != 0) {
-            doUpdate(buffer, 0, bufOfs);
-            bufOfs = 0;
-        }
+
         // SunJSSE calls this method only if the key does not have a RAW
         // encoding, i.e. if it is sensitive. Therefore, no point in calling
         // SecretKeyFactory to try to convert it. Just verify it ourselves.
@@ -252,60 +242,77 @@
         }
         P11Key p11Key = (P11Key)key;
         if (p11Key.token != token) {
-            throw new InvalidKeyException("Not a P11Key of this provider: " + key);
+            throw new InvalidKeyException("Not a P11Key of this provider: " +
+                    key);
         }
+
+        fetchSession();
         try {
             if (state == S_BUFFERED) {
-                token.p11.C_DigestInit(session.id(), new CK_MECHANISM(mechanism));
+                token.p11.C_DigestInit(session.id(), mechanism);
                 state = S_INIT;
             }
+
+            if (bufOfs != 0) {
+                token.p11.C_DigestUpdate(session.id(), 0, buffer, 0, bufOfs);
+                bufOfs = 0;
+            }
             token.p11.C_DigestKey(session.id(), p11Key.keyID);
         } catch (PKCS11Exception e) {
+            engineReset();
             throw new ProviderException("update(SecretKey) failed", e);
         }
     }
 
     // see JCA spec
     protected void engineUpdate(ByteBuffer byteBuffer) {
-        fetchSession();
         int len = byteBuffer.remaining();
         if (len <= 0) {
             return;
         }
+
         if (byteBuffer instanceof DirectBuffer == false) {
             super.engineUpdate(byteBuffer);
             return;
         }
+
+        fetchSession();
         long addr = ((DirectBuffer)byteBuffer).address();
         int ofs = byteBuffer.position();
         try {
             if (state == S_BUFFERED) {
-                token.p11.C_DigestInit(session.id(), new CK_MECHANISM(mechanism));
+                token.p11.C_DigestInit(session.id(), mechanism);
                 state = S_INIT;
-                if (bufOfs != 0) {
-                    doUpdate(buffer, 0, bufOfs);
-                    bufOfs = 0;
-                }
+            }
+            if (bufOfs != 0) {
+                token.p11.C_DigestUpdate(session.id(), 0, buffer, 0, bufOfs);
+                bufOfs = 0;
             }
             token.p11.C_DigestUpdate(session.id(), addr + ofs, null, 0, len);
             byteBuffer.position(ofs + len);
         } catch (PKCS11Exception e) {
+            engineReset();
             throw new ProviderException("update() failed", e);
         }
     }
 
-    private void doUpdate(byte[] in, int ofs, int len) {
-        if (len <= 0) {
-            return;
-        }
+    public Object clone() throws CloneNotSupportedException {
+        P11Digest copy = (P11Digest) super.clone();
+        copy.buffer = buffer.clone();
         try {
-            if (state == S_BUFFERED) {
-                token.p11.C_DigestInit(session.id(), new CK_MECHANISM(mechanism));
-                state = S_INIT;
+            if (session != null) {
+                copy.session = copy.token.getOpSession();
             }
-            token.p11.C_DigestUpdate(session.id(), 0, in, ofs, len);
+            if (state == S_INIT) {
+                byte[] stateValues =
+                    token.p11.C_GetOperationState(session.id());
+                token.p11.C_SetOperationState(copy.session.id(),
+                                              stateValues, 0, 0);
+            }
         } catch (PKCS11Exception e) {
-            throw new ProviderException("update() failed", e);
+            throw (CloneNotSupportedException)
+                (new CloneNotSupportedException(algorithm).initCause(e));
         }
+        return copy;
     }
 }
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Key.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Key.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,7 @@
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
 import sun.security.util.DerValue;
+import sun.security.util.Length;
 
 /**
  * Key implementation classes.
@@ -61,7 +62,7 @@
  * @author  Andreas Sterbenz
  * @since   1.5
  */
-abstract class P11Key implements Key {
+abstract class P11Key implements Key, Length {
 
     private final static String PUBLIC = "public";
     private final static String PRIVATE = "private";
@@ -212,7 +213,11 @@
         return s1;
     }
 
-    int keyLength() {
+    /**
+     * Return bit length of the key.
+     */
+    @Override
+    public int length() {
         return keyLength;
     }
 
--- a/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11RSACipher.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -216,7 +216,7 @@
         } else {
             throw new InvalidKeyException("Unknown key type: " + p11Key);
         }
-        int n = (p11Key.keyLength() + 7) >> 3;
+        int n = (p11Key.length() + 7) >> 3;
         outputSize = n;
         buffer = new byte[n];
         maxInputSize = ((padType == PAD_PKCS1 && encrypt) ?
@@ -495,7 +495,7 @@
 
     // see JCE spec
     protected int engineGetKeySize(Key key) throws InvalidKeyException {
-        int n = P11KeyFactory.convertKey(token, key, algorithm).keyLength();
+        int n = P11KeyFactory.convertKey(token, key, algorithm).length();
         return n;
     }
 }
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -272,7 +272,7 @@
                 if (keyAlgorithm.equals("DSA")) {
                     signature = new byte[40];
                 } else {
-                    signature = new byte[(p11Key.keyLength() + 7) >> 3];
+                    signature = new byte[(p11Key.length() + 7) >> 3];
                 }
                 if (type == T_UPDATE) {
                     token.p11.C_VerifyFinal(session.id(), signature);
@@ -357,7 +357,7 @@
         if (keyAlgorithm.equals("RSA") && publicKey != p11Key) {
             int keyLen;
             if (publicKey instanceof P11Key) {
-                keyLen = ((P11Key) publicKey).keyLength();
+                keyLen = ((P11Key) publicKey).length();
             } else {
                 keyLen = ((RSAKey) publicKey).getModulus().bitLength();
             }
@@ -618,7 +618,7 @@
 
     private byte[] pkcs1Pad(byte[] data) {
         try {
-            int len = (p11Key.keyLength() + 7) >> 3;
+            int len = (p11Key.length() + 7) >> 3;
             RSAPadding padding = RSAPadding.getInstance
                                         (RSAPadding.PAD_BLOCKTYPE_1, len);
             byte[] padded = padding.pad(data);
--- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -606,24 +606,32 @@
                 m(CKM_DES_CBC));
         d(CIP, "DES/CBC/PKCS5Padding",          P11Cipher,
                 m(CKM_DES_CBC_PAD, CKM_DES_CBC));
-        d(CIP, "DES/ECB",                       P11Cipher,      s("DES"),
+        d(CIP, "DES/ECB/NoPadding",             P11Cipher,
+                m(CKM_DES_ECB));
+        d(CIP, "DES/ECB/PKCS5Padding",          P11Cipher,      s("DES"),
                 m(CKM_DES_ECB));
 
         d(CIP, "DESede/CBC/NoPadding",          P11Cipher,
                 m(CKM_DES3_CBC));
         d(CIP, "DESede/CBC/PKCS5Padding",       P11Cipher,
                 m(CKM_DES3_CBC_PAD, CKM_DES3_CBC));
-        d(CIP, "DESede/ECB",                    P11Cipher,      s("DESede"),
+        d(CIP, "DESede/ECB/NoPadding",          P11Cipher,
+                m(CKM_DES3_ECB));
+        d(CIP, "DESede/ECB/PKCS5Padding",       P11Cipher,      s("DESede"),
                 m(CKM_DES3_ECB));
         d(CIP, "AES/CBC/NoPadding",             P11Cipher,
                 m(CKM_AES_CBC));
         d(CIP, "AES/CBC/PKCS5Padding",          P11Cipher,
                 m(CKM_AES_CBC_PAD, CKM_AES_CBC));
-        d(CIP, "AES/ECB",                       P11Cipher,      s("AES"),
+        d(CIP, "AES/ECB/NoPadding",             P11Cipher,
+                m(CKM_AES_ECB));
+        d(CIP, "AES/ECB/PKCS5Padding",          P11Cipher,      s("AES"),
                 m(CKM_AES_ECB));
         d(CIP, "AES/CTR/NoPadding",             P11Cipher,
                 m(CKM_AES_CTR));
-        d(CIP, "Blowfish/CBC",                  P11Cipher,
+        d(CIP, "Blowfish/CBC/NoPadding",        P11Cipher,
+                m(CKM_BLOWFISH_CBC));
+        d(CIP, "Blowfish/CBC/PKCS5Padding",     P11Cipher,
                 m(CKM_BLOWFISH_CBC));
 
         // XXX RSA_X_509, RSA_OAEP not yet supported
--- a/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -133,14 +133,15 @@
      * @preconditions (pkcs11ModulePath <> null)
      * @postconditions
      */
-    PKCS11(String pkcs11ModulePath, String functionListName) throws IOException {
+    PKCS11(String pkcs11ModulePath, String functionListName)
+            throws IOException {
         connect(pkcs11ModulePath, functionListName);
         this.pkcs11ModulePath = pkcs11ModulePath;
     }
 
-    public static synchronized PKCS11 getInstance(String pkcs11ModulePath, String functionList,
-            CK_C_INITIALIZE_ARGS pInitArgs, boolean omitInitialize)
-            throws IOException, PKCS11Exception {
+    public static synchronized PKCS11 getInstance(String pkcs11ModulePath,
+            String functionList, CK_C_INITIALIZE_ARGS pInitArgs,
+            boolean omitInitialize) throws IOException, PKCS11Exception {
         // we may only call C_Initialize once per native .so/.dll
         // so keep a cache using the (non-canonicalized!) path
         PKCS11 pkcs11 = moduleMap.get(pkcs11ModulePath);
@@ -177,7 +178,8 @@
      * @preconditions (pkcs11ModulePath <> null)
      * @postconditions
      */
-    private native void connect(String pkcs11ModulePath, String functionListName) throws IOException;
+    private native void connect(String pkcs11ModulePath, String functionListName)
+            throws IOException;
 
     /**
      * Disconnects the PKCS#11 library from this object. After calling this
@@ -255,7 +257,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native long[] C_GetSlotList(boolean tokenPresent) throws PKCS11Exception;
+    public native long[] C_GetSlotList(boolean tokenPresent)
+            throws PKCS11Exception;
 
 
     /**
@@ -287,7 +290,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native CK_TOKEN_INFO C_GetTokenInfo(long slotID) throws PKCS11Exception;
+    public native CK_TOKEN_INFO C_GetTokenInfo(long slotID)
+            throws PKCS11Exception;
 
 
     /**
@@ -322,7 +326,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type) throws PKCS11Exception;
+    public native CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type)
+            throws PKCS11Exception;
 
 
     /**
@@ -339,7 +344,8 @@
      * @preconditions
      * @postconditions
      */
-//    public native void C_InitToken(long slotID, char[] pPin, char[] pLabel) throws PKCS11Exception;
+//    public native void C_InitToken(long slotID, char[] pPin, char[] pLabel)
+//            throws PKCS11Exception;
 
 
     /**
@@ -354,7 +360,8 @@
      * @preconditions
      * @postconditions
      */
-//    public native void C_InitPIN(long hSession, char[] pPin) throws PKCS11Exception;
+//    public native void C_InitPIN(long hSession, char[] pPin)
+//            throws PKCS11Exception;
 
 
     /**
@@ -371,7 +378,8 @@
      * @preconditions
      * @postconditions
      */
-//    public native void C_SetPIN(long hSession, char[] pOldPin, char[] pNewPin) throws PKCS11Exception;
+//    public native void C_SetPIN(long hSession, char[] pOldPin, char[] pNewPin)
+//            throws PKCS11Exception;
 
 
 
@@ -398,7 +406,8 @@
      * @preconditions
      * @postconditions
      */
-    public native long C_OpenSession(long slotID, long flags, Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception;
+    public native long C_OpenSession(long slotID, long flags,
+            Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception;
 
 
     /**
@@ -440,7 +449,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native CK_SESSION_INFO C_GetSessionInfo(long hSession) throws PKCS11Exception;
+    public native CK_SESSION_INFO C_GetSessionInfo(long hSession)
+            throws PKCS11Exception;
 
 
     /**
@@ -457,7 +467,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-//    public native byte[] C_GetOperationState(long hSession) throws PKCS11Exception;
+    public native byte[] C_GetOperationState(long hSession)
+            throws PKCS11Exception;
 
 
     /**
@@ -478,7 +489,8 @@
      * @preconditions
      * @postconditions
      */
-//    public native void C_SetOperationState(long hSession, byte[] pOperationState, long hEncryptionKey, long hAuthenticationKey) throws PKCS11Exception;
+    public native void C_SetOperationState(long hSession, byte[] pOperationState,
+            long hEncryptionKey, long hAuthenticationKey) throws PKCS11Exception;
 
 
     /**
@@ -495,7 +507,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_Login(long hSession, long userType, char[] pPin) throws PKCS11Exception;
+    public native void C_Login(long hSession, long userType, char[] pPin)
+            throws PKCS11Exception;
 
 
     /**
@@ -531,7 +544,8 @@
      * @preconditions
      * @postconditions
      */
-    public native long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+    public native long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate)
+            throws PKCS11Exception;
 
 
     /**
@@ -552,7 +566,8 @@
      * @preconditions
      * @postconditions
      */
-    public native long C_CopyObject(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+    public native long C_CopyObject(long hSession, long hObject,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
 
 
     /**
@@ -567,7 +582,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_DestroyObject(long hSession, long hObject) throws PKCS11Exception;
+    public native void C_DestroyObject(long hSession, long hObject)
+            throws PKCS11Exception;
 
 
     /**
@@ -584,7 +600,8 @@
      * @preconditions
      * @postconditions
      */
-//    public native long C_GetObjectSize(long hSession, long hObject) throws PKCS11Exception;
+//    public native long C_GetObjectSize(long hSession, long hObject)
+//            throws PKCS11Exception;
 
 
     /**
@@ -604,7 +621,8 @@
      * @preconditions (pTemplate <> null)
      * @postconditions (result <> null)
      */
-    public native void C_GetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+    public native void C_GetAttributeValue(long hSession, long hObject,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
 
 
     /**
@@ -623,7 +641,8 @@
      * @preconditions (pTemplate <> null)
      * @postconditions
      */
-    public native void C_SetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+    public native void C_SetAttributeValue(long hSession, long hObject,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
 
 
     /**
@@ -640,7 +659,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+    public native void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate)
+            throws PKCS11Exception;
 
 
     /**
@@ -659,7 +679,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native long[] C_FindObjects(long hSession, long ulMaxObjectCount) throws PKCS11Exception;
+    public native long[] C_FindObjects(long hSession, long ulMaxObjectCount)
+            throws PKCS11Exception;
 
 
     /**
@@ -695,7 +716,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_EncryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
+    public native void C_EncryptInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception;
 
 
     /**
@@ -713,7 +735,8 @@
      * @preconditions (pData <> null)
      * @postconditions (result <> null)
      */
-    public native int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception;
+    public native int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen,
+            byte[] out, int outOfs, int outLen) throws PKCS11Exception;
 
 
     /**
@@ -732,7 +755,9 @@
      * @preconditions (pPart <> null)
      * @postconditions
      */
-    public native int C_EncryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception;
+    public native int C_EncryptUpdate(long hSession, long directIn, byte[] in,
+            int inOfs, int inLen, long directOut, byte[] out, int outOfs,
+            int outLen) throws PKCS11Exception;
 
 
     /**
@@ -749,7 +774,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native int C_EncryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception;
+    public native int C_EncryptFinal(long hSession, long directOut, byte[] out,
+            int outOfs, int outLen) throws PKCS11Exception;
 
 
     /**
@@ -766,7 +792,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_DecryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
+    public native void C_DecryptInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception;
 
 
     /**
@@ -785,7 +812,8 @@
      * @preconditions (pEncryptedPart <> null)
      * @postconditions (result <> null)
      */
-    public native int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception;
+    public native int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen,
+            byte[] out, int outOfs, int outLen) throws PKCS11Exception;
 
 
     /**
@@ -805,7 +833,9 @@
      * @preconditions (pEncryptedPart <> null)
      * @postconditions
      */
-    public native int C_DecryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception;
+    public native int C_DecryptUpdate(long hSession, long directIn, byte[] in,
+            int inOfs, int inLen, long directOut, byte[] out, int outOfs,
+            int outLen) throws PKCS11Exception;
 
 
     /**
@@ -822,7 +852,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native int C_DecryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception;
+    public native int C_DecryptFinal(long hSession, long directOut, byte[] out,
+            int outOfs, int outLen) throws PKCS11Exception;
 
 
 
@@ -842,7 +873,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_DigestInit(long hSession, CK_MECHANISM pMechanism) throws PKCS11Exception;
+    public native void C_DigestInit(long hSession, CK_MECHANISM pMechanism)
+            throws PKCS11Exception;
 
 
     // note that C_DigestSingle does not exist in PKCS#11
@@ -863,7 +895,9 @@
      * @preconditions (data <> null)
      * @postconditions (result <> null)
      */
-    public native int C_DigestSingle(long hSession, CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception;
+    public native int C_DigestSingle(long hSession, CK_MECHANISM pMechanism,
+            byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs,
+            int digestLen) throws PKCS11Exception;
 
 
     /**
@@ -879,7 +913,8 @@
      * @preconditions (pPart <> null)
      * @postconditions
      */
-    public native void C_DigestUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception;
+    public native void C_DigestUpdate(long hSession, long directIn, byte[] in,
+            int inOfs, int inLen) throws PKCS11Exception;
 
 
     /**
@@ -896,7 +931,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_DigestKey(long hSession, long hKey) throws PKCS11Exception;
+    public native void C_DigestKey(long hSession, long hKey)
+            throws PKCS11Exception;
 
 
     /**
@@ -912,7 +948,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs, int digestLen) throws PKCS11Exception;
+    public native int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs,
+            int digestLen) throws PKCS11Exception;
 
 
 
@@ -937,7 +974,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_SignInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
+    public native void C_SignInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception;
 
 
     /**
@@ -957,7 +995,8 @@
      * @preconditions (pData <> null)
      * @postconditions (result <> null)
      */
-    public native byte[] C_Sign(long hSession, byte[] pData) throws PKCS11Exception;
+    public native byte[] C_Sign(long hSession, byte[] pData)
+            throws PKCS11Exception;
 
 
     /**
@@ -974,7 +1013,8 @@
      * @preconditions (pPart <> null)
      * @postconditions
      */
-    public native void C_SignUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception;
+    public native void C_SignUpdate(long hSession, long directIn, byte[] in,
+            int inOfs, int inLen) throws PKCS11Exception;
 
 
     /**
@@ -991,7 +1031,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native byte[] C_SignFinal(long hSession, int expectedLen) throws PKCS11Exception;
+    public native byte[] C_SignFinal(long hSession, int expectedLen)
+            throws PKCS11Exception;
 
 
     /**
@@ -1009,7 +1050,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
+    public native void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception;
 
 
     /**
@@ -1028,7 +1070,9 @@
      * @preconditions (pData <> null)
      * @postconditions (result <> null)
      */
-    public native int C_SignRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception;
+    public native int C_SignRecover(long hSession, byte[] in, int inOfs,
+            int inLen, byte[] out, int outOufs, int outLen)
+            throws PKCS11Exception;
 
 
 
@@ -1052,7 +1096,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_VerifyInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
+    public native void C_VerifyInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception;
 
 
     /**
@@ -1071,7 +1116,8 @@
      * @preconditions (pData <> null) and (pSignature <> null)
      * @postconditions
      */
-    public native void C_Verify(long hSession, byte[] pData, byte[] pSignature) throws PKCS11Exception;
+    public native void C_Verify(long hSession, byte[] pData, byte[] pSignature)
+            throws PKCS11Exception;
 
 
     /**
@@ -1088,7 +1134,8 @@
      * @preconditions (pPart <> null)
      * @postconditions
      */
-    public native void C_VerifyUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception;
+    public native void C_VerifyUpdate(long hSession, long directIn, byte[] in,
+            int inOfs, int inLen) throws PKCS11Exception;
 
 
     /**
@@ -1104,7 +1151,8 @@
      * @preconditions (pSignature <> null)
      * @postconditions
      */
-    public native void C_VerifyFinal(long hSession, byte[] pSignature) throws PKCS11Exception;
+    public native void C_VerifyFinal(long hSession, byte[] pSignature)
+            throws PKCS11Exception;
 
 
     /**
@@ -1122,7 +1170,8 @@
      * @preconditions
      * @postconditions
      */
-    public native void C_VerifyRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
+    public native void C_VerifyRecoverInit(long hSession,
+            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
 
 
     /**
@@ -1140,7 +1189,9 @@
      * @preconditions (pSignature <> null)
      * @postconditions (result <> null)
      */
-    public native int C_VerifyRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception;
+    public native int C_VerifyRecover(long hSession, byte[] in, int inOfs,
+            int inLen, byte[] out, int outOufs, int outLen)
+            throws PKCS11Exception;
 
 
 
@@ -1164,7 +1215,8 @@
      * @preconditions (pPart <> null)
      * @postconditions
      */
-//    public native byte[] C_DigestEncryptUpdate(long hSession, byte[] pPart) throws PKCS11Exception;
+//    public native byte[] C_DigestEncryptUpdate(long hSession, byte[] pPart)
+//            throws PKCS11Exception;
 
 
     /**
@@ -1184,7 +1236,8 @@
      * @preconditions (pEncryptedPart <> null)
      * @postconditions
      */
-//    public native byte[] C_DecryptDigestUpdate(long hSession, byte[] pEncryptedPart) throws PKCS11Exception;
+//    public native byte[] C_DecryptDigestUpdate(long hSession,
+//            byte[] pEncryptedPart) throws PKCS11Exception;
 
 
     /**
@@ -1204,7 +1257,8 @@
      * @preconditions (pPart <> null)
      * @postconditions
      */
-//    public native byte[] C_SignEncryptUpdate(long hSession, byte[] pPart) throws PKCS11Exception;
+//    public native byte[] C_SignEncryptUpdate(long hSession, byte[] pPart)
+//            throws PKCS11Exception;
 
 
     /**
@@ -1224,7 +1278,8 @@
      * @preconditions (pEncryptedPart <> null)
      * @postconditions
      */
-//    public native byte[] C_DecryptVerifyUpdate(long hSession, byte[] pEncryptedPart) throws PKCS11Exception;
+//    public native byte[] C_DecryptVerifyUpdate(long hSession,
+//            byte[] pEncryptedPart) throws PKCS11Exception;
 
 
 
@@ -1250,7 +1305,8 @@
      * @preconditions
      * @postconditions
      */
-    public native long C_GenerateKey(long hSession, CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+    public native long C_GenerateKey(long hSession, CK_MECHANISM pMechanism,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
 
 
     /**
@@ -1280,9 +1336,8 @@
      * @postconditions (result <> null) and (result.length == 2)
      */
     public native long[] C_GenerateKeyPair(long hSession,
-                                   CK_MECHANISM pMechanism,
-                                   CK_ATTRIBUTE[] pPublicKeyTemplate,
-                                   CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception;
+            CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pPublicKeyTemplate,
+            CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception;
 
 
 
@@ -1305,7 +1360,8 @@
      * @preconditions
      * @postconditions (result <> null)
      */
-    public native byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism, long hWrappingKey, long hKey) throws PKCS11Exception;
+    public native byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism,
+            long hWrappingKey, long hKey) throws PKCS11Exception;
 
 
     /**
@@ -1331,8 +1387,8 @@
      * @postconditions
      */
     public native long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism,
-                          long hUnwrappingKey, byte[] pWrappedKey,
-                          CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+            long hUnwrappingKey, byte[] pWrappedKey, CK_ATTRIBUTE[] pTemplate)
+            throws PKCS11Exception;
 
 
     /**
@@ -1356,7 +1412,7 @@
      * @postconditions
      */
     public native long C_DeriveKey(long hSession, CK_MECHANISM pMechanism,
-                          long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
+            long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
 
 
 
@@ -1377,7 +1433,8 @@
      * @preconditions (pSeed <> null)
      * @postconditions
      */
-    public native void C_SeedRandom(long hSession, byte[] pSeed) throws PKCS11Exception;
+    public native void C_SeedRandom(long hSession, byte[] pSeed)
+            throws PKCS11Exception;
 
 
     /**
@@ -1393,7 +1450,8 @@
      * @preconditions (randomData <> null)
      * @postconditions
      */
-    public native void C_GenerateRandom(long hSession, byte[] randomData) throws PKCS11Exception;
+    public native void C_GenerateRandom(long hSession, byte[] randomData)
+            throws PKCS11Exception;
 
 
 
@@ -1413,7 +1471,8 @@
      * @preconditions
      * @postconditions
      */
-//    public native void C_GetFunctionStatus(long hSession) throws PKCS11Exception;
+//    public native void C_GetFunctionStatus(long hSession)
+//            throws PKCS11Exception;
 
 
     /**
@@ -1450,7 +1509,8 @@
      * @preconditions (pRserved == null)
      * @postconditions
      */
-//    public native long C_WaitForSlotEvent(long flags, Object pRserved) throws PKCS11Exception;
+//    public native long C_WaitForSlotEvent(long flags, Object pRserved)
+//            throws PKCS11Exception;
 
     /**
      * Returns the string representation of this object.
@@ -1476,7 +1536,8 @@
 // parent. Used for tokens that only support single threaded access
 static class SynchronizedPKCS11 extends PKCS11 {
 
-    SynchronizedPKCS11(String pkcs11ModulePath, String functionListName) throws IOException {
+    SynchronizedPKCS11(String pkcs11ModulePath, String functionListName)
+            throws IOException {
         super(pkcs11ModulePath, functionListName);
     }
 
@@ -1484,7 +1545,8 @@
         super.C_Initialize(pInitArgs);
     }
 
-    public synchronized void C_Finalize(Object pReserved) throws PKCS11Exception {
+    public synchronized void C_Finalize(Object pReserved)
+            throws PKCS11Exception {
         super.C_Finalize(pReserved);
     }
 
@@ -1492,39 +1554,48 @@
         return super.C_GetInfo();
     }
 
-    public synchronized long[] C_GetSlotList(boolean tokenPresent) throws PKCS11Exception {
+    public synchronized long[] C_GetSlotList(boolean tokenPresent)
+            throws PKCS11Exception {
         return super.C_GetSlotList(tokenPresent);
     }
 
-    public synchronized CK_SLOT_INFO C_GetSlotInfo(long slotID) throws PKCS11Exception {
+    public synchronized CK_SLOT_INFO C_GetSlotInfo(long slotID)
+            throws PKCS11Exception {
         return super.C_GetSlotInfo(slotID);
     }
 
-    public synchronized CK_TOKEN_INFO C_GetTokenInfo(long slotID) throws PKCS11Exception {
+    public synchronized CK_TOKEN_INFO C_GetTokenInfo(long slotID)
+            throws PKCS11Exception {
         return super.C_GetTokenInfo(slotID);
     }
 
-    public synchronized long[] C_GetMechanismList(long slotID) throws PKCS11Exception {
+    public synchronized long[] C_GetMechanismList(long slotID)
+            throws PKCS11Exception {
         return super.C_GetMechanismList(slotID);
     }
 
-    public synchronized CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type) throws PKCS11Exception {
+    public synchronized CK_MECHANISM_INFO C_GetMechanismInfo(long slotID,
+            long type) throws PKCS11Exception {
         return super.C_GetMechanismInfo(slotID, type);
     }
 
-    public synchronized long C_OpenSession(long slotID, long flags, Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception {
+    public synchronized long C_OpenSession(long slotID, long flags,
+            Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception {
         return super.C_OpenSession(slotID, flags, pApplication, Notify);
     }
 
-    public synchronized void C_CloseSession(long hSession) throws PKCS11Exception {
+    public synchronized void C_CloseSession(long hSession)
+            throws PKCS11Exception {
         super.C_CloseSession(hSession);
     }
 
-    public synchronized CK_SESSION_INFO C_GetSessionInfo(long hSession) throws PKCS11Exception {
+    public synchronized CK_SESSION_INFO C_GetSessionInfo(long hSession)
+            throws PKCS11Exception {
         return super.C_GetSessionInfo(hSession);
     }
 
-    public synchronized void C_Login(long hSession, long userType, char[] pPin) throws PKCS11Exception {
+    public synchronized void C_Login(long hSession, long userType, char[] pPin)
+            throws PKCS11Exception {
         super.C_Login(hSession, userType, pPin);
     }
 
@@ -1532,157 +1603,207 @@
         super.C_Logout(hSession);
     }
 
-    public synchronized long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
+    public synchronized long C_CreateObject(long hSession,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
         return super.C_CreateObject(hSession, pTemplate);
     }
 
-    public synchronized long C_CopyObject(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
+    public synchronized long C_CopyObject(long hSession, long hObject,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
         return super.C_CopyObject(hSession, hObject, pTemplate);
     }
 
-    public synchronized void C_DestroyObject(long hSession, long hObject) throws PKCS11Exception {
+    public synchronized void C_DestroyObject(long hSession, long hObject)
+            throws PKCS11Exception {
         super.C_DestroyObject(hSession, hObject);
     }
 
-    public synchronized void C_GetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
+    public synchronized void C_GetAttributeValue(long hSession, long hObject,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
         super.C_GetAttributeValue(hSession, hObject, pTemplate);
     }
 
-    public synchronized void C_SetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
+    public synchronized void C_SetAttributeValue(long hSession, long hObject,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
         super.C_SetAttributeValue(hSession, hObject, pTemplate);
     }
 
-    public synchronized void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
+    public synchronized void C_FindObjectsInit(long hSession,
+            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
         super.C_FindObjectsInit(hSession, pTemplate);
     }
 
-    public synchronized long[] C_FindObjects(long hSession, long ulMaxObjectCount) throws PKCS11Exception {
+    public synchronized long[] C_FindObjects(long hSession,
+            long ulMaxObjectCount) throws PKCS11Exception {
         return super.C_FindObjects(hSession, ulMaxObjectCount);
     }
 
-    public synchronized void C_FindObjectsFinal(long hSession) throws PKCS11Exception {
+    public synchronized void C_FindObjectsFinal(long hSession)
+            throws PKCS11Exception {
         super.C_FindObjectsFinal(hSession);
     }
 
-    public synchronized void C_EncryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
+    public synchronized void C_EncryptInit(long hSession,
+            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
         super.C_EncryptInit(hSession, pMechanism, hKey);
     }
 
-    public synchronized int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception {
+    public synchronized int C_Encrypt(long hSession, byte[] in, int inOfs,
+            int inLen, byte[] out, int outOfs, int outLen)
+            throws PKCS11Exception {
         return super.C_Encrypt(hSession, in, inOfs, inLen, out, outOfs, outLen);
     }
 
-    public synchronized int C_EncryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception {
-        return super.C_EncryptUpdate(hSession, directIn, in, inOfs, inLen, directOut, out, outOfs, outLen);
+    public synchronized int C_EncryptUpdate(long hSession, long directIn,
+            byte[] in, int inOfs, int inLen, long directOut, byte[] out,
+            int outOfs, int outLen) throws PKCS11Exception {
+        return super.C_EncryptUpdate(hSession, directIn, in, inOfs, inLen,
+                directOut, out, outOfs, outLen);
     }
 
-    public synchronized int C_EncryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception {
+    public synchronized int C_EncryptFinal(long hSession, long directOut,
+            byte[] out, int outOfs, int outLen) throws PKCS11Exception {
         return super.C_EncryptFinal(hSession, directOut, out, outOfs, outLen);
     }
 
-    public synchronized void C_DecryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
+    public synchronized void C_DecryptInit(long hSession,
+            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
         super.C_DecryptInit(hSession, pMechanism, hKey);
     }
 
-    public synchronized int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception {
+    public synchronized int C_Decrypt(long hSession, byte[] in, int inOfs,
+            int inLen, byte[] out, int outOfs, int outLen)
+            throws PKCS11Exception {
         return super.C_Decrypt(hSession, in, inOfs, inLen, out, outOfs, outLen);
     }
 
-    public synchronized int C_DecryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception {
-        return super.C_DecryptUpdate(hSession, directIn, in, inOfs, inLen, directOut, out, outOfs, outLen);
+    public synchronized int C_DecryptUpdate(long hSession, long directIn,
+            byte[] in, int inOfs, int inLen, long directOut, byte[] out,
+            int outOfs, int outLen) throws PKCS11Exception {
+        return super.C_DecryptUpdate(hSession, directIn, in, inOfs, inLen,
+                directOut, out, outOfs, outLen);
     }
 
-    public synchronized int C_DecryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception {
+    public synchronized int C_DecryptFinal(long hSession, long directOut,
+            byte[] out, int outOfs, int outLen) throws PKCS11Exception {
         return super.C_DecryptFinal(hSession, directOut, out, outOfs, outLen);
     }
 
-    public synchronized void C_DigestInit(long hSession, CK_MECHANISM pMechanism) throws PKCS11Exception {
+    public synchronized void C_DigestInit(long hSession, CK_MECHANISM pMechanism)
+            throws PKCS11Exception {
         super.C_DigestInit(hSession, pMechanism);
     }
 
-    public synchronized int C_DigestSingle(long hSession, CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception {
-        return super.C_DigestSingle(hSession, pMechanism, in, inOfs, inLen, digest, digestOfs, digestLen);
+    public synchronized int C_DigestSingle(long hSession,
+            CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen,
+            byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception {
+        return super.C_DigestSingle(hSession, pMechanism, in, inOfs, inLen,
+                digest, digestOfs, digestLen);
     }
 
-    public synchronized void C_DigestUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception {
+    public synchronized void C_DigestUpdate(long hSession, long directIn,
+            byte[] in, int inOfs, int inLen) throws PKCS11Exception {
         super.C_DigestUpdate(hSession, directIn, in, inOfs, inLen);
     }
 
-    public synchronized void C_DigestKey(long hSession, long hKey) throws PKCS11Exception {
+    public synchronized void C_DigestKey(long hSession, long hKey)
+            throws PKCS11Exception {
         super.C_DigestKey(hSession, hKey);
     }
 
-    public synchronized int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs, int digestLen) throws PKCS11Exception {
+    public synchronized int C_DigestFinal(long hSession, byte[] pDigest,
+            int digestOfs, int digestLen) throws PKCS11Exception {
         return super.C_DigestFinal(hSession, pDigest, digestOfs, digestLen);
     }
 
-    public synchronized void C_SignInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
+    public synchronized void C_SignInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception {
         super.C_SignInit(hSession, pMechanism, hKey);
     }
 
-    public synchronized byte[] C_Sign(long hSession, byte[] pData) throws PKCS11Exception {
+    public synchronized byte[] C_Sign(long hSession, byte[] pData)
+            throws PKCS11Exception {
         return super.C_Sign(hSession, pData);
     }
 
-    public synchronized void C_SignUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception {
+    public synchronized void C_SignUpdate(long hSession, long directIn,
+            byte[] in, int inOfs, int inLen) throws PKCS11Exception {
         super.C_SignUpdate(hSession, directIn, in, inOfs, inLen);
     }
 
-    public synchronized byte[] C_SignFinal(long hSession, int expectedLen) throws PKCS11Exception {
+    public synchronized byte[] C_SignFinal(long hSession, int expectedLen)
+            throws PKCS11Exception {
         return super.C_SignFinal(hSession, expectedLen);
     }
 
-    public synchronized void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
+    public synchronized void C_SignRecoverInit(long hSession,
+            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
         super.C_SignRecoverInit(hSession, pMechanism, hKey);
     }
 
-    public synchronized int C_SignRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception {
-        return super.C_SignRecover(hSession, in, inOfs, inLen, out, outOufs, outLen);
+    public synchronized int C_SignRecover(long hSession, byte[] in, int inOfs,
+            int inLen, byte[] out, int outOufs, int outLen)
+            throws PKCS11Exception {
+        return super.C_SignRecover(hSession, in, inOfs, inLen, out, outOufs,
+                outLen);
     }
 
-    public synchronized void C_VerifyInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
+    public synchronized void C_VerifyInit(long hSession, CK_MECHANISM pMechanism,
+            long hKey) throws PKCS11Exception {
         super.C_VerifyInit(hSession, pMechanism, hKey);
     }
 
-    public synchronized void C_Verify(long hSession, byte[] pData, byte[] pSignature) throws PKCS11Exception {
+    public synchronized void C_Verify(long hSession, byte[] pData,
+            byte[] pSignature) throws PKCS11Exception {
         super.C_Verify(hSession, pData, pSignature);
     }
 
-    public synchronized void C_VerifyUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception {
+    public synchronized void C_VerifyUpdate(long hSession, long directIn,
+            byte[] in, int inOfs, int inLen) throws PKCS11Exception {
         super.C_VerifyUpdate(hSession, directIn, in, inOfs, inLen);
     }
 
-    public synchronized void C_VerifyFinal(long hSession, byte[] pSignature) throws PKCS11Exception {
+    public synchronized void C_VerifyFinal(long hSession, byte[] pSignature)
+            throws PKCS11Exception {
         super.C_VerifyFinal(hSession, pSignature);
     }
 
-    public synchronized void C_VerifyRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
+    public synchronized void C_VerifyRecoverInit(long hSession,
+            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
         super.C_VerifyRecoverInit(hSession, pMechanism, hKey);
     }
 
-    public synchronized int C_VerifyRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception {
-        return super.C_VerifyRecover(hSession, in, inOfs, inLen, out, outOufs, outLen);
+    public synchronized int C_VerifyRecover(long hSession, byte[] in, int inOfs,
+            int inLen, byte[] out, int outOufs, int outLen)
+            throws PKCS11Exception {
+        return super.C_VerifyRecover(hSession, in, inOfs, inLen, out, outOufs,
+                outLen);
     }
 
-    public synchronized long C_GenerateKey(long hSession, CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
+    public synchronized long C_GenerateKey(long hSession,
+            CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate)
+            throws PKCS11Exception {
         return super.C_GenerateKey(hSession, pMechanism, pTemplate);
     }
 
     public synchronized long[] C_GenerateKeyPair(long hSession,
-                                   CK_MECHANISM pMechanism,
-                                   CK_ATTRIBUTE[] pPublicKeyTemplate,
-                                   CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception {
-        return super.C_GenerateKeyPair(hSession, pMechanism, pPublicKeyTemplate, pPrivateKeyTemplate);
+            CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pPublicKeyTemplate,
+            CK_ATTRIBUTE[] pPrivateKeyTemplate)
+            throws PKCS11Exception {
+        return super.C_GenerateKeyPair(hSession, pMechanism, pPublicKeyTemplate,
+                pPrivateKeyTemplate);
     }
 
-    public synchronized byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism, long hWrappingKey, long hKey) throws PKCS11Exception {
+    public synchronized byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism,
+            long hWrappingKey, long hKey) throws PKCS11Exception {
         return super.C_WrapKey(hSession, pMechanism, hWrappingKey, hKey);
     }
 
     public synchronized long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism,
-                          long hUnwrappingKey, byte[] pWrappedKey,
-                          CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
-        return super.C_UnwrapKey(hSession, pMechanism, hUnwrappingKey, pWrappedKey, pTemplate);
+            long hUnwrappingKey, byte[] pWrappedKey, CK_ATTRIBUTE[] pTemplate)
+            throws PKCS11Exception {
+        return super.C_UnwrapKey(hSession, pMechanism, hUnwrappingKey,
+                pWrappedKey, pTemplate);
     }
 
     public synchronized long C_DeriveKey(long hSession, CK_MECHANISM pMechanism,
@@ -1690,14 +1811,14 @@
         return super.C_DeriveKey(hSession, pMechanism, hBaseKey, pTemplate);
     }
 
-    public synchronized void C_SeedRandom(long hSession, byte[] pSeed) throws PKCS11Exception {
+    public synchronized void C_SeedRandom(long hSession, byte[] pSeed)
+            throws PKCS11Exception {
         super.C_SeedRandom(hSession, pSeed);
     }
 
-    public synchronized void C_GenerateRandom(long hSession, byte[] randomData) throws PKCS11Exception {
+    public synchronized void C_GenerateRandom(long hSession, byte[] randomData)
+            throws PKCS11Exception {
         super.C_GenerateRandom(hSession, randomData);
     }
-
 }
-
 }
--- a/jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/ClientHandshaker.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -957,7 +957,8 @@
                 if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
                     preferableSignatureAlgorithm =
                         SignatureAndHashAlgorithm.getPreferableAlgorithm(
-                            peerSupportedSignAlgs, signingKey.getAlgorithm());
+                            peerSupportedSignAlgs, signingKey.getAlgorithm(),
+                            signingKey);
 
                     if (preferableSignatureAlgorithm == null) {
                         throw new SSLHandshakeException(
--- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1024,37 +1024,39 @@
             }
             break;
         case K_DHE_RSA:
+            // need RSA certs for authentication
+            if (setupPrivateKeyAndChain("RSA") == false) {
+                return false;
+            }
+
             // get preferable peer signature algorithm for server key exchange
             if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
                 preferableSignatureAlgorithm =
                     SignatureAndHashAlgorithm.getPreferableAlgorithm(
-                                                supportedSignAlgs, "RSA");
+                                        supportedSignAlgs, "RSA", privateKey);
                 if (preferableSignatureAlgorithm == null) {
                     return false;
                 }
             }
 
+            setupEphemeralDHKeys(suite.exportable);
+            break;
+        case K_ECDHE_RSA:
             // need RSA certs for authentication
             if (setupPrivateKeyAndChain("RSA") == false) {
                 return false;
             }
-            setupEphemeralDHKeys(suite.exportable);
-            break;
-        case K_ECDHE_RSA:
+
             // get preferable peer signature algorithm for server key exchange
             if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
                 preferableSignatureAlgorithm =
                     SignatureAndHashAlgorithm.getPreferableAlgorithm(
-                                                supportedSignAlgs, "RSA");
+                                        supportedSignAlgs, "RSA", privateKey);
                 if (preferableSignatureAlgorithm == null) {
                     return false;
                 }
             }
 
-            // need RSA certs for authentication
-            if (setupPrivateKeyAndChain("RSA") == false) {
-                return false;
-            }
             if (setupEphemeralECDHKeys() == false) {
                 return false;
             }
--- a/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import java.security.AlgorithmConstraints;
 import java.security.CryptoPrimitive;
+import java.security.PrivateKey;
 
 import java.util.Set;
 import java.util.HashSet;
@@ -37,6 +38,8 @@
 import java.util.Collections;
 import java.util.ArrayList;
 
+import sun.security.util.KeyLength;
+
 /**
  * Signature and hash algorithm.
  *
@@ -231,6 +234,14 @@
     static SignatureAndHashAlgorithm getPreferableAlgorithm(
         Collection<SignatureAndHashAlgorithm> algorithms, String expected) {
 
+        return SignatureAndHashAlgorithm.getPreferableAlgorithm(
+                algorithms, expected, null);
+    }
+
+    static SignatureAndHashAlgorithm getPreferableAlgorithm(
+        Collection<SignatureAndHashAlgorithm> algorithms,
+        String expected, PrivateKey signingKey) {
+
         if (expected == null && !algorithms.isEmpty()) {
             for (SignatureAndHashAlgorithm sigAlg : algorithms) {
                 if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM) {
@@ -241,17 +252,58 @@
             return null;  // no supported algorithm
         }
 
+        if (expected == null ) {
+            return null;  // no expected algorithm, no supported algorithm
+        }
+
+        /*
+         * Need to check RSA key length to match the length of hash value
+         */
+        int maxDigestLength = Integer.MAX_VALUE;
+        if (signingKey != null &&
+                "rsa".equalsIgnoreCase(signingKey.getAlgorithm()) &&
+                expected.equalsIgnoreCase("rsa")) {
+            /*
+             * RSA keys of 512 bits have been shown to be practically
+             * breakable, it does not make much sense to use the strong
+             * hash algorithm for keys whose key size less than 512 bits.
+             * So it is not necessary to caculate the required max digest
+             * length exactly.
+             *
+             * If key size is greater than or equals to 768, there is no max
+             * digest length limitation in currect implementation.
+             *
+             * If key size is greater than or equals to 512, but less than
+             * 768, the digest length should be less than or equal to 32 bytes.
+             *
+             * If key size is less than 512, the  digest length should be
+             * less than or equal to 20 bytes.
+             */
+            int keySize = KeyLength.getKeySize(signingKey);
+            if (keySize >= 768) {
+                maxDigestLength = HashAlgorithm.SHA512.length;
+            } else if ((keySize >= 512) && (keySize < 768)) {
+                maxDigestLength = HashAlgorithm.SHA256.length;
+            } else if ((keySize > 0) && (keySize < 512)) {
+                maxDigestLength = HashAlgorithm.SHA1.length;
+            }   // Otherwise, cannot determine the key size, prefer the most
+                // perferable hash algorithm.
+        }
 
         for (SignatureAndHashAlgorithm algorithm : algorithms) {
             int signValue = algorithm.id & 0xFF;
-            if ((expected.equalsIgnoreCase("dsa") &&
-                    signValue == SignatureAlgorithm.DSA.value) ||
-                (expected.equalsIgnoreCase("rsa") &&
-                    signValue == SignatureAlgorithm.RSA.value) ||
-                (expected.equalsIgnoreCase("ecdsa") &&
-                    signValue == SignatureAlgorithm.ECDSA.value) ||
-                (expected.equalsIgnoreCase("ec") &&
-                    signValue == SignatureAlgorithm.ECDSA.value)) {
+            if (expected.equalsIgnoreCase("rsa") &&
+                    signValue == SignatureAlgorithm.RSA.value) {
+                if (algorithm.hash.length <= maxDigestLength) {
+                    return algorithm;
+                }
+            } else if (
+                    (expected.equalsIgnoreCase("dsa") &&
+                        signValue == SignatureAlgorithm.DSA.value) ||
+                    (expected.equalsIgnoreCase("ecdsa") &&
+                        signValue == SignatureAlgorithm.ECDSA.value) ||
+                    (expected.equalsIgnoreCase("ec") &&
+                        signValue == SignatureAlgorithm.ECDSA.value)) {
                 return algorithm;
             }
         }
@@ -260,25 +312,28 @@
     }
 
     static enum HashAlgorithm {
-        UNDEFINED("undefined",        "", -1),
-        NONE(          "none",    "NONE",  0),
-        MD5(            "md5",     "MD5",  1),
-        SHA1(          "sha1",   "SHA-1",  2),
-        SHA224(      "sha224", "SHA-224",  3),
-        SHA256(      "sha256", "SHA-256",  4),
-        SHA384(      "sha384", "SHA-384",  5),
-        SHA512(      "sha512", "SHA-512",  6);
+        UNDEFINED("undefined",        "", -1, -1),
+        NONE(          "none",    "NONE",  0, -1),
+        MD5(            "md5",     "MD5",  1, 16),
+        SHA1(          "sha1",   "SHA-1",  2, 20),
+        SHA224(      "sha224", "SHA-224",  3, 28),
+        SHA256(      "sha256", "SHA-256",  4, 32),
+        SHA384(      "sha384", "SHA-384",  5, 48),
+        SHA512(      "sha512", "SHA-512",  6, 64);
 
         final String name;  // not the standard signature algorithm name
                             // except the UNDEFINED, other names are defined
                             // by TLS 1.2 protocol
         final String standardName; // the standard MessageDigest algorithm name
         final int value;
+        final int length;   // digest length in bytes, -1 means not applicable
 
-        private HashAlgorithm(String name, String standardName, int value) {
+        private HashAlgorithm(String name, String standardName,
+                int value, int length) {
             this.name = name;
             this.standardName = standardName;
             this.value = value;
+            this.length = length;
         }
 
         static HashAlgorithm valueOf(int value) {
--- a/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,11 +33,6 @@
 import java.security.Security;
 import java.security.PrivilegedAction;
 import java.security.AccessController;
-import java.security.interfaces.ECKey;
-import java.security.interfaces.RSAKey;
-import java.security.interfaces.DSAKey;
-import javax.crypto.SecretKey;
-import javax.crypto.interfaces.DHKey;
 
 import java.util.Locale;
 import java.util.Set;
@@ -443,40 +438,15 @@
 
         // Does this key constraint disable the specified key?
         public boolean disables(Key key) {
-            int size = -1;
-
-            // it is a SecretKey
-            if (key instanceof SecretKey) {
-                SecretKey sk = (SecretKey)key;
-                if (sk.getFormat().equals("RAW") && sk.getEncoded() != null) {
-                    size = sk.getEncoded().length * 8;
-
-                }
-            }
-
-            // it is an asymmetric key
-            if (key instanceof RSAKey) {
-                RSAKey pubk = (RSAKey)key;
-                size = pubk.getModulus().bitLength();
-            } else if (key instanceof ECKey) {
-                ECKey pubk = (ECKey)key;
-                size = pubk.getParams().getOrder().bitLength();
-            } else if (key instanceof DSAKey) {
-                DSAKey pubk = (DSAKey)key;
-                size = pubk.getParams().getP().bitLength();
-            } else if (key instanceof DHKey) {
-                DHKey pubk = (DHKey)key;
-                size = pubk.getParams().getP().bitLength();
-            } // else, it is not a key we know.
+            int size = KeyLength.getKeySize(key);
 
             if (size == 0) {
                 return true;    // we don't allow any key of size 0.
-            }
-
-            if (size >= 0) {
+            } else if (size > 0) {
                 return ((size < minSize) || (size > maxSize) ||
                     (prohibitedSize == size));
-            }
+            }   // Otherwise, the key size is not accessible. Conservatively,
+                // please don't disable such keys.
 
             return false;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/util/KeyLength.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.util;
+
+import java.security.Key;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.security.interfaces.ECKey;
+import java.security.interfaces.RSAKey;
+import java.security.interfaces.DSAKey;
+import javax.crypto.SecretKey;
+import javax.crypto.interfaces.DHKey;
+
+/**
+ * A utility class to get key length
+ */
+public final class KeyLength {
+
+    /**
+     * Returns the key size of the given key object in bits.
+     *
+     * @param key the key object, cannot be null
+     * @return the key size of the given key object in bits, or -1 if the
+     *       key size is not accessible
+     */
+    final public static int getKeySize(Key key) {
+        int size = -1;
+
+        if (key instanceof Length) {
+            try {
+                Length ruler = (Length)key;
+                size = ruler.length();
+            } catch (UnsupportedOperationException usoe) {
+                // ignore the exception
+            }
+
+            if (size >= 0) {
+                return size;
+            }
+        }
+
+        // try to parse the length from key specification
+        if (key instanceof SecretKey) {
+            SecretKey sk = (SecretKey)key;
+            String format = sk.getFormat();
+            if ("RAW".equals(format) && sk.getEncoded() != null) {
+                size = (sk.getEncoded().length * 8);
+            }   // Otherwise, it may be a unextractable key of PKCS#11, or
+                // a key we are not able to handle.
+        } else if (key instanceof RSAKey) {
+            RSAKey pubk = (RSAKey)key;
+            size = pubk.getModulus().bitLength();
+        } else if (key instanceof ECKey) {
+            ECKey pubk = (ECKey)key;
+            size = pubk.getParams().getOrder().bitLength();
+        } else if (key instanceof DSAKey) {
+            DSAKey pubk = (DSAKey)key;
+            size = pubk.getParams().getP().bitLength();
+        } else if (key instanceof DHKey) {
+            DHKey pubk = (DHKey)key;
+            size = pubk.getParams().getP().bitLength();
+        }   // Otherwise, it may be a unextractable key of PKCS#11, or
+            // a key we are not able to handle.
+
+        return size;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/util/Length.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.util;
+
+/**
+ * The Length interface defines the length of an object
+ */
+public interface Length {
+
+    /**
+     * Gets the length of this object
+     * <p>
+     * Note that if a class of java.security.Key implements this interfaces,
+     * the length should be measured in bits.
+     *
+     * @return the length of this object
+     * @throws UnsupportedOperationException if the operation is not supported
+     */
+    public int length();
+}
--- a/jdk/src/share/lib/security/java.security-solaris	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/lib/security/java.security-solaris	Thu Jan 26 19:39:08 2012 -0800
@@ -43,16 +43,17 @@
 #
 # List of providers and their preference orders (see above):
 #
-security.provider.1=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/sunpkcs11-solaris.cfg
-security.provider.2=sun.security.provider.Sun
-security.provider.3=sun.security.rsa.SunRsaSign
-security.provider.4=sun.security.ec.SunEC
-security.provider.5=com.sun.net.ssl.internal.ssl.Provider
-security.provider.6=com.sun.crypto.provider.SunJCE
-security.provider.7=sun.security.jgss.SunProvider
-security.provider.8=com.sun.security.sasl.Provider
-security.provider.9=org.jcp.xml.dsig.internal.dom.XMLDSigRI
-security.provider.10=sun.security.smartcardio.SunPCSC
+security.provider.1=com.oracle.security.ucrypto.UcryptoProvider ${java.home}/lib/security/ucrypto-solaris.cfg
+security.provider.2=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/sunpkcs11-solaris.cfg
+security.provider.3=sun.security.provider.Sun
+security.provider.4=sun.security.rsa.SunRsaSign
+security.provider.5=sun.security.ec.SunEC
+security.provider.6=com.sun.net.ssl.internal.ssl.Provider
+security.provider.7=com.sun.crypto.provider.SunJCE
+security.provider.8=sun.security.jgss.SunProvider
+security.provider.9=com.sun.security.sasl.Provider
+security.provider.10=org.jcp.xml.dsig.internal.dom.XMLDSigRI
+security.provider.11=sun.security.smartcardio.SunPCSC
 
 #
 # Select the source of seed data for SecureRandom. By default an
--- a/jdk/src/share/lib/security/sunpkcs11-solaris.cfg	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/lib/security/sunpkcs11-solaris.cfg	Thu Jan 26 19:39:08 2012 -0800
@@ -17,23 +17,27 @@
 attributes = compatibility
 
 disabledMechanisms = {
-# the following mechanisms are disabled due to lack of digest cloning support
-# need to fix 6414899 first
+  CKM_DSA_KEY_PAIR_GEN
+# the following mechanisms are disabled due to CKR_SAVED_STATE_INVALID bug
+# (Solaris bug 7058108)
   CKM_MD2
   CKM_MD5
   CKM_SHA_1
+# the following mechanisms are disabled due to no cloning support
+# (Solaris bug 7050617)
   CKM_SHA256
   CKM_SHA384
   CKM_SHA512
-  CKM_DSA_KEY_PAIR_GEN
-# the following mechanisms are disabled due to performance issues (Solaris bug 6337157)
+# the following mechanisms are disabled due to performance issues
+# (Solaris bug 6337157)
   CKM_DSA_SHA1
   CKM_MD5_RSA_PKCS
   CKM_SHA1_RSA_PKCS
   CKM_SHA256_RSA_PKCS
   CKM_SHA384_RSA_PKCS
   CKM_SHA512_RSA_PKCS
-# the following mechanisms are disabled to ensure backward compatibility (Solaris bug 6545046)
+# the following mechanisms are disabled to ensure backward compatibility
+# (Solaris bug 6545046)
   CKM_DES_CBC_PAD
   CKM_DES3_CBC_PAD
   CKM_AES_CBC_PAD
--- a/jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -96,8 +96,8 @@
 #define P11_ENABLE_C_CLOSESESSION
 #undef  P11_ENABLE_C_CLOSEALLSESSIONS
 #define P11_ENABLE_C_GETSESSIONINFO
-#undef  P11_ENABLE_C_GETOPERATIONSTATE
-#undef  P11_ENABLE_C_SETOPERATIONSTATE
+#define P11_ENABLE_C_GETOPERATIONSTATE
+#define P11_ENABLE_C_SETOPERATIONSTATE
 #define P11_ENABLE_C_LOGIN
 #define P11_ENABLE_C_LOGOUT
 #define P11_ENABLE_C_CREATEOBJECT
--- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Thu Jan 26 19:39:08 2012 -0800
@@ -76,9 +76,12 @@
             accessor.setFiles(fd, null, null);
         } else {
             // Fix 6987233: add the trailing slash if it's absent
-            accessor.setDirectory(fd, directory +
-                    (directory.endsWith(File.separator) ?
-                     "" : File.separator));
+            String with_separator = directory;
+            if (directory != null) {
+                with_separator = directory.endsWith(File.separator) ?
+                        directory : (directory + File.separator);
+            }
+            accessor.setDirectory(fd, with_separator);
             accessor.setFile(fd, filenames[0]);
             accessor.setFiles(fd, directory, filenames);
         }
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRCompositeManager.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRCompositeManager.java	Thu Jan 26 19:39:08 2012 -0800
@@ -28,6 +28,9 @@
 import java.awt.*;
 import java.awt.geom.*;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 import sun.font.*;
 import sun.java2d.*;
 import sun.java2d.jules.*;
@@ -83,7 +86,13 @@
         con = new XRBackendNative();
         // con = XRBackendJava.getInstance();
 
-        String gradProp = System.getProperty("sun.java2d.xrgradcache");
+        String gradProp =
+            AccessController.doPrivileged(new PrivilegedAction<String>() {
+                public String run() {
+                    return System.getProperty("sun.java2d.xrgradcache");
+                }
+            });
+
         enableGradCache = gradProp == null ||
                           !(gradProp.equalsIgnoreCase("false") ||
                           gradProp.equalsIgnoreCase("f"));
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Thu Jan 26 19:39:08 2012 -0800
@@ -36,8 +36,6 @@
 import sun.misc.SharedSecrets;
 import sun.misc.JavaIOFileDescriptorAccess;
 
-import com.sun.nio.file.ExtendedOpenOption;
-
 import static sun.nio.fs.UnixNativeDispatcher.*;
 import static sun.nio.fs.UnixConstants.*;
 
@@ -86,13 +84,13 @@
                     }
                     continue;
                 }
-                if (option == LinkOption.NOFOLLOW_LINKS) {
+                if (option == LinkOption.NOFOLLOW_LINKS && supportsNoFollowLinks()) {
                     flags.noFollowLinks = true;
                     continue;
                 }
                 if (option == null)
                     throw new NullPointerException();
-               throw new UnsupportedOperationException();
+               throw new UnsupportedOperationException(option + " not supported");
             }
             return flags;
         }
@@ -220,6 +218,15 @@
         // follow links by default
         boolean followLinks = true;
         if (!flags.createNew && (flags.noFollowLinks || flags.deleteOnClose)) {
+            if (flags.deleteOnClose && !supportsNoFollowLinks()) {
+                try {
+                    if (UnixFileAttributes.get(path, false).isSymbolicLink())
+                        throw new UnixException("DELETE_ON_CLOSE specified and file is a symbolic link");
+                } catch (UnixException x) {
+                    if (!flags.create || x.errno() != ENOENT)
+                        throw x;
+                }
+            }
             followLinks = false;
             oflags |= O_NOFOLLOW;
         }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java	Thu Jan 26 19:39:08 2012 -0800
@@ -395,7 +395,7 @@
 
         // can't return SecureDirectoryStream on kernels that don't support
         // openat, etc.
-        if (!supportsAtSysCalls()) {
+        if (!supportsAtSysCalls() || !supportsNoFollowLinks()) {
             try {
                 long ptr = opendir(dir);
                 return new UnixDirectoryStream(dir, ptr, filter);
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java	Thu Jan 26 19:39:08 2012 -0800
@@ -548,6 +548,10 @@
         return hasAtSysCalls;
     }
 
+    static boolean supportsNoFollowLinks() {
+        return UnixConstants.O_NOFOLLOW != 0;
+    }
+
     // initialize syscalls and fieldIDs
     private static native int init();
 
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Thu Jan 26 19:39:08 2012 -0800
@@ -767,8 +767,11 @@
     // package-private
     int openForAttributeAccess(boolean followLinks) throws IOException {
         int flags = O_RDONLY;
-        if (!followLinks)
+        if (!followLinks) {
+            if (!supportsNoFollowLinks())
+                throw new IOException("NOFOLLOW_LINKS is not supported on this platform");
             flags |= O_NOFOLLOW;
+        }
         try {
             return open(this, flags, 0);
         } catch (UnixException x) {
--- a/jdk/src/solaris/native/java/net/net_util_md.c	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/native/java/net/net_util_md.c	Thu Jan 26 19:39:08 2012 -0800
@@ -588,7 +588,7 @@
         int plen, scope, dad_status, if_idx;
 
         if ((f = fopen("/proc/net/if_inet6", "r")) != NULL) {
-            while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+            while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n",
                       addr6p[0], addr6p[1], addr6p[2], addr6p[3],
                       addr6p[4], addr6p[5], addr6p[6], addr6p[7],
                   &if_idx, &plen, &scope, &dad_status, devname) == 13) {
@@ -1078,7 +1078,7 @@
         int plen, scope, dad_status, if_idx;
 
         if ((f = fopen("/proc/net/if_inet6", "r")) != NULL) {
-            while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+            while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n",
                       addr6p[0], addr6p[1], addr6p[2], addr6p[3],
                       addr6p[4], addr6p[5], addr6p[6], addr6p[7],
                   &if_idx, &plen, &scope, &dad_status, devname) == 13) {
--- a/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c	Thu Jan 26 19:39:08 2012 -0800
@@ -64,7 +64,12 @@
     DEFX(O_TRUNC);
     DEFX(O_SYNC);
     DEFX(O_DSYNC);
+#ifdef O_NOFOLLOW
     DEFX(O_NOFOLLOW);
+#else
+    // not supported (dummy values will not be used at runtime).
+    emitX("O_NOFOLLOW", 0x0);
+#endif
 
     // mode masks
     emitX("S_IAMB",
--- a/jdk/src/windows/classes/sun/security/mscapi/Key.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/windows/classes/sun/security/mscapi/Key.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package sun.security.mscapi;
 
+import sun.security.util.Length;
+
 /**
  * The handle for an RSA or DSA key using the Microsoft Crypto API.
  *
@@ -35,7 +37,7 @@
  * @since 1.6
  * @author  Stanley Man-Kit Ho
  */
-abstract class Key implements java.security.Key
+abstract class Key implements java.security.Key, Length
 {
 
     // Native handle
@@ -81,7 +83,8 @@
     /**
      * Return bit length of the key.
      */
-    public int bitLength()
+    @Override
+    public int length()
     {
         return keyLength;
     }
--- a/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/windows/classes/sun/security/mscapi/RSACipher.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -235,12 +235,12 @@
             mode = encrypt ? MODE_ENCRYPT : MODE_VERIFY;
             publicKey = (sun.security.mscapi.Key)key;
             privateKey = null;
-            outputSize = publicKey.bitLength() / 8;
+            outputSize = publicKey.length() / 8;
         } else if (key instanceof PrivateKey) {
             mode = encrypt ? MODE_SIGN : MODE_DECRYPT;
             privateKey = (sun.security.mscapi.Key)key;
             publicKey = null;
-            outputSize = privateKey.bitLength() / 8;
+            outputSize = privateKey.length() / 8;
         } else {
             throw new InvalidKeyException("Unknown key type: " + key);
         }
@@ -395,7 +395,7 @@
     protected int engineGetKeySize(Key key) throws InvalidKeyException {
 
         if (key instanceof sun.security.mscapi.Key) {
-            return ((sun.security.mscapi.Key) key).bitLength();
+            return ((sun.security.mscapi.Key) key).length();
 
         } else if (key instanceof RSAKey) {
             return ((RSAKey) key).getModulus().bitLength();
--- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -290,7 +290,7 @@
 
         // Check against the local and global values to make sure
         // the sizes are ok.  Round up to nearest byte.
-        RSAKeyFactory.checkKeyLengths(((privateKey.bitLength() + 7) & ~7),
+        RSAKeyFactory.checkKeyLengths(((privateKey.length() + 7) & ~7),
             null, RSAKeyPairGenerator.KEY_SIZE_MIN,
             RSAKeyPairGenerator.KEY_SIZE_MAX);
 
--- a/jdk/test/Makefile	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/Makefile	Thu Jan 26 19:39:08 2012 -0800
@@ -555,7 +555,8 @@
 # Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_security3
 jdk_security3: $(call TestDirs, com/sun/security lib/security javax/security \
-        sun/security com/sun/org/apache/xml/internal/security)
+        sun/security com/sun/org/apache/xml/internal/security \
+        com/oracle/secrity/ucrypto)
 	$(call SharedLibraryPermissions,sun/security)
 	$(call RunAgentvmBatch)
 
--- a/jdk/test/ProblemList.txt	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/ProblemList.txt	Thu Jan 26 19:39:08 2012 -0800
@@ -195,19 +195,22 @@
 
 # jdk_lang
 
+# 7123972
+java/lang/annotation/loaderLeak/Main.java			generic-all
+
 # 7079093
 java/lang/instrument/ManifestTest.sh                            windows-all
 
-############################################################################
-
-# jdk_management
-
 # 6944188
 java/lang/management/ThreadMXBean/ThreadStateTest.java          generic-all
 
 # 7067973
 java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
 
+############################################################################
+
+# jdk_management
+
 # Failing, bug was filed: 6959636
 javax/management/loading/LibraryLoader/LibraryLoaderTest.java   generic-all
 
@@ -289,6 +292,9 @@
 
 # jdk_misc
 
+# 6988950
+demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java	generic-all
+
 # Need to be marked othervm, or changed to be samevm safe
 com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all
 
@@ -387,9 +393,6 @@
 # 6962637
 java/io/File/MaxPathLength.java                                 windows-all
 
-# 6671616
-java/io/File/BlockIsDirectory.java                              solaris-all
-
 # 7076644
 java/io/File/Basic.java                                         windows-all
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/oracle/security/ucrypto/TestAES.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7088989
+ * @summary Ensure the AES ciphers of OracleUcrypto provider works correctly
+ */
+import java.io.*;
+import java.security.*;
+import java.security.spec.*;
+import java.util.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+
+public class TestAES extends UcryptoTest {
+
+    private static final String[] PADDEDCIPHER_ALGOS = {
+        "AES/ECB/PKCS5Padding",
+        "AES/CBC/PKCS5Padding",
+        "AES/CFB128/PKCS5Padding"
+    };
+
+    private static final String[] CIPHER_ALGOS = {
+        "AES/ECB/NoPadding",
+        "AES/CBC/NoPadding",
+        "AES/CFB128/NoPadding",
+        "AES/CTR/NoPadding",
+    };
+
+    private static final SecretKey CIPHER_KEY =
+        new SecretKeySpec(new byte[16], "AES");
+
+    public static void main(String[] args) throws Exception {
+        main(new TestAES(), null);
+    }
+
+    public void doTest(Provider prov) throws Exception {
+        // Provider for testing Interoperability
+        Provider sunJCEProv = Security.getProvider("SunJCE");
+
+        testCipherInterop(CIPHER_ALGOS, CIPHER_KEY, prov, sunJCEProv);
+        testCipherInterop(PADDEDCIPHER_ALGOS, CIPHER_KEY, prov, sunJCEProv);
+
+        testCipherOffset(CIPHER_ALGOS, CIPHER_KEY, prov);
+        testCipherOffset(PADDEDCIPHER_ALGOS, CIPHER_KEY, prov);
+
+        testCipherKeyWrapping(PADDEDCIPHER_ALGOS, CIPHER_KEY, prov, sunJCEProv);
+        testCipherGCM(CIPHER_KEY, prov);
+    }
+
+    private static void testCipherInterop(String[] algos, SecretKey key,
+                                          Provider p,
+                                          Provider interopP) {
+        boolean testPassed = true;
+        byte[] in = new byte[32];
+        (new SecureRandom()).nextBytes(in);
+
+        for (String algo : algos) {
+            try {
+                // check ENC
+                Cipher c;
+                try {
+                    c = Cipher.getInstance(algo, p);
+                } catch (NoSuchAlgorithmException nsae) {
+                    System.out.println("Skipping Unsupported CIP algo: " + algo);
+                    continue;
+                }
+                c.init(Cipher.ENCRYPT_MODE, key, (AlgorithmParameters)null, null);
+                byte[] eout = c.doFinal(in, 0, in.length);
+
+                AlgorithmParameters params = c.getParameters();
+                Cipher c2 = Cipher.getInstance(algo, interopP);
+                c2.init(Cipher.ENCRYPT_MODE, key, params, null);
+                byte[] eout2 = c2.doFinal(in, 0, in.length);
+
+                if (!Arrays.equals(eout, eout2)) {
+                    System.out.println(algo + ": DIFF FAILED");
+                    testPassed = false;
+                } else {
+                    System.out.println(algo + ": ENC Passed");
+                }
+
+                // check DEC
+                c.init(Cipher.DECRYPT_MODE, key, params, null);
+                byte[] dout = c.doFinal(eout);
+                c2.init(Cipher.DECRYPT_MODE, key, params, null);
+                byte[] dout2 = c2.doFinal(eout2);
+
+                if (!Arrays.equals(dout, dout2)) {
+                    System.out.println(algo + ": DIFF FAILED");
+                    testPassed = false;
+                } else {
+                    System.out.println(algo + ": DEC Passed");
+                }
+            } catch(Exception ex) {
+                System.out.println("Unexpected Exception: " + algo);
+                ex.printStackTrace();
+                testPassed = false;
+            }
+        }
+
+        if (!testPassed) {
+            throw new RuntimeException("One or more CIPHER test failed!");
+        } else {
+            System.out.println("CIPHER Interop Tests Passed");
+        }
+    }
+
+    private static void testCipherOffset(String[] algos, SecretKey key,
+                                         Provider p) {
+        boolean testPassed = true;
+        byte[] in = new byte[16];
+        (new SecureRandom()).nextBytes(in);
+        int blockSize = 16;
+
+        for (int j = 1; j < (in.length - 1); j++) {
+            System.out.println("Input offset size: " + j);
+            for (int i = 0; i < algos.length; i++) {
+                try {
+                    // check ENC
+                    Cipher c;
+                    try {
+                        c = Cipher.getInstance(algos[i], p);
+                    } catch (NoSuchAlgorithmException nsae) {
+                        System.out.println("Skip Unsupported CIP algo: " + algos[i]);
+                        continue;
+                    }
+                    c.init(Cipher.ENCRYPT_MODE, key, (AlgorithmParameters)null, null);
+                    byte[] eout = new byte[c.getOutputSize(in.length)];
+                    int firstPartLen = in.length - j - 1;
+                    //System.out.print("1st UPDATE: " + firstPartLen);
+                    int k = c.update(in, 0, firstPartLen, eout, 0);
+                    k += c.update(in, firstPartLen, 1, eout, k);
+                    k += c.doFinal(in, firstPartLen+1, j, eout, k);
+
+                    AlgorithmParameters params = c.getParameters();
+
+                    Cipher c2 = Cipher.getInstance(algos[i], p);
+                    c2.init(Cipher.ENCRYPT_MODE, key, params, null);
+                    byte[] eout2 = new byte[c2.getOutputSize(in.length)];
+                    int k2 = c2.update(in, 0, j, eout2, 0);
+                    k2 += c2.update(in, j, 1, eout2, k2);
+                    k2 += c2.doFinal(in, j+1, firstPartLen, eout2, k2);
+
+                    if (!checkArrays(eout, k, eout2, k2)) testPassed = false;
+
+                    // check DEC
+                    c.init(Cipher.DECRYPT_MODE, key, params, null);
+                    byte[] dout = new byte[c.getOutputSize(eout.length)];
+                    k = c.update(eout, 0, firstPartLen, dout, 0);
+                    k += c.update(eout, firstPartLen, 1, dout, k);
+                    k += c.doFinal(eout, firstPartLen+1, eout.length - firstPartLen - 1, dout, k);
+                    if (!checkArrays(in, in.length, dout, k)) testPassed = false;
+                } catch(Exception ex) {
+                    System.out.println("Unexpected Exception: " + algos[i]);
+                    ex.printStackTrace();
+                    testPassed = false;
+                }
+            }
+        }
+        if (!testPassed) {
+            throw new RuntimeException("One or more CIPHER test failed!");
+        } else {
+            System.out.println("CIPHER Offset Tests Passed");
+        }
+    }
+
+    private static void testCipherKeyWrapping(String[] algos, SecretKey key,
+                                              Provider p, Provider interopP)
+        throws NoSuchAlgorithmException {
+        boolean testPassed = true;
+
+        // Test SecretKey, PrivateKey and PublicKey
+        Key[] tbwKeys = new Key[3];
+        int[] tbwKeyTypes = { Cipher.SECRET_KEY, Cipher.PRIVATE_KEY, Cipher.PUBLIC_KEY };
+        tbwKeys[0] = new SecretKeySpec(new byte[20], "Blowfish");
+        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
+        kpg.initialize(1024);
+        KeyPair kp = kpg.generateKeyPair();
+        tbwKeys[1] = kp.getPrivate();
+        tbwKeys[2] = kp.getPublic();
+
+        for (int i = 0; i < algos.length; i++) {
+            try {
+                System.out.println(algos[i] + " - Native WRAP/Java UNWRAP");
+
+                Cipher c1;
+                try {
+                    c1 = Cipher.getInstance(algos[i], p);
+                } catch (NoSuchAlgorithmException nsae) {
+                    System.out.println("Skipping Unsupported CIP algo: " + algos[i]);
+                    continue;
+                }
+                c1.init(Cipher.WRAP_MODE, key, (AlgorithmParameters)null, null);
+                AlgorithmParameters params = c1.getParameters();
+                Cipher c2 = Cipher.getInstance(algos[i], interopP);
+                c2.init(Cipher.UNWRAP_MODE, key, params, null);
+
+                for (int j = 0; j < tbwKeys.length ; j++) {
+                    byte[] wrappedKey = c1.wrap(tbwKeys[j]);
+                    Key recovered = c2.unwrap(wrappedKey,
+                                              tbwKeys[j].getAlgorithm(), tbwKeyTypes[j]);
+                    if (!checkKeys(tbwKeys[j], recovered)) testPassed = false;
+                }
+
+                System.out.println(algos[i] + " - Java WRAP/Native UNWRAP");
+                c1 = Cipher.getInstance(algos[i], interopP);
+                c1.init(Cipher.WRAP_MODE, key, (AlgorithmParameters)null, null);
+                params = c1.getParameters();
+                c2 = Cipher.getInstance(algos[i], p);
+                c2.init(Cipher.UNWRAP_MODE, key, params, null);
+
+                for (int j = 0; j < tbwKeys.length ; j++) {
+                    byte[] wrappedKey = c1.wrap(tbwKeys[j]);
+                    Key recovered = c2.unwrap(wrappedKey,
+                                              tbwKeys[j].getAlgorithm(), tbwKeyTypes[j]);
+                    if (!checkKeys(tbwKeys[j], recovered)) testPassed = false;
+                }
+
+            } catch(Exception ex) {
+                System.out.println("Unexpected Exception: " + algos[i]);
+                ex.printStackTrace();
+                testPassed = false;
+            }
+        }
+        if (!testPassed) {
+            throw new RuntimeException("One or more CIPHER test failed!");
+        } else {
+            System.out.println("CIPHER KeyWrapping Tests Passed");
+        }
+    }
+
+
+    private static void testCipherGCM(SecretKey key,
+                                      Provider p) {
+        boolean testPassed = true;
+        byte[] in = new byte[16];
+        (new SecureRandom()).nextBytes(in);
+
+        byte[] iv = new byte[16];
+        (new SecureRandom()).nextBytes(iv);
+
+
+        String algo = "AES/GCM/NoPadding";
+        int tagLen[] = { 128, 120, 112, 104, 96, 64, 32 };
+
+        try {
+            Cipher c;
+            try {
+                c = Cipher.getInstance(algo, p);
+            } catch (NoSuchAlgorithmException nsae) {
+                System.out.println("Skipping Unsupported CIP algo: " + algo);
+                return;
+            }
+            for (int i = 0; i < tagLen.length; i++) {
+                AlgorithmParameterSpec paramSpec = new GCMParameterSpec(tagLen[i], iv);
+                // check ENC
+                c.init(Cipher.ENCRYPT_MODE, key, paramSpec, null);
+                c.updateAAD(iv);
+                byte[] eout = c.doFinal(in, 0, in.length);
+
+                AlgorithmParameters param = c.getParameters();
+                // check DEC
+                c.init(Cipher.DECRYPT_MODE, key, param, null);
+                c.updateAAD(iv);
+                byte[] dout = c.doFinal(eout, 0, eout.length);
+
+                if (!Arrays.equals(dout, in)) {
+                    System.out.println(algo + ": PT and RT DIFF FAILED");
+                    testPassed = false;
+                } else {
+                    System.out.println(algo + ": tagLen " + tagLen[i] + " done");
+                }
+            }
+        } catch(Exception ex) {
+            System.out.println("Unexpected Exception: " + algo);
+            ex.printStackTrace();
+            testPassed = false;
+        }
+        if (!testPassed) {
+            throw new RuntimeException("One or more CIPHER test failed!");
+        } else {
+            System.out.println("CIPHER GCM Tests Passed");
+        }
+    }
+
+    private static boolean checkArrays(byte[] a1, int a1Len, byte[] a2, int a2Len) {
+        boolean equal = true;
+        if (a1Len != a2Len) {
+            System.out.println("DIFFERENT OUT LENGTH");
+            equal = false;
+        } else {
+            for (int p = 0; p < a1Len; p++) {
+                if (a1[p] != a2[p]) {
+                    System.out.println("DIFF FAILED");
+                    equal = false;
+                    break;
+                }
+            }
+        }
+        return equal;
+    }
+
+    private static boolean checkKeys(Key k1, Key k2) {
+        boolean equal = true;
+        if (!k1.getAlgorithm().equalsIgnoreCase(k2.getAlgorithm())) {
+            System.out.println("DIFFERENT Key Algorithm");
+            equal = false;
+        } else if (!k1.getFormat().equalsIgnoreCase(k2.getFormat())) {
+            System.out.println("DIFFERENT Key Format");
+            equal = false;
+        } else if (!Arrays.equals(k1.getEncoded(), k2.getEncoded())) {
+            System.out.println("DIFFERENT Key Encoding");
+            equal = false;
+        }
+        return equal;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/oracle/security/ucrypto/TestDigest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7088989
+ * @summary Ensure the various message digests works correctly
+ */
+import java.io.*;
+import java.security.*;
+import java.security.spec.*;
+import java.util.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+
+public class TestDigest extends UcryptoTest {
+
+    private static final String[] MD_ALGOS = {
+        "MD5",
+        "SHA",
+        "SHA-256",
+        "SHA-384",
+        "SHA-512"
+    };
+
+    public static void main(String[] args) throws Exception {
+        main(new TestDigest(), null);
+    }
+
+    public void doTest(Provider p) {
+        boolean testPassed = true;
+        byte[] msg = new byte[200];
+        (new SecureRandom()).nextBytes(msg);
+        String interopProvName = "SUN";
+
+        for (String a : MD_ALGOS) {
+            try {
+                MessageDigest md, md2;
+                try {
+                    md = MessageDigest.getInstance(a, p);
+                } catch (NoSuchAlgorithmException nsae) {
+                    System.out.println("Skipping Unsupported MD algo: " + a);
+                    continue;
+                }
+                md2 = MessageDigest.getInstance(a, interopProvName);
+                // Test Interoperability for update+digest calls
+                for (int i = 0; i < 3; i++) {
+                    md.update(msg);
+                    byte[] digest = md.digest();
+                    md2.update(msg);
+                    byte[] digest2 = md2.digest();
+                    if (!Arrays.equals(digest, digest2)) {
+                        System.out.println("DIFF1 FAILED for: " + a + " at iter " + i);
+                        testPassed = false;
+                    }
+                }
+
+                // Test Interoperability for digest calls
+                md = MessageDigest.getInstance(a, p);
+                md2 = MessageDigest.getInstance(a, interopProvName);
+
+                for (int i = 0; i < 3; i++) {
+                    byte[] digest = md.digest();
+                    byte[] digest2 = md2.digest();
+                    if (!Arrays.equals(digest, digest2)) {
+                        System.out.println("DIFF2 FAILED for: " + a + " at iter " + i);
+                        testPassed = false;
+                    }
+                }
+
+                // Test Cloning functionality
+                md = MessageDigest.getInstance(a, p);
+                md2 = (MessageDigest) md.clone(); // clone right after construction
+                byte[] digest = md.digest();
+                byte[] digest2 = md2.digest();
+                if (!Arrays.equals(digest, digest2)) {
+                    System.out.println("DIFF-3.1 FAILED for: " + a);
+                    testPassed = false;
+                }
+                md.update(msg);
+                md2 = (MessageDigest) md.clone(); // clone again after update call
+                digest = md.digest();
+                digest2 = md2.digest();
+                if (!Arrays.equals(digest, digest2)) {
+                    System.out.println("DIFF-3.2 FAILED for: " + a);
+                    testPassed = false;
+                }
+                md2 = (MessageDigest) md.clone(); // clone after digest
+                digest = md.digest();
+                digest2 = md2.digest();
+                if (!Arrays.equals(digest, digest2)) {
+                    System.out.println("DIFF-3.3 FAILED for: " + a);
+                    testPassed = false;
+                }
+            } catch(Exception ex) {
+                System.out.println("Unexpected Exception: " + a);
+                ex.printStackTrace();
+                testPassed = false;
+            }
+        }
+        if (!testPassed) {
+            throw new RuntimeException("One or more MD test failed!");
+        } else {
+            System.out.println("MD Tests Passed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/oracle/security/ucrypto/TestRSA.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7088989
+ * @summary Ensure the RSA ciphers and signatures works correctly
+ */
+import java.io.*;
+import java.security.*;
+import java.security.spec.*;
+import java.util.*;
+import java.math.*;
+import javax.crypto.*;
+
+public class TestRSA extends UcryptoTest {
+
+    // KAT
+    private static final byte PLAINTEXT[] = Arrays.copyOf
+        (new String("Known plaintext message utilized" +
+                    "for RSA Encryption &  Decryption" +
+                    "block, SHA1, SHA256, SHA384  and" +
+                    "SHA512 RSA Signature KAT tests.").getBytes(), 128);
+
+    private static final byte MOD[] = {
+        (byte)0xd5, (byte)0x84, (byte)0x95, (byte)0x07, (byte)0xf4, (byte)0xd0,
+        (byte)0x1f, (byte)0x82, (byte)0xf3, (byte)0x79, (byte)0xf4, (byte)0x99,
+        (byte)0x48, (byte)0x10, (byte)0xe1, (byte)0x71, (byte)0xa5, (byte)0x62,
+        (byte)0x22, (byte)0xa3, (byte)0x4b, (byte)0x00, (byte)0xe3, (byte)0x5b,
+        (byte)0x3a, (byte)0xcc, (byte)0x10, (byte)0x83, (byte)0xe0, (byte)0xaf,
+        (byte)0x61, (byte)0x13, (byte)0x54, (byte)0x6a, (byte)0xa2, (byte)0x6a,
+        (byte)0x2c, (byte)0x5e, (byte)0xb3, (byte)0xcc, (byte)0xa3, (byte)0x71,
+        (byte)0x9a, (byte)0xb2, (byte)0x3e, (byte)0x78, (byte)0xec, (byte)0xb5,
+        (byte)0x0e, (byte)0x6e, (byte)0x31, (byte)0x3b, (byte)0x77, (byte)0x1f,
+        (byte)0x6e, (byte)0x94, (byte)0x41, (byte)0x60, (byte)0xd5, (byte)0x6e,
+        (byte)0xd9, (byte)0xc6, (byte)0xf9, (byte)0x29, (byte)0xc3, (byte)0x40,
+        (byte)0x36, (byte)0x25, (byte)0xdb, (byte)0xea, (byte)0x0b, (byte)0x07,
+        (byte)0xae, (byte)0x76, (byte)0xfd, (byte)0x99, (byte)0x29, (byte)0xf4,
+        (byte)0x22, (byte)0xc1, (byte)0x1a, (byte)0x8f, (byte)0x05, (byte)0xfe,
+        (byte)0x98, (byte)0x09, (byte)0x07, (byte)0x05, (byte)0xc2, (byte)0x0f,
+        (byte)0x0b, (byte)0x11, (byte)0x83, (byte)0x39, (byte)0xca, (byte)0xc7,
+        (byte)0x43, (byte)0x63, (byte)0xff, (byte)0x33, (byte)0x80, (byte)0xe7,
+        (byte)0xc3, (byte)0x78, (byte)0xae, (byte)0xf1, (byte)0x73, (byte)0x52,
+        (byte)0x98, (byte)0x1d, (byte)0xde, (byte)0x5c, (byte)0x53, (byte)0x6e,
+        (byte)0x01, (byte)0x73, (byte)0x0d, (byte)0x12, (byte)0x7e, (byte)0x77,
+        (byte)0x03, (byte)0xf1, (byte)0xef, (byte)0x1b, (byte)0xc8, (byte)0xa8,
+        (byte)0x0f, (byte)0x97
+    };
+
+    private static final byte PUB_EXP[] = {(byte)0x01, (byte)0x00, (byte)0x01};
+
+    private static final byte PRIV_EXP[] = {
+        (byte)0x85, (byte)0x27, (byte)0x47, (byte)0x61, (byte)0x4c, (byte)0xd4,
+        (byte)0xb5, (byte)0xb2, (byte)0x0e, (byte)0x70, (byte)0x91, (byte)0x8f,
+        (byte)0x3d, (byte)0x97, (byte)0xf9, (byte)0x5f, (byte)0xcc, (byte)0x09,
+        (byte)0x65, (byte)0x1c, (byte)0x7c, (byte)0x5b, (byte)0xb3, (byte)0x6d,
+        (byte)0x63, (byte)0x3f, (byte)0x7b, (byte)0x55, (byte)0x22, (byte)0xbb,
+        (byte)0x7c, (byte)0x48, (byte)0x77, (byte)0xae, (byte)0x80, (byte)0x56,
+        (byte)0xc2, (byte)0x10, (byte)0xd5, (byte)0x03, (byte)0xdb, (byte)0x31,
+        (byte)0xaf, (byte)0x8d, (byte)0x54, (byte)0xd4, (byte)0x48, (byte)0x99,
+        (byte)0xa8, (byte)0xc4, (byte)0x23, (byte)0x43, (byte)0xb8, (byte)0x48,
+        (byte)0x0b, (byte)0xc7, (byte)0xbc, (byte)0xf5, (byte)0xcc, (byte)0x64,
+        (byte)0x72, (byte)0xbf, (byte)0x59, (byte)0x06, (byte)0x04, (byte)0x1c,
+        (byte)0x32, (byte)0xf5, (byte)0x14, (byte)0x2e, (byte)0x6e, (byte)0xe2,
+        (byte)0x0f, (byte)0x5c, (byte)0xde, (byte)0x36, (byte)0x3c, (byte)0x6e,
+        (byte)0x7c, (byte)0x4d, (byte)0xcc, (byte)0xd3, (byte)0x00, (byte)0x6e,
+        (byte)0xe5, (byte)0x45, (byte)0x46, (byte)0xef, (byte)0x4d, (byte)0x25,
+        (byte)0x46, (byte)0x6d, (byte)0x7f, (byte)0xed, (byte)0xbb, (byte)0x4f,
+        (byte)0x4d, (byte)0x9f, (byte)0xda, (byte)0x87, (byte)0x47, (byte)0x8f,
+        (byte)0x74, (byte)0x44, (byte)0xb7, (byte)0xbe, (byte)0x9d, (byte)0xf5,
+        (byte)0xdd, (byte)0xd2, (byte)0x4c, (byte)0xa5, (byte)0xab, (byte)0x74,
+        (byte)0xe5, (byte)0x29, (byte)0xa1, (byte)0xd2, (byte)0x45, (byte)0x3b,
+        (byte)0x33, (byte)0xde, (byte)0xd5, (byte)0xae, (byte)0xf7, (byte)0x03,
+        (byte)0x10, (byte)0x21
+    };
+
+    private static final byte PRIME_P[] = {
+        (byte)0xf9, (byte)0x74, (byte)0x8f, (byte)0x16, (byte)0x02, (byte)0x6b,
+        (byte)0xa0, (byte)0xee, (byte)0x7f, (byte)0x28, (byte)0x97, (byte)0x91,
+        (byte)0xdc, (byte)0xec, (byte)0xc0, (byte)0x7c, (byte)0x49, (byte)0xc2,
+        (byte)0x85, (byte)0x76, (byte)0xee, (byte)0x66, (byte)0x74, (byte)0x2d,
+        (byte)0x1a, (byte)0xb8, (byte)0xf7, (byte)0x2f, (byte)0x11, (byte)0x5b,
+        (byte)0x36, (byte)0xd8, (byte)0x46, (byte)0x33, (byte)0x3b, (byte)0xd8,
+        (byte)0xf3, (byte)0x2d, (byte)0xa1, (byte)0x03, (byte)0x83, (byte)0x2b,
+        (byte)0xec, (byte)0x35, (byte)0x43, (byte)0x32, (byte)0xff, (byte)0xdd,
+        (byte)0x81, (byte)0x7c, (byte)0xfd, (byte)0x65, (byte)0x13, (byte)0x04,
+        (byte)0x7c, (byte)0xfc, (byte)0x03, (byte)0x97, (byte)0xf0, (byte)0xd5,
+        (byte)0x62, (byte)0xdc, (byte)0x0d, (byte)0xbf
+    };
+
+    private static final byte PRIME_Q[] = {
+        (byte)0xdb, (byte)0x1e, (byte)0xa7, (byte)0x3d, (byte)0xe7, (byte)0xfa,
+        (byte)0x8b, (byte)0x04, (byte)0x83, (byte)0x48, (byte)0xf3, (byte)0xa5,
+        (byte)0x31, (byte)0x9d, (byte)0x35, (byte)0x5e, (byte)0x4d, (byte)0x54,
+        (byte)0x77, (byte)0xcc, (byte)0x84, (byte)0x09, (byte)0xf3, (byte)0x11,
+        (byte)0x0d, (byte)0x54, (byte)0xed, (byte)0x85, (byte)0x39, (byte)0xa9,
+        (byte)0xca, (byte)0xa8, (byte)0xea, (byte)0xae, (byte)0x19, (byte)0x9c,
+        (byte)0x75, (byte)0xdb, (byte)0x88, (byte)0xb8, (byte)0x04, (byte)0x8d,
+        (byte)0x54, (byte)0xc6, (byte)0xa4, (byte)0x80, (byte)0xf8, (byte)0x93,
+        (byte)0xf0, (byte)0xdb, (byte)0x19, (byte)0xef, (byte)0xd7, (byte)0x87,
+        (byte)0x8a, (byte)0x8f, (byte)0x5a, (byte)0x09, (byte)0x2e, (byte)0x54,
+        (byte)0xf3, (byte)0x45, (byte)0x24, (byte)0x29
+    };
+
+    private static final byte EXP_P[] = {
+        (byte)0x6a, (byte)0xd1, (byte)0x25, (byte)0x80, (byte)0x18, (byte)0x33,
+        (byte)0x3c, (byte)0x2b, (byte)0x44, (byte)0x19, (byte)0xfe, (byte)0xa5,
+        (byte)0x40, (byte)0x03, (byte)0xc4, (byte)0xfc, (byte)0xb3, (byte)0x9c,
+        (byte)0xef, (byte)0x07, (byte)0x99, (byte)0x58, (byte)0x17, (byte)0xc1,
+        (byte)0x44, (byte)0xa3, (byte)0x15, (byte)0x7d, (byte)0x7b, (byte)0x22,
+        (byte)0x22, (byte)0xdf, (byte)0x03, (byte)0x58, (byte)0x66, (byte)0xf5,
+        (byte)0x24, (byte)0x54, (byte)0x52, (byte)0x91, (byte)0x2d, (byte)0x76,
+        (byte)0xfe, (byte)0x63, (byte)0x64, (byte)0x4e, (byte)0x0f, (byte)0x50,
+        (byte)0x2b, (byte)0x65, (byte)0x79, (byte)0x1f, (byte)0xf1, (byte)0xbf,
+        (byte)0xc7, (byte)0x41, (byte)0x26, (byte)0xcc, (byte)0xc6, (byte)0x1c,
+        (byte)0xa9, (byte)0x83, (byte)0x6f, (byte)0x03
+    };
+
+    private static final byte EXP_Q[] = {
+        (byte)0x12, (byte)0x84, (byte)0x1a, (byte)0x99, (byte)0xce, (byte)0x9a,
+        (byte)0x8b, (byte)0x58, (byte)0xcc, (byte)0x47, (byte)0x43, (byte)0xdf,
+        (byte)0x77, (byte)0xbb, (byte)0xd3, (byte)0x20, (byte)0xae, (byte)0xe4,
+        (byte)0x2e, (byte)0x63, (byte)0x67, (byte)0xdc, (byte)0xf7, (byte)0x5f,
+        (byte)0x3f, (byte)0x83, (byte)0x27, (byte)0xb7, (byte)0x14, (byte)0x52,
+        (byte)0x56, (byte)0xbf, (byte)0xc3, (byte)0x65, (byte)0x06, (byte)0xe1,
+        (byte)0x03, (byte)0xcc, (byte)0x93, (byte)0x57, (byte)0x09, (byte)0x7b,
+        (byte)0x6f, (byte)0xe8, (byte)0x81, (byte)0x4a, (byte)0x2c, (byte)0xb7,
+        (byte)0x43, (byte)0xa9, (byte)0x20, (byte)0x1d, (byte)0xf6, (byte)0x56,
+        (byte)0x8b, (byte)0xcc, (byte)0xe5, (byte)0x4c, (byte)0xd5, (byte)0x4f,
+        (byte)0x74, (byte)0x67, (byte)0x29, (byte)0x51
+    };
+
+    private static final byte CRT_COEFF[] = {
+        (byte)0x23, (byte)0xab, (byte)0xf4, (byte)0x03, (byte)0x2f, (byte)0x29,
+        (byte)0x95, (byte)0x74, (byte)0xac, (byte)0x1a, (byte)0x33, (byte)0x96,
+        (byte)0x62, (byte)0xed, (byte)0xf7, (byte)0xf6, (byte)0xae, (byte)0x07,
+        (byte)0x2a, (byte)0x2e, (byte)0xe8, (byte)0xab, (byte)0xfb, (byte)0x1e,
+        (byte)0xb9, (byte)0xb2, (byte)0x88, (byte)0x1e, (byte)0x85, (byte)0x05,
+        (byte)0x42, (byte)0x64, (byte)0x03, (byte)0xb2, (byte)0x8b, (byte)0xc1,
+        (byte)0x81, (byte)0x75, (byte)0xd7, (byte)0xba, (byte)0xaa, (byte)0xd4,
+        (byte)0x31, (byte)0x3c, (byte)0x8a, (byte)0x96, (byte)0x23, (byte)0x9d,
+        (byte)0x3f, (byte)0x06, (byte)0x3e, (byte)0x44, (byte)0xa9, (byte)0x62,
+        (byte)0x2f, (byte)0x61, (byte)0x5a, (byte)0x51, (byte)0x82, (byte)0x2c,
+        (byte)0x04, (byte)0x85, (byte)0x73, (byte)0xd1
+    };
+
+    private static KeyPair genRSAKey(int keyLength) throws Exception {
+        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
+        kpg.initialize(keyLength);
+        return kpg.generateKeyPair();
+    }
+
+    private static KeyPair genPredefinedRSAKeyPair() throws Exception {
+        KeyFactory kf = KeyFactory.getInstance("RSA");
+        BigInteger mod = new BigInteger(MOD);
+        BigInteger pub = new BigInteger(PUB_EXP);
+
+        PrivateKey privKey = kf.generatePrivate
+            (new RSAPrivateCrtKeySpec
+             (mod, pub, new BigInteger(PRIV_EXP),
+              new BigInteger(PRIME_P), new BigInteger(PRIME_Q),
+              new BigInteger(EXP_P), new BigInteger(EXP_Q),
+              new BigInteger(CRT_COEFF)));
+        PublicKey pubKey = kf.generatePublic(new RSAPublicKeySpec(mod, pub));
+        return new KeyPair(pubKey, privKey);
+    }
+
+    private static final String CIP_ALGOS[] = {
+        "RSA/ECB/NoPadding",
+        "RSA/ECB/PKCS1Padding"
+    };
+    private static final int INPUT_SIZE_REDUCTION[] = {
+        0,
+        11,
+    };
+    private static final String SIG_ALGOS[] = {
+        "MD5WithRSA",
+        "SHA1WithRSA",
+        "SHA256WithRSA",
+        "SHA384WithRSA",
+        "SHA512WithRSA"
+    };
+
+    private static KeyPair kp[] = null;
+
+    public static void main(String argv[]) throws Exception {
+        main(new TestRSA(), null);
+    }
+
+    public void doTest(Provider prov) throws Exception {
+        // first test w/ predefine KeyPair
+        KeyPair pkp = genPredefinedRSAKeyPair();
+        System.out.println("Test against Predefined RSA Key Pair");
+        testCipher(pkp, 128, true, prov);
+        testSignature(pkp, true, prov);
+
+        for (int i = 0; i < 10; i++) {
+            // then test w/ various key lengths
+            int keyLens[] = { 1024, 2048 };
+            kp = new KeyPair[keyLens.length];
+
+            testCipher(keyLens, false, prov);
+            testSignature(keyLens, false, prov);
+        }
+    }
+
+
+    private static void testCipher(KeyPair kp, int inputSizeInBytes,
+                                   boolean checkInterop, Provider prov)
+        throws Exception {
+        Cipher c1, c2;
+        for (int i = 0; i < CIP_ALGOS.length; i++) {
+            String algo = CIP_ALGOS[i];
+            try {
+                c1 = Cipher.getInstance(algo, prov);
+            } catch (NoSuchAlgorithmException nsae) {
+                System.out.println("Skip unsupported Cipher algo: " + algo);
+                continue;
+            }
+
+            if (checkInterop) {
+                c2 = Cipher.getInstance(algo, "SunJCE");
+            } else {
+                c2 = Cipher.getInstance(algo, prov);
+            }
+            byte[] data = Arrays.copyOf
+                 (PLAINTEXT, inputSizeInBytes - INPUT_SIZE_REDUCTION[i]);
+
+            testEncryption(c1, c2, kp, data);
+        }
+    }
+
+    private static void testCipher(int keyLens[], boolean checkInterop,
+                                   Provider prov)
+        throws Exception {
+        // RSA CipherText will always differ due to the random nonce in padding
+        // so we check whether both
+        // 1) Java Encrypt/C Decrypt
+        // 2) C Encrypt/Java Decrypt
+        // works
+        Cipher c1, c2;
+        for (int i = 0; i < CIP_ALGOS.length; i++) {
+            String algo = CIP_ALGOS[i];
+            try {
+                c1 = Cipher.getInstance(algo, prov);
+            } catch (NoSuchAlgorithmException nsae) {
+                System.out.println("Skip unsupported Cipher algo: " + algo);
+                continue;
+            }
+
+            if (checkInterop) {
+                c2 = Cipher.getInstance(algo, "SunJCE");
+            } else {
+                c2 = Cipher.getInstance(algo, prov);
+            }
+
+            for (int h = 0; h < keyLens.length; h++) {
+                // Defer key pair generation until now when it'll soon be used.
+                if (kp[h] == null) {
+                    kp[h] = genRSAKey(keyLens[h]);
+                }
+                System.out.println("\tTesting Cipher " + algo + " w/ KeySize " + keyLens[h]);
+                byte[] data = Arrays.copyOf
+                    (PLAINTEXT, keyLens[h]/8 - INPUT_SIZE_REDUCTION[i]);
+                testEncryption(c1, c2, kp[h], data);
+            }
+        }
+    }
+
+    private static void testEncryption(Cipher c1, Cipher c2, KeyPair kp, byte[] data)
+        throws Exception {
+        // C1 Encrypt + C2 Decrypt
+        byte[] out1 = null;
+        byte[] recoveredText = null;
+        try {
+            c1.init(Cipher.ENCRYPT_MODE, kp.getPublic());
+            out1 = c1.doFinal(data);
+            c2.init(Cipher.DECRYPT_MODE, kp.getPrivate());
+            recoveredText = c2.doFinal(out1);
+        } catch (Exception ex) {
+            System.out.println("\tDEC ERROR: unexpected exception");
+            ex.printStackTrace();
+            throw ex;
+        }
+        if(!Arrays.equals(recoveredText, data)) {
+            throw new RuntimeException("\tDEC ERROR: different PT bytes!");
+        }
+        // C2 Encrypt + C1 Decrypt
+        byte[] cipherText = null;
+        try {
+            c2.init(Cipher.ENCRYPT_MODE, kp.getPublic());
+            cipherText = c2.doFinal(data);
+            c1.init(Cipher.DECRYPT_MODE, kp.getPrivate());
+            try {
+                out1 = c1.doFinal(cipherText);
+            } catch (Exception ex) {
+                System.out.println("\tENC ERROR: invalid encrypted output");
+                ex.printStackTrace();
+                throw ex;
+            }
+        } catch (Exception ex) {
+            System.out.println("\tENC ERROR: unexpected exception");
+            ex.printStackTrace();
+            throw ex;
+        }
+        if (!Arrays.equals(out1, data)) {
+            throw new RuntimeException("\tENC ERROR: Decrypted result DIFF!");
+        }
+        System.out.println("\t=> PASS");
+    }
+
+    private static void testSignature(KeyPair kp, boolean checkInterop,
+                                      Provider prov) throws Exception {
+        byte[] data = PLAINTEXT;
+        Signature sig1, sig2;
+        for (int i = 0; i < SIG_ALGOS.length; i++) {
+            String algo = SIG_ALGOS[i];
+            try {
+                sig1 = Signature.getInstance(algo, prov);
+            } catch (NoSuchAlgorithmException nsae) {
+                System.out.println("Skip unsupported Signature algo: " + algo);
+                continue;
+            }
+
+            if (checkInterop) {
+                sig2 = Signature.getInstance(algo, "SunRsaSign");
+            } else {
+                sig2 = Signature.getInstance(algo, prov);
+            }
+            testSigning(sig1, sig2, kp, data);
+        }
+    }
+
+    private static void testSignature(int keyLens[], boolean checkInterop,
+                                      Provider prov) throws Exception {
+        byte[] data = PLAINTEXT;
+        Signature sig1, sig2;
+        for (int i = 0; i < SIG_ALGOS.length; i++) {
+            String algo = SIG_ALGOS[i];
+            try {
+                sig1 = Signature.getInstance(algo, prov);
+            } catch (NoSuchAlgorithmException nsae) {
+                System.out.println("Skip unsupported Signature algo: " + algo);
+                continue;
+            }
+
+            if (checkInterop) {
+                sig2 = Signature.getInstance(algo, "SunRsaSign");
+            } else {
+                sig2 = Signature.getInstance(algo, prov);
+            }
+
+            for (int h = 0; h < keyLens.length; h++) {
+                // Defer key pair generation until now when it'll soon be used.
+                if (kp[h] == null) {
+                    kp[h] = genRSAKey(keyLens[h]);
+                }
+                System.out.println("\tTesting Signature " + algo + " w/ KeySize " + keyLens[h]);
+
+                testSigning(sig1, sig2, kp[h], data);
+            }
+        }
+    }
+
+    private static void testSigning(Signature sig1, Signature sig2, KeyPair kp, byte[] data)
+            throws Exception {
+        boolean sameSig = false;
+        byte[] out = null;
+        try {
+            sig1.initSign(kp.getPrivate());
+            sig1.update(data);
+            out = sig1.sign();
+        } catch (Exception ex) {
+            System.out.println("\tSIGN ERROR: unexpected exception!");
+            ex.printStackTrace();
+        }
+
+        sig2.initSign(kp.getPrivate());
+        sig2.update(data);
+        byte[] out2 = sig2.sign();
+        if (!Arrays.equals(out2, out)) {
+            throw new RuntimeException("\tSIGN ERROR: Signature DIFF!");
+        }
+
+        boolean verify = false;
+        try {
+            System.out.println("\tVERIFY1 using native out");
+            sig1.initVerify(kp.getPublic());
+            sig1.update(data);
+            verify = sig1.verify(out);
+            if (!verify) {
+                throw new RuntimeException("VERIFY1 FAIL!");
+            }
+        } catch (Exception ex) {
+            System.out.println("\tVERIFY1 ERROR: unexpected exception!");
+            ex.printStackTrace();
+            throw ex;
+        }
+        System.out.println("\t=> PASS");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/oracle/security/ucrypto/UcryptoTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+// common infrastructure for OracleUcrypto provider tests
+
+import java.io.*;
+import java.util.*;
+import java.lang.reflect.*;
+
+import java.security.*;
+
+public abstract class UcryptoTest {
+
+    protected static final boolean hasUcrypto;
+    static {
+        hasUcrypto = (Security.getProvider("OracleUcrypto") != null);
+    }
+
+    private static Provider getCustomizedUcrypto(String config) throws Exception {
+        Class clazz = Class.forName("com.oracle.security.ucrypto.OracleUcrypto");
+        Constructor cons = clazz.getConstructor(new Class[] {String.class});
+        Object obj = cons.newInstance(new Object[] {config});
+        return (Provider)obj;
+    }
+
+    public abstract void doTest(Provider p) throws Exception;
+
+    public static void main(UcryptoTest test, String config) throws Exception {
+        Provider prov = null;
+        if (hasUcrypto) {
+            if (config != null) {
+                prov = getCustomizedUcrypto(config);
+            } else {
+                prov = Security.getProvider("OracleUcrypto");
+            }
+        }
+        if (prov == null) {
+            // un-available, skip testing...
+            System.out.println("No OracleUcrypto provider found, skipping test");
+            return;
+        }
+        test.doTest(prov);
+    }
+}
--- a/jdk/test/java/io/File/BlockIsDirectory.java	Thu Jan 26 12:15:24 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
-   @bug 4113217
-   @summary Test File.isDirectory on block device
- */
-
-import java.io.*;
-import java.util.*;
-
-public class BlockIsDirectory {
-    public static void main( String args[] ) throws Exception {
-        String osname = System.getProperty("os.name");
-        if (osname.equals("SunOS")) {
-            File dir = new File("/dev/dsk");
-            String dirList[] = dir.list();
-
-            File aFile = new File( "/dev/dsk/" + dirList[0] );
-
-            boolean result = aFile.isDirectory();
-            if (result == true)
-                throw new RuntimeException(
-                    "IsDirectory returns true for block device.");
-        }
-        if (osname.equals("Linux")) {
-            File dir = new File("/dev/ide0");
-            if (dir.exists()) {
-                boolean result = dir.isDirectory();
-                if (result == true)
-                    throw new RuntimeException(
-                        "IsDirectory returns true for block device.");
-            }
-            dir = new File("/dev/scd0");
-            if (dir.exists()) {
-                boolean result = dir.isDirectory();
-                if (result == true)
-                    throw new RuntimeException(
-                        "IsDirectory returns true for block device.");
-            }
-        }
-    }
-}
--- a/jdk/test/java/io/FileInputStream/LargeFileAvailable.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/io/FileInputStream/LargeFileAvailable.java	Thu Jan 26 19:39:08 2012 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6402006
+ * @bug 6402006 7030573
  * @summary Test if available returns correct value when reading
  *          a large file.
  */
@@ -35,23 +35,35 @@
 import static java.nio.file.StandardOpenOption.*;
 
 public class LargeFileAvailable {
-    private static final long FILESIZE = 7405576182L;
     public static void main(String args[]) throws Exception {
-        File file = createLargeFile(FILESIZE);
+        // Create a temporary file in the current directory.
+        // Use it to check if we have 7G available for
+        // a large sparse file test. As a fallback use whatever
+        // space is available, so the test can proceed.
+        File file = File.createTempFile("largefile", null, new File("."));
+        long spaceavailable = file.getUsableSpace();
+        long filesize = Math.min(spaceavailable,  7405576182L);
+        if (spaceavailable == 0L) {
+            // A full disk is considered fatal.
+            throw new RuntimeException("No space available for temp file.");
+        }
+
+        createLargeFile(filesize, file);
+
         try (FileInputStream fis = new FileInputStream(file)) {
-            if (file.length() != FILESIZE) {
-                throw new RuntimeException("unexpected file size = " + file.length());
+            if (file.length() != filesize) {
+                throw new RuntimeException("unexpected file size = "
+                                           + file.length());
             }
 
-            long bigSkip = 3110608882L;
-            long remaining = FILESIZE;
+            long bigSkip = Math.min(filesize/2, 3110608882L);
+            long remaining = filesize;
             remaining -= skipBytes(fis, bigSkip, remaining);
             remaining -= skipBytes(fis, 10L, remaining);
             remaining -= skipBytes(fis, bigSkip, remaining);
             if (fis.available() != (int) remaining) {
-                 throw new RuntimeException("available() returns " +
-                     fis.available() +
-                     " but expected " + remaining);
+                 throw new RuntimeException("available() returns "
+                     + fis.available() + " but expected " + remaining);
             }
         } finally {
             file.delete();
@@ -64,39 +76,41 @@
             throws IOException {
         long skip = is.skip(toSkip);
         if (skip != toSkip) {
-            throw new RuntimeException("skip() returns " + skip +
-                " but expected " + toSkip);
+            throw new RuntimeException("skip() returns " + skip
+                + " but expected " + toSkip);
         }
         long remaining = avail - skip;
         int expected = remaining >= Integer.MAX_VALUE
                            ? Integer.MAX_VALUE
                            : (int) remaining;
 
-        System.out.println("Skipped " + skip + " bytes " +
-            " available() returns " + expected +
+        System.out.println("Skipped " + skip + " bytes "
+            + " available() returns " + expected +
             " remaining=" + remaining);
         if (is.available() != expected) {
-            throw new RuntimeException("available() returns " +
-                is.available() + " but expected " + expected);
+            throw new RuntimeException("available() returns "
+                + is.available() + " but expected " + expected);
         }
         return skip;
     }
 
-    private static File createLargeFile(long filesize) throws Exception {
-        // Create a large file as a sparse file if possible
-        File largefile = File.createTempFile("largefile", null);
-        // re-create as a sparse file
-        Files.delete(largefile.toPath());
+    private static void createLargeFile(long filesize,
+                                        File file) throws Exception {
+        // Recreate a large file as a sparse file if possible
+        Files.delete(file.toPath());
+
         try (FileChannel fc =
-                FileChannel.open(largefile.toPath(),
-                                 CREATE_NEW, WRITE, SPARSE)) {
+             FileChannel.open(file.toPath(),
+                              CREATE_NEW, WRITE, SPARSE)) {
             ByteBuffer bb = ByteBuffer.allocate(1).put((byte)1);
             bb.rewind();
-            int rc = fc.write(bb, filesize-1);
+            int rc = fc.write(bb, filesize - 1);
+
             if (rc != 1) {
-                throw new RuntimeException("Failed to write 1 byte to the large file");
+                throw new RuntimeException("Failed to write 1 byte"
+                                           + " to the large file");
             }
         }
-        return largefile;
+        return;
     }
 }
--- a/jdk/test/java/lang/invoke/CallSiteTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/CallSiteTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -43,7 +43,7 @@
 import static java.lang.invoke.MethodType.*;
 
 public class CallSiteTest {
-    private final static Class CLASS = CallSiteTest.class;
+    private final static Class<?> CLASS = CallSiteTest.class;
 
     private static CallSite mcs;
     private static CallSite vcs;
--- a/jdk/test/java/lang/invoke/ClassValueTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/ClassValueTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -38,10 +38,6 @@
 
 package test.java.lang.invoke;
 
-import java.util.*;
-
-import java.lang.invoke.*;
-
 import org.junit.*;
 import static org.junit.Assert.*;
 
@@ -61,7 +57,7 @@
         }
     }
 
-    static final Class[] CLASSES = {
+    static final Class<?>[] CLASSES = {
         String.class,
         Integer.class,
         int.class,
@@ -73,11 +69,11 @@
     @Test
     public void testGet() {
         countForCV1 = 0;
-        for (Class c : CLASSES) {
+        for (Class<?> c : CLASSES) {
             assertEquals(nameForCV1(c), CV1.get(c));
         }
         assertEquals(CLASSES.length, countForCV1);
-        for (Class c : CLASSES) {
+        for (Class<?> c : CLASSES) {
             assertEquals(nameForCV1(c), CV1.get(c));
         }
         assertEquals(CLASSES.length, countForCV1);
@@ -85,7 +81,7 @@
 
     @Test
     public void testRemove() {
-        for (Class c : CLASSES) {
+        for (Class<?> c : CLASSES) {
             CV1.get(c);
         }
         countForCV1 = 0;
@@ -94,7 +90,7 @@
             CV1.remove(CLASSES[i]);
         }
         assertEquals(0, countForCV1);  // no change
-        for (Class c : CLASSES) {
+        for (Class<?> c : CLASSES) {
             assertEquals(nameForCV1(c), CV1.get(c));
         }
         assertEquals(REMCOUNT, countForCV1);
@@ -124,7 +120,7 @@
         for (int pass = 0; pass <= 2; pass++) {
             for (int i1 = 0; i1 < CVN_COUNT1; i1++) {
                 eachClass:
-                for (Class c : CLASSES) {
+                for (Class<?> c : CLASSES) {
                     for (int i2 = 0; i2 < CVN_COUNT2; i2++) {
                         int n = i1*CVN_COUNT2 + i2;
                         assertEquals(0, countForCVN);
@@ -156,8 +152,10 @@
             }
         }
         assertEquals(countForCVN, 0);
-        for (int n = 0; n < cvns.length; n++) {
-            for (Class c : CLASSES) {
+        System.out.println("[rechecking values]");
+        for (int i = 0; i < cvns.length * 10; i++) {
+            int n = i % cvns.length;
+            for (Class<?> c : CLASSES) {
                 assertEquals(nameForCVN(c, n), cvns[n].get(c));
             }
         }
--- a/jdk/test/java/lang/invoke/InvokeGenericTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/InvokeGenericTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -45,6 +45,7 @@
  *
  * @author jrose
  */
+@SuppressWarnings("cast")  // various casts help emphasize arguments to invokeExact
 public class InvokeGenericTest {
     // How much output?
     static int verbosity = 0;
@@ -129,7 +130,7 @@
         }
     }
 
-    static List<Object> calledLog = new ArrayList<Object>();
+    static List<Object> calledLog = new ArrayList<>();
     static Object logEntry(String name, Object... args) {
         return Arrays.asList(name, Arrays.asList(args));
     }
@@ -237,8 +238,7 @@
         else
             try {
                 return param.newInstance();
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
+            } catch (InstantiationException | IllegalAccessException ex) {
             }
         return null;  // random class not Object, String, Integer, etc.
     }
@@ -274,9 +274,11 @@
         return zeroArgs(params.toArray(new Class<?>[0]));
     }
 
+    @SafeVarargs @SuppressWarnings("varargs")
     static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
         return Arrays.copyOf(a, a.length, atype);
     }
+    @SafeVarargs @SuppressWarnings("varargs")
     static <T> T[] cat(T[] a, T... b) {
         int alen = a.length, blen = b.length;
         if (blen == 0)  return a;
@@ -311,7 +313,7 @@
             int beg, int end, Class<?> argType) {
         MethodType targetType = target.type();
         end = Math.min(end, targetType.parameterCount());
-        ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>(targetType.parameterList());
+        ArrayList<Class<?>> argTypes = new ArrayList<>(targetType.parameterList());
         Collections.fill(argTypes.subList(beg, end), argType);
         MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
         return target.asType(ttype2);
@@ -320,7 +322,7 @@
     // This lookup is good for all members in and under InvokeGenericTest.
     static final Lookup LOOKUP = MethodHandles.lookup();
 
-    Map<List<Class<?>>, MethodHandle> CALLABLES = new HashMap<List<Class<?>>, MethodHandle>();
+    Map<List<Class<?>>, MethodHandle> CALLABLES = new HashMap<>();
     MethodHandle callable(List<Class<?>> params) {
         MethodHandle mh = CALLABLES.get(params);
         if (mh == null) {
@@ -353,8 +355,8 @@
         countTest();
         String[] args = { "one", "two" };
         MethodHandle mh = callable(Object.class, String.class);
-        Object res; List resl;
-        res = resl = (List) mh.invoke((String)args[0], (Object)args[1]);
+        Object res; List<?> resl;
+        res = resl = (List<?>) mh.invoke((String)args[0], (Object)args[1]);
         //System.out.println(res);
         assertEquals(Arrays.asList(args), res);
     }
@@ -365,8 +367,8 @@
         countTest();
         int[] args = { 1, 2 };
         MethodHandle mh = callable(Object.class, Object.class);
-        Object res; List resl;
-        res = resl = (List) mh.invoke(args[0], args[1]);
+        Object res; List<?> resl;
+        res = resl = (List<?>) mh.invoke(args[0], args[1]);
         //System.out.println(res);
         assertEquals(Arrays.toString(args), res.toString());
     }
@@ -377,8 +379,8 @@
         countTest();
         String[] args = { "one", "two" };
         MethodHandle mh = callable(Object.class, String.class);
-        Object res; List resl;
-        res = resl = (List) mh.invoke((String)args[0], (Object)args[1]);
+        Object res; List<?> resl;
+        res = resl = (List<?>) mh.invoke((String)args[0], (Object)args[1]);
         //System.out.println(res);
         assertEquals(Arrays.asList(args), res);
     }
@@ -440,9 +442,9 @@
      *  A void return type is possible iff the first type is void.class.
      */
     static List<MethodType> allMethodTypes(int minargc, int maxargc, Class<?>... types) {
-        ArrayList<MethodType> result = new ArrayList<MethodType>();
+        ArrayList<MethodType> result = new ArrayList<>();
         if (types.length > 0) {
-            ArrayList<MethodType> argcTypes = new ArrayList<MethodType>();
+            ArrayList<MethodType> argcTypes = new ArrayList<>();
             // build arity-zero types first
             for (Class<?> rtype : types) {
                 argcTypes.add(MethodType.methodType(rtype));
@@ -456,7 +458,7 @@
                 if (argc >= maxargc)
                     break;
                 ArrayList<MethodType> prevTypes = argcTypes;
-                argcTypes = new ArrayList<MethodType>();
+                argcTypes = new ArrayList<>();
                 for (MethodType prevType : prevTypes) {
                     for (Class<?> ptype : types) {
                         argcTypes.add(prevType.insertParameterTypes(argc, ptype));
@@ -524,8 +526,8 @@
         countTest();
         Object[] args = { 1, 2 };
         MethodHandle mh = callable(Object.class, int.class);
-        Object res; List resl; int resi;
-        res = resl = (List) mh.invoke((int)args[0], (Object)args[1]);
+        Object res; List<?> resl; int resi;
+        res = resl = (List<?>) mh.invoke((int)args[0], (Object)args[1]);
         //System.out.println(res);
         assertEquals(Arrays.asList(args), res);
         mh = MethodHandles.identity(int.class);
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -54,6 +54,7 @@
 /**
  * @author jrose
  */
+@SuppressWarnings("LocalVariableHidesMemberVariable")
 public class JavaDocExamplesTest {
     /** Wrapper for running the JUnit tests in this module.
      *  Put JUnit on the classpath!
@@ -336,6 +337,7 @@
             }}
     }
 
+    @SuppressWarnings("rawtypes")
     @Test public void testAsVarargsCollector() throws Throwable {
         {{
 {} /// JAVADOC
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -176,7 +176,7 @@
         }
     }
 
-    static List<Object> calledLog = new ArrayList<Object>();
+    static List<Object> calledLog = new ArrayList<>();
     static Object logEntry(String name, Object... args) {
         return Arrays.asList(name, Arrays.asList(args));
     }
@@ -211,6 +211,7 @@
         return dst.cast(value);
     }
 
+    @SuppressWarnings("cast")  // primitive cast to (long) is part of the pattern
     static Object castToWrapperOrNull(long value, Class<?> dst) {
         if (dst == int.class || dst == Integer.class)
             return (int)(value);
@@ -284,8 +285,7 @@
         else
             try {
                 return param.newInstance();
-            } catch (InstantiationException ex) {
-            } catch (IllegalAccessException ex) {
+            } catch (InstantiationException | IllegalAccessException ex) {
             }
         return null;  // random class not Object, String, Integer, etc.
     }
@@ -302,9 +302,11 @@
         return args;
     }
 
+    @SafeVarargs @SuppressWarnings("varargs")
     static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
         return Arrays.copyOf(a, a.length, atype);
     }
+    @SafeVarargs @SuppressWarnings("varargs")
     static <T> T[] cat(T[] a, T... b) {
         int alen = a.length, blen = b.length;
         if (blen == 0)  return a;
@@ -354,14 +356,14 @@
                 try {
                     LIST_TO_STRING = PRIVATE.findStatic(PRIVATE.lookupClass(), "listToString",
                                                         MethodType.methodType(String.class, List.class));
-                } catch (Exception ex) { throw new RuntimeException(ex); }
+                } catch (NoSuchMethodException | IllegalAccessException ex) { throw new RuntimeException(ex); }
             list = MethodHandles.filterReturnValue(list, LIST_TO_STRING);
         } else if (rtype.isPrimitive()) {
             if (LIST_TO_INT == null)
                 try {
                     LIST_TO_INT = PRIVATE.findStatic(PRIVATE.lookupClass(), "listToInt",
                                                      MethodType.methodType(int.class, List.class));
-                } catch (Exception ex) { throw new RuntimeException(ex); }
+                } catch (NoSuchMethodException | IllegalAccessException ex) { throw new RuntimeException(ex); }
             list = MethodHandles.filterReturnValue(list, LIST_TO_INT);
             list = MethodHandles.explicitCastArguments(list, listType);
         } else {
@@ -370,8 +372,8 @@
         return list.asType(listType);
     }
     private static MethodHandle LIST_TO_STRING, LIST_TO_INT;
-    private static String listToString(List x) { return x.toString(); }
-    private static int listToInt(List x) { return x.toString().hashCode(); }
+    private static String listToString(List<?> x) { return x.toString(); }
+    private static int listToInt(List<?> x) { return x.toString().hashCode(); }
 
     static MethodHandle changeArgTypes(MethodHandle target, Class<?> argType) {
         return changeArgTypes(target, 0, 999, argType);
@@ -380,7 +382,7 @@
             int beg, int end, Class<?> argType) {
         MethodType targetType = target.type();
         end = Math.min(end, targetType.parameterCount());
-        ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>(targetType.parameterList());
+        ArrayList<Class<?>> argTypes = new ArrayList<>(targetType.parameterList());
         Collections.fill(argTypes.subList(beg, end), argType);
         MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
         return target.asType(ttype2);
@@ -405,6 +407,7 @@
         final String name;
         public Example() { name = "Example#"+nextArg(); }
         protected Example(String name) { this.name = name; }
+        @SuppressWarnings("LeakingThisInConstructor")
         protected Example(int x) { this(); called("protected <init>", this, x); }
         @Override public String toString() { return name; }
 
@@ -441,6 +444,7 @@
     static class SubExample extends Example {
         @Override public void  v0()     { called("Sub/v0", this); }
         @Override void         pkg_v0() { called("Sub/pkg_v0", this); }
+        @SuppressWarnings("LeakingThisInConstructor")
         private      SubExample(int x)  { called("<init>", this, x); }
         public SubExample() { super("SubExample#"+nextArg()); }
     }
@@ -912,7 +916,7 @@
 
         static final Object[][] CASES;
         static {
-            ArrayList<Object[]> cases = new ArrayList<Object[]>();
+            ArrayList<Object[]> cases = new ArrayList<>();
             Object types[][] = {
                 {'L',Object.class}, {'R',String.class},
                 {'I',int.class}, {'J',long.class},
@@ -931,12 +935,12 @@
                     Field field;
                         try {
                         field = HasFields.class.getDeclaredField(name);
-                    } catch (Exception ex) {
+                    } catch (NoSuchFieldException | SecurityException ex) {
                         throw new InternalError("no field HasFields."+name);
                     }
                     try {
                         value = field.get(fields);
-                    } catch (Exception ex) {
+                    } catch (IllegalArgumentException | IllegalAccessException ex) {
                         throw new InternalError("cannot fetch field HasFields."+name);
                     }
                     if (type == float.class) {
@@ -1257,7 +1261,7 @@
 
     List<Object> array2list(Object array) {
         int length = Array.getLength(array);
-        ArrayList<Object> model = new ArrayList<Object>(length);
+        ArrayList<Object> model = new ArrayList<>(length);
         for (int i = 0; i < length; i++)
             model.add(Array.get(array, i));
         return model;
@@ -1288,7 +1292,7 @@
             String name = pfx+"id";
             try {
                 return PRIVATE.findStatic(Callee.class, name, type);
-            } catch (Exception ex) {
+            } catch (NoSuchMethodException | IllegalAccessException ex) {
                 throw new RuntimeException(ex);
             }
         }
@@ -1365,7 +1369,7 @@
         MethodHandle vac = vac0.asVarargsCollector(Object[].class);
         testConvert(true, vac.asType(MethodType.genericMethodType(0)), null, "vac");
         testConvert(true, vac.asType(MethodType.genericMethodType(0)), null, "vac");
-        for (Class<?> at : new Class[] { Object.class, String.class, Integer.class }) {
+        for (Class<?> at : new Class<?>[] { Object.class, String.class, Integer.class }) {
             testConvert(true, vac.asType(MethodType.genericMethodType(1)), null, "vac", at);
             testConvert(true, vac.asType(MethodType.genericMethodType(2)), null, "vac", at, at);
         }
@@ -1514,7 +1518,7 @@
     public void testSpreadArguments() throws Throwable {
         if (CAN_SKIP_WORKING)  return;
         startTest("spreadArguments");
-        for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
+        for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) {
             if (verbosity >= 3)
                 System.out.println("spreadArguments "+argType);
             for (int nargs = 0; nargs < 50; nargs++) {
@@ -1538,7 +1542,7 @@
         Object[] args = randomArgs(target2.type().parameterArray());
         // make sure the target does what we think it does:
         if (pos == 0 && nargs < 5 && !argType.isPrimitive()) {
-            Object[] check = (Object[]) (Object) target.invokeWithArguments(args);
+            Object[] check = (Object[]) target.invokeWithArguments(args);
             assertArrayEquals(args, check);
             switch (nargs) {
                 case 0:
@@ -1555,7 +1559,7 @@
                     break;
             }
         }
-        List<Class<?>> newParams = new ArrayList<Class<?>>(target2.type().parameterList());
+        List<Class<?>> newParams = new ArrayList<>(target2.type().parameterList());
         {   // modify newParams in place
             List<Class<?>> spreadParams = newParams.subList(pos, nargs);
             spreadParams.clear(); spreadParams.add(arrayType);
@@ -1608,7 +1612,7 @@
     public void testCollectArguments() throws Throwable {
         if (CAN_SKIP_WORKING)  return;
         startTest("collectArguments");
-        for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
+        for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) {
             if (verbosity >= 3)
                 System.out.println("collectArguments "+argType);
             for (int nargs = 0; nargs < 50; nargs++) {
@@ -1670,12 +1674,13 @@
         MethodHandle target = varargsArray(nargs + ins);
         Object[] args = randomArgs(target.type().parameterArray());
         List<Object> resList = Arrays.asList(args);
-        List<Object> argsToPass = new ArrayList<Object>(resList);
+        List<Object> argsToPass = new ArrayList<>(resList);
         List<Object> argsToInsert = argsToPass.subList(pos, pos + ins);
         if (verbosity >= 3)
             System.out.println("insert: "+argsToInsert+" into "+target);
+        @SuppressWarnings("cast")  // cast to spread Object... is helpful
         MethodHandle target2 = MethodHandles.insertArguments(target, pos,
-                (Object[]) argsToInsert.toArray());
+                (Object[]/*...*/) argsToInsert.toArray());
         argsToInsert.clear();  // remove from argsToInsert
         Object res2 = target2.invokeWithArguments(argsToPass);
         Object res2List = Arrays.asList((Object[])res2);
@@ -1693,7 +1698,7 @@
         Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass();
         assertTrue(List.class.isAssignableFrom(classOfVCList));
         for (int nargs = 0; nargs <= 3; nargs++) {
-            for (Class<?> rtype : new Class[] { Object.class,
+            for (Class<?> rtype : new Class<?>[] { Object.class,
                                                 List.class,
                                                 int.class,
                                                 byte.class,
@@ -1790,7 +1795,7 @@
             System.out.println("fold "+target+" with "+combine);
         MethodHandle target2 = MethodHandles.foldArguments(target, combine);
         // Simulate expected effect of combiner on arglist:
-        List<Object> expected = new ArrayList<Object>(argsToPass);
+        List<Object> expected = new ArrayList<>(argsToPass);
         List<Object> argsToFold = expected.subList(pos, pos + fold);
         if (verbosity >= 3)
             System.out.println("fold: "+argsToFold+" into "+target2);
@@ -1822,9 +1827,9 @@
         MethodHandle target = varargsArray(nargs);
         Object[] args = randomArgs(target.type().parameterArray());
         MethodHandle target2 = MethodHandles.dropArguments(target, pos,
-                Collections.nCopies(drop, Object.class).toArray(new Class[0]));
+                Collections.nCopies(drop, Object.class).toArray(new Class<?>[0]));
         List<Object> resList = Arrays.asList(args);
-        List<Object> argsToDrop = new ArrayList<Object>(resList);
+        List<Object> argsToDrop = new ArrayList<>(resList);
         for (int i = drop; i > 0; i--) {
             argsToDrop.add(pos, "blort#"+i);
         }
@@ -1840,11 +1845,11 @@
         if (CAN_SKIP_WORKING)  return;
         startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker");
         // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker
-        Set<MethodType> done = new HashSet<MethodType>();
+        Set<MethodType> done = new HashSet<>();
         for (int i = 0; i <= 6; i++) {
             if (CAN_TEST_LIGHTLY && i > 3)  break;
             MethodType gtype = MethodType.genericMethodType(i);
-            for (Class<?> argType : new Class[]{Object.class, Integer.class, int.class}) {
+            for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) {
                 for (int j = -1; j < i; j++) {
                     MethodType type = gtype;
                     if (j < 0)
@@ -1873,7 +1878,7 @@
         assertTrue(target.isVarargsCollector());
         target = target.asType(type);
         Object[] args = randomArgs(type.parameterArray());
-        List<Object> targetPlusArgs = new ArrayList<Object>(Arrays.asList(args));
+        List<Object> targetPlusArgs = new ArrayList<>(Arrays.asList(args));
         targetPlusArgs.add(0, target);
         int code = (Integer) invokee(args);
         Object log = logEntry("invokee", args);
@@ -1960,7 +1965,7 @@
                                   .appendParameterTypes(Object[].class)
                                   .insertParameterTypes(0, MethodHandle.class));
             assertEquals(expType, inv.type());
-            List<Object> targetPlusVarArgs = new ArrayList<Object>(targetPlusArgs);
+            List<Object> targetPlusVarArgs = new ArrayList<>(targetPlusArgs);
             List<Object> tailList = targetPlusVarArgs.subList(1+k, 1+nargs);
             Object[] tail = tailList.toArray();
             tailList.clear(); tailList.add(tail);
@@ -2191,7 +2196,7 @@
         if (throwMode == THROW_NOTHING) {
             assertSame(arg0, returned);
         } else if (throwMode == THROW_CAUGHT) {
-            List<Object> catchArgs = new ArrayList<Object>(Arrays.asList(args));
+            List<Object> catchArgs = new ArrayList<>(Arrays.asList(args));
             // catcher receives an initial subsequence of target arguments:
             catchArgs.subList(nargs - catchDrops, nargs).clear();
             // catcher also receives the exception, prepended:
@@ -2317,12 +2322,13 @@
                 INT_IDENTITY = PRIVATE.findStatic(
                     Surprise.class, "intIdentity",
                         MethodType.methodType(int.class, int.class));
-            } catch (Exception ex) {
+            } catch (NoSuchMethodException | IllegalAccessException ex) {
                 throw new RuntimeException(ex);
             }
         }
     }
 
+    @SuppressWarnings("ConvertToStringSwitch")
     void testCastFailure(String mode, int okCount) throws Throwable {
         countTest(false);
         if (verbosity > 2)  System.out.println("mode="+mode);
@@ -2418,13 +2424,14 @@
     }
     public interface Fooable {
         // overloads:
-        Object foo(Object x, String y);
-        List   foo(String x, int y);
-        Object foo(String x);
+        Object  foo(Object x, String y);
+        List<?> foo(String x, int y);
+        Object  foo(String x);
     }
     static Object fooForFooable(String x, Object... y) {
         return called("fooForFooable/"+x, y);
     }
+    @SuppressWarnings("serial")  // not really a public API, just a test case
     public static class MyCheckedException extends Exception {
     }
     public interface WillThrow {
@@ -2453,7 +2460,7 @@
         {
             countTest();
             if (verbosity >= 2)  System.out.println("Appendable");
-            ArrayList<List> appendResults = new ArrayList<List>();
+            ArrayList<List<?>> appendResults = new ArrayList<>();
             MethodHandle append = lookup.bind(appendResults, "add", MethodType.methodType(boolean.class, Object.class));
             append = append.asType(MethodType.methodType(void.class, List.class)); // specialize the type
             MethodHandle asList = lookup.findStatic(Arrays.class, "asList", MethodType.methodType(List.class, Object[].class));
@@ -2475,11 +2482,11 @@
             formatter.format(fmt, fmtArgs);
             String actual = "";
             if (verbosity >= 3)  System.out.println("appendResults="+appendResults);
-            for (List l : appendResults) {
+            for (List<?> l : appendResults) {
                 Object x = l.get(0);
                 switch (l.size()) {
                 case 1:  actual += x; continue;
-                case 3:  actual += ((String)x).substring((int)l.get(1), (int)l.get(2)); continue;
+                case 3:  actual += ((String)x).substring((int)(Object)l.get(1), (int)(Object)l.get(2)); continue;
                 }
                 actual += l;
             }
@@ -2551,7 +2558,7 @@
             }
         }
         // Test error checking on bad interfaces:
-        for (Class<?> nonSMI : new Class[] { Object.class,
+        for (Class<?> nonSMI : new Class<?>[] { Object.class,
                                              String.class,
                                              CharSequence.class,
                                              java.io.Serializable.class,
@@ -2579,7 +2586,7 @@
             }
         }
         // Test error checking on interfaces with the wrong method type:
-        for (Class<?> intfc : new Class[] { Runnable.class /*arity 0*/,
+        for (Class<?> intfc : new Class<?>[] { Runnable.class /*arity 0*/,
                                             Fooable.class /*arity 1 & 2*/ }) {
             int badArity = 1;  // known to be incompatible
             if (verbosity > 2)  System.out.println(intfc.getName());
@@ -2657,7 +2664,7 @@
                                   Object a8, Object a9)
                 { return makeArray(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
     static MethodHandle[] makeArrays() {
-        ArrayList<MethodHandle> arrays = new ArrayList<MethodHandle>();
+        ArrayList<MethodHandle> arrays = new ArrayList<>();
         MethodHandles.Lookup lookup = IMPL_LOOKUP;
         for (;;) {
             int nargs = arrays.size();
@@ -2746,7 +2753,7 @@
                                      Object a8, Object a9)
                 { return makeList(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
     static MethodHandle[] makeLists() {
-        ArrayList<MethodHandle> lists = new ArrayList<MethodHandle>();
+        ArrayList<MethodHandle> lists = new ArrayList<>();
         MethodHandles.Lookup lookup = IMPL_LOOKUP;
         for (;;) {
             int nargs = lists.size();
@@ -2769,7 +2776,7 @@
     static {
         try {
             AS_LIST = IMPL_LOOKUP.findStatic(Arrays.class, "asList", MethodType.methodType(List.class, Object[].class));
-        } catch (Exception ex) { throw new RuntimeException(ex); }
+        } catch (NoSuchMethodException | IllegalAccessException ex) { throw new RuntimeException(ex); }
     }
 
     /** Return a method handle that takes the indicated number of Object
--- a/jdk/test/java/lang/invoke/MethodTypeTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/MethodTypeTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -29,6 +29,7 @@
 
 package test.java.lang.invoke;
 
+import java.io.IOException;
 import java.lang.invoke.MethodType;
 import java.lang.reflect.Method;
 
@@ -378,7 +379,7 @@
     public void testHashCode() {
         System.out.println("hashCode");
         MethodType instance = mt_viS;
-        ArrayList<Class<?>> types = new ArrayList<Class<?>>();
+        ArrayList<Class<?>> types = new ArrayList<>();
         types.add(instance.returnType());
         types.addAll(instance.parameterList());
         int expResult = types.hashCode();
@@ -556,7 +557,7 @@
             Object decode;
             try {
                 decode = readSerial(wire);
-            } catch (Exception ex) {
+            } catch (IOException | ClassNotFoundException ex) {
                 decode = ex;  // oops!
             }
             assertEquals(mt, decode);
--- a/jdk/test/java/lang/invoke/PermuteArgsTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/PermuteArgsTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -45,7 +45,7 @@
 import static java.lang.invoke.MethodType.*;
 
 public class PermuteArgsTest {
-    private static final Class CLASS = PermuteArgsTest.class;
+    private static final Class<?> CLASS = PermuteArgsTest.class;
     private static final int MAX_ARITY = Integer.getInteger(CLASS.getSimpleName()+".MAX_ARITY", 8);
     private static final boolean DRY_RUN = Boolean.getBoolean(CLASS.getSimpleName()+".DRY_RUN");
     private static final boolean VERBOSE = Boolean.getBoolean(CLASS.getSimpleName()+".VERBOSE") || DRY_RUN;
@@ -99,12 +99,12 @@
         return Arrays.asList(w, x, y, z);
     }
     static Object listI_etc(int... va) {
-        ArrayList<Object> res = new ArrayList<Object>();
+        ArrayList<Object> res = new ArrayList<>();
         for (int x : va)  res.add(x);
         return res;
     }
     static Object listIJL_etc(int x, long y, Object z, Object... va) {
-        ArrayList<Object> res = new ArrayList<Object>();
+        ArrayList<Object> res = new ArrayList<>();
         res.addAll(Arrays.asList(x, y, z));
         res.addAll(Arrays.asList(va));
         return res;
@@ -168,7 +168,7 @@
                     mh1 = adjustArity(mh, arity);
                 } catch (IllegalArgumentException ex) {
                     System.out.println("*** mh = "+name+" : "+mh+"; arity = "+arity+" => "+ex);
-                    ex.printStackTrace();
+                    ex.printStackTrace(System.out);
                     break;  // cannot get this arity for this type
                 }
                 test("("+arity+")"+name, mh1);
@@ -213,7 +213,7 @@
     }
 
     static void testPermutations(MethodHandle mh) throws Throwable {
-        HashSet<String> done = new HashSet<String>();
+        HashSet<String> done = new HashSet<>();
         MethodType mt = mh.type();
         int[] perm = nullPerm(mt.parameterCount());
         final int MARGIN = (perm.length <= 10 ? 2 : 0);
@@ -326,8 +326,8 @@
             Class<?> pt = ptypes[i];
             Object arg;
             if (pt == Void.class)       arg = null;
-            else if (pt == int.class)   arg = (int)  i + 101;
-            else if (pt == long.class)  arg = (long) i + 10_000_000_001L;
+            else if (pt == int.class)   arg = i + 101;
+            else if (pt == long.class)  arg = i + 10_000_000_001L;
             else                        arg = "#" + (i + 1);
             args[i] = arg;
         }
--- a/jdk/test/java/lang/invoke/RicochetTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/RicochetTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -40,7 +40,6 @@
 import static java.lang.invoke.MethodType.*;
 import static java.lang.invoke.MethodHandles.*;
 import static org.junit.Assert.*;
-import static org.junit.Assume.*;
 
 
 /**
@@ -48,7 +47,7 @@
  * @author jrose
  */
 public class RicochetTest {
-    private static final Class CLASS = RicochetTest.class;
+    private static final Class<?> CLASS = RicochetTest.class;
     private static final int MAX_ARITY = Integer.getInteger(CLASS.getSimpleName()+".MAX_ARITY", 40);
 
     public static void main(String... av) throws Throwable {
@@ -148,7 +147,7 @@
         for (int nargs = 0; nargs <= MAX; nargs++) {
             if (nargs > 30 && nargs < MAX-20)  nargs += 10;
             int[] args = new int[nargs];
-            for (int j = 0; j < args.length; j++)  args[j] = (int)(j + 11);
+            for (int j = 0; j < args.length; j++)  args[j] = j + 11;
             //System.out.println("testIntSpreads "+Arrays.toString(args));
             int[] args1 = (int[]) id.invokeExact(args);
             assertArrayEquals(args, args1);
@@ -388,6 +387,7 @@
         java.util.Random random;
         final MethodHandle[] fns;
         int depth;
+        @SuppressWarnings("LeakingThisInConstructor")
         RFCB(int seed) throws Throwable {
             this.random = new java.util.Random(seed);
             this.fns = new MethodHandle[Math.max(29, (1 << MAX_DEPTH-2)/3)];
@@ -408,7 +408,7 @@
                 case 1:
                     Throwable ex = new RuntimeException();
                     ex.fillInStackTrace();
-                    if (VERBOSITY >= 2) ex.printStackTrace();
+                    if (VERBOSITY >= 2) ex.printStackTrace(System.out);
                     x = "ST; " + x;
                     break;
                 case 2:
@@ -467,7 +467,7 @@
             return mh.invokeWithArguments(args);
         } catch (Throwable ex) {
             System.out.println("threw: "+mh+Arrays.asList(args));
-            ex.printStackTrace();
+            ex.printStackTrace(System.out);
             return ex;
         }
     }
@@ -515,8 +515,8 @@
     private static long opJ(long x) { return (long) opI((int)x); }
     private static Object opL2(Object x, Object y) { return (Object) opI2((int)x, (int)y); }
     private static Object opL(Object x) { return (Object) opI((int)x); }
-    private static int opL2_I(Object x, Object y) { return (int) opI2((int)x, (int)y); }
-    private static int opL_I(Object x) { return (int) opI((int)x); }
+    private static int opL2_I(Object x, Object y) { return opI2((int)x, (int)y); }
+    private static int opL_I(Object x) { return opI((int)x); }
     private static long opL_J(Object x) { return (long) opI((int)x); }
     private static final MethodHandle opI, opI2, opI3, opI4, opI_L, opJ, opJ2, opJ3, opL2, opL, opL2_I, opL_I, opL_J;
     static {
@@ -570,8 +570,8 @@
             INT_LISTERS[i] = lister;
             LONG_LISTERS[i] = llister;
             if (i == 0)  break;
-            lister  = insertArguments(lister,  i-1, (int)0);
-            llister = insertArguments(llister, i-1, (long)0);
+            lister  = insertArguments(lister,  i-1, 0);
+            llister = insertArguments(llister, i-1, 0L);
         }
     }
 
--- a/jdk/test/java/lang/invoke/ThrowExceptionsTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/lang/invoke/ThrowExceptionsTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -40,7 +40,7 @@
 import static java.lang.invoke.MethodType.*;
 
 public class ThrowExceptionsTest {
-    private static final Class CLASS = ThrowExceptionsTest.class;
+    private static final Class<?> CLASS = ThrowExceptionsTest.class;
     private static final Lookup LOOKUP = lookup();
 
     public static void main(String argv[]) throws Throwable {
@@ -132,9 +132,9 @@
                 int tc = testCases;
                 try {
                     m.invoke(this);
-                } catch (Throwable ex) {
+                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                     System.out.println("*** "+ex);
-                    ex.printStackTrace();
+                    ex.printStackTrace(System.out);
                 }
                 if (testCases == tc)  testCases++;
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/HttpURLConnection/UnmodifiableMaps.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 7128648
+ * @summary HttpURLConnection.getHeaderFields should return an unmodifiable Map
+ */
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.HttpURLConnection;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import com.sun.net.httpserver.Headers;
+
+public class UnmodifiableMaps {
+
+    void test(String[] args) throws Exception {
+        HttpServer server = startHttpServer();
+        try {
+            InetSocketAddress address = server.getAddress();
+            URI uri = new URI("http://" + InetAddress.getLocalHost().getHostAddress()
+                              + ":" + address.getPort() + "/foo");
+            doClient(uri);
+        } finally {
+            server.stop(0);
+        }
+    }
+
+    void doClient(URI uri) throws Exception {
+        HttpURLConnection uc = (HttpURLConnection) uri.toURL().openConnection();
+
+        // Test1: getRequestProperties is unmodifiable
+        System.out.println("Check getRequestProperties");
+        checkUnmodifiable(uc.getRequestProperties());
+        uc.addRequestProperty("X", "V");
+        uc.addRequestProperty("X1", "V1");
+        checkUnmodifiable(uc.getRequestProperties());
+
+        int resp = uc.getResponseCode();
+        check(resp == 200,
+              "Unexpected response code. Expected 200, got " + resp);
+
+        // Test2: getHeaderFields is unmodifiable
+        System.out.println("Check getHeaderFields");
+        checkUnmodifiable(uc.getHeaderFields());
+        // If the implementation does caching, check again.
+        checkUnmodifiable(uc.getHeaderFields());
+    }
+
+    // HTTP Server
+    HttpServer startHttpServer() throws IOException {
+        HttpServer httpServer = HttpServer.create(new InetSocketAddress(0), 0);
+        httpServer.createContext("/foo", new SimpleHandler());
+        httpServer.start();
+        return httpServer;
+    }
+
+    class SimpleHandler implements HttpHandler {
+        @Override
+        public void handle(HttpExchange t) throws IOException {
+            Headers respHeaders = t.getResponseHeaders();
+            // ensure some response headers, over the usual ones
+            respHeaders.add("RespHdr1", "Value1");
+            respHeaders.add("RespHdr2", "Value2");
+            respHeaders.add("RespHdr3", "Value3");
+            t.sendResponseHeaders(200, -1);
+            t.close();
+        }
+    }
+
+    void checkUnmodifiable(Map<String,List<String>> map) {
+        checkUnmodifiableMap(map);
+
+        // Now check the individual values
+        Collection<List<String>> values = map.values();
+        for (List<String> value : values) {
+            checkUnmodifiableList(value);
+        }
+    }
+
+    void checkUnmodifiableMap(final Map<String,List<String>> map) {
+        expectThrow( new Runnable() {
+            public void run() { map.clear(); }});
+        expectThrow( new Runnable() {
+            public void run() { map.put("X", new ArrayList<String>()); }});
+        expectThrow( new Runnable() {
+            public void run() { map.remove("X"); }});
+    }
+
+    void checkUnmodifiableList(final List<String> list) {
+        expectThrow( new Runnable() {
+            public void run() { list.clear(); }});
+        expectThrow( new Runnable() {
+            public void run() { list.add("X"); }});
+        expectThrow( new Runnable() {
+            public void run() { list.remove("X"); }});
+    }
+
+    void expectThrow(Runnable r) {
+        try { r.run(); fail("Excepted UOE to be thrown."); Thread.dumpStack(); }
+        catch (UnsupportedOperationException e) { pass(); }
+    }
+
+    volatile int passed = 0, failed = 0;
+    void pass() {passed++;}
+    void fail() {failed++;}
+    void fail(String msg) {System.err.println(msg); fail();}
+    void unexpected(Throwable t) {failed++; t.printStackTrace();}
+    void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
+    public static void main(String[] args) throws Throwable {
+        Class<?> k = new Object(){}.getClass().getEnclosingClass();
+        try {k.getMethod("instanceMain",String[].class)
+                .invoke( k.newInstance(), (Object) args);}
+        catch (Throwable e) {throw e.getCause();}}
+    public void instanceMain(String[] args) throws Throwable {
+        try {test(args);} catch (Throwable t) {unexpected(t);}
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new AssertionError("Some tests failed");}
+}
+
--- a/jdk/test/java/security/Provider/DefaultPKCS11.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/java/security/Provider/DefaultPKCS11.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,10 @@
             System.out.println("Test only applies to Solaris 10 and later, skipping");
             return;
         }
-        if (ps[0].getName().equals("SunPKCS11-Solaris") == false) {
+        // SunPKCS11-Solaris provider should be either the first one or
+        // the second one
+        if (ps[0].getName().equals("SunPKCS11-Solaris") == false &&
+            ps[1].getName().equals("SunPKCS11-Solaris") == false) {
             throw new Exception("SunPKCS11-Solaris provider not installed");
         }
         System.out.println("OK");
--- a/jdk/test/javax/crypto/Cipher/GetMaxAllowed.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/javax/crypto/Cipher/GetMaxAllowed.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4807942
+ * @bug 4807942 7033170
  * @summary Test the Cipher.getMaxAllowedKeyLength(String) and
  * getMaxAllowedParameterSpec(String) methods
  * @author Valerie Peng
@@ -40,7 +40,7 @@
 
 public class GetMaxAllowed {
 
-    private static void runTest(boolean isUnlimited) throws Exception {
+    private static void runTest1(boolean isUnlimited) throws Exception {
         System.out.println("Testing " + (isUnlimited? "un":"") +
                            "limited policy...");
 
@@ -78,6 +78,20 @@
         System.out.println("All tests passed");
     }
 
+    private static void runTest2() throws Exception {
+        System.out.println("Testing against Security.getAlgorithms()");
+
+        Set<String> algorithms = Security.getAlgorithms("Cipher");
+
+        for (String algorithm: algorithms) {
+            int keylength = -1;
+
+            // if 7033170 is not fixed, NoSuchAlgorithmException is thrown
+            keylength = Cipher.getMaxAllowedKeyLength(algorithm);
+
+        }
+    }
+
     public static void main(String[] args) throws Exception {
         // decide if the installed jurisdiction policy file is the
         // unlimited version
@@ -88,6 +102,9 @@
         } catch (InvalidKeyException ike) {
             isUnlimited = false;
         }
-        runTest(isUnlimited);
+        runTest1(isUnlimited);
+
+        // test using the set of algorithms returned by Security.getAlgorithms()
+        runTest2();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/x500/X500Principal/NameFormat.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4505980 5109882 7049963 7090565
+ * @summary X500Principal input name parsing issues and wrong exception thrown
+ * @run main/othervm -Djava.security.debug=x509,ava NameFormat
+ *
+ * The debug=ava above must be set in order to check for escaped hex chars.
+ */
+import javax.security.auth.x500.X500Principal;
+
+public class NameFormat {
+
+    public static void main(String[] args) throws Exception {
+
+        // tests for leading/trailing escaped/non-escaped spaces
+
+        testName("cn=\\ duke   ", "RFC1779", "CN=\" duke\"", 1);
+        testName("cn=\\ duke   ", "RFC2253", "CN=\\ duke", 2);
+        testName("cn=\\ duke   ", "CANONICAL", "cn=duke", 3);
+        testName("cn=\\ duke   ", "toString", "CN=\" duke\"", 4);
+
+        testName("cn= duke", "RFC1779", "CN=duke", 5);
+        testName("cn= duke", "RFC2253", "CN=duke", 6);
+        testName("cn= duke", "CANONICAL", "cn=duke", 7);
+        testName("cn= duke", "toString", "CN=duke", 8);
+
+        testName("cn=duke\\   ", "RFC1779", "CN=\"duke \"", 9);
+        testName("cn=duke\\   ", "RFC2253", "CN=duke\\ ", 10);
+        testName("cn=duke\\   ", "CANONICAL", "cn=duke", 11);
+        testName("cn=duke\\   ", "toString", "CN=\"duke \"", 12);
+
+        testName("cn=duke\\   , ou= sun\\ ", "RFC1779",
+                "CN=\"duke \", OU=\"sun \"", 13);
+        testName("cn=duke\\   , ou= sun\\ ", "RFC2253",
+                "CN=duke\\ ,OU=sun\\ ", 14);
+        testName("cn=duke\\   , ou= sun\\ ", "CANONICAL",
+                "cn=duke,ou=sun", 15);
+        testName("cn=duke\\   , ou= sun\\ ", "toString",
+                "CN=\"duke \", OU=\"sun \"", 16);
+
+        // tests for trailing escaped backslash
+
+        testName("cn=duke \\\\\\,test,O=java", "CANONICAL",
+                "cn=duke \\\\\\,test,o=java", 17);
+
+        testName("cn=duke\\\\, o=java", "CANONICAL",
+                "cn=duke\\\\,o=java", 18);
+
+        X500Principal p = new X500Principal("cn=duke \\\\\\,test,o=java");
+        X500Principal p2 = new X500Principal(p.getName("CANONICAL"));
+        if (p.getName("CANONICAL").equals(p2.getName("CANONICAL"))) {
+            System.out.println("test 19 succeeded");
+        } else {
+            throw new SecurityException("test 19 failed\n" +
+                p.getName("CANONICAL") + " not equal to " +
+                p2.getName("CANONICAL"));
+        }
+
+        try {
+            p = new X500Principal("cn=duke \\\\,test,o=java");
+            throw new SecurityException("test 19.5 failed:\n" +
+                p.getName("CANONICAL"));
+        } catch (IllegalArgumentException iae) {
+            System.out.println("test 19.5 succeeded");
+            iae.printStackTrace();
+        }
+
+        // tests for wrong exception thrown
+        try {
+            byte[] encoding = {
+                (byte)0x17, (byte)0x80, (byte)0x70, (byte)0x41,
+                (byte)0x6b, (byte)0x15, (byte)0xdc, (byte)0x84,
+                (byte)0xef, (byte)0x58, (byte)0xac, (byte)0x88,
+                (byte)0xae, (byte)0xb0, (byte)0x19, (byte)0x7c,
+                (byte)0x6f, (byte)0xea, (byte)0xf5, (byte)0x56,
+            };
+            p = new X500Principal(new java.io.DataInputStream
+                (new java.io.ByteArrayInputStream(encoding)));
+        } catch (IllegalArgumentException iae) {
+            System.out.println("test 20 succeeded");
+            iae.printStackTrace();
+        } catch (Exception e) {
+            System.out.println("test 20 failed");
+            throw e;
+        }
+
+        // tests for escaping '+' in canonical form
+
+        testName("cn=se\\+an, ou= sun\\ ", "CANONICAL",
+                "cn=se\\+an,ou=sun", 21);
+
+        // tests for embedded hex pairs
+
+        testName("CN=Before\\0dAfter,DC=example,DC=net", "toString",
+                "CN=Before\\0DAfter, DC=example, DC=net", 22);
+        testName("CN=Before\\0dAfter,DC=example,DC=net", "RFC1779",
+                "CN=Before\\0DAfter, " +
+                "OID.0.9.2342.19200300.100.1.25=example, " +
+                "OID.0.9.2342.19200300.100.1.25=net", 23);
+        testName("CN=Before\\0dAfter,DC=example,DC=net", "RFC2253",
+                "CN=Before\\0DAfter,DC=example,DC=net", 24);
+        testName("CN=Before\\0dAfter,DC=example,DC=net", "CANONICAL",
+                "cn=before\\0dafter,dc=#16076578616d706c65,dc=#16036e6574", 25);
+
+        testName("CN=Lu\\C4\\8Di\\C4\\87", "toString",
+                "CN=Lu\\C4\\8Di\\C4\\87", 26);
+        testName("CN=Lu\\C4\\8Di\\C4\\87", "RFC1779",
+                "CN=Lu\\C4\\8Di\\C4\\87", 27);
+        testName("CN=Lu\\C4\\8Di\\C4\\87", "RFC2253",
+                "CN=Lu\\C4\\8Di\\C4\\87", 28);
+        testName("CN=Lu\\C4\\8Di\\C4\\87", "CANONICAL",
+                "cn=lu\\c4\\8di\\c4\\87", 29);
+
+        try {
+            p = new X500Principal("cn=\\gg");
+            throw new SecurityException("test 30 failed");
+        } catch (IllegalArgumentException iae) {
+            System.out.println("test 30 succeeded");
+        }
+
+        // tests for invalid escaped chars
+
+        try {
+            p = new X500Principal("cn=duke \\test");
+            throw new SecurityException("test 31 failed");
+        } catch (IllegalArgumentException iae) {
+            System.out.println("test 31 succeeded");
+        }
+
+        try {
+            p = new X500Principal("cn=duke \\?test");
+            throw new SecurityException("test 32 failed");
+        } catch (IllegalArgumentException iae) {
+            System.out.println("test 32 succeeded");
+        }
+
+        // tests for X500Name using RFC2253 as format
+
+        try {
+            // invalid non-escaped leading space
+            sun.security.x509.X500Name name =
+                new sun.security.x509.X500Name("cn= duke test", "RFC2253");
+            throw new SecurityException("test 33 failed");
+        } catch (java.io.IOException ioe) {
+            ioe.printStackTrace();
+            System.out.println("test 33 succeeded");
+        }
+
+        try {
+            // invalid non-escaped trailing space
+            sun.security.x509.X500Name name =
+                new sun.security.x509.X500Name("cn=duke test ", "RFC2253");
+            throw new SecurityException("test 34 failed");
+        } catch (java.io.IOException ioe) {
+            System.out.println("test 34 succeeded");
+        }
+
+        testName("CN=SPECIAL CHARS,OU=\\#\\\"\\,\\<\\>\\+\\;,O=foo, " +
+                "L=bar, ST=baz, C=JP", "RFC1779",
+                "CN=SPECIAL CHARS, OU=\"#\\\",<>+;\", O=foo, L=bar, " +
+                "ST=baz, C=JP", 35);
+
+        // test that double-quoted string is not escaped in RFC 1779 format
+        testName("CN=\"\\\"Duke\\\"\"", "RFC1779", "CN=\"Duke\"", 36);
+    }
+
+    public static void testName(String in, String outFormat,
+                                String expect, int n)
+        throws Exception {
+
+        X500Principal p = new X500Principal(in);
+        if (outFormat.equalsIgnoreCase("toString")) {
+            if (p.toString().equals(expect)) {
+                System.out.println("test " + n + " succeeded");
+            } else {
+                throw new SecurityException("test " + n + " failed:\n" +
+                        "expected '" + expect + "'\n" +
+                        "got '" + p.toString() + "'");
+            }
+        } else {
+            if (p.getName(outFormat).equals(expect)) {
+                System.out.println("test " + n + " succeeded");
+            } else {
+                throw new SecurityException("test " + n + " failed:\n" +
+                        "expected '" + expect + "'\n" +
+                        "got '" + p.getName(outFormat) + "'");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSplitPane/4885629/bug4885629.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4885629
+ * @summary With JSplitPane in VERTICAL_SPLIT, SplitPaneBorder draws bottom edge of divider
+ * @author Andrey Pikalev
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.plaf.basic.BasicBorders;
+import javax.swing.plaf.basic.BasicLookAndFeel;
+import javax.swing.plaf.basic.BasicSplitPaneUI;
+import java.awt.*;
+
+
+public class bug4885629 {
+
+    private static final Color darkShadow = new Color(100,120,200);
+    private static final Color darkHighlight = new Color(200,120,50);
+    private static final Color lightHighlight = darkHighlight.brighter();
+    private static final Color BGCOLOR = Color.blue;
+
+    private static JSplitPane sp;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new BasicLookAndFeel() {
+                public boolean isSupportedLookAndFeel(){ return true; }
+                public boolean isNativeLookAndFeel(){ return false; }
+                public String getDescription() { return "Foo"; }
+                public String getID() { return "FooID"; }
+                public String getName() { return "FooName"; }
+        });
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JFrame frame = new JFrame();
+
+                JComponent a = new JPanel();
+                a.setBackground(Color.white);
+                a.setMinimumSize(new Dimension(10, 10));
+
+                JComponent b = new JPanel();
+                b.setBackground(Color.white);
+                b.setMinimumSize(new Dimension(10, 10));
+
+                sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, a, b);
+                sp.setPreferredSize(new Dimension(20, 20));
+                sp.setBackground(BGCOLOR);
+
+                Border bo = new BasicBorders.SplitPaneBorder(lightHighlight,
+                        Color.red);
+                Border ibo = new EmptyBorder(0, 0, 0, 0);
+                sp.setBorder(bo);
+                sp.setMinimumSize(new Dimension(200, 200));
+
+                ((BasicSplitPaneUI) sp.getUI()).getDivider().setBorder(ibo);
+
+                frame.getContentPane().setLayout(new FlowLayout());
+                frame.getContentPane().setBackground(darkShadow);
+                frame.getContentPane().add(sp);
+
+                frame.setSize(200, 200);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setVisible(true);
+            }
+        });
+
+        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+
+        final Robot robot = new Robot();
+        robot.delay(1000);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Rectangle rect = ((BasicSplitPaneUI) sp.getUI()).getDivider().getBounds();
+
+                Point p = rect.getLocation();
+
+                SwingUtilities.convertPointToScreen(p, sp);
+
+                for (int i = 0; i < rect.width; i++) {
+                    if (!BGCOLOR.equals(robot.getPixelColor(p.x + i, p.y + rect.height - 1))) {
+                        throw new Error("The divider's area has incorrect color.");
+                    }
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4697612 6244705
+ * @author Peter Zhelezniakov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug4697612
+ */
+import java.io.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import javax.swing.text.BadLocationException;
+import sun.awt.SunToolkit;
+
+public class bug4697612 {
+
+    static final int FRAME_WIDTH = 300;
+    static final int FRAME_HEIGHT = 300;
+    static final int FONT_HEIGHT = 16;
+    private static volatile int frameHeight;
+    private static volatile int fontHeight;
+    private static JFrame frame;
+    private static JTextArea text;
+    private static JScrollPane scroller;
+
+    public static void main(String[] args) throws Throwable {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(100);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                text.requestFocus();
+            }
+        });
+
+        toolkit.realSync();
+
+        // 4697612: pressing PgDn + PgUp should not alter caret position
+        Util.hitKeys(robot, KeyEvent.VK_HOME);
+        Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
+
+
+        int pos0 = getTextCaretPosition();
+        int caretHeight = getTextCaretHeight();
+        fontHeight = FONT_HEIGHT;
+
+        // iterate two times, for different (even and odd) font height
+        for (int i = 0; i < 2; i++) {
+
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                public void run() {
+                    text.setFont(text.getFont().deriveFont(fontHeight));
+                }
+            });
+
+            frameHeight = FRAME_HEIGHT;
+
+            for (int j = 0; j < caretHeight; j++) {
+                SwingUtilities.invokeAndWait(new Runnable() {
+
+                    public void run() {
+                        frame.setSize(FRAME_WIDTH, frameHeight);
+                    }
+                });
+
+                toolkit.realSync();
+
+                Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
+                Util.hitKeys(robot, KeyEvent.VK_PAGE_UP);
+                toolkit.realSync();
+
+                int pos = getTextCaretPosition();
+                if (pos0 != pos) {
+                    throw new RuntimeException("Failed 4697612: PgDn & PgUp keys scroll by different amounts");
+                }
+                frameHeight++;
+            }
+            fontHeight++;
+        }
+
+
+        // 6244705: pressing PgDn at the very bottom should not scroll
+        LookAndFeel laf = UIManager.getLookAndFeel();
+        if (laf.getID().equals("Aqua")) {
+            Util.hitKeys(robot, KeyEvent.VK_END);
+        } else {
+            Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_END);
+        }
+
+        toolkit.realSync();
+
+        pos0 = getScrollerViewPosition();
+        Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
+        toolkit.realSync();
+
+        int pos = getScrollerViewPosition();
+
+        if (pos0 != pos) {
+            throw new RuntimeException("Failed 6244705: PgDn at the bottom causes scrolling");
+        }
+    }
+
+    private static int getTextCaretPosition() throws Exception {
+        final int[] result = new int[1];
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                result[0] = text.getCaretPosition();
+            }
+        });
+
+        return result[0];
+    }
+
+    private static int getTextCaretHeight() throws Exception {
+        final int[] result = new int[1];
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+                    int pos0 = text.getCaretPosition();
+                    Rectangle dotBounds = text.modelToView(pos0);
+                    result[0] = dotBounds.height;
+                } catch (BadLocationException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        });
+
+        return result[0];
+    }
+
+    private static int getScrollerViewPosition() throws Exception {
+        final int[] result = new int[1];
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                result[0] = scroller.getViewport().getViewPosition().y;
+            }
+        });
+
+        return result[0];
+    }
+
+    private static void createAndShowGUI() {
+        frame = new JFrame();
+        frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        text = new JTextArea();
+        try {
+            InputStream is =
+                    bug4697612.class.getResourceAsStream("bug4697612.txt");
+            text.read(new InputStreamReader(is), null);
+        } catch (IOException e) {
+            throw new Error(e);
+        }
+
+        scroller = new JScrollPane(text);
+
+        frame.getContentPane().add(scroller);
+
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTextArea/4697612/bug4697612.txt	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,223 @@
+                                   README
+
+                      Java(TM) 2 SDK, Standard Edition
+                             Version 1.4.2 Beta
+
+     For a more extensive HTML version of this file, see README.html.
+
+Contents
+
+   * Introduction
+   * Release Notes
+   * Bug Reports and Feedback
+   * Java 2 SDK Documentation
+   * Redistribution
+   * Web Pages
+
+
+Introduction
+
+     Thank you for downloading this release of the Java(TM) 2 SDK,
+     Standard Edition. The Java 2 SDK is a development environment for
+     building applications, applets, and components that can be
+     deployed on the Java platform.
+
+     The Java 2 SDK software includes tools useful for developing and
+     testing programs written in the Java programming language and
+     running on the Java platform. These tools are designed to be used
+     from the command line. Except for appletviewer, these tools do not
+     provide a graphical user interface.
+
+
+Release Notes
+
+      See the Release Notes on the Java Software web site for additional 
+      information pertaining to this release. 
+ 
+      http://java.sun.com/j2se/1.4.2/relnotes.html
+
+      The on-line release notes will be updated as needed, so you should 
+      check it occasionally for the latest information. 
+
+
+Bug Reports and Feedback
+
+      The Bug Parade Web Page on the Java Developer Connection(SM) web 
+      site lets you search for and examine existing bug reports, submit 
+      your own bug reports, and tell us which bug fixes matter most to you. 
+
+      http://java.sun.com/jdc/bugParade/
+
+      To directly submit a bug or request a feature, fill out this form: 
+
+      http://java.sun.com/cgi-bin/bugreport.cgi 
+
+      You can also send comments directly to Java Software engineering 
+      team email addresses. 
+
+      http://java.sun.com/mail/
+
+
+Java 2 SDK Documentation
+
+     The on-line Java 2 SDK Documentation contains API specifications,
+     feature descriptions, developer guides, tool reference pages, demos, 
+     and links to related information. It is located at
+
+     http://java.sun.com/j2se/1.4.2/docs/
+
+     The Java 2 SDK documentation is also available in a download bundle 
+     which you can install locally on your machine. See the 
+     Java 2 SDK download page: 
+     
+     http://java.sun.com/j2se/1.4.2/download.html
+
+
+Redistribution
+
+      The term "vendors" used here refers to licensees, developers, 
+      and independent software vendors (ISVs) who license and 
+      distribute the Java 2 Runtime Environment with their programs. 
+      Vendors must follow the terms of the Java 2 SDK, Standard 
+      Edition, Binary Code License agreement. 
+      Required vs. Optional Files
+
+      The files that make up the Java 2 SDK, Standard Edition, are
+      divided into two categories: required and optional. Optional 
+      files may be excluded from redistributions of the Java 2 SDK 
+      at the vendor's discretion. The following section contains a 
+      list of the files and directories that may optionally be 
+      omitted from redistributions of the Java 2 SDK. All files not 
+      in these lists of optional files must be included in 
+      redistributions of the Java 2 SDK. 
+
+      Optional Files and Directories
+
+      The following files may be optionally excluded from 
+      redistributions:
+
+      jre/lib/charsets.jar 
+            Character conversion classes 
+      jre/lib/ext/ 
+            sunjce_provider.jar - the SunJCE provider for Java 
+              Cryptography APIs
+            localedata.jar - contains many of the resources 
+              needed for non US English locales
+            ldapsec.jar - contains security features supported 
+              by the LDAP service provider
+            dnsns.jar - for the InetAddress wrapper of JNDI DNS 
+              provider
+      bin/rmid and jre/bin/rmid 
+            Java RMI Activation System Daemon 
+      bin/rmiregistry and jre/bin/rmiregistry 
+            Java Remote Object Registry 
+      bin/tnameserv and jre/bin/tnameserv 
+            Java IDL Name Server 
+      bin/keytool and jre/bin/keytool 
+            Key and Certificate Management Tool 
+      bin/kinit and jre/bin/kinit
+            Used to obtain and cache Kerberos ticket-granting tickets
+      bin/klist and jre/bin/klist
+            Kerberos display entries in credentials cache and keytab
+      bin/ktab and jre/bin/ktab
+            Kerberos key table manager
+      bin/policytool and jre/bin/policytool 
+            Policy File Creation and Management Tool 
+      bin/orbd and jre/bin/orbd 
+            Object Request Broker Daemon 
+      bin/servertool and jre/bin/servertool 
+            Java IDL Server Tool 
+      src.zip 
+            Archive of source files 
+
+      In addition, the Java Web Start product may be excluded from
+      redistributions. The Java Web Start product is contained in a 
+      file named javaws-1_2-solaris-sparc-i.zip,
+      javaws-1_2-solaris-i586-i.zip,
+      javaws-1_2-linux-i586-i.zip, or
+      javaws-1_2-windows-i586-i.exe, depending on the platform. 
+
+
+      Unlimited Strength Java Cryptography Extension
+
+      Due to import control restrictions for some countries, the 
+      Java Cryptography Extension (JCE) policy files shipped with 
+      the Java 2 SDK, Standard Edition and the Java 2 Runtime 
+      Environment allow strong but limited cryptography to be 
+      used.  These files are located at
+
+      <java-home>/lib/security/local_policy.jar
+      <java-home>/lib/security/US_export_policy.jar
+
+      where <java-home> is the jre directory of the Java 2 
+      SDK or the top-level directory of the Java 2 Runtime 
+      Environment.
+
+      An unlimited strength version of these files indicating 
+      no restrictions on cryptographic strengths is available 
+      on the Java 2 SDK web site for those living in eligible 
+      countries.  Those living in eligible countries may download 
+      the unlimited strength version and replace the strong 
+      cryptography jar files with the unlimited strength files.
+
+
+      Endorsed Standards Override Mechanism
+
+      An endorsed standard is a Java API defined through a standards
+      process other than the Java Community Process(SM) (JCP(SM)).
+      Because endorsed standards are defined outside the JCP, it is
+      anticipated that such standards will be revised between 
+      releases of the Java 2 Platform. In order to take advantage of 
+      new revisions to endorsed standards, developers and software
+      vendors may use the Endorsed Standards Override Mechanism to
+      provide newer versions of an endorsed standard than those
+      included in the Java 2 Platform as released by Sun Microsystems.
+
+      For more information on the Endorsed Standards Override
+      Mechanism, including the list of platform packages that it may 
+      be used to override, see 
+
+            http://java.sun.com/j2se/1.4.2/docs/guide/standards/ 
+
+      Classes in the packages listed on that web page may be replaced
+      only by classes implementing a more recent version of the API 
+      as defined by the appropriate standards body. 
+
+      In addition to the packages listed in the document at the above 
+      URL, which are part of the Java 2 Platform, Standard Edition 
+      (J2SE(TM)) specification, redistributors of Sun's J2SE 
+      Reference Implementation are allowed to override classes whose 
+      sole purpose is to implement the functionality provided by 
+      public APIs defined in these Endorsed Standards packages.  
+      Redistributors may also override classes in the org.w3c.dom.* 
+      packages, or other classes whose sole purpose is to implement 
+      these APIs. 
+
+
+Sun Java Web Pages
+
+     For additional information, refer to these Sun Microsystems pages
+     on the World Wide Web:
+
+     http://java.sun.com/
+          The Java Software web site, with the latest information on
+          Java technology, product information, news, and features.
+     http://java.sun.com/docs
+          Java Platform Documentation provides access to white papers,
+          the Java Tutorial and other documents.
+     http://java.sun.com/jdc
+          The Java Developer Connection(SM) web site. (Free registration
+          required.) Additional technical information, news, and
+          features; user forums; support information, and much more.
+     http://java.sun.com/products/
+          Java Technology Products & API
+
+
+------------------------------------------------------------------------
+The Java 2 SDK, Standard Edition, is a product of Sun Microsystems(TM), 
+Inc.  This product includes code licensed from RSA Security.
+
+Copyright 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 
+California 95054, U.S.A.  All rights reserved.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/6505523/bug6505523.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6505523
+ * @summary NullPointerException in BasicTreeUI when a node is removed by expansion listener
+ * @author Alexandr Scherbatiy
+ * @run main bug6505523
+ */
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import sun.awt.SunToolkit;
+
+public class bug6505523 {
+
+    private static JTree tree;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        Point point = getRowPointToClick(2);
+        robot.mouseMove(point.x, point.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        toolkit.realSync();
+
+    }
+
+    private static Point getRowPointToClick(final int row) throws Exception {
+
+        final Point[] result = new Point[1];
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                Rectangle rect = tree.getRowBounds(row);
+                Point point = new Point(rect.x - 5, rect.y + rect.height / 2);
+                SwingUtilities.convertPointToScreen(point, tree);
+                result[0] = point;
+            }
+        });
+
+        return result[0];
+    }
+
+    private static void createAndShowGUI() {
+        final DefaultMutableTreeNode root = new DefaultMutableTreeNode("Problem with NPE under JDK 1.6");
+        final DefaultMutableTreeNode problematic = new DefaultMutableTreeNode("Expand me and behold a NPE in stderr");
+        problematic.add(new DefaultMutableTreeNode("some content"));
+        root.add(new DefaultMutableTreeNode("irrelevant..."));
+        root.add(problematic);
+
+        final DefaultTreeModel model = new DefaultTreeModel(root);
+        tree = new JTree(model);
+        tree.setRootVisible(true);
+        tree.setShowsRootHandles(true);
+        tree.expandRow(0);
+        tree.collapseRow(2);
+
+        // this is critical - without dragEnabled everything works
+        tree.setDragEnabled(true);
+
+        tree.addTreeExpansionListener(new TreeExpansionListener() {
+
+            @Override
+            public void treeExpanded(TreeExpansionEvent event) {
+                TreeNode parent = problematic.getParent();
+                if (parent instanceof DefaultMutableTreeNode) {
+                    model.removeNodeFromParent(problematic);
+                }
+            }
+
+            @Override
+            public void treeCollapsed(TreeExpansionEvent event) {
+            }
+        });
+
+        JFrame frame = new JFrame("JTree Problem");
+        frame.add(new JScrollPane(tree));
+        frame.setSize(500, 300);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+}
\ No newline at end of file
--- a/jdk/test/sun/invoke/util/ValueConversionsTest.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/sun/invoke/util/ValueConversionsTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -27,11 +27,9 @@
 import sun.invoke.util.Wrapper;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Collections;
-import org.junit.Ignore;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
@@ -52,7 +50,7 @@
  * @author jrose
  */
 public class ValueConversionsTest {
-    private static final Class CLASS = ValueConversionsTest.class;
+    private static final Class<?> CLASS = ValueConversionsTest.class;
     private static final int MAX_ARITY = Integer.getInteger(CLASS.getSimpleName()+".MAX_ARITY", 40);
     private static final int START_ARITY = Integer.getInteger(CLASS.getSimpleName()+".START_ARITY", 0);
     private static final boolean EXHAUSTIVE = Boolean.getBoolean(CLASS.getSimpleName()+".EXHAUSTIVE");
@@ -165,7 +163,7 @@
                 Object expResult = box;
                 Object result = null;
                 switch (w) {
-                    case INT:     result = boxer.invokeExact((int)n); break;
+                    case INT:     result = boxer.invokeExact(/*int*/n); break;
                     case LONG:    result = boxer.invokeExact((long)n); break;
                     case FLOAT:   result = boxer.invokeExact((float)n); break;
                     case DOUBLE:  result = boxer.invokeExact((double)n); break;
@@ -361,6 +359,7 @@
             assert(stype == MethodType.methodType(arrayType, arrayType));
             if (nargs <= 5) {
                 // invoke target as a spreader also:
+                @SuppressWarnings("cast")
                 Object res2 = spreader.invokeWithArguments((Object)res);
                 String res2String = toArrayString(res2);
                 assertEquals(Arrays.toString(args), res2String);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/http/HttpClient/CookieHttpClientTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7129083
+ * @summary Cookiemanager does not store cookies if url is read
+ *          before setting cookiemanager
+ */
+
+import java.net.CookieHandler;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URL;
+import java.io.InputStream;
+import java.io.IOException;
+
+public class CookieHttpClientTest implements Runnable {
+    final ServerSocket ss;
+    static final int TIMEOUT = 10 * 1000;
+
+    static final String replyString = "HTTP/1.1 200 OK\r\n" +
+            "Set-Cookie: name=test\r\n" +
+            "Content-Length: 10\r\n\r\n" +
+            "1234567890";
+
+    // HTTP server, reply with Set-Cookie
+    @Override
+    public void run() {
+        Socket s = null;
+        try {
+            s = ss.accept();
+            s.setSoTimeout(TIMEOUT);
+            readOneRequest(s.getInputStream());
+            s.getOutputStream().write(replyString.getBytes());
+
+            readOneRequest(s.getInputStream());
+            s.getOutputStream().write(replyString.getBytes());
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try { if (s != null) { s.close(); } ss.close(); }
+            catch (IOException unused) {  /* gulp!burp! */   }
+        }
+    }
+
+    static final byte[] requestEnd = new byte[] {'\r', '\n', '\r', '\n' };
+
+    // Read until the end of a HTTP request
+    static void readOneRequest(InputStream is) throws IOException {
+        int requestEndCount = 0, r;
+        while ((r = is.read()) != -1) {
+            if (r == requestEnd[requestEndCount]) {
+                requestEndCount++;
+                if (requestEndCount == 4) {
+                    break;
+                }
+            } else {
+                requestEndCount = 0;
+            }
+        }
+    }
+
+    CookieHttpClientTest() throws Exception {
+        /* start the server */
+        ss = new ServerSocket(0);
+        (new Thread(this)).start();
+
+        URL url = new URL("http://localhost:" + ss.getLocalPort() +"/");
+
+        // Run without a CookieHandler first
+        InputStream in = url.openConnection().getInputStream();
+        while (in.read() != -1);  // read response body so connection can be reused
+
+        // Set a CookeHandler and retest using the HttpClient from the KAC
+        CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL);
+        CookieHandler.setDefault(manager);
+
+        in = url.openConnection().getInputStream();
+        while (in.read() != -1);
+
+        if (manager.getCookieStore().getCookies().isEmpty()) {
+            throw new RuntimeException("Failed: No cookies in the cookie Handler.");
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        new CookieHttpClientTest();
+    }
+}
--- a/jdk/test/sun/security/krb5/auto/Context.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/sun/security/krb5/auto/Context.java	Thu Jan 26 19:39:08 2012 -0800
@@ -76,7 +76,6 @@
 
     private Subject s;
     private ExtendedGSSContext x;
-    private boolean f;      // context established?
     private String name;
     private GSSCredential cred;     // see static method delegated().
 
@@ -194,7 +193,6 @@
                 return null;
             }
         }, null);
-        f = false;
     }
 
     /**
@@ -228,7 +226,6 @@
                 return null;
             }
         }, null);
-        f = false;
     }
 
     /**
@@ -502,6 +499,29 @@
         return sb.toString();
     }
 
+    public byte[] take(final byte[] in) throws Exception {
+        return doAs(new Action() {
+            @Override
+            public byte[] run(Context me, byte[] input) throws Exception {
+                if (me.x.isEstablished()) {
+                    System.out.println(name + " side established");
+                    if (input != null) {
+                        throw new Exception("Context established but " +
+                                "still receive token at " + name);
+                    }
+                    return null;
+                } else {
+                    System.out.println(name + " call initSecContext");
+                    if (me.x.isInitiator()) {
+                        return me.x.initSecContext(input, 0, input.length);
+                    } else {
+                        return me.x.acceptSecContext(input, 0, input.length);
+                    }
+                }
+            }
+        }, in);
+    }
+
     /**
      * Handshake (security context establishment process) between two Contexts
      * @param c the initiator
@@ -510,54 +530,9 @@
      */
     static public void handshake(final Context c, final Context s) throws Exception {
         byte[] t = new byte[0];
-        while (!c.f || !s.f) {
-            t = c.doAs(new Action() {
-                @Override
-                public byte[] run(Context me, byte[] input) throws Exception {
-                    if (me.x.isEstablished()) {
-                        me.f = true;
-                        System.out.println(c.name + " side established");
-                        if (input != null) {
-                            throw new Exception("Context established but " +
-                                    "still receive token at " + c.name);
-                        }
-                        return null;
-                    } else {
-                        System.out.println(c.name + " call initSecContext");
-                        if (usingStream) {
-                            ByteArrayOutputStream os = new ByteArrayOutputStream();
-                            me.x.initSecContext(new ByteArrayInputStream(input), os);
-                            return os.size() == 0 ? null : os.toByteArray();
-                        } else {
-                            return me.x.initSecContext(input, 0, input.length);
-                        }
-                    }
-                }
-            }, t);
-
-            t = s.doAs(new Action() {
-                @Override
-                public byte[] run(Context me, byte[] input) throws Exception {
-                    if (me.x.isEstablished()) {
-                        me.f = true;
-                        System.out.println(s.name + " side established");
-                        if (input != null) {
-                            throw new Exception("Context established but " +
-                                    "still receive token at " + s.name);
-                        }
-                        return null;
-                    } else {
-                        System.out.println(s.name + " called acceptSecContext");
-                        if (usingStream) {
-                            ByteArrayOutputStream os = new ByteArrayOutputStream();
-                            me.x.acceptSecContext(new ByteArrayInputStream(input), os);
-                            return os.size() == 0 ? null : os.toByteArray();
-                        } else {
-                            return me.x.acceptSecContext(input, 0, input.length);
-                        }
-                    }
-                }
-            }, t);
+        while (!c.x.isEstablished() || !s.x.isEstablished()) {
+            t = c.take(t);
+            t = s.take(t);
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ReplayCache.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2012 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 7118809
+ * @run main/othervm ReplayCache
+ * @summary rcache deadlock
+ */
+
+import org.ietf.jgss.GSSException;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.KrbException;
+import sun.security.krb5.internal.Krb5;
+
+public class ReplayCache {
+
+    public static void main(String[] args)
+            throws Exception {
+
+        new OneKDC(null).writeJAASConf();
+
+        Context c, s;
+        c = Context.fromJAAS("client");
+        s = Context.fromJAAS("server");
+
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+        byte[] first = c.take(new byte[0]);
+        s.take(first);
+
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+        try {
+            s.take(first);  // Replay the last token sent
+            throw new Exception("This method should fail");
+        } catch (GSSException gsse) {
+            KrbException ke = (KrbException)gsse.getCause();
+            if (ke.returnCode() != Krb5.KRB_AP_ERR_REPEAT) {
+                throw gsse;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/ShortRSAKey1024.sh	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 7106773
+# @summary 512 bits RSA key cannot work with SHA384 and SHA512
+# @run shell ShortRSAKey1024.sh
+
+# set a few environment variables so that the shell-script can run stand-alone
+# in the source directory
+if [ "${TESTSRC}" = "" ] ; then
+   TESTSRC="."
+fi
+
+if [ "${TESTCLASSES}" = "" ] ; then
+   TESTCLASSES="."
+fi
+
+if [ "${TESTJAVA}" = "" ] ; then
+   echo "TESTJAVA not set.  Test cannot execute."
+   echo "FAILED!!!"
+   exit 1
+fi
+
+OS=`uname -s`
+case "$OS" in
+    Windows* | CYGWIN* )
+
+        echo "Creating a temporary RSA keypair in the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+            -genkeypair \
+            -storetype Windows-My \
+            -keyalg RSA \
+            -alias 7106773.1024 \
+            -keysize 1024 \
+            -dname "cn=localhost,c=US" \
+            -noprompt
+
+        echo
+        echo "Running the test..."
+        ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java
+        ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.1024 1024 \
+            TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+
+        rc=$?
+
+        echo
+        echo "Removing the temporary RSA keypair from the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+            -delete \
+            -storetype Windows-My \
+            -alias 7106773.1024
+
+        echo done.
+        exit $rc
+        ;;
+
+    * )
+        echo "This test is not intended for '$OS' - passing test"
+        exit 0
+        ;;
+esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/ShortRSAKey512.sh	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 7106773
+# @summary 512 bits RSA key cannot work with SHA384 and SHA512
+# @run shell ShortRSAKey512.sh
+
+# set a few environment variables so that the shell-script can run stand-alone
+# in the source directory
+if [ "${TESTSRC}" = "" ] ; then
+   TESTSRC="."
+fi
+
+if [ "${TESTCLASSES}" = "" ] ; then
+   TESTCLASSES="."
+fi
+
+if [ "${TESTJAVA}" = "" ] ; then
+   echo "TESTJAVA not set.  Test cannot execute."
+   echo "FAILED!!!"
+   exit 1
+fi
+
+OS=`uname -s`
+case "$OS" in
+    Windows* | CYGWIN* )
+
+        echo "Creating a temporary RSA keypair in the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+            -genkeypair \
+            -storetype Windows-My \
+            -keyalg RSA \
+            -alias 7106773.512 \
+            -keysize 512 \
+            -dname "cn=localhost,c=US" \
+            -noprompt
+
+        echo
+        echo "Running the test..."
+        ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java
+        ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.512 512 \
+            TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+
+
+        rc=$?
+
+        echo
+        echo "Removing the temporary RSA keypair from the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+            -delete \
+            -storetype Windows-My \
+            -alias 7106773.512
+
+        echo done.
+        exit $rc
+        ;;
+
+    * )
+        echo "This test is not intended for '$OS' - passing test"
+        exit 0
+        ;;
+esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/ShortRSAKey768.sh	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+
+# @test
+# @bug 7106773
+# @summary 512 bits RSA key cannot work with SHA384 and SHA512
+# @run shell ShortRSAKey768.sh
+
+# set a few environment variables so that the shell-script can run stand-alone
+# in the source directory
+if [ "${TESTSRC}" = "" ] ; then
+   TESTSRC="."
+fi
+
+if [ "${TESTCLASSES}" = "" ] ; then
+   TESTCLASSES="."
+fi
+
+if [ "${TESTJAVA}" = "" ] ; then
+   echo "TESTJAVA not set.  Test cannot execute."
+   echo "FAILED!!!"
+   exit 1
+fi
+
+OS=`uname -s`
+case "$OS" in
+    Windows* | CYGWIN* )
+
+        echo "Creating a temporary RSA keypair in the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+            -genkeypair \
+            -storetype Windows-My \
+            -keyalg RSA \
+            -alias 7106773.768 \
+            -keysize 768 \
+            -dname "cn=localhost,c=US" \
+            -noprompt
+
+        echo
+        echo "Running the test..."
+        ${TESTJAVA}/bin/javac -d . ${TESTSRC}\\ShortRSAKeyWithinTLS.java
+        ${TESTJAVA}/bin/java ShortRSAKeyWithinTLS 7106773.768 768 \
+            TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+
+        rc=$?
+
+        echo
+        echo "Removing the temporary RSA keypair from the Windows-My store..."
+        ${TESTJAVA}/bin/keytool \
+            -delete \
+            -storetype Windows-My \
+            -alias 7106773.768
+
+        echo done.
+        exit $rc
+        ;;
+
+    * )
+        echo "This test is not intended for '$OS' - passing test"
+        exit 0
+        ;;
+esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/ShortRSAKeyWithinTLS.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,355 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.security.*;
+import javax.net.*;
+import javax.net.ssl.*;
+import java.lang.reflect.*;
+
+import sun.security.util.KeyLength;
+
+public class ShortRSAKeyWithinTLS {
+
+    /*
+     * =============================================================
+     * Set the various variables needed for the tests, then
+     * specify what tests to run on each side.
+     */
+
+    /*
+     * Should we run the client or server in a separate thread?
+     * Both sides can throw exceptions, but do you have a preference
+     * as to which side should be the main thread.
+     */
+    static boolean separateServerThread = false;
+
+    /*
+     * Is the server ready to serve?
+     */
+    volatile static boolean serverReady = false;
+
+    /*
+     * Turn on SSL debugging?
+     */
+    static boolean debug = false;
+
+    /*
+     * If the client or server is doing some kind of object creation
+     * that the other side depends on, and that thread prematurely
+     * exits, you may experience a hang.  The test harness will
+     * terminate all hung threads after its timeout has expired,
+     * currently 3 minutes by default, but you might try to be
+     * smart about it....
+     */
+
+    /*
+     * Define the server side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doServerSide() throws Exception {
+
+        // load the key store
+        KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
+        ks.load(null, null);
+        System.out.println("Loaded keystore: Windows-MY");
+
+        // check key size
+        checkKeySize(ks);
+
+        // initialize the SSLContext
+        KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+        kmf.init(ks, null);
+
+        TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+        tmf.init(ks);
+
+        SSLContext ctx = SSLContext.getInstance("TLS");
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        ServerSocketFactory ssf = ctx.getServerSocketFactory();
+        SSLServerSocket sslServerSocket = (SSLServerSocket)
+                                ssf.createServerSocket(serverPort);
+        sslServerSocket.setNeedClientAuth(true);
+        serverPort = sslServerSocket.getLocalPort();
+        System.out.println("serverPort = " + serverPort);
+
+        /*
+         * Signal Client, we're ready for his connect.
+         */
+        serverReady = true;
+
+        SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+        InputStream sslIS = sslSocket.getInputStream();
+        OutputStream sslOS = sslSocket.getOutputStream();
+
+        sslIS.read();
+        sslOS.write(85);
+        sslOS.flush();
+
+        sslSocket.close();
+    }
+
+    /*
+     * Define the client side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doClientSide() throws Exception {
+
+        /*
+         * Wait for server to get started.
+         */
+        while (!serverReady) {
+            Thread.sleep(50);
+        }
+
+        // load the key store
+        KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
+        ks.load(null, null);
+        System.out.println("Loaded keystore: Windows-MY");
+
+        // initialize the SSLContext
+        KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+        kmf.init(ks, null);
+
+        TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+        tmf.init(ks);
+
+        SSLContext ctx = SSLContext.getInstance("TLS");
+        ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        SSLSocketFactory sslsf = ctx.getSocketFactory();
+        SSLSocket sslSocket = (SSLSocket)
+            sslsf.createSocket("localhost", serverPort);
+
+        if (clientProtocol != null) {
+            sslSocket.setEnabledProtocols(new String[] {clientProtocol});
+        }
+
+        if (clientCiperSuite != null) {
+            sslSocket.setEnabledCipherSuites(new String[] {clientCiperSuite});
+        }
+
+        InputStream sslIS = sslSocket.getInputStream();
+        OutputStream sslOS = sslSocket.getOutputStream();
+
+        sslOS.write(280);
+        sslOS.flush();
+        sslIS.read();
+
+        sslSocket.close();
+    }
+
+    private void checkKeySize(KeyStore ks) throws Exception {
+        PrivateKey privateKey = null;
+        PublicKey publicKey = null;
+
+        if (ks.containsAlias(keyAlias)) {
+            System.out.println("Loaded entry: " + keyAlias);
+            privateKey = (PrivateKey)ks.getKey(keyAlias, null);
+            publicKey = (PublicKey)ks.getCertificate(keyAlias).getPublicKey();
+
+            int privateKeySize = KeyLength.getKeySize(privateKey);
+            if (privateKeySize != keySize) {
+                throw new Exception("Expected key size is " + keySize +
+                        ", but the private key size is " + privateKeySize);
+            }
+
+            int publicKeySize = KeyLength.getKeySize(publicKey);
+            if (publicKeySize != keySize) {
+                throw new Exception("Expected key size is " + keySize +
+                        ", but the public key size is " + publicKeySize);
+            }
+        }
+    }
+
+    /*
+     * =============================================================
+     * The remainder is just support stuff
+     */
+
+    // use any free port by default
+    volatile int serverPort = 0;
+
+    volatile Exception serverException = null;
+    volatile Exception clientException = null;
+
+    private static String keyAlias;
+    private static int keySize;
+    private static String clientProtocol = null;
+    private static String clientCiperSuite = null;
+
+    private static void parseArguments(String[] args) {
+        keyAlias = args[0];
+        keySize = Integer.parseInt(args[1]);
+
+        if (args.length > 2) {
+            clientProtocol = args[2];
+        }
+
+        if (args.length > 3) {
+            clientCiperSuite = args[3];
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (debug) {
+            System.setProperty("javax.net.debug", "all");
+        }
+
+        // Get the customized arguments.
+        parseArguments(args);
+
+        new ShortRSAKeyWithinTLS();
+    }
+
+    Thread clientThread = null;
+    Thread serverThread = null;
+
+    /*
+     * Primary constructor, used to drive remainder of the test.
+     *
+     * Fork off the other side, then do your work.
+     */
+    ShortRSAKeyWithinTLS() throws Exception {
+        try {
+            if (separateServerThread) {
+                startServer(true);
+                startClient(false);
+            } else {
+                startClient(true);
+                startServer(false);
+            }
+        } catch (Exception e) {
+            // swallow for now.  Show later
+        }
+
+        /*
+         * Wait for other side to close down.
+         */
+        if (separateServerThread) {
+            serverThread.join();
+        } else {
+            clientThread.join();
+        }
+
+        /*
+         * When we get here, the test is pretty much over.
+         * Which side threw the error?
+         */
+        Exception local;
+        Exception remote;
+        String whichRemote;
+
+        if (separateServerThread) {
+            remote = serverException;
+            local = clientException;
+            whichRemote = "server";
+        } else {
+            remote = clientException;
+            local = serverException;
+            whichRemote = "client";
+        }
+
+        /*
+         * If both failed, return the curthread's exception, but also
+         * print the remote side Exception
+         */
+        if ((local != null) && (remote != null)) {
+            System.out.println(whichRemote + " also threw:");
+            remote.printStackTrace();
+            System.out.println();
+            throw local;
+        }
+
+        if (remote != null) {
+            throw remote;
+        }
+
+        if (local != null) {
+            throw local;
+        }
+    }
+
+    void startServer(boolean newThread) throws Exception {
+        if (newThread) {
+            serverThread = new Thread() {
+                public void run() {
+                    try {
+                        doServerSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our server thread just died.
+                         *
+                         * Release the client, if not active already...
+                         */
+                        System.err.println("Server died...");
+                        serverReady = true;
+                        serverException = e;
+                    }
+                }
+            };
+            serverThread.start();
+        } else {
+            try {
+                doServerSide();
+            } catch (Exception e) {
+                serverException = e;
+            } finally {
+                serverReady = true;
+            }
+        }
+    }
+
+    void startClient(boolean newThread) throws Exception {
+        if (newThread) {
+            clientThread = new Thread() {
+                public void run() {
+                    try {
+                        doClientSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our client thread just died.
+                         */
+                        System.err.println("Client died...");
+                        clientException = e;
+                    }
+                }
+            };
+            clientThread.start();
+        } else {
+            try {
+                doClientSide();
+            } catch (Exception e) {
+                clientException = e;
+            }
+        }
+    }
+}
+
--- a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,6 +155,14 @@
         SSLSocket sslSocket = (SSLSocket)
             sslsf.createSocket("localhost", serverPort);
 
+        if (clientProtocol != null) {
+            sslSocket.setEnabledProtocols(new String[] {clientProtocol});
+        }
+
+        if (clientCiperSuite != null) {
+            sslSocket.setEnabledCipherSuites(new String[] {clientCiperSuite});
+        }
+
         InputStream sslIS = sslSocket.getInputStream();
         OutputStream sslOS = sslSocket.getOutputStream();
 
@@ -176,7 +184,22 @@
     volatile Exception serverException = null;
     volatile Exception clientException = null;
 
+    private static String clientProtocol = null;
+    private static String clientCiperSuite = null;
+
+    private static void parseArguments(String[] args) {
+        if (args.length > 0) {
+            clientProtocol = args[0];
+        }
+
+        if (args.length > 1) {
+            clientCiperSuite = args[1];
+        }
+    }
+
     public static void main(String[] args) throws Exception {
+        // Get the customized arguments.
+        parseArguments(args);
         main(new ClientAuth());
     }
 
--- a/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/sun/security/pkcs11/KeyStore/ClientAuth.sh	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,9 @@
 #
 
 # @test
-# @bug 4938185
+# @bug 4938185 7106773
 # @summary KeyStore support for NSS cert/key databases
+#          512 bits RSA key cannot work with SHA384 and SHA512
 #
 # @run shell ClientAuth.sh
 
@@ -126,6 +127,7 @@
 	${TESTSRC}${FS}ClientAuth.java
 
 # run test
+echo "Run ClientAuth ..."
 ${TESTJAVA}${FS}bin${FS}java \
 	-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
 	-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
@@ -140,5 +142,26 @@
 # save error status
 status=$?
 
+# return if failed
+if [ "${status}" != "0" ] ; then
+    exit $status
+fi
+
+# run test with specified TLS protocol and cipher suite
+echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA"
+${TESTJAVA}${FS}bin${FS}java \
+	-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
+	-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
+	-DCUSTOM_DB_DIR=${TESTCLASSES} \
+	-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
+	-DNO_DEFAULT=true \
+	-DNO_DEIMOS=true \
+	-Dtest.src=${TESTSRC} \
+	-Dtest.classes=${TESTCLASSES} \
+	ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+
+# save error status
+status=$?
+
 # return
 exit $status
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 6414899
+ * @summary Ensure the cloning functionality works.
+ * @author Valerie Peng
+ * @library ..
+ */
+
+import java.util.*;
+
+import java.security.*;
+
+public class TestCloning extends PKCS11Test {
+
+    private static final String[] ALGOS = {
+        "MD2", "MD5", "SHA1", "SHA-256", "SHA-384", "SHA-512"
+    };
+
+    public static void main(String[] args) throws Exception {
+        main(new TestCloning());
+    }
+
+    private static final byte[] data1 = new byte[10];
+    private static final byte[] data2 = new byte[10*1024];
+
+
+    public void main(Provider p) throws Exception {
+        Random r = new Random();
+        byte[] data1 = new byte[10];
+        byte[] data2 = new byte[2*1024];
+        r.nextBytes(data1);
+        r.nextBytes(data2);
+        System.out.println("Testing against provider " + p.getName());
+        for (int i = 0; i < ALGOS.length; i++) {
+            if (p.getService("MessageDigest", ALGOS[i]) == null) {
+                System.out.println(ALGOS[i] + " is not supported, skipping");
+                continue;
+            } else {
+                System.out.println("Testing " + ALGOS[i] + " of " + p.getName());
+                MessageDigest md = MessageDigest.getInstance(ALGOS[i], p);
+                try {
+                    md = testCloning(md, p);
+                    // repeat the test again after generating digest once
+                    for (int j = 0; j < 10; j++) {
+                        md = testCloning(md, p);
+                    }
+                } catch (Exception ex) {
+                    if (ALGOS[i] == "MD2" &&
+                        p.getName().equalsIgnoreCase("SunPKCS11-NSS")) {
+                        // known bug in NSS; ignore for now
+                        System.out.println("Ignore Known bug in MD2 of NSS");
+                        continue;
+                    }
+                    throw ex;
+                }
+            }
+        }
+    }
+
+    private static MessageDigest testCloning(MessageDigest mdObj, Provider p)
+        throws Exception {
+
+        // copy#0: clone at state BLANK w/o any data
+        MessageDigest mdCopy0 = (MessageDigest) mdObj.clone();
+
+        // copy#1: clone again at state BUFFERED w/ very short data
+        mdObj.update(data1);
+        mdCopy0.update(data1);
+        MessageDigest mdCopy1 = (MessageDigest) mdObj.clone();
+
+        // copy#2: clone again after updating it w/ long data to trigger
+        // the state into INIT
+        mdObj.update(data2);
+        mdCopy0.update(data2);
+        mdCopy1.update(data2);
+        MessageDigest mdCopy2 = (MessageDigest) mdObj.clone();
+
+        // copy#3: clone again after updating it w/ very short data
+        mdObj.update(data1);
+        mdCopy0.update(data1);
+        mdCopy1.update(data1);
+        mdCopy2.update(data1);
+        MessageDigest mdCopy3 = (MessageDigest) mdObj.clone();
+
+        // copy#4: clone again after updating it w/ long data
+        mdObj.update(data2);
+        mdCopy0.update(data2);
+        mdCopy1.update(data2);
+        mdCopy2.update(data2);
+        mdCopy3.update(data2);
+        MessageDigest mdCopy4 = (MessageDigest) mdObj.clone();
+
+        // check digest equalities
+        byte[] answer = mdObj.digest();
+        byte[] result0 = mdCopy0.digest();
+        byte[] result1 = mdCopy1.digest();
+        byte[] result2 = mdCopy2.digest();
+        byte[] result3 = mdCopy3.digest();
+        byte[] result4 = mdCopy4.digest();
+
+
+        check(answer, result0, "copy0");
+        check(answer, result1, "copy1");
+        check(answer, result2, "copy2");
+        check(answer, result3, "copy3");
+        check(answer, result4, "copy4");
+
+        return mdCopy3;
+    }
+
+    private static void check(byte[] d1, byte[] d2, String copyName)
+            throws Exception {
+        if (Arrays.equals(d1, d2) == false) {
+            throw new RuntimeException(copyName + " digest mismatch!");
+        }
+    }
+}
+
--- a/jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,7 +91,7 @@
             ciphers = parameters.getCipherSuites();
 
             if (protocols.length == 0 || ciphers.length == 0) {
-                throw new Exception("No default protocols or cipher suites");
+                throw new Exception("No supported protocols or cipher suites");
             }
 
             isMatch = false;
@@ -104,7 +104,7 @@
             }
 
             if (!isMatch) {
-                throw new Exception("No matched default protocol");
+                throw new Exception("No matched supported protocol");
             }
             System.out.println("\t... Success");
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/javax/net/ssl/TLSv12/ShortRSAKey512.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 7106773
+ * @summary 512 bits RSA key cannot work with SHA384 and SHA512
+ *
+ *     SunJSSE does not support dynamic system properties, no way to re-use
+ *     system properties in samevm/agentvm mode.
+ * @run main/othervm ShortRSAKey512 PKIX
+ * @run main/othervm ShortRSAKey512 SunX509
+ */
+
+import java.net.*;
+import java.util.*;
+import java.io.*;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import sun.misc.BASE64Decoder;
+
+
+public class ShortRSAKey512 {
+
+    /*
+     * =============================================================
+     * Set the various variables needed for the tests, then
+     * specify what tests to run on each side.
+     */
+
+    /*
+     * Should we run the client or server in a separate thread?
+     * Both sides can throw exceptions, but do you have a preference
+     * as to which side should be the main thread.
+     */
+    static boolean separateServerThread = false;
+
+    /*
+     * Where do we find the keystores?
+     */
+    // Certificates and key used in the test.
+    static String trustedCertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIICkjCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" +
+        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" +
+        "MTEwODE5MDE1MjE5WhcNMzIwNzI5MDE1MjE5WjA7MQswCQYDVQQGEwJVUzENMAsG\n" +
+        "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwgZ8wDQYJ\n" +
+        "KoZIhvcNAQEBBQADgY0AMIGJAoGBAM8orG08DtF98TMSscjGsidd1ZoN4jiDpi8U\n" +
+        "ICz+9dMm1qM1d7O2T+KH3/mxyox7Rc2ZVSCaUD0a3CkhPMnlAx8V4u0H+E9sqso6\n" +
+        "iDW3JpOyzMExvZiRgRG/3nvp55RMIUV4vEHOZ1QbhuqG4ebN0Vz2DkRft7+flthf\n" +
+        "vDld6f5JAgMBAAGjgaUwgaIwHQYDVR0OBBYEFLl81dnfp0wDrv0OJ1sxlWzH83Xh\n" +
+        "MGMGA1UdIwRcMFqAFLl81dnfp0wDrv0OJ1sxlWzH83XhoT+kPTA7MQswCQYDVQQG\n" +
+        "EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" +
+        "Y2WCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEE\n" +
+        "BQADgYEALlgaH1gWtoBZ84EW8Hu6YtGLQ/L9zIFmHonUPZwn3Pr//icR9Sqhc3/l\n" +
+        "pVTxOINuFHLRz4BBtEylzRIOPzK3tg8XwuLb1zd0db90x3KBCiAL6E6cklGEPwLe\n" +
+        "XYMHDn9eDsaq861Tzn6ZwzMgw04zotPMoZN0mVd/3Qca8UJFucE=\n" +
+        "-----END CERTIFICATE-----";
+
+    static String targetCertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIICNDCCAZ2gAwIBAgIBDDANBgkqhkiG9w0BAQQFADA7MQswCQYDVQQGEwJVUzEN\n" +
+        "MAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UwHhcN\n" +
+        "MTExMTA3MTM1NTUyWhcNMzEwNzI1MTM1NTUyWjBPMQswCQYDVQQGEwJVUzENMAsG\n" +
+        "A1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2UxEjAQBgNV\n" +
+        "BAMTCWxvY2FsaG9zdDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3Pb49OSPfOD2G\n" +
+        "HSXFCFx1GJEZfqG9ZUf7xuIi/ra5dLjPGAaoY5QF2QOa8VnOriQCXDfyXHxsuRnE\n" +
+        "OomxL7EVAgMBAAGjeDB2MAsGA1UdDwQEAwID6DAdBgNVHQ4EFgQUXNCJK3/dtCIc\n" +
+        "xb+zlA/JINlvs/MwHwYDVR0jBBgwFoAUuXzV2d+nTAOu/Q4nWzGVbMfzdeEwJwYD\n" +
+        "VR0lBCAwHgYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDAzANBgkqhkiG9w0B\n" +
+        "AQQFAAOBgQB2qIDUxA2caMPpGtUACZAPRUtrGssCINIfItETXJZCx/cRuZ5sP4D9\n" +
+        "N1acoNDn0hCULe3lhXAeTC9NZ97680yJzregQMV5wATjo1FGsKY30Ma+sc/nfzQW\n" +
+        "+h/7RhYtoG0OTsiaDCvyhI6swkNJzSzrAccPY4+ZgU8HiDLzZTmM3Q==\n" +
+        "-----END CERTIFICATE-----";
+
+    // Private key in the format of PKCS#8, key size is 512 bits.
+    static String targetPrivateKey =
+        "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAtz2+PTkj3zg9hh0l\n" +
+        "xQhcdRiRGX6hvWVH+8biIv62uXS4zxgGqGOUBdkDmvFZzq4kAlw38lx8bLkZxDqJ\n" +
+        "sS+xFQIDAQABAkByx/5Oo2hQ/w2q4L8z+NTRlJ3vdl8iIDtC/4XPnfYfnGptnpG6\n" +
+        "ZThQRvbMZiai0xHQPQMszvAHjZVme1eDl3EBAiEA3aKJHynPVCEJhpfCLWuMwX5J\n" +
+        "1LntwJO7NTOyU5m8rPECIQDTpzn5X44r2rzWBDna/Sx7HW9IWCxNgUD2Eyi2nA7W\n" +
+        "ZQIgJerEorw4aCAuzQPxiGu57PB6GRamAihEAtoRTBQlH0ECIQDN08FgTtnesgCU\n" +
+        "DFYLLcw1CiHvc7fZw4neBDHCrC8NtQIgA8TOUkGnpCZlQ0KaI8KfKWI+vxFcgFnH\n" +
+        "3fnqsTgaUs4=";
+
+    static char passphrase[] = "passphrase".toCharArray();
+
+    /*
+     * Is the server ready to serve?
+     */
+    volatile static boolean serverReady = false;
+
+    /*
+     * Turn on SSL debugging?
+     */
+    static boolean debug = false;
+
+    /*
+     * Define the server side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doServerSide() throws Exception {
+        SSLContext context = generateSSLContext(null, targetCertStr,
+                                            targetPrivateKey);
+        SSLServerSocketFactory sslssf = context.getServerSocketFactory();
+        SSLServerSocket sslServerSocket =
+            (SSLServerSocket)sslssf.createServerSocket(serverPort);
+        serverPort = sslServerSocket.getLocalPort();
+
+        /*
+         * Signal Client, we're ready for his connect.
+         */
+        serverReady = true;
+
+        SSLSocket sslSocket = (SSLSocket)sslServerSocket.accept();
+        InputStream sslIS = sslSocket.getInputStream();
+        OutputStream sslOS = sslSocket.getOutputStream();
+
+        sslIS.read();
+        sslOS.write('A');
+        sslOS.flush();
+
+        sslSocket.close();
+    }
+
+    /*
+     * Define the client side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doClientSide() throws Exception {
+
+        /*
+         * Wait for server to get started.
+         */
+        while (!serverReady) {
+            Thread.sleep(50);
+        }
+
+        SSLContext context = generateSSLContext(trustedCertStr, null, null);
+        SSLSocketFactory sslsf = context.getSocketFactory();
+
+        SSLSocket sslSocket =
+            (SSLSocket)sslsf.createSocket("localhost", serverPort);
+
+        // enable TLSv1.2 only
+        sslSocket.setEnabledProtocols(new String[] {"TLSv1.2"});
+
+        // enable a block cipher
+        sslSocket.setEnabledCipherSuites(
+            new String[] {"TLS_DHE_RSA_WITH_AES_128_CBC_SHA"});
+
+        InputStream sslIS = sslSocket.getInputStream();
+        OutputStream sslOS = sslSocket.getOutputStream();
+
+        sslOS.write('B');
+        sslOS.flush();
+        sslIS.read();
+
+        sslSocket.close();
+    }
+
+    /*
+     * =============================================================
+     * The remainder is just support stuff
+     */
+    private static String tmAlgorithm;        // trust manager
+
+    private static void parseArguments(String[] args) {
+        tmAlgorithm = args[0];
+    }
+
+    private static SSLContext generateSSLContext(String trustedCertStr,
+            String keyCertStr, String keySpecStr) throws Exception {
+
+        // generate certificate from cert string
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+        // create a key store
+        KeyStore ks = KeyStore.getInstance("JKS");
+        ks.load(null, null);
+
+        // import the trused cert
+        Certificate trusedCert = null;
+        ByteArrayInputStream is = null;
+        if (trustedCertStr != null) {
+            is = new ByteArrayInputStream(trustedCertStr.getBytes());
+            trusedCert = cf.generateCertificate(is);
+            is.close();
+
+            ks.setCertificateEntry("RSA Export Signer", trusedCert);
+        }
+
+        if (keyCertStr != null) {
+            // generate the private key.
+            PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec(
+                                new BASE64Decoder().decodeBuffer(keySpecStr));
+            KeyFactory kf = KeyFactory.getInstance("RSA");
+            RSAPrivateKey priKey =
+                    (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+            // generate certificate chain
+            is = new ByteArrayInputStream(keyCertStr.getBytes());
+            Certificate keyCert = cf.generateCertificate(is);
+            is.close();
+
+            Certificate[] chain = null;
+            if (trusedCert != null) {
+                chain = new Certificate[2];
+                chain[0] = keyCert;
+                chain[1] = trusedCert;
+            } else {
+                chain = new Certificate[1];
+                chain[0] = keyCert;
+            }
+
+            // import the key entry.
+            ks.setKeyEntry("Whatever", priKey, passphrase, chain);
+        }
+
+        // create SSL context
+        TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlgorithm);
+        tmf.init(ks);
+
+        SSLContext ctx = SSLContext.getInstance("TLS");
+        if (keyCertStr != null && !keyCertStr.isEmpty()) {
+            KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
+            kmf.init(ks, passphrase);
+
+            ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+            ks = null;
+        } else {
+            ctx.init(null, tmf.getTrustManagers(), null);
+        }
+
+        return ctx;
+    }
+
+
+    // use any free port by default
+    volatile int serverPort = 0;
+
+    volatile Exception serverException = null;
+    volatile Exception clientException = null;
+
+    public static void main(String[] args) throws Exception {
+        if (debug)
+            System.setProperty("javax.net.debug", "all");
+
+        /*
+         * Get the customized arguments.
+         */
+        parseArguments(args);
+
+        /*
+         * Start the tests.
+         */
+        new ShortRSAKey512();
+    }
+
+    Thread clientThread = null;
+    Thread serverThread = null;
+
+    /*
+     * Primary constructor, used to drive remainder of the test.
+     *
+     * Fork off the other side, then do your work.
+     */
+    ShortRSAKey512() throws Exception {
+        try {
+            if (separateServerThread) {
+                startServer(true);
+                startClient(false);
+            } else {
+                startClient(true);
+                startServer(false);
+            }
+        } catch (Exception e) {
+            // swallow for now.  Show later
+        }
+
+        /*
+         * Wait for other side to close down.
+         */
+        if (separateServerThread) {
+            serverThread.join();
+        } else {
+            clientThread.join();
+        }
+
+        /*
+         * When we get here, the test is pretty much over.
+         * Which side threw the error?
+         */
+        Exception local;
+        Exception remote;
+        String whichRemote;
+
+        if (separateServerThread) {
+            remote = serverException;
+            local = clientException;
+            whichRemote = "server";
+        } else {
+            remote = clientException;
+            local = serverException;
+            whichRemote = "client";
+        }
+
+        /*
+         * If both failed, return the curthread's exception, but also
+         * print the remote side Exception
+         */
+        if ((local != null) && (remote != null)) {
+            System.out.println(whichRemote + " also threw:");
+            remote.printStackTrace();
+            System.out.println();
+            throw local;
+        }
+
+        if (remote != null) {
+            throw remote;
+        }
+
+        if (local != null) {
+            throw local;
+        }
+    }
+
+    void startServer(boolean newThread) throws Exception {
+        if (newThread) {
+            serverThread = new Thread() {
+                public void run() {
+                    try {
+                        doServerSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our server thread just died.
+                         *
+                         * Release the client, if not active already...
+                         */
+                        System.err.println("Server died...");
+                        serverReady = true;
+                        serverException = e;
+                    }
+                }
+            };
+            serverThread.start();
+        } else {
+            try {
+                doServerSide();
+            } catch (Exception e) {
+                serverException = e;
+            } finally {
+                serverReady = true;
+            }
+        }
+    }
+
+    void startClient(boolean newThread) throws Exception {
+        if (newThread) {
+            clientThread = new Thread() {
+                public void run() {
+                    try {
+                        doClientSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our client thread just died.
+                         */
+                        System.err.println("Client died...");
+                        clientException = e;
+                    }
+                }
+            };
+            clientThread.start();
+        } else {
+            try {
+                doClientSide();
+            } catch (Exception e) {
+                clientException = e;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/CookieHttpsClientTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7129083
+ * @summary Cookiemanager does not store cookies if url is read
+ *          before setting cookiemanager
+ */
+
+import java.net.CookieHandler;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+import java.net.URL;
+import java.io.InputStream;
+import java.io.IOException;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocket;
+
+public class CookieHttpsClientTest {
+    static final int TIMEOUT = 10 * 1000;
+
+    static final String replyString = "HTTP/1.1 200 OK\r\n" +
+            "Set-Cookie: name=test\r\n" +
+            "Content-Length: 10\r\n\r\n" +
+            "1234567890";
+
+    /*
+     * =============================================================
+     * Set the various variables needed for the tests, then
+     * specify what tests to run on each side.
+     */
+
+    /*
+     * Should we run the client or server in a separate thread?
+     * Both sides can throw exceptions, but do you have a preference
+     * as to which side should be the main thread.
+     */
+    static boolean separateServerThread = true;
+
+    /*
+     * Where do we find the keystores?
+     */
+    static String pathToStores = "../../../../../../etc";
+    static String keyStoreFile = "keystore";
+    static String trustStoreFile = "truststore";
+    static String passwd = "passphrase";
+
+    /*
+     * Is the server ready to serve?
+     */
+    volatile static boolean serverReady = false;
+
+    /*
+     * Turn on SSL debugging?
+     */
+    static boolean debug = false;
+
+    /*
+     * Define the server side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doServerSide() throws Exception {
+        SSLServerSocketFactory sslssf =
+            (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
+        SSLServerSocket sslServerSocket =
+            (SSLServerSocket) sslssf.createServerSocket(serverPort);
+        serverPort = sslServerSocket.getLocalPort();
+
+        /*
+         * Signal Client, we're ready for his connect.
+         */
+        serverReady = true;
+        SSLSocket sslSocket = null;
+        try {
+            sslSocket = (SSLSocket) sslServerSocket.accept();
+            sslSocket.setSoTimeout(TIMEOUT);
+            readOneRequest(sslSocket.getInputStream());
+            sslSocket.getOutputStream().write(replyString.getBytes());
+
+            readOneRequest(sslSocket.getInputStream());
+            sslSocket.getOutputStream().write(replyString.getBytes());
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (sslSocket != null) { sslSocket.close(); }
+                sslServerSocket.close();
+            } catch (IOException unused)  {  /* gulp!burp! */   }
+        }
+    }
+
+    /*
+     * Define the client side of the test.
+     *
+     * If the server prematurely exits, serverReady will be set to true
+     * to avoid infinite hangs.
+     */
+    void doClientSide() throws Exception {
+        // Wait for server to get started.
+        while (!serverReady) {
+            Thread.sleep(50);
+        }
+
+        HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
+            public boolean verify(String hostname, SSLSession session) {
+                return true;
+            }});
+
+        URL url = new URL("https://localhost:" + serverPort +"/");
+
+        // Run without a CookieHandler first
+        InputStream in = url.openConnection().getInputStream();
+        while (in.read() != -1);  // read response body so connection can be reused
+
+        // Set a CookeHandler and retest using the HttpClient from the KAC
+        CookieManager manager = new CookieManager(null, CookiePolicy.ACCEPT_ALL);
+        CookieHandler.setDefault(manager);
+
+        in = url.openConnection().getInputStream();
+        while (in.read() != -1);
+
+        if (manager.getCookieStore().getCookies().isEmpty()) {
+            throw new RuntimeException("Failed: No cookies in the cookie Handler.");
+        }
+    }
+
+    static final byte[] requestEnd = new byte[] {'\r', '\n', '\r', '\n' };
+
+    // Read until the end of a HTTP request
+    static void readOneRequest(InputStream is) throws IOException {
+        int requestEndCount = 0, r;
+        while ((r = is.read()) != -1) {
+            if (r == requestEnd[requestEndCount]) {
+                requestEndCount++;
+                if (requestEndCount == 4) {
+                    break;
+                }
+            } else {
+                requestEndCount = 0;
+            }
+        }
+    }
+
+    /*
+     * =============================================================
+     * The remainder is just support stuff
+     */
+
+    // use any free port by default
+    volatile int serverPort = 0;
+
+    volatile Exception serverException = null;
+    volatile Exception clientException = null;
+
+    public static void main(String args[]) throws Exception {
+        String keyFilename =
+            System.getProperty("test.src", "./") + "/" + pathToStores +
+                "/" + keyStoreFile;
+        String trustFilename =
+            System.getProperty("test.src", "./") + "/" + pathToStores +
+                "/" + trustStoreFile;
+
+        System.setProperty("javax.net.ssl.keyStore", keyFilename);
+        System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+        System.setProperty("javax.net.ssl.trustStore", trustFilename);
+        System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+        if (debug)
+            System.setProperty("javax.net.debug", "all");
+
+        new CookieHttpsClientTest();
+    }
+
+    Thread clientThread = null;
+    Thread serverThread = null;
+    /*
+     * Primary constructor, used to drive remainder of the test.
+     *
+     * Fork off the other side, then do your work.
+     */
+    CookieHttpsClientTest() throws Exception {
+        if (separateServerThread) {
+            startServer(true);
+            startClient(false);
+        } else {
+            startClient(true);
+            startServer(false);
+        }
+
+        /*
+         * Wait for other side to close down.
+         */
+        if (separateServerThread) {
+            serverThread.join();
+        } else {
+            clientThread.join();
+        }
+
+        /*
+         * When we get here, the test is pretty much over.
+         *
+         * If the main thread excepted, that propagates back
+         * immediately.  If the other thread threw an exception, we
+         * should report back.
+         */
+        if (serverException != null)
+            throw serverException;
+        if (clientException != null)
+            throw clientException;
+    }
+
+    void startServer(boolean newThread) throws Exception {
+        if (newThread) {
+            serverThread = new Thread() {
+                public void run() {
+                    try {
+                        doServerSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our server thread just died.
+                         *
+                         * Release the client, if not active already...
+                         */
+                        System.err.println("Server died...");
+                        serverReady = true;
+                        serverException = e;
+                    }
+                }
+            };
+            serverThread.start();
+        } else {
+            doServerSide();
+        }
+    }
+
+    void startClient(boolean newThread) throws Exception {
+        if (newThread) {
+            clientThread = new Thread() {
+                public void run() {
+                    try {
+                        doClientSide();
+                    } catch (Exception e) {
+                        /*
+                         * Our client thread just died.
+                         */
+                        System.err.println("Client died...");
+                        clientException = e;
+                   }
+                }
+            };
+            clientThread.start();
+        } else {
+            doClientSide();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/I18NJarTest.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7125442
+ * @summary ensures a jar path as well as a class located in a path containing
+ *          unicode characters are launched.
+ * @compile -XDignore.symbol.file I18NJarTest.java TestHelper.java
+ * @run main/othervm I18NJarTest
+ */
+import java.io.File;
+import java.util.Locale;
+
+/*
+ * Note 1: the system must have the correct Locale, in order for the test to
+ * work correctly, on those systems that do not comply, the test will succeed.
+ * Here are some guidelines to set the locale correctly.
+ * On Windows: ControlPanel->Regional Settings,
+ *             ensure that "Japanese" is selected and checked, and in
+ *             "Code page conversion tables", the following must be checked,
+ *             932 (ANSI/OEM - Japanese Shift-JIS).
+ * On Unix: use "locale -a" verify one of these exist ja_JP.UTF-8 or
+ *          ja_JP.utf8 or ja_JP.ujis, and export one of them with LC_ALL.
+ *
+ *
+ * Note 2: since we need to set the locale, it is safest to execute this test
+ * in its own VM (othervm mode), such that the ensuing tests can run unperturbed,
+ * regardless of the outcome.
+ */
+public class I18NJarTest {
+    private static final File cwd = new File(".");
+    private static final File dir = new File("\uFF66\uFF67\uFF68\uFF69");
+    private static final String encoding = System.getProperty("sun.jnu.encoding", "");
+
+    public static void main(String... args) throws Exception {
+        boolean localeAvailable = false;
+        for (Locale l : Locale.getAvailableLocales()) {
+            if (l.toLanguageTag().equals(Locale.JAPAN.toLanguageTag())) {
+                localeAvailable = true;
+                break;
+            }
+        }
+        if (!localeAvailable) {
+            System.out.println("Warning: locale: " + Locale.JAPAN
+                    + " not found, test passes vacuosly");
+            return;
+        }
+        if (encoding.equals("MS932") || encoding.equals("UTF-8")) {
+            Locale.setDefault(Locale.JAPAN);
+            System.out.println("using locale " + Locale.JAPAN +
+                    ", encoding " + encoding);
+        } else {
+            System.out.println("Warning: current encoding is " + encoding +
+                    "this test requires MS932 <Ja> or UTF-8," +
+                    " test passes vacuosly");
+            return;
+        }
+        dir.mkdir();
+        File dirfile = new File(dir, "foo.jar");
+        TestHelper.createJar(dirfile,
+                "public static void main(String... args) {",
+                "System.out.println(\"Hello World\");",
+                "System.exit(0);",
+                "}");
+
+        // remove the class files, to ensure that the class is indeed picked up
+        // from the jar file and not from ambient classpath.
+        File[] classFiles = cwd.listFiles(TestHelper.createFilter(TestHelper.CLASS_FILE_EXT));
+        for (File f : classFiles) {
+            f.delete();
+        }
+
+        // test with a jar file
+        TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javaCmd,
+                "-jar", dirfile.getAbsolutePath());
+        System.out.println(tr);
+        if (!tr.isOK()) {
+            throw new RuntimeException("TEST FAILED");
+        }
+
+        // test the same class but by specifying it as a classpath
+        tr = TestHelper.doExec(TestHelper.javaCmd, "-cp",
+                dirfile.getAbsolutePath(), "Foo");
+        System.out.println(tr);
+        if (!tr.isOK()) {
+            throw new RuntimeException("TEST FAILED");
+        }
+    }
+}
--- a/jdk/test/tools/launcher/TestHelper.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/jdk/test/tools/launcher/TestHelper.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,23 +21,24 @@
  * questions.
  */
 
-import java.nio.file.attribute.BasicFileAttributes;
-import java.nio.file.FileVisitResult;
-import java.nio.file.SimpleFileVisitor;
-import javax.tools.ToolProvider;
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.nio.file.Files;
+import java.nio.file.FileVisitResult;
+import java.nio.file.SimpleFileVisitor;
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
 
 import static java.nio.file.StandardCopyOption.*;
 
@@ -68,6 +69,10 @@
     static final boolean isDualMode = isSolaris;
     static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc");
 
+    static final String JAVA_FILE_EXT  = ".java";
+    static final String CLASS_FILE_EXT = ".class";
+    static final String JAR_FILE_EXT   = ".jar";
+
     static int testExitValue = 0;
 
     static {
@@ -303,6 +308,19 @@
         }
     }
 
+    static FileFilter createFilter(final String extension) {
+        return new FileFilter() {
+            @Override
+            public boolean accept(File pathname) {
+                String name = pathname.getName();
+                if (name.endsWith(extension)) {
+                    return true;
+                }
+                return false;
+            }
+        };
+    }
+
     /*
      * A class to encapsulate the test results and stuff, with some ease
      * of use methods to check the test results.
--- a/langtools/.hgtags	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/.hgtags	Thu Jan 26 19:39:08 2012 -0800
@@ -143,3 +143,4 @@
 77b2c066084cbc75150efc6603a713c558329813 jdk8-b19
 ffd294128a48cbb90ce8f0569f82b61f1f164a18 jdk8-b20
 bcb21abf1c4177baf4574f99709513dcd4474727 jdk8-b21
+390a7828ae18324030c0546b6452d51093ffa451 jdk8-b22
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3600,39 +3600,44 @@
 
         @Override
         public Type visitCapturedType(CapturedType t, Void s) {
-            Type bound = visitWildcardType(t.wildcard, null);
-            return (bound.contains(t)) ?
-                    erasure(bound) :
-                    bound;
+            Type w_bound = t.wildcard.type;
+            Type bound = w_bound.contains(t) ?
+                        erasure(w_bound) :
+                        visit(w_bound);
+            return rewriteAsWildcardType(visit(bound), t.wildcard.bound, t.wildcard.kind);
         }
 
         @Override
         public Type visitTypeVar(TypeVar t, Void s) {
             if (rewriteTypeVars) {
-                Type bound = high ?
-                    (t.bound.contains(t) ?
+                Type bound = t.bound.contains(t) ?
                         erasure(t.bound) :
-                        visit(t.bound)) :
-                    syms.botType;
-                return rewriteAsWildcardType(bound, t);
+                        visit(t.bound);
+                return rewriteAsWildcardType(bound, t, EXTENDS);
+            } else {
+                return t;
             }
-            else
-                return t;
         }
 
         @Override
         public Type visitWildcardType(WildcardType t, Void s) {
-            Type bound = high ? t.getExtendsBound() :
-                                t.getSuperBound();
-            if (bound == null)
-            bound = high ? syms.objectType : syms.botType;
-            return rewriteAsWildcardType(visit(bound), t.bound);
+            Type bound2 = visit(t.type);
+            return t.type == bound2 ? t : rewriteAsWildcardType(bound2, t.bound, t.kind);
         }
 
-        private Type rewriteAsWildcardType(Type bound, TypeVar formal) {
-            return high ?
-                makeExtendsWildcard(B(bound), formal) :
-                makeSuperWildcard(B(bound), formal);
+        private Type rewriteAsWildcardType(Type bound, TypeVar formal, BoundKind bk) {
+            switch (bk) {
+               case EXTENDS: return high ?
+                       makeExtendsWildcard(B(bound), formal) :
+                       makeExtendsWildcard(syms.objectType, formal);
+               case SUPER: return high ?
+                       makeSuperWildcard(syms.botType, formal) :
+                       makeSuperWildcard(B(bound), formal);
+               case UNBOUND: return makeExtendsWildcard(syms.objectType, formal);
+               default:
+                   Assert.error("Invalid bound kind " + bk);
+                   return null;
+            }
         }
 
         Type B(Type t) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -332,25 +332,29 @@
             //replace uninferred type-vars
             targs = types.subst(targs,
                     that.tvars,
-                    instaniateAsUninferredVars(undetvars, that.tvars));
+                    instantiateAsUninferredVars(undetvars, that.tvars));
         }
         return chk.checkType(warn.pos(), that.inst(targs, types), to);
     }
     //where
-    private List<Type> instaniateAsUninferredVars(List<Type> undetvars, List<Type> tvars) {
+    private List<Type> instantiateAsUninferredVars(List<Type> undetvars, List<Type> tvars) {
+        Assert.check(undetvars.length() == tvars.length());
         ListBuffer<Type> new_targs = ListBuffer.lb();
-        //step 1 - create syntethic captured vars
+        //step 1 - create synthetic captured vars
         for (Type t : undetvars) {
             UndetVar uv = (UndetVar)t;
             Type newArg = new CapturedType(t.tsym.name, t.tsym, uv.inst, syms.botType, null);
             new_targs = new_targs.append(newArg);
         }
         //step 2 - replace synthetic vars in their bounds
+        List<Type> formals = tvars;
         for (Type t : new_targs.toList()) {
             CapturedType ct = (CapturedType)t;
             ct.bound = types.subst(ct.bound, tvars, new_targs.toList());
-            WildcardType wt = new WildcardType(ct.bound, BoundKind.EXTENDS, syms.boundClass);
+            WildcardType wt = new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass);
+            wt.bound = (TypeVar)formals.head;
             ct.wildcard = wt;
+            formals = formals.tail;
         }
         return new_targs.toList();
     }
--- a/langtools/src/share/classes/javax/lang/model/element/Element.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/src/share/classes/javax/lang/model/element/Element.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,14 +214,13 @@
      * Returns the elements that are, loosely speaking, directly
      * enclosed by this element.
      *
-     * A class or interface is considered to enclose the fields,
-     * methods, constructors, and member types that it directly
-     * declares.  This includes any (implicit) default constructor and
-     * the implicit {@code values} and {@code valueOf} methods of an
-     * enum type.
+     * A {@linkplain TypeElement#getEnclosedElements class or
+     * interface} is considered to enclose the fields, methods,
+     * constructors, and member types that it directly declares.
      *
-     * A package encloses the top-level classes and interfaces within
-     * it, but is not considered to enclose subpackages.
+     * A {@linkplain PackageElement#getEnclosedElements package}
+     * encloses the top-level classes and interfaces within it, but is
+     * not considered to enclose subpackages.
      *
      * Other kinds of elements are not currently considered to enclose
      * any elements; however, that may change as this API or the
@@ -231,6 +230,8 @@
      * methods in {@link ElementFilter}.
      *
      * @return the enclosed elements, or an empty list if none
+     * @see PackageElement#getEnclosedElements
+     * @see TypeElement#getEnclosedElements
      * @see Elements#getAllMembers
      * @jls 8.8.9 Default Constructor
      * @jls 8.9 Enums
--- a/langtools/src/share/classes/javax/lang/model/element/PackageElement.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/src/share/classes/javax/lang/model/element/PackageElement.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package javax.lang.model.element;
 
+import java.util.List;
+
 /**
  * Represents a package program element.  Provides access to information
  * about the package and its members.
@@ -49,7 +51,7 @@
 
     /**
      * Returns the simple name of this package.  For an unnamed
-     * package, an empty name is returned
+     * package, an empty name is returned.
      *
      * @return the simple name of this package or an empty name if
      * this is an unnamed package
@@ -58,6 +60,18 @@
     Name getSimpleName();
 
     /**
+     * Returns the {@linkplain NestingKind#TOP_LEVEL top-level}
+     * classes and interfaces within this package.  Note that
+     * subpackages are <em>not</em> considered to be enclosed by a
+     * package.
+     *
+     * @return the top-level classes and interfaces within this
+     * package
+     */
+    @Override
+    List<? extends Element> getEnclosedElements();
+
+    /**
      * Returns {@code true} is this is an unnamed package and {@code
      * false} otherwise.
      *
--- a/langtools/src/share/classes/javax/lang/model/element/TypeElement.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/src/share/classes/javax/lang/model/element/TypeElement.java	Thu Jan 26 19:39:08 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,12 @@
  */
 public interface TypeElement extends Element, Parameterizable, QualifiedNameable {
     /**
-     * {@inheritDoc}
+     * Returns the fields, methods, constructors, and member types
+     * that are directly declared in this class or interface.
+     *
+     * This includes any (implicit) default constructor and
+     * the implicit {@code values} and {@code valueOf} methods of an
+     * enum type.
      *
      * <p> Note that as a particular instance of the {@linkplain
      * javax.lang.model.element general accuracy requirements} and the
@@ -75,6 +80,7 @@
      *
      * @return the enclosed elements in proper order, or an empty list if none
      */
+    @Override
     List<? extends Element> getEnclosedElements();
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100a.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100a.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100a.java
+ */
+
+class T7123100a {
+    <E extends Enum<E>> E m() {
+        return null;
+    }
+
+    <Z> void test() {
+        Z z = (Z)m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100a.out	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,4 @@
+T7123100a.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100b.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100b.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100b.java
+ */
+
+class T7123100b {
+    <Z> void test(Enum<?> e) {
+        Z z = (Z)e;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100b.out	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,4 @@
+T7123100b.java:10:18: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum<compiler.misc.type.captureof: 1, ?>, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100c.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100c.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100c.java
+ */
+
+class T7123100c {
+    <E> E m(E e) {
+        return null;
+    }
+
+    <Z> void test(Enum<?> e) {
+        Z z = (Z)m(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100c.out	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,4 @@
+T7123100c.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum<compiler.misc.type.captureof: 1, ?>, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100d.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7123100
+ * @summary javac fails with java.lang.StackOverflowError
+ * @compile/fail/ref=T7123100d.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100d.java
+ */
+
+class T7123100d {
+    <E extends Enum<E>> E m(Enum<E> e) {
+        return null;
+    }
+
+    <Z> void test(Enum<?> e) {
+        Z z = (Z)m(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7123100/T7123100d.out	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,4 @@
+T7123100d.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7126754/T7126754.java	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @author mcimadamore
+ * @bug     7005671
+ * @summary Generics compilation failure casting List<? extends Set...> to List<Set...>
+ * @compile/fail/ref=T7126754.out -Xlint:unchecked -Werror -XDrawDiagnostics T7126754.java
+ */
+
+import java.util.List;
+
+class T7126754 {
+    List<? extends List<? extends String>> c = null;
+    List<List<? extends String>> d = (List<List<? extends String>>)c;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/7126754/T7126754.out	Thu Jan 26 19:39:08 2012 -0800
@@ -0,0 +1,4 @@
+T7126754.java:13:68: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.util.List<compiler.misc.type.captureof: 1, ? extends java.util.List<? extends java.lang.String>>, java.util.List<java.util.List<? extends java.lang.String>>
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- a/langtools/test/tools/javac/diags/CheckExamples.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/test/tools/javac/diags/CheckExamples.java	Thu Jan 26 19:39:08 2012 -0800
@@ -23,10 +23,13 @@
 
 /*
  * @test
- * @bug 6968063
+ * @bug 6968063 7127924
  * @summary provide examples of code that generate diagnostics
  * @build Example CheckExamples
- * @run main CheckExamples
+ * @run main/othervm CheckExamples
+ */
+/*
+ *      See CR 7127924 for info on why othervm is used.
  */
 
 import java.io.*;
--- a/langtools/test/tools/javac/diags/MessageInfo.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/test/tools/javac/diags/MessageInfo.java	Thu Jan 26 19:39:08 2012 -0800
@@ -23,10 +23,13 @@
 
 /**
  * @test
- * @bug 7013272
+ * @bug 7013272 7127924
  * @summary Automatically generate info about how compiler resource keys are used
  * @build Example ArgTypeCompilerFactory MessageFile MessageInfo
- * @run main MessageInfo
+ * @run main/othervm MessageInfo
+ */
+/*
+ *      See CR 7127924 for info on why othervm is used.
  */
 
 import java.io.*;
--- a/langtools/test/tools/javac/diags/RunExamples.java	Thu Jan 26 12:15:24 2012 -0800
+++ b/langtools/test/tools/javac/diags/RunExamples.java	Thu Jan 26 19:39:08 2012 -0800
@@ -23,10 +23,13 @@
 
 /**
  * @test
- * @bug 6968063
+ * @bug 6968063 7127924
  * @summary provide examples of code that generate diagnostics
  * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples
- * @run main RunExamples
+ * @run main/othervm RunExamples
+ */
+/*
+ *      See CR 7127924 for info on why othervm is used.
  */
 
 import java.io.*;