Merge
authorlana
Fri, 15 Mar 2013 23:31:19 -0700
changeset 16483 443a7e5f9b91
parent 16482 cbc9c93df1fd (diff)
parent 16128 1ee796f45a7f (current diff)
child 16484 f24cb2927b7a
Merge
jdk/makefiles/CompileNativeLibraries.gmk
jdk/src/share/classes/java/util/logging/Logger.java
jdk/src/share/classes/sun/security/util/KeyLength.java
--- a/jdk/make/java/java/FILES_java.gmk	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/make/java/java/FILES_java.gmk	Fri Mar 15 23:31:19 2013 -0700
@@ -209,6 +209,7 @@
             sun/util/locale/provider/CalendarDataProviderImpl.java \
             sun/util/locale/provider/CalendarDataUtility.java \
             sun/util/locale/provider/CalendarNameProviderImpl.java \
+            sun/util/locale/provider/CalendarProviderImpl.java \
             sun/util/locale/provider/CollationRules.java \
             sun/util/locale/provider/CollatorProviderImpl.java \
             sun/util/locale/provider/CurrencyNameProviderImpl.java \
@@ -232,6 +233,7 @@
             sun/util/locale/provider/SPILocaleProviderAdapter.java \
             sun/util/locale/provider/TimeZoneNameProviderImpl.java \
             sun/util/locale/provider/TimeZoneNameUtility.java \
+	sun/util/spi/CalendarProvider.java \
     java/util/LocaleISOData.java \
         sun/util/cldr/CLDRLocaleProviderAdapter.java \
     java/util/MissingResourceException.java \
--- a/jdk/make/java/java/mapfile-vers	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/make/java/java/mapfile-vers	Fri Mar 15 23:31:19 2013 -0700
@@ -133,6 +133,7 @@
 		Java_java_lang_ClassLoader_00024NativeLibrary_find;
 		Java_java_lang_ClassLoader_00024NativeLibrary_load;
 		Java_java_lang_ClassLoader_00024NativeLibrary_unload;
+		Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib;
 		Java_java_lang_ClassLoader_getCaller; 
 		Java_java_lang_ClassLoader_registerNatives;
 		Java_java_lang_Compiler_registerNatives;
--- a/jdk/make/java/nio/Makefile	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/make/java/nio/Makefile	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -384,9 +384,7 @@
 ifeq ($(PLATFORM),windows)
   OTHER_LDLIBS += $(JVMLIB) ws2_32.lib \
      -libpath:$(LIBDIR) java.lib \
-     $(OBJDIR)/../../../../sun/java.net/net/$(OBJDIRNAME)/net.lib \
-     $(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/io_util.obj \
-     $(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/FileDescriptor_md.obj
+     $(OBJDIR)/../../../../sun/java.net/net/$(OBJDIRNAME)/net.lib
 endif
 ifeq ($(PLATFORM), linux)
 OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread $(LIBDL)
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -1959,8 +1959,6 @@
 				        -lsendfile -ljava -lnet -lc,\
 		LDFLAGS_SUFFIX_windows:=jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
 					$(JDK_OUTPUTDIR)/objs/libnet/net.lib \
-                                        $(JDK_OUTPUTDIR)/objs/libjava/io_util.obj \
-		                        $(JDK_OUTPUTDIR)/objs/libjava/FileDescriptor_md.obj \
 					advapi32.lib,\
 		LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread -framework CoreFoundation,\
 		LDFLAGS_SUFFIX:=,\
--- a/jdk/makefiles/CreateJars.gmk	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/CreateJars.gmk	Fri Mar 15 23:31:19 2013 -0700
@@ -213,28 +213,28 @@
 	org/relaxng/datatype \
 	sun/awt/HKSCS.class \
 	sun/awt/motif/X11GB2312.class \
-	sun/awt/motif/X11GB2312\$$Decoder.class \
-	sun/awt/motif/X11GB2312\$$Encoder.class \
+	sun/awt/motif/X11GB2312\$$$$Decoder.class \
+	sun/awt/motif/X11GB2312\$$$$Encoder.class \
 	sun/awt/motif/X11GBK.class \
-	sun/awt/motif/X11GBK\$$Encoder.class \
+	sun/awt/motif/X11GBK\$$$$Encoder.class \
 	sun/awt/motif/X11KSC5601.class \
-	sun/awt/motif/X11KSC5601\$$Decoder.class \
-	sun/awt/motif/X11KSC5601\$$Encoder.class \
+	sun/awt/motif/X11KSC5601\$$$$Decoder.class \
+	sun/awt/motif/X11KSC5601\$$$$Encoder.class \
 	sun/jvmstat \
 	sun/net/spi/nameservice/dns \
 	sun/nio/cs/ext \
 	sun/rmi/rmic \
 	sun/security/ec/ECDHKeyAgreement.class \
 	sun/security/ec/ECDSASignature.class \
-	sun/security/ec/ECDSASignature\$$Raw.class \
-	sun/security/ec/ECDSASignature\$$SHA1.class \
-	sun/security/ec/ECDSASignature\$$SHA224.class \
-	sun/security/ec/ECDSASignature\$$SHA256.class \
-	sun/security/ec/ECDSASignature\$$SHA384.class \
-	sun/security/ec/ECDSASignature\$$SHA512.class \
+	sun/security/ec/ECDSASignature\$$$$Raw.class \
+	sun/security/ec/ECDSASignature\$$$$SHA1.class \
+	sun/security/ec/ECDSASignature\$$$$SHA224.class \
+	sun/security/ec/ECDSASignature\$$$$SHA256.class \
+	sun/security/ec/ECDSASignature\$$$$SHA384.class \
+	sun/security/ec/ECDSASignature\$$$$SHA512.class \
 	sun/security/ec/ECKeyFactory.class \
 	sun/security/ec/ECKeyPairGenerator.class \
-	sun/security/ec/SunEC\$$1.class \
+	sun/security/ec/SunEC\$$$$1.class \
 	sun/security/ec/SunEC.class \
 	sun/security/ec/SunECEntries.class \
 	sun/security/internal \
@@ -357,23 +357,25 @@
 
 
 # Support for removing the addPropertyChangeListener and removePropertyChangeListener
-# methods from classes that only go into the profile builds. For now the Pack200.Packer
-# and Packer200.Unpacker classes have special handling because of the $ in the file
-# name.
+# methods from classes that only go into the profile builds. 
 BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless
 
+# When there are $ characters in filenames we have some very subtle interactions between
+# make expansion and shell expansion. In this particular case $< will contain a single $ while
+# $@ will contain \$. So we have to pass $< in single-quotes to avoid shell expansion
 $(BEANLESS_CLASSES)/%: $(JDK_OUTPUTDIR)/classes/%
 	$(MKDIR) -p $(@D)
-	$(TOOL_REMOVEMETHODS) $< $@ addPropertyChangeListener removePropertyChangeListener
+	$(TOOL_REMOVEMETHODS) '$<' $@ addPropertyChangeListener removePropertyChangeListener
 
 CLASSES_TO_DEBEAN = \
     java/util/logging/LogManager.class \
+    java/util/jar/Pack200\$$Packer.class \
+    java/util/jar/Pack200\$$Unpacker.class \
     com/sun/java/util/jar/pack/PackerImpl.class \
-    com/sun/java/util/jar/pack/UnpackerImpl.class
+    com/sun/java/util/jar/pack/UnpackerImpl.class 
 
-BEANLESS_CLASSES_TARGETS =
 ifneq ($(PROFILE),)
-    BEANLESS_CLASSES_TARGETS := $(foreach c, $(CLASSES_TO_DEBEAN), $(BEANLESS_CLASSES)/$c)
+    BEANLESS_CLASSES_TARGETS := $(addprefix $(BEANLESS_CLASSES)/, $(CLASSES_TO_DEBEAN))
 endif
 
 
@@ -400,13 +402,8 @@
 	      $(ECHO)  Updating rt.jar $(PROFILE) && \
 	      $(CD) $(patsubst %$(VERSION_CLASS_PATH),%,$(CLASS_FILE)) && \
                 $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
-	      $(MKDIR) -p $(BEANLESS_CLASSES)/java/util/jar; \
-	      $(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Packer.class \
-		$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Packer.class addPropertyChangeListener removePropertyChangeListener; \
-	      $(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Unpacker.class \
-		$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Unpacker.class addPropertyChangeListener removePropertyChangeListener; \
 	      $(CD) $(BEANLESS_CLASSES) && \
-		$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN) java/util/jar/* ; \
+		$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN); \
             fi
 	$(MV) $@.tmp $@
 
--- a/jdk/makefiles/ProfileNames.gmk	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/ProfileNames.gmk	Fri Mar 15 23:31:19 2013 -0700
@@ -30,9 +30,8 @@
 
 PROFILE_NAMES := compact1 compact2 compact3
 
-# The include files use 1,2,3,4 for simplicity and conciseness. Internally we
-# use profile_1, profile_2 and profile_3. Note that profile_4 is a full JRE so
-# we never have to use it directly.
+# The include files use 1,2,3 for simplicity and conciseness. Internally we
+# use profile_1, profile_2 and profile_3. 
 
 ALL_PROFILES := profile_1 profile_2 profile_3
 
--- a/jdk/makefiles/Profiles.gmk	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/Profiles.gmk	Fri Mar 15 23:31:19 2013 -0700
@@ -74,11 +74,11 @@
     $(PROFILE_2_JARS)
 
 ifdef OPENJDK
-  PROFILE_4_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(PROFILE_4_JRE_JAR_FILES))
+  FULL_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(FULL_JRE_JAR_FILES))
 endif
 
-PROFILE_4_JARS := \
-    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_4_JRE_JAR_FILES)) \
+FULL_JRE_JARS := \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(FULL_JRE_JAR_FILES)) \
     $(PROFILE_3_JARS)
 
 # The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
@@ -86,7 +86,7 @@
 # Note we need to add back the regular form of all the custom profile jars e.g.
 # rt.jar and resources.jar
 
-ALL_JARS := $(PROFILE_4_JARS) \
+ALL_JARS := $(FULL_JRE_JARS) \
         $(IMAGES_OUTPUTDIR)/lib/rt.jar \
         $(IMAGES_OUTPUTDIR)/lib/resources.jar \
         $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
@@ -140,7 +140,7 @@
    $(PROFILE_1_JRE_BIN_FILES) \
    $(PROFILE_2_JRE_BIN_FILES) \
    $(PROFILE_3_JRE_BIN_FILES) \
-   $(PROFILE_4_JRE_BIN_FILES) 
+   $(FULL_JRE_BIN_FILES) 
 
 NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
 
@@ -149,18 +149,18 @@
     NOT_JRE_BIN_FILES += \
         $(PROFILE_2_JRE_BIN_FILES) \
         $(PROFILE_3_JRE_BIN_FILES) \
-        $(PROFILE_4_JRE_BIN_FILES) 
+        $(FULL_JRE_BIN_FILES) 
 endif
 
 ifeq ($(PROFILE), profile_2)
     NOT_JRE_BIN_FILES += \
         $(PROFILE_3_JRE_BIN_FILES) \
-        $(PROFILE_4_JRE_BIN_FILES) 
+        $(FULL_JRE_BIN_FILES) 
 endif
 
 ifeq ($(PROFILE), profile_3)
     NOT_JRE_BIN_FILES += \
-        $(PROFILE_4_JRE_BIN_FILES) 
+        $(FULL_JRE_BIN_FILES) 
 endif
 
 NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
@@ -173,7 +173,7 @@
    $(PROFILE_1_JRE_LIB_FILES) \
    $(PROFILE_2_JRE_LIB_FILES) \
    $(PROFILE_3_JRE_LIB_FILES) \
-   $(PROFILE_4_JRE_LIB_FILES) 
+   $(FULL_JRE_LIB_FILES) 
 
 NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
 
@@ -189,18 +189,18 @@
     NOT_JRE_LIB_FILES += \
         $(PROFILE_2_JRE_LIB_FILES) \
         $(PROFILE_3_JRE_LIB_FILES) \
-        $(PROFILE_4_JRE_LIB_FILES) 
+        $(FULL_JRE_LIB_FILES) 
 endif
 
 ifeq ($(PROFILE), profile_2)
     NOT_JRE_LIB_FILES += \
         $(PROFILE_3_JRE_LIB_FILES) \
-        $(PROFILE_4_JRE_LIB_FILES) 
+        $(FULL_JRE_LIB_FILES) 
 endif
 
 ifeq ($(PROFILE), profile_3)
     NOT_JRE_LIB_FILES += \
-        $(PROFILE_4_JRE_LIB_FILES) 
+        $(FULL_JRE_LIB_FILES) 
 endif
 
 # Exclude the custom jar files as these will be added back via a special rule
@@ -279,13 +279,13 @@
 
 ifeq ($(PROFILE), profile_1)
   RT_JAR_EXCLUDES += \
-    $(PROFILE_1_RTJAR_EXCLUDE_TYPES) \
+    $(call class_list, $(PROFILE_1_RTJAR_EXCLUDE_TYPES)) \
     $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
     $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
     $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
     $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
-    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
-    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+    $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
   RT_JAR_INCLUDE_TYPES := \
 	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
   PROFILE_INCLUDE_METAINF_SERVICES := \
@@ -293,11 +293,11 @@
 endif
 ifeq ($(PROFILE), profile_2)
   RT_JAR_EXCLUDES += \
-    $(PROFILE_2_RTJAR_EXCLUDE_TYPES) \
+    $(call class_list, $(PROFILE_2_RTJAR_EXCLUDE_TYPES)) \
     $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
     $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
-    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
-    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+    $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
   RT_JAR_INCLUDE_TYPES := \
 	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
 	$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
@@ -307,9 +307,9 @@
 endif
 ifeq ($(PROFILE), profile_3)
   RT_JAR_EXCLUDES += \
-    $(PROFILE_3_RTJAR_EXCLUDE_TYPES) \
-    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
-    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+    $(call class_list, $(PROFILE_3_RTJAR_EXCLUDE_TYPES)) \
+    $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
   RT_JAR_INCLUDE_TYPES := \
 	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
 	$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
--- a/jdk/makefiles/mapfiles/libjava/mapfile-vers	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers	Fri Mar 15 23:31:19 2013 -0700
@@ -133,6 +133,7 @@
 		Java_java_lang_ClassLoader_00024NativeLibrary_find;
 		Java_java_lang_ClassLoader_00024NativeLibrary_load;
 		Java_java_lang_ClassLoader_00024NativeLibrary_unload;
+		Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib;
 		Java_java_lang_ClassLoader_getCaller; 
 		Java_java_lang_ClassLoader_registerNatives;
 		Java_java_lang_Compiler_registerNatives;
--- a/jdk/makefiles/profile-includes.txt	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/profile-includes.txt	Fri Mar 15 23:31:19 2013 -0700
@@ -142,7 +142,7 @@
     management-agent.jar
 
 
-PROFILE_4_JRE_BIN_FILES := \
+FULL_JRE_BIN_FILES := \
     orbd$(EXE_SUFFIX) \
     pack200$(EXE_SUFFIX) \
     policytool$(EXE_SUFFIX) \
@@ -150,7 +150,7 @@
     tnameserv$(EXE_SUFFIX) \
     unpack200$(EXE_SUFFIX)
 
-PROFILE_4_JRE_LIB_FILES := \
+FULL_JRE_LIB_FILES := \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_xawt$(SHARED_LIBRARY_SUFFIX) \
@@ -222,7 +222,7 @@
     servicetag/jdk_header.png \
     sound.properties
 
-PROFILE_4_JRE_OTHER_FILES := \
+FULL_JRE_OTHER_FILES := \
     man/ja_JP.UTF-8/man1/java.1 \
     man/ja_JP.UTF-8/man1/javaws.1 \
     man/ja_JP.UTF-8/man1/keytool.1 \
@@ -246,7 +246,7 @@
     man/man1/tnameserv.1 \
     man/man1/unpack200.1
 
-PROFILE_4_JRE_JAR_FILES := \
+FULL_JRE_JAR_FILES := \
     alt-rt.jar \
     charsets.jar \
     ext/cldrdata.jar \
--- a/jdk/makefiles/profile-rtjar-includes.txt	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/makefiles/profile-rtjar-includes.txt	Fri Mar 15 23:31:19 2013 -0700
@@ -22,119 +22,55 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
+
+# Included or excluded types must take one of two forms
+# - *.class   to indicate all classes; or else
+# - a full single type name e.g.
+#      com/sun/security/auth/callback/DialogCallbackHandler$$1.class
+# You can not use arbitrary wildcards like DialogCallbackHandler*.class.
+#
+# Notes:
+#  -  Nested types must use $$ in place of $ as $ is the make meta-character
+#  -  If a package is not listed in any profile's inclusion list then it will
+#     not appear in any profile. But if a package is also missing from the
+#     full JRE's inclusion list then it will still be part of the full JRE.
+#     This is because the full JRE's inclusion lists are only used to define
+#     the exclusion lists for profiles; they are not used to define the full
+#     JRE contents - that is still done with the pre-profile legacy mechanism
+#     (all packagesthat can be found, less those not intended for rt.jar).
+#     This was done to minimize the impact of profiles on the regular
+#     non-profile build.
+#
 PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
     com/sun/demo/jvmti/hprof \
     com/sun/java/util/jar/pack \
     com/sun/net/ssl \
-    com/sun/net/ssl/internal/www/protocol/https \
     com/sun/nio/file \
     com/sun/security/cert/internal/x509 \
     java/io \
     java/lang \
-    java/lang/annotation \
-    java/lang/invoke \
-    java/lang/ref \
-    java/lang/reflect \
     java/math \
     java/net \
     java/nio \
-    java/nio/channels \
-    java/nio/channels/spi \
-    java/nio/charset \
-    java/nio/charset/spi \
-    java/nio/file \
-    java/nio/file/attribute \
-    java/nio/file/spi \
     java/security \
-    java/security/cert \
-    java/security/interfaces \
-    java/security/spec \
     java/text \
-    java/text/spi \
     java/time \
     java/util \
-    java/util/concurrent \
-    java/util/concurrent/atomic \
-    java/util/concurrent/locks \
-    java/util/function \
-    java/util/jar \
-    java/util/logging \
-    java/util/regex \
-    java/util/spi \
-    java/util/zip \
     javax/net \
-    javax/net/ssl \
-    javax/security/auth \
-    javax/security/auth/callback \
-    javax/security/auth/login \
-    javax/security/auth/spi \
-    javax/security/auth/x500 \
-    javax/security/cert \
-    jdk/internal \
+    javax/security \
+    jdk \
     sun/invoke \
-    sun/invoke/anon \
-    sun/invoke/empty \
-    sun/invoke/util \
     sun/launcher \
-    sun/launcher/resources \
     sun/misc \
-    sun/misc/resources \
     sun/net/ \
-    sun/net/idn \
-    sun/net/sdp \
-    sun/net/spi \
-    sun/net/spi/nameservice \
-    sun/net/util \
-    sun/net/www \
-    sun/net/www/http \
-    sun/net/www/protocol/file \
-    sun/net/www/protocol/http/ \
-    sun/net/www/protocol/http/logging \
-    sun/net/www/protocol/https \
-    sun/net/www/protocol/jar \
     sun/nio \
-    sun/nio/ch \
-    sun/nio/cs \
-    sun/nio/fs \
     sun/reflect \
-    sun/reflect/annotation \
-    sun/reflect/generics/factory \
-    sun/reflect/generics/parser \
-    sun/reflect/generics/reflectiveObjects \
-    sun/reflect/generics/repository \
-    sun/reflect/generics/scope \
-    sun/reflect/generics/tree \
-    sun/reflect/generics/visitor \
-    sun/reflect/misc \
-    sun/security/action \
-    sun/security/ec \
-    sun/security/jca \
-    sun/security/pkcs \
-    sun/security/pkcs10 \
-    sun/security/pkcs12 \
-    sun/security/provider \
-    sun/security/provider/certpath \
-    sun/security/provider/certpath/ssl \
-    sun/security/rsa \
-    sun/security/timestamp \
-    sun/security/tools \
-    sun/security/tools/keytool \
-    sun/security/util \
-    sun/security/validator \
-    sun/security/x509 \
+    sun/security \
     sun/text \
-    sun/text/bidi \
-    sun/text/normalizer \
-    sun/text/resources \
     sun/usagetracker \
-    sun/util \
-    sun/util/calendar \
-    sun/util/locale \
-    sun/util/logging \
-    sun/util/logging/resources \
-    sun/util/resources
+    sun/util
 
-PROFILE_1_RTJAR_INCLUDE_TYPES :=
+PROFILE_1_RTJAR_INCLUDE_TYPES := 
 
 PROFILE_1_RTJAR_EXCLUDE_TYPES := 
 
@@ -144,139 +80,19 @@
 PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
     com/sun/java_cup/internal/runtime \
     com/sun/net/httpserver \
-    com/sun/net/httpserver/spi \
-    com/sun/org/apache/bcel/internal \
-    com/sun/org/apache/bcel/internal/classfile \
-    com/sun/org/apache/bcel/internal/generic \
-    com/sun/org/apache/bcel/internal/util \
-    com/sun/org/apache/regexp/internal \
-    com/sun/org/apache/xalan/internal \
-    com/sun/org/apache/xalan/internal/extensions \
-    com/sun/org/apache/xalan/internal/lib \
-    com/sun/org/apache/xalan/internal/res \
-    com/sun/org/apache/xalan/internal/templates \
-    com/sun/org/apache/xalan/internal/utils \
-    com/sun/org/apache/xalan/internal/xslt \
-    com/sun/org/apache/xalan/internal/xsltc \
-    com/sun/org/apache/xalan/internal/xsltc/cmdline \
-    com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt \
-    com/sun/org/apache/xalan/internal/xsltc/compiler \
-    com/sun/org/apache/xalan/internal/xsltc/compiler/util \
-    com/sun/org/apache/xalan/internal/xsltc/dom \
-    com/sun/org/apache/xalan/internal/xsltc/runtime \
-    com/sun/org/apache/xalan/internal/xsltc/runtime/output \
-    com/sun/org/apache/xalan/internal/xsltc/trax \
-    com/sun/org/apache/xalan/internal/xsltc/util \
-    com/sun/org/apache/xerces/internal/dom \
-    com/sun/org/apache/xerces/internal/dom/events \
-    com/sun/org/apache/xerces/internal/impl \
-    com/sun/org/apache/xerces/internal/impl/dtd \
-    com/sun/org/apache/xerces/internal/impl/dtd/models \
-    com/sun/org/apache/xerces/internal/impl/dv \
-    com/sun/org/apache/xerces/internal/impl/dv/dtd \
-    com/sun/org/apache/xerces/internal/impl/dv/util \
-    com/sun/org/apache/xerces/internal/impl/dv/xs \
-    com/sun/org/apache/xerces/internal/impl/io \
-    com/sun/org/apache/xerces/internal/impl/msg \
-    com/sun/org/apache/xerces/internal/impl/validation \
-    com/sun/org/apache/xerces/internal/impl/xpath \
-    com/sun/org/apache/xerces/internal/impl/xpath/regex \
-    com/sun/org/apache/xerces/internal/impl/xs \
-    com/sun/org/apache/xerces/internal/impl/xs/identity \
-    com/sun/org/apache/xerces/internal/impl/xs/models \
-    com/sun/org/apache/xerces/internal/impl/xs/opti \
-    com/sun/org/apache/xerces/internal/impl/xs/traversers \
-    com/sun/org/apache/xerces/internal/impl/xs/util \
-    com/sun/org/apache/xerces/internal/jaxp \
-    com/sun/org/apache/xerces/internal/jaxp/datatype \
-    com/sun/org/apache/xerces/internal/jaxp/validation \
-    com/sun/org/apache/xerces/internal/parsers \
-    com/sun/org/apache/xerces/internal/util \
-    com/sun/org/apache/xerces/internal/utils \
-    com/sun/org/apache/xerces/internal/xinclude \
-    com/sun/org/apache/xerces/internal/xni \
-    com/sun/org/apache/xerces/internal/xni/grammars \
-    com/sun/org/apache/xerces/internal/xni/parser \
-    com/sun/org/apache/xerces/internal/xpointer \
-    com/sun/org/apache/xerces/internal/xs \
-    com/sun/org/apache/xerces/internal/xs/datatypes \
-    com/sun/org/apache/xml/internal/dtm \
-    com/sun/org/apache/xml/internal/dtm/ref \
-    com/sun/org/apache/xml/internal/dtm/ref/dom2dtm \
-    com/sun/org/apache/xml/internal/dtm/ref/sax2dtm \
-    com/sun/org/apache/xml/internal/res \
-    com/sun/org/apache/xml/internal/resolver \
-    com/sun/org/apache/xml/internal/resolver/helpers \
-    com/sun/org/apache/xml/internal/resolver/readers \
-    com/sun/org/apache/xml/internal/resolver/tools \
-    com/sun/org/apache/xml/internal/serialize \
-    com/sun/org/apache/xml/internal/serializer \
-    com/sun/org/apache/xml/internal/serializer/utils \
-    com/sun/org/apache/xml/internal/utils \
-    com/sun/org/apache/xml/internal/utils/res \
-    com/sun/org/apache/xpath/internal \
-    com/sun/org/apache/xpath/internal/axes \
-    com/sun/org/apache/xpath/internal/compiler \
-    com/sun/org/apache/xpath/internal/domapi \
-    com/sun/org/apache/xpath/internal/functions \
-    com/sun/org/apache/xpath/internal/jaxp \
-    com/sun/org/apache/xpath/internal/objects \
-    com/sun/org/apache/xpath/internal/operations \
-    com/sun/org/apache/xpath/internal/patterns \
-    com/sun/org/apache/xpath/internal/res \
+    com/sun/org/apache \
     com/sun/rmi/rmid \
-    com/sun/xml/internal/stream/ \
-    com/sun/xml/internal/stream/dtd \
-    com/sun/xml/internal/stream/dtd/nonvalidating \
-    com/sun/xml/internal/stream/events \
-    com/sun/xml/internal/stream/util \
-    com/sun/xml/internal/stream/writers \
+    com/sun/xml/internal/stream \
     java/rmi \
-    java/rmi/activation \
-    java/rmi/dgc \
-    java/rmi/registry \
-    java/rmi/server \
     java/sql \
     javax/rmi/ssl \
     javax/sql \
     javax/transaction \
-    javax/transaction/xa \
     javax/xml \
-    javax/xml/datatype \
-    javax/xml/namespace \
-    javax/xml/parsers \
-    javax/xml/stream \
-    javax/xml/stream/events \
-    javax/xml/stream/util \
-    javax/xml/transform \
-    javax/xml/transform/dom \
-    javax/xml/transform/sax \
-    javax/xml/transform/stax \
-    javax/xml/transform/stream \
-    javax/xml/validation \
-    javax/xml/xpath \
-    org/w3c/dom \
-    org/w3c/dom/bootstrap \
-    org/w3c/dom/css \
-    org/w3c/dom/events \
-    org/w3c/dom/html \
-    org/w3c/dom/ls \
-    org/w3c/dom/ranges \
-    org/w3c/dom/stylesheets \
-    org/w3c/dom/traversal \
-    org/w3c/dom/views \
-    org/w3c/dom/xpath \
+    org/w3c \
     org/xml/sax \
-    org/xml/sax/ext \
-    org/xml/sax/helpers \
     sun/net/httpserver \
-    sun/rmi/log \
-    sun/rmi/registry \
-    sun/rmi/runtime \
-    sun/rmi/server \
-    sun/rmi/transport \
-    sun/rmi/transport/proxy \
-    sun/rmi/transport/tcp \
+    sun/rmi \
     sun/util/xml
 
 PROFILE_2_RTJAR_INCLUDE_TYPES := 
@@ -284,287 +100,83 @@
 PROFILE_2_RTJAR_EXCLUDE_TYPES := 
 
 PROFILE_2_INCLUDE_METAINF_SERVICES := \
-    META-INF/services/sun.util.spi.XmlPropertiesProvider
+    META-INF/services/sun.util.spi.XmlPropertiesProvider 
 
 
 PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
-    com/sun/jmx/defaults \
-    com/sun/jmx/interceptor \
-    com/sun/jmx/mbeanserver \
-    com/sun/jmx/remote/internal \
-    com/sun/jmx/remote/protocol/rmi \
-    com/sun/jmx/remote/security \
-    com/sun/jmx/remote/util \
-    com/sun/jmx/snmp \
-    com/sun/jmx/snmp/IPAcl \
-    com/sun/jmx/snmp/agent \
-    com/sun/jmx/snmp/daemon \
-    com/sun/jmx/snmp/defaults \
-    com/sun/jmx/snmp/internal \
-    com/sun/jmx/snmp/mpm \
-    com/sun/jmx/snmp/tasks \
-    com/sun/jmx/trace \
-    com/sun/jndi/dns \
-    com/sun/jndi/ldap \
-    com/sun/jndi/ldap/ext \
-    com/sun/jndi/ldap/pool \
-    com/sun/jndi/ldap/sasl \
-    com/sun/jndi/rmi/registry \
-    com/sun/jndi/toolkit/ctx \
-    com/sun/jndi/toolkit/dir \
-    com/sun/jndi/toolkit/url \
-    com/sun/jndi/url/dns \
-    com/sun/jndi/url/ldap \
-    com/sun/jndi/url/ldaps \
-    com/sun/jndi/url/rmi \
+    com/sun/jmx \
+    com/sun/jndi \
     com/sun/management \
-    com/sun/management/jmx \
     com/sun/naming/internal \
     com/sun/nio/sctp \
     com/sun/org/apache/xml/internal/security \
-    com/sun/org/apache/xml/internal/security/algorithms \
-    com/sun/org/apache/xml/internal/security/algorithms/implementations \
-    com/sun/org/apache/xml/internal/security/c14n \
-    com/sun/org/apache/xml/internal/security/c14n/helper \
-    com/sun/org/apache/xml/internal/security/c14n/implementations \
-    com/sun/org/apache/xml/internal/security/encryption \
-    com/sun/org/apache/xml/internal/security/exceptions \
-    com/sun/org/apache/xml/internal/security/keys \
-    com/sun/org/apache/xml/internal/security/keys/content \
-    com/sun/org/apache/xml/internal/security/keys/content/keyvalues \
-    com/sun/org/apache/xml/internal/security/keys/content/x509 \
-    com/sun/org/apache/xml/internal/security/keys/keyresolver \
-    com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations \
-    com/sun/org/apache/xml/internal/security/keys/storage \
-    com/sun/org/apache/xml/internal/security/keys/storage/implementations \
-    com/sun/org/apache/xml/internal/security/signature \
-    com/sun/org/apache/xml/internal/security/transforms \
-    com/sun/org/apache/xml/internal/security/transforms/implementations \
-    com/sun/org/apache/xml/internal/security/transforms/params \
-    com/sun/org/apache/xml/internal/security/utils \
-    com/sun/org/apache/xml/internal/security/utils/resolver \
-    com/sun/org/apache/xml/internal/security/utils/resolver/implementations \
     com/sun/rowset \
-    com/sun/rowset/internal \
-    com/sun/rowset/providers \
-    com/sun/script/javascript \
-    com/sun/script/util \
+    com/sun/script \
     com/sun/security/auth \
-    com/sun/security/auth/callback \
-    com/sun/security/auth/login \
-    com/sun/security/auth/module \
     com/sun/security/jgss \
     com/sun/security/ntlm \
     com/sun/security/sasl \
-    com/sun/security/sasl/digest \
-    com/sun/security/sasl/gsskerb \
-    com/sun/security/sasl/ntlm \
-    com/sun/security/sasl/util \
     com/sun/tracing \
-    com/sun/tracing/dtrace \
     java/lang/instrument \
     java/lang/management \
     java/security/acl \
     java/util/prefs \
     javax/annotation/processing \
     javax/lang/model \
-    javax/lang/model/element \
-    javax/lang/model/type \
-    javax/lang/model/util \
     javax/management \
-    javax/management/loading \
-    javax/management/modelmbean \
-    javax/management/monitor \
-    javax/management/openmbean \
-    javax/management/relation \
-    javax/management/remote \
-    javax/management/remote/rmi \
-    javax/management/timer \
     javax/naming \
-    javax/naming/directory \
-    javax/naming/event \
-    javax/naming/ldap \
-    javax/naming/spi \
     javax/script \
     javax/security/auth/kerberos \
     javax/security/sasl \
     javax/smartcardio \
     javax/sql/rowset \
-    javax/sql/rowset/serial \
-    javax/sql/rowset/spi \
     javax/tools \
-    javax/tools/annotation \
     javax/xml/crypto \
-    javax/xml/crypto/dom \
-    javax/xml/crypto/dsig \
-    javax/xml/crypto/dsig/dom \
-    javax/xml/crypto/dsig/keyinfo \
-    javax/xml/crypto/dsig/spec \
     org/ietf/jgss \
-    org/jcp/xml/dsig/internal \
-    org/jcp/xml/dsig/internal/dom \
+    org/jcp/xml \
     sun/instrument \
     sun/management \
-    sun/management/counter \
-    sun/management/counter/perf \
-    sun/management/jmxremote \
-    sun/management/resources \
-    sun/management/snmp \
-    sun/management/snmp/jvminstr \
-    sun/management/snmp/jvmmib \
-    sun/management/snmp/util \
     sun/net/dns \
     sun/net/www/protocol/http/ntlm \
     sun/net/www/protocol/http/spnego \
     sun/nio/ch/sctp \
-    sun/org/mozilla/classfile/internal \
-    sun/org/mozilla/javascript/internal \
-    sun/org/mozilla/javascript/internal/annotations \
-    sun/org/mozilla/javascript/internal/ast \
-    sun/org/mozilla/javascript/internal/debug \
-    sun/org/mozilla/javascript/internal/jdk13 \
-    sun/org/mozilla/javascript/internal/jdk15 \
-    sun/org/mozilla/javascript/internal/json \
-    sun/org/mozilla/javascript/internal/optimizer \
-    sun/org/mozilla/javascript/internal/regexp \
-    sun/org/mozilla/javascript/internal/serialize \
-    sun/org/mozilla/javascript/internal/xml \
-    sun/org/mozilla/javascript/internal/xmlimpl \
+    sun/org/mozilla \
     sun/security/acl \
     sun/security/jgss \
-    sun/security/jgss/krb5 \
-    sun/security/jgss/spi \
-    sun/security/jgss/spnego \
-    sun/security/jgss/wrapper \
     sun/security/krb5 \
-    sun/security/krb5/internal \
-    sun/security/krb5/internal/ccache \
-    sun/security/krb5/internal/crypto \
-    sun/security/krb5/internal/crypto/dk \
-    sun/security/krb5/internal/ktab \
-    sun/security/krb5/internal/rcache \
-    sun/security/krb5/internal/util \
     sun/security/provider/certpath/ldap \
     sun/security/smartcardio \
-    sun/tracing \
-    sun/tracing/dtrace
+    sun/tracing
 
-PROFILE_3_RTJAR_INCLUDE_TYPES :=
+PROFILE_3_RTJAR_INCLUDE_TYPES := 
 
 PROFILE_3_RTJAR_EXCLUDE_TYPES := \
+    com/sun/security/auth/callback/DialogCallbackHandler$$1.class \
+    com/sun/security/auth/callback/DialogCallbackHandler$$2.class \
+    com/sun/security/auth/callback/DialogCallbackHandler$$Action.class \
+    com/sun/security/auth/callback/DialogCallbackHandler$$ConfirmationInfo.class \
+    com/sun/security/auth/callback/DialogCallbackHandler.class \
     javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
     javax/management/remote/rmi/_RMIConnection_Stub.class \
     javax/management/remote/rmi/_RMIServerImpl_Tie.class \
-    javax/management/remote/rmi/_RMIServer_Stub.class \
-    com/sun/security/auth/callback/DialogCallbackHandler.class \
-    com/sun/security/auth/callback/DialogCallbackHandler\$$1.class \
-    com/sun/security/auth/callback/DialogCallbackHandler\$$2.class \
-    com/sun/security/auth/callback/DialogCallbackHandler\$$Action.class \
-    com/sun/security/auth/callback/DialogCallbackHandler\$$ConfirmationInfo.class
+    javax/management/remote/rmi/_RMIServer_Stub.class
 
 PROFILE_3_INCLUDE_METAINF_SERVICES := \
     META-INF/services/javax.script.ScriptEngineFactory 
 
 
-PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
-    com/oracle/net \
-    com/oracle/nio \
-    com/oracle/util \
+FULL_JRE_RTJAR_INCLUDE_PACKAGES := \
+    com/oracle \
     com/sun/accessibility/internal/resources \
     com/sun/activation/registries \
     com/sun/awt \
     com/sun/beans \
-    com/sun/beans/decoder \
-    com/sun/beans/finder \
-    com/sun/corba/se/impl/activation \
-    com/sun/corba/se/impl/copyobject \
-    com/sun/corba/se/impl/corba \
-    com/sun/corba/se/impl/dynamicany \
-    com/sun/corba/se/impl/encoding \
-    com/sun/corba/se/impl/interceptors \
-    com/sun/corba/se/impl/io \
-    com/sun/corba/se/impl/ior \
-    com/sun/corba/se/impl/ior/iiop \
-    com/sun/corba/se/impl/javax/rmi \
-    com/sun/corba/se/impl/javax/rmi/CORBA \
-    com/sun/corba/se/impl/legacy/connection \
-    com/sun/corba/se/impl/logging \
-    com/sun/corba/se/impl/monitoring \
-    com/sun/corba/se/impl/naming/cosnaming \
-    com/sun/corba/se/impl/naming/namingutil \
-    com/sun/corba/se/impl/naming/pcosnaming \
-    com/sun/corba/se/impl/oa \
-    com/sun/corba/se/impl/oa/poa \
-    com/sun/corba/se/impl/oa/toa \
-    com/sun/corba/se/impl/orb \
-    com/sun/corba/se/impl/orbutil \
-    com/sun/corba/se/impl/orbutil/closure \
-    com/sun/corba/se/impl/orbutil/concurrent \
-    com/sun/corba/se/impl/orbutil/fsm \
-    com/sun/corba/se/impl/orbutil/graph \
-    com/sun/corba/se/impl/orbutil/threadpool \
-    com/sun/corba/se/impl/presentation/rmi \
-    com/sun/corba/se/impl/protocol \
-    com/sun/corba/se/impl/protocol/giopmsgheaders \
-    com/sun/corba/se/impl/resolver \
-    com/sun/corba/se/impl/transport \
-    com/sun/corba/se/impl/util \
-    com/sun/corba/se/internal/CosNaming \
-    com/sun/corba/se/internal/Interceptors \
-    com/sun/corba/se/internal/POA \
-    com/sun/corba/se/internal/corba \
-    com/sun/corba/se/internal/iiop \
-    com/sun/corba/se/org/omg/CORBA \
-    com/sun/corba/se/pept/broker \
-    com/sun/corba/se/pept/encoding \
-    com/sun/corba/se/pept/protocol \
-    com/sun/corba/se/pept/transport \
-    com/sun/corba/se/spi/activation \
-    com/sun/corba/se/spi/activation/InitialNameServicePackage \
-    com/sun/corba/se/spi/activation/LocatorPackage \
-    com/sun/corba/se/spi/activation/RepositoryPackage \
-    com/sun/corba/se/spi/copyobject \
-    com/sun/corba/se/spi/encoding \
-    com/sun/corba/se/spi/extension \
-    com/sun/corba/se/spi/ior \
-    com/sun/corba/se/spi/ior/iiop \
-    com/sun/corba/se/spi/legacy/connection \
-    com/sun/corba/se/spi/legacy/interceptor \
-    com/sun/corba/se/spi/logging \
-    com/sun/corba/se/spi/monitoring \
-    com/sun/corba/se/spi/oa \
-    com/sun/corba/se/spi/orb \
-    com/sun/corba/se/spi/orbutil/closure \
-    com/sun/corba/se/spi/orbutil/fsm \
-    com/sun/corba/se/spi/orbutil/proxy \
-    com/sun/corba/se/spi/orbutil/threadpool \
-    com/sun/corba/se/spi/presentation/rmi \
-    com/sun/corba/se/spi/protocol \
-    com/sun/corba/se/spi/resolver \
-    com/sun/corba/se/spi/servicecontext \
-    com/sun/corba/se/spi/transport \
+    com/sun/corba \
     com/sun/image/codec/jpeg \
-    com/sun/imageio/plugins/bmp \
-    com/sun/imageio/plugins/common \
-    com/sun/imageio/plugins/gif \
-    com/sun/imageio/plugins/jpeg \
-    com/sun/imageio/plugins/png \
-    com/sun/imageio/plugins/wbmp \
-    com/sun/imageio/spi \
-    com/sun/imageio/stream \
-    com/sun/istack/internal \
-    com/sun/istack/internal/localization \
-    com/sun/istack/internal/logging \
-    com/sun/java/browser/dom \
-    com/sun/java/browser/net \
+    com/sun/imageio \
+    com/sun/istack \
+    com/sun/java/browser \
     com/sun/java/swing \
-    com/sun/java/swing/plaf/gtk \
-    com/sun/java/swing/plaf/gtk/resources \
-    com/sun/java/swing/plaf/motif \
-    com/sun/java/swing/plaf/motif/resources \
-    com/sun/java/swing/plaf/nimbus \
-    com/sun/java/swing/plaf/windows \
-    com/sun/java/swing/plaf/windows/resources \
     com/sun/jmx/remote/protocol/iiop \
     com/sun/jndi/cosnaming \
     com/sun/jndi/toolkit/corba \
@@ -572,313 +184,41 @@
     com/sun/jndi/url/iiop \
     com/sun/jndi/url/iiopname \
     com/sun/media/sound \
-    com/sun/org/glassfish/external/amx \
-    com/sun/org/glassfish/external/arc \
-    com/sun/org/glassfish/external/probe/provider \
-    com/sun/org/glassfish/external/probe/provider/annotations \
-    com/sun/org/glassfish/external/statistics \
-    com/sun/org/glassfish/external/statistics/annotations \
-    com/sun/org/glassfish/external/statistics/impl \
-    com/sun/org/glassfish/gmbal \
-    com/sun/org/glassfish/gmbal/util \
-    com/sun/org/omg/CORBA \
-    com/sun/org/omg/CORBA/ValueDefPackage \
-    com/sun/org/omg/CORBA/portable \
-    com/sun/org/omg/SendingContext \
-    com/sun/org/omg/SendingContext/CodeBasePackage \
+    com/sun/org/glassfish \
+    com/sun/org/omg \
     com/sun/servicetag \
-    com/sun/swing/internal/plaf/basic/resources \
-    com/sun/swing/internal/plaf/metal/resources \
-    com/sun/swing/internal/plaf/synth/resources \
+    com/sun/swing \
     com/sun/xml/internal/bind \
-    com/sun/xml/internal/bind/annotation \
-    com/sun/xml/internal/bind/api \
-    com/sun/xml/internal/bind/api/impl \
-    com/sun/xml/internal/bind/marshaller \
-    com/sun/xml/internal/bind/unmarshaller \
-    com/sun/xml/internal/bind/util \
-    com/sun/xml/internal/bind/v2 \
-    com/sun/xml/internal/bind/v2/bytecode \
-    com/sun/xml/internal/bind/v2/model/annotation \
-    com/sun/xml/internal/bind/v2/model/core \
-    com/sun/xml/internal/bind/v2/model/impl \
-    com/sun/xml/internal/bind/v2/model/nav \
-    com/sun/xml/internal/bind/v2/model/runtime \
-    com/sun/xml/internal/bind/v2/runtime \
-    com/sun/xml/internal/bind/v2/runtime/output \
-    com/sun/xml/internal/bind/v2/runtime/property \
-    com/sun/xml/internal/bind/v2/runtime/reflect \
-    com/sun/xml/internal/bind/v2/runtime/reflect/opt \
-    com/sun/xml/internal/bind/v2/runtime/unmarshaller \
-    com/sun/xml/internal/bind/v2/schemagen \
-    com/sun/xml/internal/bind/v2/schemagen/episode \
-    com/sun/xml/internal/bind/v2/schemagen/xmlschema \
-    com/sun/xml/internal/bind/v2/util \
     com/sun/xml/internal/fastinfoset \
-    com/sun/xml/internal/fastinfoset/algorithm \
-    com/sun/xml/internal/fastinfoset/alphabet \
-    com/sun/xml/internal/fastinfoset/dom \
-    com/sun/xml/internal/fastinfoset/org/apache/xerces/util \
-    com/sun/xml/internal/fastinfoset/sax \
-    com/sun/xml/internal/fastinfoset/stax \
-    com/sun/xml/internal/fastinfoset/stax/events \
-    com/sun/xml/internal/fastinfoset/stax/factory \
-    com/sun/xml/internal/fastinfoset/stax/util \
-    com/sun/xml/internal/fastinfoset/tools \
-    com/sun/xml/internal/fastinfoset/util \
-    com/sun/xml/internal/fastinfoset/vocab \
-    com/sun/xml/internal/messaging/saaj \
-    com/sun/xml/internal/messaging/saaj/client/p2p \
-    com/sun/xml/internal/messaging/saaj/packaging/mime \
-    com/sun/xml/internal/messaging/saaj/packaging/mime/internet \
-    com/sun/xml/internal/messaging/saaj/packaging/mime/util \
-    com/sun/xml/internal/messaging/saaj/soap \
-    com/sun/xml/internal/messaging/saaj/soap/dynamic \
-    com/sun/xml/internal/messaging/saaj/soap/impl \
-    com/sun/xml/internal/messaging/saaj/soap/name \
-    com/sun/xml/internal/messaging/saaj/soap/ver1_1 \
-    com/sun/xml/internal/messaging/saaj/soap/ver1_2 \
-    com/sun/xml/internal/messaging/saaj/util \
-    com/sun/xml/internal/messaging/saaj/util/transform \
-    com/sun/xml/internal/org/jvnet/fastinfoset \
-    com/sun/xml/internal/org/jvnet/fastinfoset/sax \
-    com/sun/xml/internal/org/jvnet/fastinfoset/sax/helpers \
-    com/sun/xml/internal/org/jvnet/fastinfoset/stax \
-    com/sun/xml/internal/org/jvnet/mimepull \
-    com/sun/xml/internal/org/jvnet/staxex \
-    com/sun/xml/internal/org/jvnet/ws \
-    com/sun/xml/internal/org/jvnet/ws/databinding \
-    com/sun/xml/internal/org/jvnet/ws/message \
+    com/sun/xml/internal/messaging \
+    com/sun/xml/internal/org \
     com/sun/xml/internal/stream/buffer \
-    com/sun/xml/internal/stream/buffer/sax \
-    com/sun/xml/internal/stream/buffer/stax \
     com/sun/xml/internal/txw2 \
-    com/sun/xml/internal/txw2/annotation \
-    com/sun/xml/internal/txw2/output \
-    com/sun/xml/internal/ws/addressing \
-    com/sun/xml/internal/ws/addressing/model \
-    com/sun/xml/internal/ws/addressing/policy \
-    com/sun/xml/internal/ws/addressing/v200408 \
-    com/sun/xml/internal/ws/api \
-    com/sun/xml/internal/ws/api/addressing \
-    com/sun/xml/internal/ws/api/client \
-    com/sun/xml/internal/ws/api/config/management \
-    com/sun/xml/internal/ws/api/config/management/policy \
-    com/sun/xml/internal/ws/api/databinding \
-    com/sun/xml/internal/ws/api/fastinfoset \
-    com/sun/xml/internal/ws/api/ha \
-    com/sun/xml/internal/ws/api/handler \
-    com/sun/xml/internal/ws/api/message \
-    com/sun/xml/internal/ws/api/message/saaj \
-    com/sun/xml/internal/ws/api/message/stream \
-    com/sun/xml/internal/ws/api/model \
-    com/sun/xml/internal/ws/api/model/soap \
-    com/sun/xml/internal/ws/api/model/wsdl \
-    com/sun/xml/internal/ws/api/pipe \
-    com/sun/xml/internal/ws/api/pipe/helper \
-    com/sun/xml/internal/ws/api/policy \
-    com/sun/xml/internal/ws/api/policy/subject \
-    com/sun/xml/internal/ws/api/server \
-    com/sun/xml/internal/ws/api/streaming \
-    com/sun/xml/internal/ws/api/wsdl/parser \
-    com/sun/xml/internal/ws/api/wsdl/writer \
-    com/sun/xml/internal/ws/binding \
-    com/sun/xml/internal/ws/client \
-    com/sun/xml/internal/ws/client/dispatch \
-    com/sun/xml/internal/ws/client/sei \
-    com/sun/xml/internal/ws/config/management/policy \
-    com/sun/xml/internal/ws/db \
-    com/sun/xml/internal/ws/db/glassfish \
-    com/sun/xml/internal/ws/developer \
-    com/sun/xml/internal/ws/encoding \
-    com/sun/xml/internal/ws/encoding/fastinfoset \
-    com/sun/xml/internal/ws/encoding/policy \
-    com/sun/xml/internal/ws/encoding/soap \
-    com/sun/xml/internal/ws/encoding/soap/streaming \
-    com/sun/xml/internal/ws/encoding/xml \
-    com/sun/xml/internal/ws/fault \
-    com/sun/xml/internal/ws/handler \
-    com/sun/xml/internal/ws/message \
-    com/sun/xml/internal/ws/message/jaxb \
-    com/sun/xml/internal/ws/message/saaj \
-    com/sun/xml/internal/ws/message/source \
-    com/sun/xml/internal/ws/message/stream \
-    com/sun/xml/internal/ws/model \
-    com/sun/xml/internal/ws/model/soap \
-    com/sun/xml/internal/ws/model/wsdl \
-    com/sun/xml/internal/ws/org/objectweb/asm \
-    com/sun/xml/internal/ws/policy \
-    com/sun/xml/internal/ws/policy/jaxws \
-    com/sun/xml/internal/ws/policy/jaxws/spi \
-    com/sun/xml/internal/ws/policy/privateutil \
-    com/sun/xml/internal/ws/policy/sourcemodel \
-    com/sun/xml/internal/ws/policy/sourcemodel/attach \
-    com/sun/xml/internal/ws/policy/sourcemodel/wspolicy \
-    com/sun/xml/internal/ws/policy/spi \
-    com/sun/xml/internal/ws/policy/subject \
-    com/sun/xml/internal/ws/protocol/soap \
-    com/sun/xml/internal/ws/protocol/xml \
-    com/sun/xml/internal/ws/resources \
-    com/sun/xml/internal/ws/server \
-    com/sun/xml/internal/ws/server/provider \
-    com/sun/xml/internal/ws/server/sei \
-    com/sun/xml/internal/ws/spi \
-    com/sun/xml/internal/ws/spi/db \
-    com/sun/xml/internal/ws/streaming \
-    com/sun/xml/internal/ws/transport \
-    com/sun/xml/internal/ws/transport/http \
-    com/sun/xml/internal/ws/transport/http/client \
-    com/sun/xml/internal/ws/transport/http/server \
-    com/sun/xml/internal/ws/util \
-    com/sun/xml/internal/ws/util/exception \
-    com/sun/xml/internal/ws/util/localization \
-    com/sun/xml/internal/ws/util/pipe \
-    com/sun/xml/internal/ws/util/xml \
-    com/sun/xml/internal/ws/wsdl \
-    com/sun/xml/internal/ws/wsdl/parser \
-    com/sun/xml/internal/ws/wsdl/writer \
-    com/sun/xml/internal/ws/wsdl/writer/document \
-    com/sun/xml/internal/ws/wsdl/writer/document/http \
-    com/sun/xml/internal/ws/wsdl/writer/document/soap \
-    com/sun/xml/internal/ws/wsdl/writer/document/soap12 \
-    com/sun/xml/internal/ws/wsdl/writer/document/xsd \
+    com/sun/xml/internal/ws \
     java/applet \
     java/awt \
-    java/awt/color \
-    java/awt/datatransfer \
-    java/awt/dnd \
-    java/awt/dnd/peer \
-    java/awt/event \
-    java/awt/font \
-    java/awt/geom \
-    java/awt/im \
-    java/awt/im/spi \
-    java/awt/image \
-    java/awt/image/renderable \
-    java/awt/peer \
-    java/awt/print \
     java/beans \
     javax/accessibility \
     javax/activation \
     javax/activity \
     javax/imageio \
-    javax/imageio/event \
-    javax/imageio/metadata \
-    javax/imageio/plugins/bmp \
-    javax/imageio/plugins/jpeg \
-    javax/imageio/spi \
-    javax/imageio/stream \
     javax/jws \
-    javax/jws/soap \
     javax/print \
-    javax/print/attribute \
-    javax/print/attribute/standard \
-    javax/print/event \
     javax/rmi/CORBA \
-    javax/sound/midi \
-    javax/sound/midi/spi \
-    javax/sound/sampled \
-    javax/sound/sampled/spi \
+    javax/sound \
     javax/swing \
-    javax/swing/border \
-    javax/swing/colorchooser \
-    javax/swing/event \
-    javax/swing/filechooser \
-    javax/swing/plaf \
-    javax/swing/plaf/basic \
-    javax/swing/plaf/metal \
-    javax/swing/plaf/multi \
-    javax/swing/plaf/nimbus \
-    javax/swing/plaf/synth \
-    javax/swing/table \
-    javax/swing/text \
-    javax/swing/text/html \
-    javax/swing/text/html/parser \
-    javax/swing/text/rtf \
-    javax/swing/tree \
-    javax/swing/undo \
     javax/xml/bind \
-    javax/xml/bind/annotation \
-    javax/xml/bind/annotation/adapters \
-    javax/xml/bind/attachment \
-    javax/xml/bind/helpers \
-    javax/xml/bind/util \
     javax/xml/soap \
     javax/xml/ws \
-    javax/xml/ws/handler \
-    javax/xml/ws/handler/soap \
-    javax/xml/ws/http \
-    javax/xml/ws/soap \
-    javax/xml/ws/spi \
-    javax/xml/ws/spi/http \
-    javax/xml/ws/wsaddressing \
-    org/omg/CORBA \
-    org/omg/CORBA/DynAnyPackage \
-    org/omg/CORBA/ORBPackage \
-    org/omg/CORBA/TypeCodePackage \
-    org/omg/CORBA/portable \
-    org/omg/CORBA_2_3 \
-    org/omg/CORBA_2_3/portable \
-    org/omg/CosNaming \
-    org/omg/CosNaming/NamingContextExtPackage \
-    org/omg/CosNaming/NamingContextPackage \
-    org/omg/Dynamic \
-    org/omg/DynamicAny \
-    org/omg/DynamicAny/DynAnyFactoryPackage \
-    org/omg/DynamicAny/DynAnyPackage \
-    org/omg/IOP \
-    org/omg/IOP/CodecFactoryPackage \
-    org/omg/IOP/CodecPackage \
-    org/omg/Messaging \
-    org/omg/PortableInterceptor \
-    org/omg/PortableInterceptor/ORBInitInfoPackage \
-    org/omg/PortableServer \
-    org/omg/PortableServer/CurrentPackage \
-    org/omg/PortableServer/POAManagerPackage \
-    org/omg/PortableServer/POAPackage \
-    org/omg/PortableServer/ServantLocatorPackage \
-    org/omg/PortableServer/portable \
-    org/omg/SendingContext \
-    org/omg/stub/java/rmi \
-    org/omg/stub/javax/management/remote/rmi \
+    org/omg \
     sun/applet \
-    sun/applet/resources \
     sun/audio \
     sun/awt \
-    sun/awt/X11 \
-    sun/awt/datatransfer \
-    sun/awt/dnd \
-    sun/awt/event \
-    sun/awt/geom \
-    sun/awt/im \
-    sun/awt/image \
-    sun/awt/image/codec \
-    sun/awt/motif \
-    sun/awt/resources \
-    sun/awt/shell \
-    sun/awt/util \
-    sun/awt/windows \
-    sun/beans/editors \
-    sun/beans/infos \
     sun/corba \
     sun/dc \
-    sun/dc/path \
-    sun/dc/pr \
     sun/font \
     sun/java2d \
-    sun/java2d/cmm \
-    sun/java2d/cmm/kcms \
-    sun/java2d/cmm/lcms \
-    sun/java2d/jules \
-    sun/java2d/loops \
-    sun/java2d/opengl \
-    sun/java2d/pipe \
-    sun/java2d/pipe/hw \
-    sun/java2d/pisces \
-    sun/java2d/x11 \
-    sun/java2d/xr \
     sun/net/ftp \
-    sun/net/ftp/impl \
     sun/net/smtp \
     sun/net/www/content/audio \
     sun/net/www/content/image \
@@ -887,27 +227,26 @@
     sun/net/www/protocol/mailto \
     sun/net/www/protocol/netdoc \
     sun/print \
-    sun/print/resources \
     sun/security/tools/policytool \
     sun/swing \
-    sun/swing/icon \
-    sun/swing/plaf \
-    sun/swing/plaf/synth \
-    sun/swing/plaf/windows \
-    sun/swing/table \
-    sun/swing/text \
-    sun/swing/text/html \
-    sun/tools/jar \
-    sun/tools/jar/resources
+    sun/tools/jar
 
-PROFILE_4_RTJAR_INCLUDE_TYPES := \
-    com/sun/xml/internal/ws/*.class \
+FULL_JRE_RTJAR_INCLUDE_TYPES := \
+    com/sun/security/auth/callback/DialogCallbackHandler$$1.class \
+    com/sun/security/auth/callback/DialogCallbackHandler$$2.class \
+    com/sun/security/auth/callback/DialogCallbackHandler$$Action.class \
+    com/sun/security/auth/callback/DialogCallbackHandler$$ConfirmationInfo.class \
+    com/sun/security/auth/callback/DialogCallbackHandler.class \
     javax/annotation/*.class \
+    javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
+    javax/management/remote/rmi/_RMIConnection_Stub.class \
+    javax/management/remote/rmi/_RMIServerImpl_Tie.class \
+    javax/management/remote/rmi/_RMIServer_Stub.class \
     javax/rmi/*.class
 
-PROFILE_4_RTJAR_EXCLUDE_TYPES := 
+FULL_JRE_RTJAR_EXCLUDE_TYPES := 
 
-PROFILE_4_INCLUDE_METAINF_SERVICES := \
+FULL_JRE_INCLUDE_METAINF_SERVICES := \
     META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin  \
     META-INF/services/com.sun.tools.internal.xjc.Plugin  \
     META-INF/services/javax.print.PrintServiceLookup  \
--- a/jdk/src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Fri Mar 15 23:31:19 2013 -0700
@@ -32,11 +32,13 @@
 import java.text.spi.DecimalFormatSymbolsProvider;
 import java.text.spi.NumberFormatProvider;
 import java.util.Collections;
+import java.util.Calendar;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle.Control;
 import java.util.Set;
+import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReferenceArray;
@@ -45,6 +47,7 @@
 import java.util.spi.CurrencyNameProvider;
 import java.util.spi.LocaleNameProvider;
 import java.util.spi.TimeZoneNameProvider;
+import sun.util.spi.CalendarProvider;
 
 /**
  * LocaleProviderAdapter implementation for the Mac OS X locale data
@@ -94,17 +97,56 @@
 
     private static final Set<Locale> supportedLocaleSet;
     static {
-        Set<Locale> tmpSet = new HashSet<Locale>();
+        Set<Locale> tmpSet = new HashSet<>();
         // Assuming the default locales do not include any extensions, so
         // no stripping is needed here.
-        Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replaceAll("_","-"));
+        Locale l = convertMacOSXLocaleToJavaLocale(getDefaultLocale(CAT_FORMAT));
         tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
-        l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replaceAll("_","-"));
+        l = convertMacOSXLocaleToJavaLocale(getDefaultLocale(CAT_DISPLAY));
         tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
         supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
     }
     private final static Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]);
 
+    @SuppressWarnings("fallthrough")
+    private static Locale convertMacOSXLocaleToJavaLocale(String macosxloc) {
+        // MacOSX may return ICU notation, here is the quote from CFLocale doc:
+        // "The corresponding value is a CFString containing the POSIX locale
+        // identifier as used by ICU, such as "ja_JP". If you have a variant
+        // locale or a different currency or calendar, it can be as complex as
+        // "en_US_POSIX@calendar=japanese;currency=EUR" or
+        // "az_Cyrl_AZ@calendar=buddhist;currency=JPY".
+        String[] tmp = macosxloc.split("@");
+        String langTag = tmp[0].replace('_', '-');
+        if (tmp.length > 1) {
+            String[] ext = tmp[1].split(";");
+            for (String keyval : ext) {
+                // We are only interested in "calendar" value for now.
+                if (keyval.startsWith("calendar=")) {
+                    String calid = keyval.substring(keyval.indexOf('=')+1);
+                    switch (calid) {
+                        case "gregorian":
+                            langTag += "-u-ca-gregory";
+                            break;
+                        case "japanese":
+                            // Tweak for ja_JP_JP
+                            if (tmp[0].equals("ja_JP")) {
+                                return JRELocaleConstants.JA_JP_JP;
+                            }
+
+                            // fall through
+
+                        default:
+                            langTag += "-u-ca-" + calid;
+                            break;
+                    }
+                }
+            }
+        }
+
+        return Locale.forLanguageTag(langTag);
+    }
+
     public static DateFormatProvider getDateFormatProvider() {
         return new DateFormatProvider() {
 
@@ -170,9 +212,8 @@
                 if (isSupportedLocale(Locale.getDefault(Locale.Category.FORMAT))) {
                     return supportedLocale;
                 }
-
-                        return new Locale[0];
-                    }
+                return new Locale[0];
+            }
 
             @Override
             public boolean isSupportedLocale(Locale locale) {
@@ -362,6 +403,30 @@
         };
     }
 
+    public static CalendarProvider getCalendarProvider() {
+        return new CalendarProvider() {
+            @Override
+            public Locale[] getAvailableLocales() {
+                return getSupportedCalendarLocales();
+            }
+
+            @Override
+            public boolean isSupportedLocale(Locale locale) {
+                return isSupportedCalendarLocale(locale);
+            }
+
+            @Override
+            public Calendar getInstance(TimeZone zone, Locale locale) {
+                return new Calendar.Builder()
+                             .setLocale(locale)
+                             .setCalendarType(getCalendarID(locale.toLanguageTag()))
+                             .setTimeZone(zone)
+                             .setInstant(System.currentTimeMillis())
+                             .build();
+            }
+        };
+    }
+
     public static CurrencyNameProvider getCurrencyNameProvider() {
         return new CurrencyNameProvider() {
             @Override
@@ -455,23 +520,20 @@
     }
 
     private static boolean isSupportedCalendarLocale(Locale locale) {
-        // special case for ja_JP_JP
-        if (JRELocaleConstants.JA_JP_JP.equals(locale)) {
-            return isJapaneseCalendar();
-        }
-
         Locale base = locale.stripExtensions();
         if (!supportedLocaleSet.contains(base)) {
             return false;
         }
 
-        String caltype = locale.getUnicodeLocaleType("ca");
-        if (caltype == null) {
-            return true;
+        String requestedCalType = locale.getUnicodeLocaleType("ca");
+        String nativeCalType =
+            getCalendarID(locale.toLanguageTag()).replaceFirst("gregorian", "gregory");
+
+        if (requestedCalType == null) {
+            return Calendar.getAvailableCalendarTypes().contains(nativeCalType);
+        } else {
+            return requestedCalType.equals(nativeCalType);
         }
-
-        return caltype.replaceFirst("gregory", "gregorian").equals(
-                getCalendarID(locale.toLanguageTag()));
     }
 
     private static boolean isJapaneseCalendar() {
@@ -479,18 +541,15 @@
     }
 
     private static Locale getCalendarLocale(Locale locale) {
-        Locale.Builder lb = new Locale.Builder().setLocale(locale);
-        String calid = getCalendarID(locale.toLanguageTag());
-        switch (calid) {
-            case "gregorian":
-                calid = "gregory";
-                // FALL THROUGH!
-            case "japanese":
-            case "buddhist":
-                lb.setUnicodeLocaleKeyword("ca", calid);
-                return lb.build();
-            default:
-                return locale;
+        String nativeCalType = getCalendarID(locale.toLanguageTag())
+                     .replaceFirst("gregorian", "gregory");
+        if (Calendar.getAvailableCalendarTypes().contains(nativeCalType)) {
+            return new Locale.Builder()
+                           .setLocale(locale)
+                           .setUnicodeLocaleKeyword("ca", nativeCalType)
+                           .build();
+        } else {
+            return locale;
         }
     }
 
--- a/jdk/src/share/classes/com/sun/tools/script/shell/init.js	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/script/shell/init.js	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
  */
 
 /**
- * Creates an object that delegates all method calls on 
+ * Creates an object that delegates all method calls on
  * it to the 'invoke' method on the given delegate object.<br>
  *
  * Example:
@@ -43,13 +43,13 @@
  * @constructor
  */
 function JSInvoker(obj) {
-	return new JSAdapter({
-			__get__ : function(name) {
-				return function() {
-					return obj.invoke(name, arguments);
-				}
-			}
-		});
+    return new JSAdapter({
+        __get__ : function(name) {
+            return function() {
+                return obj.invoke(name, arguments);
+            }
+        }
+    });
 }
 
 /**
@@ -58,24 +58,24 @@
  * example, env.PATH will return PATH value configured.
  */
 var env = new JSAdapter({
-	__get__ : function (name) {
-		return java.lang.System.getenv(name);
-	},
-	__has__ : function (name) {
-		return java.lang.System.getenv().containsKey(name);
-	},
-	__getIds__ : function() {
-		return java.lang.System.getenv().keySet().toArray();
-	},
-	__delete__ : function(name) {
-		println("can't delete env item");
-	},
-	__put__ : function (name, value) {
-		println("can't change env item");
-	},			
-	toString: function() {
-		return java.lang.System.getenv().toString();
-	}		
+    __get__ : function (name) {
+        return java.lang.System.getenv(name);
+    },
+    __has__ : function (name) {
+        return java.lang.System.getenv().containsKey(name);
+    },
+    __getIds__ : function() {
+        return java.lang.System.getenv().keySet().toArray();
+    },
+    __delete__ : function(name) {
+        println("can't delete env item");
+    },
+    __put__ : function (name, value) {
+        println("can't change env item");
+    },
+    toString: function() {
+        return java.lang.System.getenv().toString();
+    }
 });
 
 /**
@@ -91,36 +91,36 @@
  *     delete y['java.class.path']; // remove java.class.path System property
  * </code>
  * </pre>
- * 
+ *
  * @param map java.util.Map instance that will be wrapped
  * @constructor
  */
-function jmap(map) {	
-	return new JSAdapter({
-		__get__ : function(name) {
-			if (map.containsKey(name)) {
-				return map.get(name);
-			} else {
-				return undefined;
-			}
-   		  },
-		__has__ :  function(name) {
-				return map.containsKey(name);
-			},
+function jmap(map) {
+    return new JSAdapter({
+        __get__ : function(name) {
+            if (map.containsKey(name)) {
+                return map.get(name);
+            } else {
+                return undefined;
+            }
+        },
+        __has__ :  function(name) {
+            return map.containsKey(name);
+        },
 
-		__delete__ : function (name) {
-				return map.remove(name);
-			},
-		__put__ : function(name, value) {
-				map.put(name, value);
-			},
-		__getIds__ : function() {
-				return map.keySet().toArray();		
-			},
-		toString: function() {
-				return map.toString();
-		}
-	});
+        __delete__ : function (name) {
+            return map.remove(name);
+        },
+        __put__ : function(name, value) {
+            map.put(name, value);
+        },
+        __getIds__ : function() {
+            return map.keySet().toArray();
+        },
+        toString: function() {
+            return map.toString();
+        }
+    });
 }
 
 /**
@@ -146,52 +146,72 @@
  * @constructor
  */
 function jlist(list) {
-	function isValid(index) {
-		return typeof(index) == 'number' &&
-			index > -1 && index < list.size();
-	}
-	return new JSAdapter({
-		__get__ :  function(name) {
-			if (isValid(name)) {
-				return list.get(name);
-			} else if (name == 'length') {
-				return list.size();
-			} else {
-				return undefined;
-			}
-		},
-		__has__ : function (name) {
-			return isValid(name) || name == 'length';
-		},
-		__delete__ : function(name) {				
-			if (isValid(name)) {
-				list.remove(name);	
-			}
-		},
-		__put__ : function(name, value) {
-			if (isValid(name)) {
-				list.set(name, value);
-			}
-		},
-		__getIds__: function() {
-			var res = new Array(list.size());
-			for (var i = 0; i < res.length; i++) {
-				res[i] = i;
-			}
-			return res;
-		},
-		toString: function() {
-			return list.toString();
-		}				
-	});
+    function isValid(index) {
+        return typeof(index) == 'number' &&
+            index > -1 && index < list.size();
+    }
+    return new JSAdapter({
+        __get__ :  function(name) {
+            if (isValid(name)) {
+                return list.get(name);
+            } else if (name == 'length') {
+                return list.size();
+            } else {
+                return undefined;
+            }
+        },
+        __has__ : function (name) {
+            return isValid(name) || name == 'length';
+        },
+        __delete__ : function(name) {
+            if (isValid(name)) {
+                list.remove(name);
+            }
+        },
+        __put__ : function(name, value) {
+            if (isValid(name)) {
+                list.set(name, value);
+            }
+        },
+        __getIds__: function() {
+            var res = new Array(list.size());
+            for (var i = 0; i < res.length; i++) {
+                res[i] = i;
+            }
+            return res;
+        },
+        toString: function() {
+            return list.toString();
+        }
+    });
 }
 
 /**
- * This is java.lang.System properties wrapped by jmap.
+ * This is java.lang.System properties wrapped by JSAdapter.
  * For eg. to access java.class.path property, you can use
  * the syntax sysProps["java.class.path"]
  */
-var sysProps = jmap(java.lang.System.getProperties());
+var sysProps = new JSAdapter({
+    __get__ : function (name) {
+        return java.lang.System.getProperty(name);
+    },
+    __has__ : function (name) {
+        return java.lang.System.getProperty(name) != null;
+    },
+    __getIds__ : function() {
+        return java.lang.System.getProperties().keySet().toArray();
+    },
+    __delete__ : function(name) {
+        java.lang.System.clearProperty(name);
+        return true;
+    },
+    __put__ : function (name, value) {
+        java.lang.System.setProperty(name, value);
+    },
+    toString: function() {
+        return "<system properties>";
+    }
+});
 
 // stdout, stderr & stdin
 var out = java.lang.System.out;
@@ -199,76 +219,85 @@
 // can't use 'in' because it is a JavaScript keyword :-(
 var inp = java.lang.System["in"];
 
-// useful imports for often used io, net classes
-importPackage(java.io);
-importPackage(java.net);
+var BufferedInputStream = java.io.BufferedInputStream;
+var BufferedOutputStream = java.io.BufferedOutputStream;
+var BufferedReader = java.io.BufferedReader;
+var DataInputStream = java.io.DataInputStream;
+var File = java.io.File;
+var FileInputStream = java.io.FileInputStream;
+var FileOutputStream = java.io.FileOutputStream;
+var InputStream = java.io.InputStream;
+var InputStreamReader = java.io.InputStreamReader;
+var OutputStream = java.io.OutputStream;
+var Reader = java.io.Reader;
+var URL = java.net.URL;
 
 /**
  * Generic any object to input stream mapper
- * @param str input file name, URL or InputStream 
+ * @param str input file name, URL or InputStream
  * @return InputStream object
  * @private
  */
 function inStream(str) {
-	if (typeof(str) == "string") {
-		// '-' means standard input
-		if (str == '-') {
-			return java.lang.System["in"];
-		}
-		// try file first
-		var file = null;
-		try {
-			file = pathToFile(str);
-		} catch (e) {
-		}		
-		if (file && file.exists()) {
-			return new FileInputStream(file);
-		} else {
-			try {
-				// treat the string as URL
-				return new URL(str).openStream();
-			} catch (e) {
-				throw 'file or URL ' + str + ' not found';
-			}
-		}
-	} else {
-		if (str instanceof InputStream) {
-			return str;
-		} else if (str instanceof URL) {
-			return str.openStream();
-		} else if (str instanceof File) {
-			return new FileInputStream(str);
-		}
-	}
-	// everything failed, just give input stream
-	return java.lang.System["in"];
+    if (typeof(str) == "string") {
+        // '-' means standard input
+        if (str == '-') {
+            return java.lang.System["in"];
+        }
+        // try file first
+        var file = null;
+        try {
+            file = pathToFile(str);
+        } catch (e) {
+        }
+        if (file && file.exists()) {
+            return new FileInputStream(file);
+        } else {
+            try {
+                // treat the string as URL
+                return new URL(str).openStream();
+            } catch (e) {
+                throw 'file or URL ' + str + ' not found';
+            }
+        }
+    } else {
+        if (str instanceof InputStream) {
+            return str;
+        } else if (str instanceof URL) {
+            return str.openStream();
+        } else if (str instanceof File) {
+            return new FileInputStream(str);
+        }
+    }
+    // everything failed, just give input stream
+    return java.lang.System["in"];
 }
 
 /**
  * Generic any object to output stream mapper
- * 
+ *
  * @param out output file name or stream
  * @return OutputStream object
  * @private
  */
 function outStream(out) {
-	if (typeof(out) == "string") {
-		if (out == '>') {
-			return java.lang.System.out;
-		} else {
-			// treat it as file			
-			return new FileOutputStream(pathToFile(out));
-		}
-	} else {
-		if (out instanceof OutputStream) {
-			return out;
-		} else if (out instanceof File) {
-			return new FileOutputStream(out);
-		}
-	}
+    if (typeof(out) == "string") {
+        if (out == '>') {
+            return java.lang.System.out;
+        } else {
+            // treat it as file
+            return new FileOutputStream(pathToFile(out));
+        }
+    } else {
+        if (out instanceof OutputStream) {
+            return out;
+        } else if (out instanceof File) {
+            return new FileOutputStream(out);
+        }
+    }
 
-	// everything failed, just return System.out
-	return java.lang.System.out;
+    // everything failed, just return System.out
+    return java.lang.System.out;
 }
 
 /**
@@ -276,17 +305,17 @@
  * @private
  */
 function streamClose(stream) {
-	if (stream) {
-		if (stream != java.lang.System["in"] &&
-			stream != java.lang.System.out &&
-			stream != java.lang.System.err) {
-			try {
-				stream.close();
-			} catch (e) {
-				println(e);
-			}
-		}
-	}
+    if (stream) {
+        if (stream != java.lang.System["in"] &&
+            stream != java.lang.System.out &&
+            stream != java.lang.System.err) {
+            try {
+                stream.close();
+            } catch (e) {
+                println(e);
+            }
+        }
+    }
 }
 
 /**
@@ -302,18 +331,20 @@
  *
  * @param str input from which script is loaded and evaluated
  */
-function load(str) {
-	var stream = inStream(str);
-	var bstream = new BufferedInputStream(stream);
-	var reader = new BufferedReader(new InputStreamReader(bstream));
-	var oldFilename = engine.get(engine.FILENAME);
-	engine.put(engine.FILENAME, str);	
-	try {
-		engine.eval(reader);
-	} finally {
-		engine.put(engine.FILENAME, oldFilename);
-	        streamClose(stream);
-	}
+if (typeof(load) == 'undefined') {
+    var load = function(str) {
+        var stream = inStream(str);
+        var bstream = new BufferedInputStream(stream);
+        var reader = new BufferedReader(new InputStreamReader(bstream));
+        var oldFilename = engine.get(engine.FILENAME);
+        engine.put(engine.FILENAME, str);
+        try {
+            engine.eval(reader);
+        } finally {
+            engine.put(engine.FILENAME, oldFilename);
+            streamClose(stream);
+        }
+    }
 }
 
 // file system utilities
@@ -324,7 +355,7 @@
  * @private
  */
 function javaByteArray(len) {
-	return java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, len);
+    return java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, len);
 }
 
 var curDir = new File('.');
@@ -333,7 +364,7 @@
  * Print present working directory
  */
 function pwd() {
-	println(curDir.getAbsolutePath());
+    println(curDir.getAbsolutePath());
 }
 
 /**
@@ -341,17 +372,17 @@
  * @param target directory to change to. optional, defaults to user's HOME
  */
 function cd(target) {
-	if (target == undefined) {
-		target = sysProps["user.home"];
-	}
-	if (!(target instanceof File)) {
-		target = pathToFile(target);
-	}
-	if (target.exists() && target.isDirectory()) {
-		curDir = target;
-	} else {
-		println(target + " is not a directory");
-	}
+    if (target == undefined) {
+        target = sysProps["user.home"];
+    }
+    if (!(target instanceof File)) {
+        target = pathToFile(target);
+    }
+    if (target.exists() && target.isDirectory()) {
+        curDir = target;
+    } else {
+        println(target + " is not a directory");
+    }
 }
 
 /**
@@ -361,15 +392,15 @@
  * @private
  */
 function pathToFile(pathname) {
-	var tmp = pathname;
-	if (!(tmp instanceof File)) {
-		tmp = new File(tmp);
-	}
-	if (!tmp.isAbsolute()) {
-		return new File(curDir, pathname);
-	} else {
-		return tmp;
-	}
+    var tmp = pathname;
+    if (!(tmp instanceof File)) {
+        tmp = new File(tmp);
+    }
+    if (!tmp.isAbsolute()) {
+        return new File(curDir, pathname);
+    } else {
+        return tmp;
+    }
 }
 
 /**
@@ -379,22 +410,22 @@
  * @param to output stream or file
  */
 function cp(from, to) {
-	if (from == to) {
-		println("file " + from + " cannot be copied onto itself!");
-		return;
-	}
-	var inp = inStream(from);
-	var out = outStream(to);
-	var binp = new BufferedInputStream(inp);
-	var bout = new BufferedOutputStream(out);
-	var buff = javaByteArray(1024);
-	var len;
-	while ((len = binp.read(buff)) > 0 )
-		bout.write(buff, 0, len);
+    if (from == to) {
+        println("file " + from + " cannot be copied onto itself!");
+        return;
+    }
+    var inp = inStream(from);
+    var out = outStream(to);
+    var binp = new BufferedInputStream(inp);
+    var bout = new BufferedOutputStream(out);
+    var buff = javaByteArray(1024);
+    var len;
+    while ((len = binp.read(buff)) > 0 )
+        bout.write(buff, 0, len);
 
-	bout.flush();
-	streamClose(inp);
-	streamClose(out);	
+    bout.flush();
+    streamClose(inp);
+    streamClose(out);
 }
 
 /**
@@ -403,37 +434,37 @@
  * <pre>
  * <code>
  *    cat('test.txt'); // show test.txt file contents
- *    cat('http://java.net'); // show the contents from the URL http://java.net 
+ *    cat('http://java.net'); // show the contents from the URL http://java.net
  * </code>
  * </pre>
  * @param obj input to show
  * @param pattern optional. show only the lines matching the pattern
  */
 function cat(obj, pattern) {
-	if (obj instanceof File && obj.isDirectory()) {
-		ls(obj);
-		return;
-	}
-	
-	var inp = null;
-	if (!(obj instanceof Reader)) {
-		inp = inStream(obj);
-		obj = new BufferedReader(new InputStreamReader(inp));
-	}
-	var line;
-	if (pattern) {
-		var count = 1;
-		while ((line=obj.readLine()) != null) {
-			if (line.match(pattern)) {
-				println(count + "\t: " + line);
-			}
-			count++;
-		}
-	} else {
-		while ((line=obj.readLine()) != null) {
-			println(line);
-		}
-	}
+    if (obj instanceof File && obj.isDirectory()) {
+        ls(obj);
+        return;
+    }
+
+    var inp = null;
+    if (!(obj instanceof Reader)) {
+        inp = inStream(obj);
+        obj = new BufferedReader(new InputStreamReader(inp));
+    }
+    var line;
+    if (pattern) {
+        var count = 1;
+        while ((line=obj.readLine()) != null) {
+            if (line.match(pattern)) {
+                println(count + "\t: " + line);
+            }
+            count++;
+        }
+    } else {
+        while ((line=obj.readLine()) != null) {
+            println(line);
+        }
+    }
 }
 
 /**
@@ -443,13 +474,13 @@
  * @return directory part of the given file name
  */
 function dirname(pathname) {
-	var dirName = ".";
-	// Normalize '/' to local file separator before work.
-	var i = pathname.replace('/', File.separatorChar ).lastIndexOf( 
-		File.separator );
-	if ( i != -1 )
-		dirName = pathname.substring(0, i);
-	return dirName;
+    var dirName = ".";
+    // Normalize '/' to local file separator before work.
+    var i = pathname.replace('/', File.separatorChar ).lastIndexOf(
+        File.separator );
+    if ( i != -1 )
+        dirName = pathname.substring(0, i);
+    return dirName;
 }
 
 /**
@@ -458,34 +489,34 @@
  * @param dir name of the new directory
  */
 function mkdir(dir) {
-	var dir = pathToFile(dir);
-	println(dir.mkdir()? "created" : "can not create dir");
+    dir = pathToFile(dir);
+    println(dir.mkdir()? "created" : "can not create dir");
 }
 
 /**
- * Creates the directory named by given pathname, including 
+ * Creates the directory named by given pathname, including
  * any necessary but nonexistent parent directories.
  *
  * @param dir input path name
  */
 function mkdirs(dir) {
-	var dir = pathToFile(dir);
-	println(dir.mkdirs()? "created" : "can not create dirs");
+    dir = pathToFile(dir);
+    println(dir.mkdirs()? "created" : "can not create dirs");
 }
-	
+
 /**
- * Removes a given file 
+ * Removes a given file
  *
- * @param pathname name of the file 
+ * @param pathname name of the file
  */
 function rm(pathname) {
-    	file = pathToFile(pathname);
-	if (!file.exists()) {
-		println("file not found: " + pathname);
-		return false;
-	}
-	// note that delete is a keyword in JavaScript!
-	println(file["delete"]()? "deleted" : "can not delete");
+    var file = pathToFile(pathname);
+    if (!file.exists()) {
+        println("file not found: " + pathname);
+        return false;
+    }
+    // note that delete is a keyword in JavaScript!
+    println(file["delete"]()? "deleted" : "can not delete");
 }
 
 /**
@@ -494,14 +525,14 @@
  * @param pathname name of the directory
  */
 function rmdir(pathname) {
-	rm(pathname);
+    rm(pathname);
 }
 
 /**
  * Synonym for 'rm'
  */
 function del(pathname) {
-	rm(pathname);
+    rm(pathname);
 }
 
 /**
@@ -511,62 +542,62 @@
  * @param to new name for the file
  */
 function mv(from, to) {
-	println(pathToFile(from).renameTo(pathToFile(to))? 
-		"moved" : "can not move");
+    println(pathToFile(from).renameTo(pathToFile(to))?
+        "moved" : "can not move");
 }
 
 /**
  * Synonym for 'mv'.
  */
 function ren(from, to) {
-	mv(from, to);
+    mv(from, to);
 }
 
-var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
-		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
+var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
 
 /**
  * Helper function called by ls
  * @private
- */	
+ */
 function printFile(f) {
-	var sb = new java.lang.StringBuffer();
-	sb.append(f.isDirectory()? "d" : "-");
-	sb.append(f.canRead() ? "r": "-" );
-	sb.append(f.canWrite() ? "w": "-" );		
-	sb.append(" ");
+    var sb = new java.lang.StringBuffer();
+    sb.append(f.isDirectory()? "d" : "-");
+    sb.append(f.canRead() ? "r": "-" );
+    sb.append(f.canWrite() ? "w": "-" );
+    sb.append(" ");
 
-	var d = new java.util.Date(f.lastModified());
-	var c = new java.util.GregorianCalendar();
-	c.setTime(d);
-	var day	= c.get(java.util.Calendar.DAY_OF_MONTH);
-	sb.append(months[c.get(java.util.Calendar.MONTH)]
-		 + " " + day );
-	if (day < 10) {
-		sb.append(" ");
-	}
+    var d = new java.util.Date(f.lastModified());
+    var c = new java.util.GregorianCalendar();
+    c.setTime(d);
+    var day    = c.get(java.util.Calendar.DAY_OF_MONTH);
+    sb.append(months[c.get(java.util.Calendar.MONTH)]
+         + " " + day );
+    if (day < 10) {
+        sb.append(" ");
+    }
 
-	// to get fixed length 'length' field
-	var fieldlen = 8;
-	var len = new java.lang.StringBuffer();
-	for(var j=0; j<fieldlen; j++)
-		len.append(" ");
-	len.insert(0, java.lang.Long.toString(f.length()));
-	len.setLength(fieldlen);
-	// move the spaces to the front
-	var si = len.toString().indexOf(" ");
-	if ( si != -1 ) {
-		var pad = len.toString().substring(si);
-		len.setLength(si);
-		len.insert(0, pad);
-	}
-	sb.append(len.toString());
-	sb.append(" ");
-	sb.append(f.getName());
-	if (f.isDirectory()) {
-		sb.append('/');
-	}
-	println(sb.toString());
+    // to get fixed length 'length' field
+    var fieldlen = 8;
+    var len = new java.lang.StringBuffer();
+    for(var j=0; j<fieldlen; j++)
+        len.append(" ");
+    len.insert(0, java.lang.Long.toString(f.length()));
+    len.setLength(fieldlen);
+    // move the spaces to the front
+    var si = len.toString().indexOf(" ");
+    if ( si != -1 ) {
+        var pad = len.toString().substring(si);
+        len.setLength(si);
+        len.insert(0, pad);
+    }
+    sb.append(len.toString());
+    sb.append(" ");
+    sb.append(f.getName());
+    if (f.isDirectory()) {
+        sb.append('/');
+    }
+    println(sb.toString());
 }
 
 /**
@@ -576,32 +607,32 @@
  * @param filter pattern to filter the files listed. optional, default is '.'.
  */
 function ls(dir, filter) {
-	if (dir) {
-		dir = pathToFile(dir);		
-	} else {
-		dir = curDir;
-	}
-	if (dir.isDirectory()) {
-		var files = dir.listFiles();
-		for (var i in files) {
-			var f = files[i];
-			if (filter) {			
-				if(!f.getName().match(filter)) {
-					continue;
-				}
-			}
-			printFile(f);
-		}
-	} else {
-		printFile(dir);
-	}
+    if (dir) {
+        dir = pathToFile(dir);
+    } else {
+        dir = curDir;
+    }
+    if (dir.isDirectory()) {
+        var files = dir.listFiles();
+        for (var i in files) {
+            var f = files[i];
+            if (filter) {
+                if(!f.getName().match(filter)) {
+                    continue;
+                }
+            }
+            printFile(f);
+        }
+    } else {
+        printFile(dir);
+    }
 }
 
 /**
  * Synonym for 'ls'.
  */
 function dir(d, filter) {
-	ls(d, filter);
+    ls(d, filter);
 }
 
 /**
@@ -611,24 +642,24 @@
  * @param files one or more files
  */
 function grep(pattern, files /*, one or more files */) {
-	if (arguments.length < 2) return;
-	for (var i = 1; i < arguments.length; i++) {
-		println(arguments[i] + ":");
-		cat(arguments[i], pattern);
-	}
+    if (arguments.length < 2) return;
+    for (var i = 1; i < arguments.length; i++) {
+        println(arguments[i] + ":");
+        cat(arguments[i], pattern);
+    }
 }
 
 /**
  * Find in files. Calls arbitrary callback function
  * for each matching file.<br>
  *
- * Examples: 
+ * Examples:
  * <pre>
  * <code>
- *    find('.') 
- *    find('.', '.*\.class', rm);  // remove all .class files 
- *    find('.', '.*\.java');       // print fullpath of each .java file 
- *    find('.', '.*\.java', cat);  // print all .java files 
+ *    find('.')
+ *    find('.', '.*\.class', rm);  // remove all .class files
+ *    find('.', '.*\.java');       // print fullpath of each .java file
+ *    find('.', '.*\.java', cat);  // print all .java files
  * </code>
  * </pre>
  *
@@ -637,23 +668,23 @@
  * @param callback function to call for matching files
  */
 function find(dir, pattern, callback) {
-	dir = pathToFile(dir);
-	if (!callback) callback = print;
-	var files = dir.listFiles();
-	for (var f in files) {
-		var file = files[f];
-		if (file.isDirectory()) {
-			find(file, pattern, callback);
-		} else {
-			if (pattern) {
-				if (file.getName().match(pattern)) {
-					callback(file);
-				}
-			} else {
-				callback(file);
-			}
-		}
-	}	
+    dir = pathToFile(dir);
+    if (!callback) callback = print;
+    var files = dir.listFiles();
+    for (var f in files) {
+        var file = files[f];
+        if (file.isDirectory()) {
+            find(file, pattern, callback);
+        } else {
+            if (pattern) {
+                if (file.getName().match(pattern)) {
+                    callback(file);
+                }
+            } else {
+                callback(file);
+            }
+        }
+    }
 }
 
 // process utilities
@@ -664,40 +695,44 @@
  * @param cmd command to execute in child process
  */
 function exec(cmd) {
-	var process = java.lang.Runtime.getRuntime().exec(cmd);
-	var inp = new DataInputStream(process.getInputStream());
-	var line = null;
-	while ((line = inp.readLine()) != null) {
-		println(line);
-	}
-	process.waitFor();
-	$exit = process.exitValue();
+    var process = java.lang.Runtime.getRuntime().exec(cmd);
+    var inp = new DataInputStream(process.getInputStream());
+    var line = null;
+    while ((line = inp.readLine()) != null) {
+        println(line);
+    }
+    process.waitFor();
+    $exit = process.exitValue();
 }
 
-/**
- * Exit the shell program.
- *
- * @param exitCode integer code returned to OS shell.
- * optional, defaults to 0
- */
-function exit(code) {
-	if (code) {
-		java.lang.System.exit(code + 0);		
-	} else {
-		java.lang.System.exit(0);		
-	}
+if (typeof(exit) == 'undefined') {
+    /**
+     * Exit the shell program.
+     *
+     * @param exitCode integer code returned to OS shell.
+     * optional, defaults to 0
+     */
+    var exit = function (code) {
+        if (code) {
+            java.lang.System.exit(code + 0);
+        } else {
+            java.lang.System.exit(0);
+        }
+    }
 }
 
-/**
- * synonym for exit
- */
-function quit(code) {
-	exit(code);
+if (typeof(quit) == 'undefined') {
+    /**
+     * synonym for exit
+     */
+    var quit = function (code) {
+        exit(code);
+    }
 }
 
 // XML utilities
 
-/** 
+/**
  * Converts input to DOM Document object
  *
  * @param inp file or reader. optional, without this param,
@@ -705,17 +740,17 @@
  * @return returns a DOM Document object
  */
 function XMLDocument(inp) {
-	var factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
-	var builder = factory.newDocumentBuilder();
-	if (inp) {
-		if (typeof(inp) == "string") {
-			return builder.parse(pathToFile(inp));
-		} else {
-			return builder.parse(inp);
-		}
-	} else {
-		return builder.newDocument();
-	}
+    var factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+    var builder = factory.newDocumentBuilder();
+    if (inp) {
+        if (typeof(inp) == "string") {
+            return builder.parse(pathToFile(inp));
+        } else {
+            return builder.parse(inp);
+        }
+    } else {
+        return builder.newDocument();
+    }
 }
 
 /**
@@ -725,14 +760,14 @@
  * @return XMLSource object
  */
 function XMLSource(inp) {
-	if (inp instanceof javax.xml.transform.Source) {
-		return inp;
-	} else if (inp instanceof Packages.org.w3c.dom.Document) {
-		return new javax.xml.transform.dom.DOMSource(inp);
-	} else {
-		inp = new BufferedInputStream(inStream(inp));
-		return new javax.xml.transform.stream.StreamSource(inp);
-	}
+    if (inp instanceof javax.xml.transform.Source) {
+        return inp;
+    } else if (inp instanceof Packages.org.w3c.dom.Document) {
+        return new javax.xml.transform.dom.DOMSource(inp);
+    } else {
+        inp = new BufferedInputStream(inStream(inp));
+        return new javax.xml.transform.stream.StreamSource(inp);
+    }
 }
 
 /**
@@ -742,73 +777,73 @@
  * @return XMLResult object
  */
 function XMLResult(out) {
-	if (out instanceof javax.xml.transform.Result) {
-		return out;
-	} else if (out instanceof Packages.org.w3c.dom.Document) {
-		return new javax.xml.transform.dom.DOMResult(out);
-	} else {
-		out = new BufferedOutputStream(outStream(out));
-		return new javax.xml.transform.stream.StreamResult(out);
-	}
+    if (out instanceof javax.xml.transform.Result) {
+        return out;
+    } else if (out instanceof Packages.org.w3c.dom.Document) {
+        return new javax.xml.transform.dom.DOMResult(out);
+    } else {
+        out = new BufferedOutputStream(outStream(out));
+        return new javax.xml.transform.stream.StreamResult(out);
+    }
 }
 
 /**
- * Perform XSLT transform 
+ * Perform XSLT transform
  *
  * @param inp Input XML to transform (URL, File or InputStream)
  * @param style XSL Stylesheet to be used (URL, File or InputStream). optional.
  * @param out Output XML (File or OutputStream
  */
 function XSLTransform(inp, style, out) {
-	switch (arguments.length) {
-	case 2:
-		inp = arguments[0];
-		out = arguments[1];
-		break;
-	case 3:
-		inp = arguments[0];
-		style = arguments[1];
-		out = arguments[2];
-		break;
-	default:
-		println("XSL tranform requires 2 or 3 arguments");
-		return;
-	}
+    switch (arguments.length) {
+    case 2:
+        inp = arguments[0];
+        out = arguments[1];
+        break;
+    case 3:
+        inp = arguments[0];
+        style = arguments[1];
+        out = arguments[2];
+        break;
+    default:
+        println("XSL tranform requires 2 or 3 arguments");
+        return;
+    }
 
-	var factory = javax.xml.transform.TransformerFactory.newInstance();
-	var tranformer;
-	if (style) {		
-		transformer = factory.newTransformer(XMLSource(style));	
-	} else {
-		transformer = factory.newTransformer();
-	}
-	var source = XMLSource(inp);
-	var result = XMLResult(out);
-	transformer.transform(source, result);
-	if (source.getInputStream) {
-		streamClose(source.getInputStream());
-	}
-	if (result.getOutputStream) {
-		streamClose(result.getOutputStream());
-	}
+    var factory = javax.xml.transform.TransformerFactory.newInstance();
+    var transformer;
+    if (style) {
+        transformer = factory.newTransformer(XMLSource(style));
+    } else {
+        transformer = factory.newTransformer();
+    }
+    var source = XMLSource(inp);
+    var result = XMLResult(out);
+    transformer.transform(source, result);
+    if (source.getInputStream) {
+        streamClose(source.getInputStream());
+    }
+    if (result.getOutputStream) {
+        streamClose(result.getOutputStream());
+    }
 }
 
 // miscellaneous utilities
 
 /**
- * Prints which command is selected from PATH 
+ * Prints which command is selected from PATH
  *
  * @param cmd name of the command searched from PATH
  */
 function which(cmd) {
-	var st = new java.util.StringTokenizer(env.PATH, File.pathSeparator);
-	while (st.hasMoreTokens()) {
-		var file = new File(st.nextToken(), cmd);
-		if (file.exists()) {
-			println(file.getAbsolutePath());
-			return;
-		}
-	}
+    var st = new java.util.StringTokenizer(env.PATH, File.pathSeparator);
+    while (st.hasMoreTokens()) {
+        var file = new File(st.nextToken(), cmd);
+        if (file.exists()) {
+            println(file.getAbsolutePath());
+            return;
+        }
+    }
 }
 
 /**
@@ -817,41 +852,43 @@
  * @param name domain name
  */
 function ip(name) {
-	var addrs = InetAddress.getAllByName(name);	
-	for (var i in addrs) {
-		println(addrs[i]);
-	}
+    var addrs = InetAddress.getAllByName(name);
+    for (var i in addrs) {
+        println(addrs[i]);
+    }
 }
 
 /**
  * Prints current date in current locale
  */
 function date() {
-	println(new Date().toLocaleString());
+    println(new Date().toLocaleString());
 }
 
 /**
  * Echoes the given string arguments
  */
 function echo(x) {
-	for (var i = 0; i < arguments.length; i++) {
-		println(arguments[i]);
-	}
+    for (var i = 0; i < arguments.length; i++) {
+        println(arguments[i]);
+    }
 }
 
-/**
- * This is C-like printf 
- *
- * @param format string to format the rest of the print items
- * @param args variadic argument list
- */
-function printf(format, args/*, more args*/) {	
-	var array = java.lang.reflect.Array.newInstance(java.lang.Object, 
-			arguments.length - 1);
-	for (var i = 0; i < array.length; i++) {
-		array[i] = arguments[i+1];
-	}
-	return java.lang.System.out.printf(format, array);
+if (typeof(printf) == 'undefined') {
+    /**
+     * This is C-like printf 
+     *
+     * @param format string to format the rest of the print items
+     * @param args variadic argument list
+     */
+    var printf = function (format, args/*, more args*/) {  
+        var array = java.lang.reflect.Array.newInstance(java.lang.Object, 
+                    arguments.length - 1);
+        for (var i = 0; i < array.length; i++) {
+            array[i] = arguments[i+1];
+        }
+        java.lang.System.out.printf(format, array);
+    }
 }
 
 /**
@@ -861,24 +898,48 @@
  * @param multiline to tell whether to read single line or multiple lines
  */
 function read(prompt, multiline) {
-	if (!prompt) {
-		prompt = '>';
-	}	
-	var inp = java.lang.System["in"];
-	var reader = new BufferedReader(new InputStreamReader(inp));
-	if (multiline) {
-		var line = '';
-		while (true) {
-			java.lang.System.err.print(prompt);
-			java.lang.System.err.flush();
-			var tmp = reader.readLine();
-			if (tmp == '' || tmp == null) break;
-			line += tmp + '\n';
-		}
-		return line;
-	} else {
-		java.lang.System.err.print(prompt);
-		java.lang.System.err.flush();	
-		return reader.readLine();
-	}
+    if (!prompt) {
+        prompt = '>';
+    }
+    var inp = java.lang.System["in"];
+    var reader = new BufferedReader(new InputStreamReader(inp));
+    if (multiline) {
+        var line = '';
+        while (true) {
+            java.lang.System.err.print(prompt);
+            java.lang.System.err.flush();
+            var tmp = reader.readLine();
+            if (tmp == '' || tmp == null) break;
+            line += tmp + '\n';
+        }
+        return line;
+    } else {
+        java.lang.System.err.print(prompt);
+        java.lang.System.err.flush();
+        return reader.readLine();
+    }
 }
+
+if (typeof(println) == 'undefined') {
+    var print = function(str, newline) {
+        if (typeof(str) == 'undefined') {
+            str = 'undefined';
+        } else if (str == null) {
+            str = 'null';
+        }
+
+        if (!(out instanceof java.io.PrintWriter)) {
+            out = new java.io.PrintWriter(out);
+        }
+
+        out.print(String(str));
+        if (newline) {
+            out.print('\n');
+        }
+        out.flush();
+    }
+
+    var println = function(str) {
+        print(str, true);
+    };
+}
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1683,22 +1683,29 @@
         private int jniVersion;
         // the class from which the library is loaded, also indicates
         // the loader this native library belongs.
-        private Class<?> fromClass;
+        private final Class<?> fromClass;
         // the canonicalized name of the native library.
+        // or static library name
         String name;
+        // Indicates if the native library is linked into the VM
+        boolean isBuiltin;
+        // Indicates if the native library is loaded
+        boolean loaded;
+        native void load(String name, boolean isBuiltin);
 
-        native void load(String name);
         native long find(String name);
-        native void unload();
+        native void unload(String name, boolean isBuiltin);
+        static native String findBuiltinLib(String name);
 
-        public NativeLibrary(Class<?> fromClass, String name) {
+        public NativeLibrary(Class<?> fromClass, String name, boolean isBuiltin) {
             this.name = name;
             this.fromClass = fromClass;
+            this.isBuiltin = isBuiltin;
         }
 
         protected void finalize() {
             synchronized (loadedLibraryNames) {
-                if (fromClass.getClassLoader() != null && handle != 0) {
+                if (fromClass.getClassLoader() != null && loaded) {
                     /* remove the native library name */
                     int size = loadedLibraryNames.size();
                     for (int i = 0; i < size; i++) {
@@ -1710,7 +1717,7 @@
                     /* unload the library. */
                     ClassLoader.nativeLibraryContext.push(this);
                     try {
-                        unload();
+                        unload(name, isBuiltin);
                     } finally {
                         ClassLoader.nativeLibraryContext.pop();
                     }
@@ -1830,20 +1837,24 @@
     }
 
     private static boolean loadLibrary0(Class<?> fromClass, final File file) {
-        boolean exists = AccessController.doPrivileged(
-            new PrivilegedAction<Object>() {
-                public Object run() {
-                    return file.exists() ? Boolean.TRUE : null;
-                }})
-            != null;
-        if (!exists) {
-            return false;
-        }
-        String name;
-        try {
-            name = file.getCanonicalPath();
-        } catch (IOException e) {
-            return false;
+        // Check to see if we're attempting to access a static library
+        String name = NativeLibrary.findBuiltinLib(file.getName());
+        boolean isBuiltin = (name != null);
+        if (!isBuiltin) {
+            boolean exists = AccessController.doPrivileged(
+                new PrivilegedAction<Object>() {
+                    public Object run() {
+                        return file.exists() ? Boolean.TRUE : null;
+                    }})
+                != null;
+            if (!exists) {
+                return false;
+            }
+            try {
+                name = file.getCanonicalPath();
+            } catch (IOException e) {
+                return false;
+            }
         }
         ClassLoader loader =
             (fromClass == null) ? null : fromClass.getClassLoader();
@@ -1891,14 +1902,14 @@
                         }
                     }
                 }
-                NativeLibrary lib = new NativeLibrary(fromClass, name);
+                NativeLibrary lib = new NativeLibrary(fromClass, name, isBuiltin);
                 nativeLibraryContext.push(lib);
                 try {
-                    lib.load(name);
+                    lib.load(name, isBuiltin);
                 } finally {
                     nativeLibraryContext.pop();
                 }
-                if (lib.handle != 0) {
+                if (lib.loaded) {
                     loadedLibraryNames.addElement(name);
                     libs.addElement(lib);
                     return true;
--- a/jdk/src/share/classes/java/lang/Runtime.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Runtime.java	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -749,10 +749,21 @@
     public native void traceMethodCalls(boolean on);
 
     /**
-     * Loads the specified filename as a dynamic library. The filename
-     * argument must be a complete path name,
+     * Loads the native library specified by the filename argument.  The filename
+     * argument must be an absolute path name.
      * (for example
      * <code>Runtime.getRuntime().load("/home/avh/lib/libX11.so");</code>).
+     *
+     * If the filename argument, when stripped of any platform-specific library
+     * prefix, path, and file extension, indicates a library whose name is,
+     * for example, L, and a native library called L is statically linked
+     * with the VM, then the JNI_OnLoad_L function exported by the library
+     * is invoked rather than attempting to load a dynamic library.
+     * A filename matching the argument does not have to exist in the file
+     * system. See the JNI Specification for more details.
+     *
+     * Otherwise, the filename argument is mapped to a native library image in
+     * an implementation-dependent manner.
      * <p>
      * First, if there is a security manager, its <code>checkLink</code>
      * method is called with the <code>filename</code> as its argument.
@@ -769,7 +780,10 @@
      * @exception  SecurityException  if a security manager exists and its
      *             <code>checkLink</code> method doesn't allow
      *             loading of the specified dynamic library
-     * @exception  UnsatisfiedLinkError  if the file does not exist.
+     * @exception  UnsatisfiedLinkError  if either the filename is not an
+     *             absolute path name, the native library is not statically
+     *             linked with the VM, or the library cannot be mapped to
+     *             a native library image by the host system.
      * @exception  NullPointerException if <code>filename</code> is
      *             <code>null</code>
      * @see        java.lang.Runtime#getRuntime()
@@ -793,12 +807,16 @@
     }
 
     /**
-     * Loads the dynamic library with the specified library name.
-     * A file containing native code is loaded from the local file system
-     * from a place where library files are conventionally obtained. The
-     * details of this process are implementation-dependent. The
-     * mapping from a library name to a specific filename is done in a
-     * system-specific manner.
+     * Loads the native library specified by the <code>libname</code>
+     * argument.  The <code>libname</code> argument must not contain any platform
+     * specific prefix, file extension or path. If a native library
+     * called <code>libname</code> is statically linked with the VM, then the
+     * JNI_OnLoad_<code>libname</code> function exported by the library is invoked.
+     * See the JNI Specification for more details.
+     *
+     * Otherwise, the libname argument is loaded from a system library
+     * location and mapped to a native library image in an implementation-
+     * dependent manner.
      * <p>
      * First, if there is a security manager, its <code>checkLink</code>
      * method is called with the <code>libname</code> as its argument.
@@ -823,7 +841,10 @@
      * @exception  SecurityException  if a security manager exists and its
      *             <code>checkLink</code> method doesn't allow
      *             loading of the specified dynamic library
-     * @exception  UnsatisfiedLinkError  if the library does not exist.
+     * @exception  UnsatisfiedLinkError if either the libname argument
+     *             contains a file path, the native library is not statically
+     *             linked with the VM,  or the library cannot be mapped to a
+     *             native library image by the host system.
      * @exception  NullPointerException if <code>libname</code> is
      *             <code>null</code>
      * @see        java.lang.SecurityException
--- a/jdk/src/share/classes/java/lang/System.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/java/lang/System.java	Fri Mar 15 23:31:19 2013 -0700
@@ -1037,9 +1037,21 @@
     }
 
     /**
-     * Loads a code file with the specified filename from the local file
-     * system as a dynamic library. The filename
-     * argument must be a complete path name.
+     * Loads the native library specified by the filename argument.  The filename
+     * argument must be an absolute path name.
+     *
+     * If the filename argument, when stripped of any platform-specific library
+     * prefix, path, and file extension, indicates a library whose name is,
+     * for example, L, and a native library called L is statically linked
+     * with the VM, then the JNI_OnLoad_L function exported by the library
+     * is invoked rather than attempting to load a dynamic library.
+     * A filename matching the argument does not have to exist in the
+     * file system.
+     * See the JNI Specification for more details.
+     *
+     * Otherwise, the filename argument is mapped to a native library image in
+     * an implementation-dependent manner.
+     *
      * <p>
      * The call <code>System.load(name)</code> is effectively equivalent
      * to the call:
@@ -1051,7 +1063,10 @@
      * @exception  SecurityException  if a security manager exists and its
      *             <code>checkLink</code> method doesn't allow
      *             loading of the specified dynamic library
-     * @exception  UnsatisfiedLinkError  if the file does not exist.
+     * @exception  UnsatisfiedLinkError  if either the filename is not an
+     *             absolute path name, the native library is not statically
+     *             linked with the VM, or the library cannot be mapped to
+     *             a native library image by the host system.
      * @exception  NullPointerException if <code>filename</code> is
      *             <code>null</code>
      * @see        java.lang.Runtime#load(java.lang.String)
@@ -1062,9 +1077,16 @@
     }
 
     /**
-     * Loads the system library specified by the <code>libname</code>
-     * argument. The manner in which a library name is mapped to the
-     * actual system library is system dependent.
+     * Loads the native library specified by the <code>libname</code>
+     * argument.  The <code>libname</code> argument must not contain any platform
+     * specific prefix, file extension or path. If a native library
+     * called <code>libname</code> is statically linked with the VM, then the
+     * JNI_OnLoad_<code>libname</code> function exported by the library is invoked.
+     * See the JNI Specification for more details.
+     *
+     * Otherwise, the libname argument is loaded from a system library
+     * location and mapped to a native library image in an implementation-
+     * dependent manner.
      * <p>
      * The call <code>System.loadLibrary(name)</code> is effectively
      * equivalent to the call
@@ -1076,7 +1098,10 @@
      * @exception  SecurityException  if a security manager exists and its
      *             <code>checkLink</code> method doesn't allow
      *             loading of the specified dynamic library
-     * @exception  UnsatisfiedLinkError  if the library does not exist.
+     * @exception  UnsatisfiedLinkError if either the libname argument
+     *             contains a file path, the native library is not statically
+     *             linked with the VM,  or the library cannot be mapped to a
+     *             native library image by the host system.
      * @exception  NullPointerException if <code>libname</code> is
      *             <code>null</code>
      * @see        java.lang.Runtime#loadLibrary(java.lang.String)
--- a/jdk/src/share/classes/java/util/Calendar.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/java/util/Calendar.java	Fri Mar 15 23:31:19 2013 -0700
@@ -57,6 +57,8 @@
 import sun.util.BuddhistCalendar;
 import sun.util.calendar.ZoneInfo;
 import sun.util.locale.provider.CalendarDataUtility;
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.spi.CalendarProvider;
 
 /**
  * The <code>Calendar</code> class is an abstract class that provides methods
@@ -1608,9 +1610,7 @@
      */
     public static Calendar getInstance()
     {
-        Calendar cal = createCalendar(TimeZone.getDefaultRef(), Locale.getDefault(Locale.Category.FORMAT));
-        cal.sharedZone = true;
-        return cal;
+        return createCalendar(TimeZone.getDefault(), Locale.getDefault(Locale.Category.FORMAT));
     }
 
     /**
@@ -1637,9 +1637,7 @@
      */
     public static Calendar getInstance(Locale aLocale)
     {
-        Calendar cal = createCalendar(TimeZone.getDefaultRef(), aLocale);
-        cal.sharedZone = true;
-        return cal;
+        return createCalendar(TimeZone.getDefault(), aLocale);
     }
 
     /**
@@ -1660,6 +1658,17 @@
     private static Calendar createCalendar(TimeZone zone,
                                            Locale aLocale)
     {
+        CalendarProvider provider =
+            LocaleProviderAdapter.getAdapter(CalendarProvider.class, aLocale)
+                                 .getCalendarProvider();
+        if (provider != null) {
+            try {
+                return provider.getInstance(zone, aLocale);
+            } catch (IllegalArgumentException iae) {
+                // fall back to the default instantiation
+            }
+        }
+
         Calendar cal = null;
 
         if (aLocale.hasExtensions()) {
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,10 +26,15 @@
 
 package java.util.logging;
 
-import java.util.*;
+import java.lang.ref.WeakReference;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.security.*;
-import java.lang.ref.WeakReference;
 import java.util.function.Supplier;
 
 /**
@@ -104,7 +109,7 @@
  * unnecessary message construction. For example, if the developer wants to
  * log system health status for diagnosis, with the String-accepting version,
  * the code would look like:
- <code><pre>
+ <pre><code>
 
    class DiagnosisMessages {
      static String systemHealthStatus() {
@@ -114,26 +119,20 @@
    }
    ...
    logger.log(Level.FINER, DiagnosisMessages.systemHealthStatus());
- </pre></code>
+</code></pre>
  * With the above code, the health status is collected unnecessarily even when
  * the log level FINER is disabled. With the Supplier-accepting version as
  * below, the status will only be collected when the log level FINER is
  * enabled.
- <code><pre>
+ <pre><code>
 
    logger.log(Level.FINER, DiagnosisMessages::systemHealthStatus);
- </pre></code>
+</code></pre>
  * <p>
  * When mapping ResourceBundle names to ResourceBundles, the Logger
  * will first try to use the Thread's ContextClassLoader.  If that
- * is null it will try the SystemClassLoader instead.  As a temporary
- * transition feature in the initial implementation, if the Logger is
- * unable to locate a ResourceBundle from the ContextClassLoader or
- * SystemClassLoader the Logger will also search up the class stack
- * and use successive calling ClassLoaders to try to locate a ResourceBundle.
- * (This call stack search is to allow containers to transition to
- * using ContextClassLoaders and is likely to be removed in future
- * versions.)
+ * is null it will try the
+ * {@linkplain java.lang.ClassLoader#getSystemClassLoader() system ClassLoader} instead.
  * <p>
  * Formatting (including localization) is the responsibility of
  * the output Handler, which will typically call a Formatter.
@@ -1584,12 +1583,6 @@
         return useParentHandlers;
     }
 
-    // Private utility method to map a resource bundle name to an
-    // actual resource bundle, using a simple one-entry cache.
-    // Returns null for a null name.
-    // May also return null if we can't find the resource bundle and
-    // there is no suitable previous cached value.
-
     static final String SYSTEM_LOGGER_RB_NAME = "sun.util.logging.resources.logging";
 
     private static ResourceBundle findSystemResourceBundle(final Locale locale) {
@@ -1607,6 +1600,16 @@
         });
     }
 
+    /**
+     * Private utility method to map a resource bundle name to an
+     * actual resource bundle, using a simple one-entry cache.
+     * Returns null for a null name.
+     * May also return null if we can't find the resource bundle and
+     * there is no suitable previous cached value.
+     *
+     * @param name the ResourceBundle to locate
+     * @return ResourceBundle specified by name or null if not found
+     */
     private synchronized ResourceBundle findResourceBundle(String name) {
         // Return a null bundle for a null name.
         if (name == null) {
@@ -1616,8 +1619,8 @@
         Locale currentLocale = Locale.getDefault();
 
         // Normally we should hit on our simple one entry cache.
-        if (catalog != null && currentLocale == catalogLocale
-                                        && name == catalogName) {
+        if (catalog != null && currentLocale.equals(catalogLocale)
+                && name.equals(catalogName)) {
             return catalog;
         }
 
@@ -1628,8 +1631,8 @@
             return catalog;
         }
 
-        // Use the thread's context ClassLoader.  If there isn't one,
-        // use the SystemClassloader.
+        // Use the thread's context ClassLoader.  If there isn't one, use the
+        // {@linkplain java.lang.ClassLoader#getSystemClassLoader() system ClassLoader}.
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         if (cl == null) {
             cl = ClassLoader.getSystemClassLoader();
@@ -1640,44 +1643,8 @@
             catalogLocale = currentLocale;
             return catalog;
         } catch (MissingResourceException ex) {
-            // Woops.  We can't find the ResourceBundle in the default
-            // ClassLoader.  Drop through.
+            return null;
         }
-
-        // Fall back to searching up the call stack and trying each
-        // calling ClassLoader.
-        for (int ix = 0; ; ix++) {
-            Class clz = sun.reflect.Reflection.getCallerClass(ix);
-            if (clz == null) {
-                break;
-            }
-            ClassLoader cl2 = clz.getClassLoader();
-            if (cl2 == null) {
-                cl2 = ClassLoader.getSystemClassLoader();
-            }
-            if (cl == cl2) {
-                // We've already checked this classloader.
-                continue;
-            }
-            cl = cl2;
-            try {
-                catalog = ResourceBundle.getBundle(name, currentLocale, cl);
-                catalogName = name;
-                catalogLocale = currentLocale;
-                return catalog;
-            } catch (MissingResourceException ex) {
-                // Ok, this one didn't work either.
-                // Drop through, and try the next one.
-            }
-        }
-
-        if (name.equals(catalogName)) {
-            // Return the previous cached value for that name.
-            // This may be null.
-            return catalog;
-        }
-        // Sorry, we're out of luck.
-        return null;
     }
 
     // Private utility method to initialize our one entry
@@ -1704,8 +1671,7 @@
                 resourceBundleName + " != " + name);
         }
 
-        ResourceBundle rb = findResourceBundle(name);
-        if (rb == null) {
+        if (findResourceBundle(name) == null) {
             // We've failed to find an expected ResourceBundle.
             throw new MissingResourceException("Can't find " + name + " bundle", name, "");
         }
--- a/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,14 @@
     public boolean reuse = false;
 
     // Traffic capture tool, if configured. See HttpCapture class for info
-     private HttpCapture capture = null;
+    private HttpCapture capture = null;
+
+    private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
+    private static void logFinest(String msg) {
+        if (logger.isLoggable(PlatformLogger.FINEST)) {
+            logger.finest(msg);
+        }
+    }
 
     /**
      * A NOP method kept for backwards binary compatibility
@@ -266,8 +273,11 @@
             if (ret != null && httpuc != null &&
                 httpuc.streaming() &&
                 httpuc.getRequestMethod() == "POST") {
-                if (!ret.available())
+                if (!ret.available()) {
+                    ret.inCache = false;
+                    ret.closeServer();
                     ret = null;
+                }
             }
 
             if (ret != null) {
@@ -279,10 +289,7 @@
                         ret.inCache = false;
                         if (httpuc != null && ret.needsTunneling())
                             httpuc.setTunnelState(TUNNELING);
-                        PlatformLogger logger = HttpURLConnection.getHttpLogger();
-                        if (logger.isLoggable(PlatformLogger.FINEST)) {
-                            logger.finest("KeepAlive stream retrieved from the cache, " + ret);
-                        }
+                        logFinest("KeepAlive stream retrieved from the cache, " + ret);
                     }
                 } else {
                     // We cannot return this connection to the cache as it's
@@ -360,30 +367,33 @@
         }
     }
 
-    protected synchronized boolean available() throws IOException {
+    protected synchronized boolean available() {
         boolean available = true;
-        int old = serverSocket.getSoTimeout();
-        serverSocket.setSoTimeout(1);
-        BufferedInputStream tmpbuf =
-            new BufferedInputStream(serverSocket.getInputStream());
+        int old = -1;
 
-        PlatformLogger logger = HttpURLConnection.getHttpLogger();
         try {
-            int r = tmpbuf.read();
-            if (r == -1) {
-                if (logger.isLoggable(PlatformLogger.FINEST)) {
-                    logger.finest("HttpClient.available(): " +
-                        "read returned -1: not available");
+            try {
+                old = serverSocket.getSoTimeout();
+                serverSocket.setSoTimeout(1);
+                BufferedInputStream tmpbuf =
+                        new BufferedInputStream(serverSocket.getInputStream());
+                int r = tmpbuf.read();
+                if (r == -1) {
+                    logFinest("HttpClient.available(): " +
+                            "read returned -1: not available");
+                    available = false;
                 }
-                available = false;
+            } catch (SocketTimeoutException e) {
+                logFinest("HttpClient.available(): " +
+                        "SocketTimeout: its available");
+            } finally {
+                if (old != -1)
+                    serverSocket.setSoTimeout(old);
             }
-        } catch (SocketTimeoutException e) {
-            if (logger.isLoggable(PlatformLogger.FINEST)) {
-                logger.finest("HttpClient.available(): " +
-                    "SocketTimeout: its available");
-            }
-        } finally {
-            serverSocket.setSoTimeout(old);
+        } catch (IOException e) {
+            logFinest("HttpClient.available(): " +
+                        "SocketException: not available");
+            available = false;
         }
         return available;
     }
@@ -865,10 +875,7 @@
 
             if (isKeepingAlive())   {
                 // Wrap KeepAliveStream if keep alive is enabled.
-                PlatformLogger logger = HttpURLConnection.getHttpLogger();
-                if (logger.isLoggable(PlatformLogger.FINEST)) {
-                    logger.finest("KeepAlive stream used: " + url);
-                }
+                logFinest("KeepAlive stream used: " + url);
                 serverInput = new KeepAliveStream(serverInput, pi, cl, this);
                 failedOnce = false;
             }
--- a/jdk/src/share/classes/sun/util/locale/LanguageTag.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/sun/util/locale/LanguageTag.java	Fri Mar 15 23:31:19 2013 -0700
@@ -134,7 +134,7 @@
     }
 
     /*
-     * BNF in RFC5464
+     * BNF in RFC5646
      *
      * Language-Tag  = langtag             ; normal language tags
      *               / privateuse          ; private use tag
--- a/jdk/src/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java	Fri Mar 15 23:31:19 2013 -0700
@@ -43,6 +43,7 @@
 import java.util.spi.LocaleNameProvider;
 import java.util.spi.LocaleServiceProvider;
 import java.util.spi.TimeZoneNameProvider;
+import sun.util.spi.CalendarProvider;
 
 /**
  * An abstract parent class for the
@@ -140,6 +141,14 @@
         return getLocaleServiceProvider(CalendarNameProvider.class);
     }
 
+    /**
+     * Getter methods for sun.util.spi.* providers
+     */
+    @Override
+    public CalendarProvider getCalendarProvider() {
+        return getLocaleServiceProvider(CalendarProvider.class);
+    }
+
     @Override
     public LocaleResources getLocaleResources(Locale locale) {
         return null;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/locale/provider/CalendarProviderImpl.java	Fri Mar 15 23:31:19 2013 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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.util.locale.provider;
+
+import java.util.Calendar;
+import java.util.Calendar.Builder;
+import java.util.Locale;
+import java.util.Set;
+import java.util.TimeZone;
+import sun.util.spi.CalendarProvider;
+
+/**
+ * Concrete implementation of the  {@link sun.util.spi.CalendarProvider
+ * CalendarProvider} class for the JRE LocaleProviderAdapter.
+ *
+ * @author Naoto Sato
+ */
+public class CalendarProviderImpl extends CalendarProvider implements AvailableLanguageTags {
+    private final LocaleProviderAdapter.Type type;
+    private final Set<String> langtags;
+
+    public CalendarProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags) {
+        this.type = type;
+        this.langtags = langtags;
+    }
+
+    /**
+     * Returns an array of all locales for which this locale service provider
+     * can provide localized objects or names.
+     *
+     * @return An array of all locales for which this locale service provider
+     * can provide localized objects or names.
+     */
+    @Override
+    public Locale[] getAvailableLocales() {
+        return LocaleProviderAdapter.toLocaleArray(langtags);
+    }
+
+    @Override
+    public boolean isSupportedLocale(Locale locale) {
+        // Support any locales.
+        return true;
+    }
+
+    /**
+     * Returns a new <code>Calendar</code> instance for the
+     * specified locale.
+     *
+     * @param zone the time zone
+     * @param locale the desired locale
+     * @exception NullPointerException if <code>locale</code> is null
+     * @exception IllegalArgumentException if <code>locale</code> isn't
+     *     one of the locales returned from
+     *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
+     *     getAvailableLocales()}.
+     * @return a <code>Calendar</code> instance.
+     * @see java.util.Calendar#getInstance(java.util.Locale)
+     */
+    @Override
+    public Calendar getInstance(TimeZone zone, Locale locale) {
+        return new Calendar.Builder()
+                     .setLocale(locale)
+                     .setTimeZone(zone)
+                     .setInstant(System.currentTimeMillis())
+                     .build();
+    }
+
+    @Override
+    public Set<String> getAvailableLanguageTags() {
+        return langtags;
+    }
+}
--- a/jdk/src/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java	Fri Mar 15 23:31:19 2013 -0700
@@ -34,10 +34,12 @@
 import java.text.spi.DateFormatSymbolsProvider;
 import java.text.spi.DecimalFormatSymbolsProvider;
 import java.text.spi.NumberFormatProvider;
+import java.util.Calendar;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Set;
 import java.util.StringTokenizer;
+import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.spi.CalendarDataProvider;
@@ -47,6 +49,7 @@
 import java.util.spi.LocaleServiceProvider;
 import java.util.spi.TimeZoneNameProvider;
 import sun.util.resources.LocaleData;
+import sun.util.spi.CalendarProvider;
 
 /**
  * LocaleProviderAdapter implementation for the legacy JRE locale data.
@@ -104,6 +107,8 @@
             return (P) getCalendarDataProvider();
         case "CalendarNameProvider":
             return (P) getCalendarNameProvider();
+        case "CalendarProvider":
+            return (P) getCalendarProvider();
         default:
             throw new InternalError("should not come down here");
         }
@@ -122,6 +127,8 @@
     private volatile CalendarDataProvider calendarDataProvider = null;
     private volatile CalendarNameProvider calendarNameProvider = null;
 
+    private volatile CalendarProvider calendarProvider = null;
+
     /*
      * Getter methods for java.text.spi.* providers
      */
@@ -283,6 +290,23 @@
         return calendarNameProvider;
     }
 
+    /**
+     * Getter methods for sun.util.spi.* providers
+     */
+    @Override
+    public CalendarProvider getCalendarProvider() {
+        if (calendarProvider == null) {
+            CalendarProvider provider = new CalendarProviderImpl(getAdapterType(),
+                                                    getLanguageTagSet("CalendarData"));
+            synchronized (this) {
+                if (calendarProvider == null) {
+                    calendarProvider = provider;
+                }
+            }
+        }
+        return calendarProvider;
+    }
+
     @Override
     public LocaleResources getLocaleResources(Locale locale) {
         LocaleResources lr = localeResourcesMap.get(locale);
--- a/jdk/src/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java	Fri Mar 15 23:31:19 2013 -0700
@@ -47,6 +47,7 @@
 import java.util.spi.LocaleServiceProvider;
 import java.util.spi.TimeZoneNameProvider;
 import sun.util.cldr.CLDRLocaleProviderAdapter;
+import sun.util.spi.CalendarProvider;
 
 /**
  * The LocaleProviderAdapter abstract class.
@@ -295,7 +296,10 @@
         }
         if (type == Type.JRE) {
             String oldname = locale.toString().replace('_', '-');
-            return langtags.contains(oldname);
+            return langtags.contains(oldname) ||
+                   "ja-JP-JP".equals(oldname) ||
+                   "th-TH-TH".equals(oldname) ||
+                   "no-NO-NY".equals(oldname);
         }
         return false;
     }
@@ -422,6 +426,14 @@
      */
     public abstract CalendarNameProvider getCalendarNameProvider();
 
+    /**
+     * Returns a CalendarProvider for this LocaleProviderAdapter, or null if no
+     * CalendarProvider is available.
+     *
+     * @return a CalendarProvider
+     */
+    public abstract CalendarProvider getCalendarProvider();
+
     public abstract LocaleResources getLocaleResources(Locale locale);
 
     public abstract Locale[] getAvailableLocales();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/spi/CalendarProvider.java	Fri Mar 15 23:31:19 2013 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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.util.spi;
+
+import java.util.Calendar;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.util.spi.LocaleServiceProvider;
+
+/**
+ * An abstract class for service providers that
+ * provide instances of the
+ * {@link java.util.Calendar Calendar} class.
+ *
+ * @since        1.8
+ */
+public abstract class CalendarProvider extends LocaleServiceProvider {
+
+    /**
+     * Sole constructor.  (For invocation by subclass constructors, typically
+     * implicit.)
+     */
+    protected CalendarProvider() {
+    }
+
+    /**
+     * Returns a new <code>Calendar</code> instance for the
+     * specified locale.
+     *
+     * @param zone the time zone
+     * @param locale the desired locale
+     * @exception NullPointerException if <code>locale</code> is null
+     * @exception IllegalArgumentException if <code>locale</code> isn't
+     *     one of the locales returned from
+     *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
+     *     getAvailableLocales()}.
+     * @return a <code>Calendar</code> instance.
+     * @see java.util.Calendar#getInstance(java.util.Locale)
+     */
+    public abstract Calendar getInstance(TimeZone zone, Locale locale);
+}
--- a/jdk/src/share/javavm/export/jni.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/javavm/export/jni.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1951,6 +1951,7 @@
 #define JNI_VERSION_1_2 0x00010002
 #define JNI_VERSION_1_4 0x00010004
 #define JNI_VERSION_1_6 0x00010006
+#define JNI_VERSION_1_8 0x00010008
 
 #ifdef __cplusplus
 } /* extern "C" */
--- a/jdk/src/share/native/common/jni_util.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/native/common/jni_util.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -339,6 +339,10 @@
 
 void initializeEncoding();
 
+void* getProcessHandle();
+
+void buildJniFunctionName(const char *sym, const char *cname,
+                          char *jniEntryName);
 
 #ifdef __cplusplus
 } /* extern "C" */
--- a/jdk/src/share/native/java/io/ObjectOutputStream.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/native/java/io/ObjectOutputStream.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +23,8 @@
  * questions.
  */
 
-#include "jni.h"
-#include "jvm.h"
 #include "jni_util.h"
-#include "jlong.h"
+#include "jdk_util.h"
 
 #include "java_lang_Float.h"
 #include "java_lang_Double.h"
@@ -88,7 +86,7 @@
     srcend = srcpos + nfloats;
     for ( ; srcpos < srcend; srcpos++) {
         fval = (float) floats[srcpos];
-        if (JVM_IsNaN(fval)) {          /* collapse NaNs */
+        if (ISNANF(fval)) {          /* collapse NaNs */
             ival = 0x7fc00000;
         } else {
             u.f = fval;
@@ -160,7 +158,7 @@
     srcend = srcpos + ndoubles;
     for ( ; srcpos < srcend; srcpos++) {
         dval = doubles[srcpos];
-        if (JVM_IsNaN((double) dval)) {         /* collapse NaNs */
+        if (ISNAND((double) dval)) {         /* collapse NaNs */
             lval = jint_to_jlong(0x7ff80000);
             lval = jlong_shl(lval, 32);
         } else {
--- a/jdk/src/share/native/java/io/io_util.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/native/java/io/io_util.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,10 +47,8 @@
     nread = IO_Read(fd, &ret, 1);
     if (nread == 0) { /* EOF */
         return -1;
-    } else if (nread == JVM_IO_ERR) { /* error */
+    } else if (nread == -1) { /* error */
         JNU_ThrowIOExceptionWithLastError(env, "Read error");
-    } else if (nread == JVM_IO_INTR) {
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
     }
     return ret & 0xFF;
 }
@@ -111,10 +109,8 @@
         nread = IO_Read(fd, buf, len);
         if (nread > 0) {
             (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf);
-        } else if (nread == JVM_IO_ERR) {
+        } else if (nread == -1) {
             JNU_ThrowIOExceptionWithLastError(env, "Read error");
-        } else if (nread == JVM_IO_INTR) {
-            JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
         } else { /* EOF */
             nread = -1;
         }
@@ -141,10 +137,8 @@
     } else {
         n = IO_Write(fd, &c, 1);
     }
-    if (n == JVM_IO_ERR) {
+    if (n == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "Write error");
-    } else if (n == JVM_IO_INTR) {
-        JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
     }
 }
 
@@ -194,12 +188,9 @@
             } else {
                 n = IO_Write(fd, buf+off, len);
             }
-            if (n == JVM_IO_ERR) {
+            if (n == -1) {
                 JNU_ThrowIOExceptionWithLastError(env, "Write error");
                 break;
-            } else if (n == JVM_IO_INTR) {
-                JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL);
-                break;
             }
             off += n;
             len -= n;
@@ -214,11 +205,11 @@
 throwFileNotFoundException(JNIEnv *env, jstring path)
 {
     char buf[256];
-    jint n;
+    size_t n;
     jobject x;
     jstring why = NULL;
 
-    n = JVM_GetLastErrorString(buf, sizeof(buf));
+    n = getLastErrorString(buf, sizeof(buf));
     if (n > 0) {
         why = JNU_NewStringPlatform(env, buf);
     }
--- a/jdk/src/share/native/java/io/io_util.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/native/java/io/io_util.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
                 jint len, jboolean append, jfieldID fid);
 void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
 void throwFileNotFoundException(JNIEnv *env, jstring path);
-
+size_t getLastErrorString(char *buf, size_t len);
 
 /*
  * Macros for managing platform strings.  The typical usage pattern is:
--- a/jdk/src/share/native/java/lang/ClassLoader.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/share/native/java/lang/ClassLoader.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 #include "jvm.h"
 #include "java_lang_ClassLoader.h"
 #include "java_lang_ClassLoader_NativeLibrary.h"
+#include <string.h>
 
 /* defined in libverify.so/verify.dll (src file common/check_format.c) */
 extern jboolean VerifyClassname(char *utf_name, jboolean arrayAllowed);
@@ -286,6 +287,8 @@
 
 static jfieldID handleID;
 static jfieldID jniVersionID;
+static jfieldID loadedID;
+static void *procHandle;
 
 static jboolean initIDs(JNIEnv *env)
 {
@@ -300,6 +303,10 @@
         jniVersionID = (*env)->GetFieldID(env, this, "jniVersion", "I");
         if (jniVersionID == 0)
             return JNI_FALSE;
+        loadedID = (*env)->GetFieldID(env, this, "loaded", "Z");
+        if (loadedID == 0)
+             return JNI_FALSE;
+        procHandle = getProcessHandle();
     }
     return JNI_TRUE;
 }
@@ -308,13 +315,59 @@
 typedef void (JNICALL *JNI_OnUnload_t)(JavaVM *, void *);
 
 /*
+ * Support for finding JNI_On(Un)Load_<lib_name> if it exists.
+ * If cname == NULL then just find normal JNI_On(Un)Load entry point
+ */
+static void *findJniFunction(JNIEnv *env, void *handle,
+                                    const char *cname, jboolean isLoad) {
+    const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS;
+    const char *onUnloadSymbols[] = JNI_ONUNLOAD_SYMBOLS;
+    const char **syms;
+    int symsLen;
+    void *entryName = NULL;
+    char *jniFunctionName;
+    int i;
+    int len;
+
+    // Check for JNI_On(Un)Load<_libname> function
+    if (isLoad) {
+        syms = onLoadSymbols;
+        symsLen = sizeof(onLoadSymbols) / sizeof(char *);
+    } else {
+        syms = onUnloadSymbols;
+        symsLen = sizeof(onUnloadSymbols) / sizeof(char *);
+    }
+    for (i = 0; i < symsLen; i++) {
+        // cname + sym + '_' + '\0'
+        if ((len = (cname != NULL ? strlen(cname) : 0) + strlen(syms[i]) + 2) >
+            FILENAME_MAX) {
+            goto done;
+        }
+        jniFunctionName = malloc(len);
+        if (jniFunctionName == NULL) {
+            JNU_ThrowOutOfMemoryError(env, NULL);
+            goto done;
+        }
+        buildJniFunctionName(syms[i], cname, jniFunctionName);
+        entryName = JVM_FindLibraryEntry(handle, jniFunctionName);
+        free(jniFunctionName);
+        if(entryName) {
+            break;
+        }
+    }
+
+ done:
+    return entryName;
+}
+
+/*
  * Class:     java_lang_ClassLoader_NativeLibrary
  * Method:    load
- * Signature: (Ljava/lang/String;)J
+ * Signature: (Ljava/lang/String;Z)V
  */
 JNIEXPORT void JNICALL
 Java_java_lang_ClassLoader_00024NativeLibrary_load
-  (JNIEnv *env, jobject this, jstring name)
+  (JNIEnv *env, jobject this, jstring name, jboolean isBuiltin)
 {
     const char *cname;
     jint jniVersion;
@@ -327,18 +380,12 @@
     cname = JNU_GetStringPlatformChars(env, name, 0);
     if (cname == 0)
         return;
-    handle = JVM_LoadLibrary(cname);
+    handle = isBuiltin ? procHandle : JVM_LoadLibrary(cname);
     if (handle) {
-        const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS;
         JNI_OnLoad_t JNI_OnLoad;
-        unsigned int i;
-        for (i = 0; i < sizeof(onLoadSymbols) / sizeof(char *); i++) {
-            JNI_OnLoad = (JNI_OnLoad_t)
-                JVM_FindLibraryEntry(handle, onLoadSymbols[i]);
-            if (JNI_OnLoad) {
-                break;
-            }
-        }
+        JNI_OnLoad = (JNI_OnLoad_t)findJniFunction(env, handle,
+                                               isBuiltin ? cname : NULL,
+                                               JNI_TRUE);
         if (JNI_OnLoad) {
             JavaVM *jvm;
             (*env)->GetJavaVM(env, &jvm);
@@ -355,7 +402,8 @@
             goto done;
         }
 
-        if (!JVM_IsSupportedJNIVersion(jniVersion)) {
+        if (!JVM_IsSupportedJNIVersion(jniVersion) ||
+            (isBuiltin && jniVersion < JNI_VERSION_1_8)) {
             char msg[256];
             jio_snprintf(msg, sizeof(msg),
                          "unsupported JNI version 0x%08X required by %s",
@@ -375,6 +423,7 @@
         goto done;
     }
     (*env)->SetLongField(env, this, handleID, ptr_to_jlong(handle));
+    (*env)->SetBooleanField(env, this, loadedID, JNI_TRUE);
 
  done:
     JNU_ReleaseStringPlatformChars(env, name, cname);
@@ -383,41 +432,40 @@
 /*
  * Class:     java_lang_ClassLoader_NativeLibrary
  * Method:    unload
- * Signature: ()V
+ * Signature: (Z)V
  */
 JNIEXPORT void JNICALL
 Java_java_lang_ClassLoader_00024NativeLibrary_unload
-  (JNIEnv *env, jobject this)
+(JNIEnv *env, jobject this, jstring name, jboolean isBuiltin)
 {
     const char *onUnloadSymbols[] = JNI_ONUNLOAD_SYMBOLS;
     void *handle;
     JNI_OnUnload_t JNI_OnUnload;
-    unsigned int i;
+     const char *cname;
 
     if (!initIDs(env))
         return;
-
+    cname = JNU_GetStringPlatformChars(env, name, 0);
+    if (cname == NULL) {
+        return;
+    }
     handle = jlong_to_ptr((*env)->GetLongField(env, this, handleID));
-    for (i = 0; i < sizeof(onUnloadSymbols) / sizeof(char *); i++) {
-        JNI_OnUnload = (JNI_OnUnload_t )
-            JVM_FindLibraryEntry(handle, onUnloadSymbols[i]);
-        if (JNI_OnUnload) {
-            break;
-        }
-    }
-
+    JNI_OnUnload = (JNI_OnUnload_t )findJniFunction(env, handle,
+                                                isBuiltin ? cname : NULL,
+                                                JNI_FALSE);
     if (JNI_OnUnload) {
         JavaVM *jvm;
         (*env)->GetJavaVM(env, &jvm);
         (*JNI_OnUnload)(jvm, NULL);
     }
     JVM_UnloadLibrary(handle);
+    JNU_ReleaseStringPlatformChars(env, name, cname);
 }
 
 /*
  * Class:     java_lang_ClassLoader_NativeLibrary
  * Method:    find
- * Signature: (Ljava/lang/String;J)J
+ * Signature: (Ljava/lang/String;)J
  */
 JNIEXPORT jlong JNICALL
 Java_java_lang_ClassLoader_00024NativeLibrary_find
@@ -456,3 +504,63 @@
     return NULL;
 }
 
+/*
+ * Class:     java_lang_ClassLoader_NativeLibrary
+ * Method:    findBuiltinLib
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib
+  (JNIEnv *env, jclass cls, jstring name)
+{
+    const char *cname;
+    char *libName;
+    int prefixLen = (int) strlen(JNI_LIB_PREFIX);
+    int suffixLen = (int) strlen(JNI_LIB_SUFFIX);
+    int len;
+    jstring lib;
+    void *ret;
+    const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS;
+
+    if (name == NULL) {
+        JNU_ThrowInternalError(env, "NULL filename for native library");
+        return NULL;
+    }
+    // Can't call initIDs because it will recurse into NativeLibrary via
+    // FindClass to check context so set prochandle here as well.
+    procHandle = getProcessHandle();
+    cname = JNU_GetStringPlatformChars(env, name, 0);
+    if (cname == NULL) {
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return NULL;
+    }
+    // Copy name Skipping PREFIX
+    len = strlen(cname);
+    if (len <= (prefixLen+suffixLen)) {
+        JNU_ReleaseStringPlatformChars(env, name, cname);
+        return NULL;
+    }
+    libName = malloc(len + 1); //+1 for null if prefix+suffix == 0
+    if (libName == NULL) {
+        JNU_ReleaseStringPlatformChars(env, name, cname);
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return NULL;
+    }
+    if (len > prefixLen) {
+        strcpy(libName, cname+prefixLen);
+    }
+    JNU_ReleaseStringPlatformChars(env, name, cname);
+
+    // Strip SUFFIX
+    libName[strlen(libName)-suffixLen] = '\0';
+
+    // Check for JNI_OnLoad_libname function
+    ret = findJniFunction(env, procHandle, libName, JNI_TRUE);
+    if (ret != NULL) {
+        lib = JNU_NewStringPlatform(env, libName);
+        free(libName);
+        return lib;
+    }
+    free(libName);
+    return NULL;
+}
--- a/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java	Fri Mar 15 23:31:19 2013 -0700
@@ -26,9 +26,9 @@
 package sun.nio.ch;
 
 import java.io.IOException;
-import java.util.LinkedList;
-import java.util.HashSet;
-import java.util.Iterator;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Manipulates a native array of epoll_event structs on Linux:
@@ -52,37 +52,78 @@
  * this implementation we set data.fd to be the file descriptor that we
  * register. That way, we have the file descriptor available when we
  * process the events.
- *
- * All file descriptors registered with epoll have the POLLHUP and POLLERR
- * events enabled even when registered with an event set of 0. To ensure
- * that epoll_wait doesn't poll an idle file descriptor when the underlying
- * connection is closed or reset then its registration is deleted from
- * epoll (it will be re-added again if the event set is changed)
  */
 
 class EPollArrayWrapper {
     // EPOLL_EVENTS
-    static final int EPOLLIN      = 0x001;
+    private static final int EPOLLIN      = 0x001;
 
     // opcodes
-    static final int EPOLL_CTL_ADD      = 1;
-    static final int EPOLL_CTL_DEL      = 2;
-    static final int EPOLL_CTL_MOD      = 3;
+    private static final int EPOLL_CTL_ADD      = 1;
+    private static final int EPOLL_CTL_DEL      = 2;
+    private static final int EPOLL_CTL_MOD      = 3;
 
     // Miscellaneous constants
-    static final int SIZE_EPOLLEVENT  = sizeofEPollEvent();
-    static final int EVENT_OFFSET     = 0;
-    static final int DATA_OFFSET      = offsetofData();
-    static final int FD_OFFSET        = DATA_OFFSET;
-    static final int NUM_EPOLLEVENTS  = Math.min(IOUtil.fdLimit(), 8192);
+    private static final int SIZE_EPOLLEVENT  = sizeofEPollEvent();
+    private static final int EVENT_OFFSET     = 0;
+    private static final int DATA_OFFSET      = offsetofData();
+    private static final int FD_OFFSET        = DATA_OFFSET;
+    private static final int OPEN_MAX         = IOUtil.fdLimit();
+    private static final int NUM_EPOLLEVENTS  = Math.min(OPEN_MAX, 8192);
+
+    // Special value to indicate that an update should be ignored
+    private static final byte  KILLED = (byte)-1;
 
-    // Base address of the native pollArray
+    // Initial size of arrays for fd registration changes
+    private static final int INITIAL_PENDING_UPDATE_SIZE = 64;
+
+    // maximum size of updatesLow
+    private static final int MAX_UPDATE_ARRAY_SIZE = Math.min(OPEN_MAX, 64*1024);
+
+
+    // The fd of the epoll driver
+    private final int epfd;
+
+     // The epoll_event array for results from epoll_wait
+    private final AllocatedNativeObject pollArray;
+
+    // Base address of the epoll_event array
     private final long pollArrayAddress;
 
-    // Set of "idle" channels
-    private final HashSet<SelChImpl> idleSet;
+    // The fd of the interrupt line going out
+    private int outgoingInterruptFD;
+
+    // The fd of the interrupt line coming in
+    private int incomingInterruptFD;
+
+    // The index of the interrupt FD
+    private int interruptedIndex;
+
+    // Number of updated pollfd entries
+    int updated;
+
+    // object to synchronize fd registration changes
+    private final Object updateLock = new Object();
 
-    EPollArrayWrapper() {
+    // number of file descriptors with registration changes pending
+    private int updateCount;
+
+    // file descriptors with registration changes pending
+    private int[] updateDescriptors = new int[INITIAL_PENDING_UPDATE_SIZE];
+
+    // events for file descriptors with registration changes pending, indexed
+    // by file descriptor and stored as bytes for efficiency reasons. For
+    // file descriptors higher than MAX_UPDATE_ARRAY_SIZE (unlimited case at
+    // least) then the update is stored in a map.
+    private final byte[] eventsLow = new byte[MAX_UPDATE_ARRAY_SIZE];
+    private Map<Integer,Byte> eventsHigh;
+
+    // Used by release and updateRegistrations to track whether a file
+    // descriptor is registered with epoll.
+    private final BitSet registered = new BitSet();
+
+
+    EPollArrayWrapper() throws IOException {
         // creates the epoll file descriptor
         epfd = epollCreate();
 
@@ -91,50 +132,11 @@
         pollArray = new AllocatedNativeObject(allocationSize, true);
         pollArrayAddress = pollArray.address();
 
-        for (int i=0; i<NUM_EPOLLEVENTS; i++) {
-            putEventOps(i, 0);
-            putData(i, 0L);
-        }
-
-        // create idle set
-        idleSet = new HashSet<SelChImpl>();
+        // eventHigh needed when using file descriptors > 64k
+        if (OPEN_MAX > MAX_UPDATE_ARRAY_SIZE)
+            eventsHigh = new HashMap<>();
     }
 
-    // Used to update file description registrations
-    private static class Updator {
-        SelChImpl channel;
-        int opcode;
-        int events;
-        Updator(SelChImpl channel, int opcode, int events) {
-            this.channel = channel;
-            this.opcode = opcode;
-            this.events = events;
-        }
-        Updator(SelChImpl channel, int opcode) {
-            this(channel, opcode, 0);
-        }
-    }
-
-    private LinkedList<Updator> updateList = new LinkedList<Updator>();
-
-    // The epoll_event array for results from epoll_wait
-    private AllocatedNativeObject pollArray;
-
-    // The fd of the epoll driver
-    final int epfd;
-
-    // The fd of the interrupt line going out
-    int outgoingInterruptFD;
-
-    // The fd of the interrupt line coming in
-    int incomingInterruptFD;
-
-    // The index of the interrupt FD
-    int interruptedIndex;
-
-    // Number of updated pollfd entries
-    int updated;
-
     void initInterrupt(int fd0, int fd1) {
         outgoingInterruptFD = fd1;
         incomingInterruptFD = fd0;
@@ -146,11 +148,6 @@
         pollArray.putInt(offset, event);
     }
 
-    void putData(int i, long value) {
-        int offset = SIZE_EPOLLEVENT * i + DATA_OFFSET;
-        pollArray.putLong(offset, value);
-    }
-
     void putDescriptor(int i, int fd) {
         int offset = SIZE_EPOLLEVENT * i + FD_OFFSET;
         pollArray.putInt(offset, fd);
@@ -167,51 +164,83 @@
     }
 
     /**
-     * Update the events for a given channel.
+     * Sets the pending update events for the given file descriptor. This
+     * method has no effect if the update events is already set to KILLED,
+     * unless {@code force} is {@code true}.
      */
-    void setInterest(SelChImpl channel, int mask) {
-        synchronized (updateList) {
-            // if the previous pending operation is to add this file descriptor
-            // to epoll then update its event set
-            if (updateList.size() > 0) {
-                Updator last = updateList.getLast();
-                if (last.channel == channel && last.opcode == EPOLL_CTL_ADD) {
-                    last.events = mask;
-                    return;
-                }
+    private void setUpdateEvents(int fd, byte events, boolean force) {
+        if (fd < MAX_UPDATE_ARRAY_SIZE) {
+            if ((eventsLow[fd] != KILLED) || force) {
+                eventsLow[fd] = events;
+            }
+        } else {
+            Integer key = Integer.valueOf(fd);
+            if ((eventsHigh.get(key) != KILLED) || force) {
+                eventsHigh.put(key, Byte.valueOf(events));
             }
+        }
+    }
 
-            // update existing registration
-            updateList.add(new Updator(channel, EPOLL_CTL_MOD, mask));
+    /**
+     * Returns the pending update events for the given file descriptor.
+     */
+    private byte getUpdateEvents(int fd) {
+        if (fd < MAX_UPDATE_ARRAY_SIZE) {
+            return eventsLow[fd];
+        } else {
+            Byte result = eventsHigh.get(Integer.valueOf(fd));
+            // result should never be null
+            return result.byteValue();
         }
     }
 
     /**
-     * Add a channel's file descriptor to epoll
+     * Update the events for a given file descriptor
      */
-    void add(SelChImpl channel) {
-        synchronized (updateList) {
-            updateList.add(new Updator(channel, EPOLL_CTL_ADD));
+    void setInterest(int fd, int mask) {
+        synchronized (updateLock) {
+            // record the file descriptor and events
+            int oldCapacity = updateDescriptors.length;
+            if (updateCount == oldCapacity) {
+                int newCapacity = oldCapacity + INITIAL_PENDING_UPDATE_SIZE;
+                int[] newDescriptors = new int[newCapacity];
+                System.arraycopy(updateDescriptors, 0, newDescriptors, 0, oldCapacity);
+                updateDescriptors = newDescriptors;
+            }
+            updateDescriptors[updateCount++] = fd;
+
+            // events are stored as bytes for efficiency reasons
+            byte b = (byte)mask;
+            assert (b == mask) && (b != KILLED);
+            setUpdateEvents(fd, b, false);
         }
     }
 
     /**
-     * Remove a channel's file descriptor from epoll
+     * Add a file descriptor
      */
-    void release(SelChImpl channel) {
-        synchronized (updateList) {
-            // flush any pending updates
-            for (Iterator<Updator> it = updateList.iterator(); it.hasNext();) {
-                if (it.next().channel == channel) {
-                    it.remove();
-                }
+    void add(int fd) {
+        // force the initial update events to 0 as it may be KILLED by a
+        // previous registration.
+        synchronized (updateLock) {
+            assert !registered.get(fd);
+            setUpdateEvents(fd, (byte)0, true);
+        }
+    }
+
+    /**
+     * Remove a file descriptor
+     */
+    void remove(int fd) {
+        synchronized (updateLock) {
+            // kill pending and future update for this file descriptor
+            setUpdateEvents(fd, KILLED, false);
+
+            // remove from epoll
+            if (registered.get(fd)) {
+                epollCtl(epfd, EPOLL_CTL_DEL, fd, 0);
+                registered.clear(fd);
             }
-
-            // remove from the idle set (if present)
-            idleSet.remove(channel);
-
-            // remove from epoll (if registered)
-            epollCtl(epfd, EPOLL_CTL_DEL, channel.getFDVal(), 0);
         }
     }
 
@@ -239,36 +268,38 @@
     /**
      * Update the pending registrations.
      */
-    void updateRegistrations() {
-        synchronized (updateList) {
-            Updator u = null;
-            while ((u = updateList.poll()) != null) {
-                SelChImpl ch = u.channel;
-                if (!ch.isOpen())
-                    continue;
+    private void updateRegistrations() {
+        synchronized (updateLock) {
+            int j = 0;
+            while (j < updateCount) {
+                int fd = updateDescriptors[j];
+                short events = getUpdateEvents(fd);
+                boolean isRegistered = registered.get(fd);
+                int opcode = 0;
 
-                // if the events are 0 then file descriptor is put into "idle
-                // set" to prevent it being polled
-                if (u.events == 0) {
-                    boolean added = idleSet.add(u.channel);
-                    // if added to idle set then remove from epoll if registered
-                    if (added && (u.opcode == EPOLL_CTL_MOD))
-                        epollCtl(epfd, EPOLL_CTL_DEL, ch.getFDVal(), 0);
-                } else {
-                    // events are specified. If file descriptor was in idle set
-                    // it must be re-registered (by converting opcode to ADD)
-                    boolean idle = false;
-                    if (!idleSet.isEmpty())
-                        idle = idleSet.remove(u.channel);
-                    int opcode = (idle) ? EPOLL_CTL_ADD : u.opcode;
-                    epollCtl(epfd, opcode, ch.getFDVal(), u.events);
+                if (events != KILLED) {
+                    if (isRegistered) {
+                        opcode = (events != 0) ? EPOLL_CTL_MOD : EPOLL_CTL_DEL;
+                    } else {
+                        opcode = (events != 0) ? EPOLL_CTL_ADD : 0;
+                    }
+                    if (opcode != 0) {
+                        epollCtl(epfd, opcode, fd, events);
+                        if (opcode == EPOLL_CTL_ADD) {
+                            registered.set(fd);
+                        } else if (opcode == EPOLL_CTL_DEL) {
+                            registered.clear(fd);
+                        }
+                    }
                 }
+                j++;
             }
+            updateCount = 0;
         }
     }
 
     // interrupt support
-    boolean interrupted = false;
+    private boolean interrupted = false;
 
     public void interrupt() {
         interrupt(outgoingInterruptFD);
--- a/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java	Fri Mar 15 23:31:19 2013 -0700
@@ -53,26 +53,24 @@
     private volatile boolean closed = false;
 
     // Lock for interrupt triggering and clearing
-    private Object interruptLock = new Object();
+    private final Object interruptLock = new Object();
     private boolean interruptTriggered = false;
 
     /**
      * Package private constructor called by factory method in
      * the abstract superclass Selector.
      */
-    EPollSelectorImpl(SelectorProvider sp) {
+    EPollSelectorImpl(SelectorProvider sp) throws IOException {
         super(sp);
         long pipeFds = IOUtil.makePipe(false);
         fd0 = (int) (pipeFds >>> 32);
         fd1 = (int) pipeFds;
         pollWrapper = new EPollArrayWrapper();
         pollWrapper.initInterrupt(fd0, fd1);
-        fdToKey = new HashMap<Integer,SelectionKeyImpl>();
+        fdToKey = new HashMap<>();
     }
 
-    protected int doSelect(long timeout)
-        throws IOException
-    {
+    protected int doSelect(long timeout) throws IOException {
         if (closed)
             throw new ClosedSelectorException();
         processDeregisterQueue();
@@ -161,8 +159,9 @@
         if (closed)
             throw new ClosedSelectorException();
         SelChImpl ch = ski.channel;
-        fdToKey.put(Integer.valueOf(ch.getFDVal()), ski);
-        pollWrapper.add(ch);
+        int fd = Integer.valueOf(ch.getFDVal());
+        fdToKey.put(fd, ski);
+        pollWrapper.add(fd);
         keys.add(ski);
     }
 
@@ -171,7 +170,7 @@
         SelChImpl ch = ski.channel;
         int fd = ch.getFDVal();
         fdToKey.remove(Integer.valueOf(fd));
-        pollWrapper.release(ch);
+        pollWrapper.remove(fd);
         ski.setIndex(-1);
         keys.remove(ski);
         selectedKeys.remove(ski);
@@ -181,10 +180,11 @@
             ((SelChImpl)selch).kill();
     }
 
-    public void putEventOps(SelectionKeyImpl sk, int ops) {
+    public void putEventOps(SelectionKeyImpl ski, int ops) {
         if (closed)
             throw new ClosedSelectorException();
-        pollWrapper.setInterest(sk.channel, ops);
+        SelChImpl ch = ski.channel;
+        pollWrapper.setInterest(ch.getFDVal(), ops);
     }
 
     public Selector wakeup() {
@@ -200,5 +200,4 @@
     static {
         Util.load();
     }
-
 }
--- a/jdk/src/solaris/native/common/jdk_util_md.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/native/common/jdk_util_md.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,4 +23,24 @@
  * questions.
  */
 
-// Currently, there are no unix specific functions defined.
+#ifndef JDK_UTIL_MD_H
+#define JDK_UTIL_MD_H
+
+// checking for nanness
+#ifdef __solaris__
+#include <ieeefp.h>
+#define ISNANF(f) isnanf(f)
+#define ISNAND(d) isnand(d)
+#elif defined(MACOSX)
+#include <math.h>
+#define ISNANF(f) isnan(f)
+#define ISNAND(d) isnan(d)
+#elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+#include <math.h>
+#define ISNANF(f) isnanf(f)
+#define ISNAND(d) isnan(d)
+#else
+#error "missing platform-specific definition here"
+#endif
+
+#endif /* JDK_UTIL_MD_H */
--- a/jdk/src/solaris/native/common/jni_util_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/native/common/jni_util_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 #include "jni.h"
 #include "jni_util.h"
+#include "dlfcn.h"
 
 jstring nativeNewStringPlatform(JNIEnv *env, const char *str) {
     return NULL;
@@ -33,3 +34,22 @@
 char* nativeGetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy) {
     return NULL;
 }
+
+void* getProcessHandle() {
+    static void *procHandle = NULL;
+    if (procHandle != NULL) {
+        return procHandle;
+    }
+    procHandle = (void*)dlopen(NULL, RTLD_LAZY);
+    return procHandle;
+}
+
+void buildJniFunctionName(const char *sym, const char *cname,
+                          char *jniEntryName) {
+    strcpy(jniEntryName, sym);
+    if (cname != NULL) {
+        strcat(jniEntryName, "_");
+        strcat(jniEntryName, cname);
+    }
+}
+
--- a/jdk/src/solaris/native/java/io/FileDescriptor_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/native/java/io/FileDescriptor_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +23,8 @@
  * questions.
  */
 
-#include "jni.h"
-#include "jni_util.h"
 #include "jvm.h"
+#include "io_util_md.h"
 
 #include "java_io_FileDescriptor.h"
 
@@ -51,8 +50,8 @@
 
 JNIEXPORT void JNICALL
 Java_java_io_FileDescriptor_sync(JNIEnv *env, jobject this) {
-    int fd = (*env)->GetIntField(env, this, IO_fd_fdID);
-    if (JVM_Sync(fd) == -1) {
+    FD fd = THIS_FD(this);
+    if (IO_Sync(fd) == -1) {
         JNU_ThrowByName(env, "java/io/SyncFailedException", "sync failed");
     }
 }
--- a/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/native/java/io/UnixFileSystem_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
 
     WITH_PLATFORM_STRING(env, pathname, path) {
         char canonicalPath[JVM_MAXPATHLEN];
-        if (canonicalize(JVM_NativePath((char *)path),
+        if (canonicalize((char *)path,
                          canonicalPath, JVM_MAXPATHLEN) < 0) {
             JNU_ThrowIOExceptionWithLastError(env, "Bad pathname");
         } else {
@@ -241,19 +241,18 @@
     jboolean rv = JNI_FALSE;
 
     WITH_PLATFORM_STRING(env, pathname, path) {
-        int fd;
-        if (!strcmp (path, "/")) {
-            fd = JVM_EEXIST;    /* The root directory always exists */
-        } else {
-            fd = JVM_Open(path, JVM_O_RDWR | JVM_O_CREAT | JVM_O_EXCL, 0666);
-        }
-        if (fd < 0) {
-            if (fd != JVM_EEXIST) {
-                JNU_ThrowIOExceptionWithLastError(env, path);
+        FD fd;
+        /* The root directory always exists */
+        if (strcmp (path, "/")) {
+            fd = handleOpen(path, O_RDWR | O_CREAT | O_EXCL, 0666);
+            if (fd < 0) {
+                if (errno != EEXIST)
+                    JNU_ThrowIOExceptionWithLastError(env, path);
+            } else {
+                if (close(fd) == -1)
+                    JNU_ThrowIOExceptionWithLastError(env, path);
+                rv = JNI_TRUE;
             }
-        } else {
-            JVM_Close(fd);
-            rv = JNI_TRUE;
         }
     } END_PLATFORM_STRING(env, path);
     return rv;
--- a/jdk/src/solaris/native/java/io/io_util_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/native/java/io/io_util_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,15 @@
 #include "io_util.h"
 #include "io_util_md.h"
 #include <string.h>
+#include <unistd.h>
+
+#ifdef __solaris__
+#include <sys/filio.h>
+#endif
+
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#include <sys/ioctl.h>
+#endif
 
 #ifdef MACOSX
 
@@ -62,6 +71,28 @@
 }
 #endif
 
+FD
+handleOpen(const char *path, int oflag, int mode) {
+    FD fd;
+    RESTARTABLE(open64(path, oflag, mode), fd);
+    if (fd != -1) {
+        struct stat64 buf64;
+        int result;
+        RESTARTABLE(fstat64(fd, &buf64), result);
+        if (result != -1) {
+            if (S_ISDIR(buf64.st_mode)) {
+                close(fd);
+                errno = EISDIR;
+                fd = -1;
+            }
+        } else {
+            close(fd);
+            fd = -1;
+        }
+    }
+    return fd;
+}
+
 void
 fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags)
 {
@@ -74,8 +105,8 @@
         while ((p > ps) && (*p == '/'))
             *p-- = '\0';
 #endif
-        fd = JVM_Open(ps, flags, 0666);
-        if (fd >= 0) {
+        fd = handleOpen(ps, flags, 0666);
+        if (fd != -1) {
             SET_FD(this, fd, fid);
         } else {
             throwFileNotFoundException(env, path);
@@ -83,7 +114,6 @@
     } END_PLATFORM_STRING(env, ps);
 }
 
-
 void
 fileClose(JNIEnv *env, jobject this, jfieldID fid)
 {
@@ -114,7 +144,89 @@
             dup2(devnull, fd);
             close(devnull);
         }
-    } else if (JVM_Close(fd) == -1) {
+    } else if (close(fd) == -1) {
         JNU_ThrowIOExceptionWithLastError(env, "close failed");
     }
 }
+
+ssize_t
+handleRead(FD fd, void *buf, jint len)
+{
+    ssize_t result;
+    RESTARTABLE(read(fd, buf, len), result);
+    return result;
+}
+
+ssize_t
+handleWrite(FD fd, const void *buf, jint len)
+{
+    ssize_t result;
+    RESTARTABLE(write(fd, buf, len), result);
+    return result;
+}
+
+jint
+handleAvailable(FD fd, jlong *pbytes)
+{
+    int mode;
+    struct stat64 buf64;
+    jlong size = -1, current = -1;
+
+    int result;
+    RESTARTABLE(fstat64(fd, &buf64), result);
+    if (result != -1) {
+        mode = buf64.st_mode;
+        if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
+            int n;
+            int result;
+            RESTARTABLE(ioctl(fd, FIONREAD, &n), result);
+            if (result >= 0) {
+                *pbytes = n;
+                return 1;
+            }
+        } else if (S_ISREG(mode)) {
+            size = buf64.st_size;
+        }
+    }
+
+    if ((current = lseek64(fd, 0, SEEK_CUR)) == -1) {
+        return 0;
+    }
+
+    if (size < current) {
+        if ((size = lseek64(fd, 0, SEEK_END)) == -1)
+            return 0;
+        else if (lseek64(fd, current, SEEK_SET) == -1)
+            return 0;
+    }
+
+    if (size >= current) {
+        *pbytes = size - current;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+jint
+handleSetLength(FD fd, jlong length)
+{
+    int result;
+    RESTARTABLE(ftruncate64(fd, length), result);
+    return result;
+}
+
+size_t
+getLastErrorString(char *buf, size_t len)
+{
+    if (errno == 0 || len < 1) return 0;
+
+    const char *err = strerror(errno);
+    size_t n = strlen(err);
+    if (n >= len)
+        n = len - 1;
+
+    strncpy(buf, err, n);
+    buf[n] = '\0';
+    return n;
+}
--- a/jdk/src/solaris/native/java/io/io_util_md.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/solaris/native/java/io/io_util_md.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
  * questions.
  */
 
-#include "jni.h"
 #include "jni_util.h"
 
 /*
@@ -32,6 +31,18 @@
 #define FD jint
 
 /*
+ * Prototypes for functions in io_util_md.c called from io_util.c,
+ * FileDescriptor.c, FileInputStream.c, FileOutputStream.c,
+ * UnixFileSystem_md.c
+ */
+ssize_t handleWrite(FD fd, const void *buf, jint len);
+ssize_t handleRead(FD fd, void *buf, jint len);
+jint handleAvailable(FD fd, jlong *pbytes);
+jint handleSetLength(FD fd, jlong length);
+
+FD handleOpen(const char *path, int oflag, int mode);
+
+/*
  * Macros to set/get fd from the java.io.FileDescriptor.  These
  * macros rely on having an appropriately defined 'this' object
  * within the scope in which they're used.
@@ -53,15 +64,25 @@
 #define THIS_FD(obj) (*env)->GetIntField(env, obj, IO_fd_fdID)
 
 /*
- * Route the routines through VM
+ * Route the routines
  */
-#define IO_Append JVM_Write
-#define IO_Write JVM_Write
-#define IO_Sync JVM_Sync
-#define IO_Read JVM_Read
-#define IO_Lseek JVM_Lseek
-#define IO_Available JVM_Available
-#define IO_SetLength JVM_SetLength
+#define IO_Sync fsync
+#define IO_Read handleRead
+#define IO_Write handleWrite
+#define IO_Append handleWrite
+#define IO_Available handleAvailable
+#define IO_SetLength handleSetLength
+
+#ifdef _ALLBSD_SOURCE
+#define open64 open
+#define fstat64 fstat
+#define stat64 stat
+#define lseek64 lseek
+#define ftruncate64 ftruncate
+#define IO_Lseek lseek
+#else
+#define IO_Lseek lseek64
+#endif
 
 /*
  * On Solaris, the handle field is unused
@@ -69,6 +90,15 @@
 #define SET_HANDLE(fd) return (jlong)-1
 
 /*
+ * Retry the operation if it is interrupted
+ */
+#define RESTARTABLE(_cmd, _result) do { \
+    do { \
+        _result = _cmd; \
+    } while((_result == -1) && (errno == EINTR)); \
+} while(0)
+
+/*
  * IO helper function(s)
  */
 void fileClose(JNIEnv *env, jobject this, jfieldID fid);
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsConstants.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsConstants.java	Fri Mar 15 23:31:19 2013 -0700
@@ -181,6 +181,11 @@
     public static final int FILE_READ_ATTRIBUTES        = 0x0080;
     public static final int FILE_WRITE_ATTRIBUTES       = 0x0100;
 
+    public static final int FILE_GENERIC_READ           = 0x00120089;
+    public static final int FILE_GENERIC_WRITE          = 0x00120116;
+    public static final int FILE_GENERIC_EXECUTE        = 0x001200a0;
+    public static final int FILE_ALL_ACCESS             = 0x001f01ff;
+
     // operating system security
     public static final int TOKEN_DUPLICATE             = 0x0002;
     public static final int TOKEN_IMPERSONATE           = 0x0004;
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java	Fri Mar 15 23:31:19 2013 -0700
@@ -38,6 +38,7 @@
 import sun.security.util.SecurityConstants;
 
 import static sun.nio.fs.WindowsNativeDispatcher.*;
+import static sun.nio.fs.WindowsSecurity.*;
 import static sun.nio.fs.WindowsConstants.*;
 
 public class WindowsFileSystemProvider
@@ -289,67 +290,29 @@
     }
 
     /**
-     * Returns buffer with SID_AND_ATTRIBUTES structure representing the user
-     * associated with the current thread access token.
-     * FIXME - this should be cached.
+     * Checks the file security against desired access.
      */
-    private static NativeBuffer getUserInfo(WindowsPath file) throws IOException {
-        try {
-            long hToken = WindowsSecurity.processTokenWithQueryAccess;
-            int size = GetTokenInformation(hToken, TokenUser, 0L, 0);
-            assert size > 0;
-
-            NativeBuffer buffer = NativeBuffers.getNativeBuffer(size);
-            try {
-                int newsize = GetTokenInformation(hToken, TokenUser,
-                                                  buffer.address(), size);
-                if (newsize != size)
-                    throw new AssertionError();
-                return buffer;
-            } catch (WindowsException x) {
-                buffer.release();
-                throw x;
-            }
-        } catch (WindowsException x) {
-            throw new IOException(x.getMessage());
-        }
-    }
-
-    /**
-     * Reads the file ACL and return the effective access as ACCESS_MASK
-     */
-    private static int getEffectiveAccess(WindowsPath file) throws IOException {
-        // read security descriptor continaing ACL (symlinks are followed)
+    private static boolean hasDesiredAccess(WindowsPath file, int rights) throws IOException {
+        // read security descriptor containing ACL (symlinks are followed)
+        boolean hasRights = false;
         String target = WindowsLinkSupport.getFinalPath(file, true);
         NativeBuffer aclBuffer = WindowsAclFileAttributeView
-            .getFileSecurity(target, DACL_SECURITY_INFORMATION);
-
-        // retrieves DACL from security descriptor
-        long pAcl = GetSecurityDescriptorDacl(aclBuffer.address());
-
-        // Use GetEffectiveRightsFromAcl to get effective access to file
+            .getFileSecurity(target,
+                DACL_SECURITY_INFORMATION
+                | OWNER_SECURITY_INFORMATION
+                | GROUP_SECURITY_INFORMATION);
         try {
-            NativeBuffer userBuffer = getUserInfo(file);
-            try {
-                try {
-                    // SID_AND_ATTRIBUTES->pSid
-                    long pSid = unsafe.getAddress(userBuffer.address());
-                    long pTrustee = BuildTrusteeWithSid(pSid);
-                    try {
-                        return GetEffectiveRightsFromAcl(pAcl, pTrustee);
-                    } finally {
-                        LocalFree(pTrustee);
-                    }
-                } catch (WindowsException x) {
-                    throw new IOException("Unable to get effective rights from ACL: " +
-                        x.getMessage());
-                }
-            } finally {
-                userBuffer.release();
-            }
+            hasRights = checkAccessMask(aclBuffer.address(), rights,
+                FILE_GENERIC_READ,
+                FILE_GENERIC_WRITE,
+                FILE_GENERIC_EXECUTE,
+                FILE_ALL_ACCESS);
+        } catch (WindowsException exc) {
+            exc.rethrowAsIOException(file);
         } finally {
             aclBuffer.release();
         }
+        return hasRights;
     }
 
     /**
@@ -416,10 +379,10 @@
             mask |= FILE_EXECUTE;
         }
 
-        if ((getEffectiveAccess(file) & mask) == 0)
+        if (!hasDesiredAccess(file, mask))
             throw new AccessDeniedException(
                 file.getPathForExceptionMessage(), null,
-                "Effective permissions does not allow requested access");
+                "Permissions does not allow requested access");
 
         // for write access we neeed to check if the DOS readonly attribute
         // and if the volume is read-only
@@ -438,7 +401,6 @@
                 throw new AccessDeniedException(
                     file.getPathForExceptionMessage(), null, "Read-only file system");
             }
-            return;
         }
     }
 
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsNativeDispatcher.java	Fri Mar 15 23:31:19 2013 -0700
@@ -844,6 +844,23 @@
     static native void AdjustTokenPrivileges(long token, long luid, int attributes)
         throws WindowsException;
 
+
+    /**
+     * AccessCheck(
+     *   PSECURITY_DESCRIPTOR pSecurityDescriptor,
+     *   HANDLE ClientToken,
+     *   DWORD DesiredAccess,
+     *   PGENERIC_MAPPING GenericMapping,
+     *   PPRIVILEGE_SET PrivilegeSet,
+     *   LPDWORD PrivilegeSetLength,
+     *   LPDWORD GrantedAccess,
+     *   LPBOOL AccessStatus
+     * )
+     */
+    static native boolean AccessCheck(long token, long securityInfo, int accessMask,
+        int genericRead, int genericWrite, int genericExecute, int genericAll)
+        throws WindowsException;
+
     /**
      */
     static long LookupPrivilegeValue(String name) throws WindowsException {
@@ -858,28 +875,6 @@
         throws WindowsException;
 
     /**
-     * BuildTrusteeWithSid(
-     *   PTRUSTEE pTrustee,
-     *   PSID pSid
-     * )
-     *
-     * @return  pTrustee
-     */
-    static native long BuildTrusteeWithSid(long pSid);
-
-    /**
-     * GetEffectiveRightsFromAcl(
-     *   PACL pacl,
-     *   PTRUSTEE pTrustee,
-     *   PACCESS_MASK pAccessRights
-     * )
-     *
-     * @return  AccessRights
-     */
-    static native int GetEffectiveRightsFromAcl(long pAcl, long pTrustee)
-        throws WindowsException;
-
-    /**
      * CreateSymbolicLink(
      *   LPCWSTR lpSymlinkFileName,
      *   LPCWSTR lpTargetFileName,
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsSecurity.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsSecurity.java	Fri Mar 15 23:31:19 2013 -0700
@@ -105,19 +105,46 @@
         return new Privilege() {
             @Override
             public void drop() {
-                try {
-                    if (stopImpersontating) {
-                        SetThreadToken(0L, 0L);
-                    } else {
-                        if (needToRevert) {
+                if (token != 0L) {
+                    try {
+                        if (stopImpersontating)
+                            SetThreadToken(0L, 0L);
+                        else if (needToRevert)
                             AdjustTokenPrivileges(token, pLuid, 0);
-                        }
+                    } catch (WindowsException x) {
+                        // should not happen
+                        throw new AssertionError(x);
+                    } finally {
+                        CloseHandle(token);
                     }
-                } catch (WindowsException x) {
-                    // should not happen
-                    throw new AssertionError(x);
                 }
             }
         };
     }
+
+    /**
+     * Check the access right against the securityInfo in the current thread.
+     */
+    static boolean checkAccessMask(long securityInfo, int accessMask,
+        int genericRead, int genericWrite, int genericExecute, int genericAll)
+        throws WindowsException
+    {
+        int privilegies = TOKEN_QUERY;
+        long hToken = OpenThreadToken(GetCurrentThread(), privilegies, false);
+        if (hToken == 0L && processTokenWithDuplicateAccess != 0L)
+            hToken = DuplicateTokenEx(processTokenWithDuplicateAccess,
+                privilegies);
+
+        boolean hasRight = false;
+        if (hToken != 0L) {
+            try {
+                hasRight = AccessCheck(hToken, securityInfo, accessMask,
+                    genericRead, genericWrite, genericExecute, genericAll);
+            } finally {
+                CloseHandle(hToken);
+            }
+        }
+        return hasRight;
+    }
+
 }
--- a/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Fri Mar 15 23:31:19 2013 -0700
@@ -35,17 +35,20 @@
 import java.text.spi.DateFormatSymbolsProvider;
 import java.text.spi.DecimalFormatSymbolsProvider;
 import java.text.spi.NumberFormatProvider;
+import java.util.Calendar;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle.Control;
 import java.util.Set;
+import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.spi.CalendarDataProvider;
 import java.util.spi.CalendarNameProvider;
+import sun.util.spi.CalendarProvider;
 
 /**
  * LocaleProviderdapter implementation for the Windows locale data.
@@ -98,9 +101,9 @@
         if (initialize()) {
             // Assuming the default locales do not include any extensions, so
             // no stripping is needed here.
-            Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replaceAll("_","-"));
+            Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replace('_', '-'));
             tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
-            l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replaceAll("_","-"));
+            l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replace('_', '-'));
             tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
         }
         supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
@@ -173,24 +176,12 @@
 
             @Override
             public Locale[] getAvailableLocales() {
-                if (isSupportedLocale(Locale.getDefault(Locale.Category.FORMAT))) {
-                    return supportedLocale;
-                }
-
-                return new Locale[0];
+                return getSupportedCalendarLocales();
             }
 
             @Override
             public boolean isSupportedLocale(Locale locale) {
-                // Only supports the locale with Gregorian calendar
-                if (supportedLocale.length != 0) {
-                    int calid = getCalendarID(locale.toLanguageTag());
-                    if (calid > 0 && calid < calIDToLDML.length) {
-                        return calIDToLDML[calid].startsWith("gregory");
-                    }
-                }
-
-                return false;
+                return isSupportedCalendarLocale(locale);
             }
 
             @Override
@@ -380,6 +371,29 @@
         };
     }
 
+    public static CalendarProvider getCalendarProvider() {
+        return new CalendarProvider() {
+            @Override
+            public Locale[] getAvailableLocales() {
+                return getSupportedCalendarLocales();
+            }
+
+            @Override
+            public boolean isSupportedLocale(Locale locale) {
+                return isSupportedCalendarLocale(locale);
+            }
+
+            @Override
+            public Calendar getInstance(TimeZone zone, Locale locale) {
+                return new Calendar.Builder()
+                             .setLocale(getCalendarLocale(locale))
+                             .setTimeZone(zone)
+                             .setInstant(System.currentTimeMillis())
+                             .build();
+            }
+        };
+    }
+
     private static String convertDateTimePattern(String winPattern) {
         String ret = winPattern.replaceAll("dddd", "EEEE");
         ret = ret.replaceAll("ddd", "EEE");
@@ -401,24 +415,21 @@
     }
 
     private static boolean isSupportedCalendarLocale(Locale locale) {
-        // special case for ja_JP_JP
-        if (JRELocaleConstants.JA_JP_JP.equals(locale)) {
-            return isJapaneseCalendar();
-        }
-
         Locale base = locale.stripExtensions();
         if (!supportedLocaleSet.contains(base)) {
             return false;
         }
 
-        String caltype = locale.getUnicodeLocaleType("ca");
-        if (caltype == null) {
-            return true;
+        String requestedCalType = locale.getUnicodeLocaleType("ca");
+        String nativeCalType =
+                calIDToLDML[getCalendarID(locale.toLanguageTag())]
+                .replaceFirst("_.*", ""); // remove locale part.
+
+        if (requestedCalType == null) {
+            return Calendar.getAvailableCalendarTypes().contains(nativeCalType);
+        } else {
+            return requestedCalType.equals(nativeCalType);
         }
-
-        return caltype.equals(
-            calIDToLDML[getCalendarID(locale.toLanguageTag())]
-            .replaceFirst("_.*", ""));
     }
 
     private static Locale[] getSupportedNativeDigitLocales() {
--- a/jdk/src/windows/native/common/jdk_util_md.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/native/common/jdk_util_md.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,11 @@
 #define JDK_UTIL_MD_H
 
 #include "jni.h"
+#include <float.h>
+
+// checking for nanness
+#define ISNANF(f) _isnan(f)
+#define ISNAND(d) _isnan(d)
 
 #ifdef __cplusplus
 extern "C" {
--- a/jdk/src/windows/native/common/jni_util_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/native/common/jni_util_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,3 +137,35 @@
     else
         return NULL;
 }
+
+void* getProcessHandle() {
+    return (void*)GetModuleHandle(NULL);
+}
+
+/*
+ * Windows symbols can be simple like JNI_OnLoad or __stdcall format
+ * like _JNI_OnLoad@8. We need to handle both.
+ */
+void buildJniFunctionName(const char *sym, const char *cname,
+                          char *jniEntryName) {
+    if (cname != NULL) {
+        char *p = strrchr(sym, '@');
+        if (p != NULL && p != sym) {
+            // sym == _JNI_OnLoad@8
+            strncpy(jniEntryName, sym, (p - sym));
+            jniEntryName[(p-sym)] = '\0';
+            // jniEntryName == _JNI_OnLoad
+            strcat(jniEntryName, "_");
+            strcat(jniEntryName, cname);
+            strcat(jniEntryName, p);
+            //jniEntryName == _JNI_OnLoad_cname@8
+        } else {
+            strcpy(jniEntryName, sym);
+            strcat(jniEntryName, "_");
+            strcat(jniEntryName, cname);
+        }
+    } else {
+        strcpy(jniEntryName, sym);
+    }
+    return;
+}
--- a/jdk/src/windows/native/java/io/io_util_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/native/java/io/io_util_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -208,7 +208,7 @@
     return pathbuf;
 }
 
-jlong
+FD
 winFileHandleOpen(JNIEnv *env, jstring path, int flags)
 {
     const DWORD access =
@@ -264,7 +264,7 @@
 void
 fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags)
 {
-    jlong h = winFileHandleOpen(env, path, flags);
+    FD h = winFileHandleOpen(env, path, flags);
     if (h >= 0) {
         SET_FD(this, h, fid);
     }
@@ -274,12 +274,12 @@
    old C style int fd as is used in HPI layer */
 
 static int
-handleNonSeekAvailable(jlong, long *);
+handleNonSeekAvailable(FD, long *);
 static int
-handleStdinAvailable(jlong, long *);
+handleStdinAvailable(FD, long *);
 
 int
-handleAvailable(jlong fd, jlong *pbytes) {
+handleAvailable(FD fd, jlong *pbytes) {
     HANDLE h = (HANDLE)fd;
     DWORD type = 0;
 
@@ -317,7 +317,7 @@
 }
 
 static int
-handleNonSeekAvailable(jlong fd, long *pbytes) {
+handleNonSeekAvailable(FD fd, long *pbytes) {
     /* This is used for available on non-seekable devices
      * (like both named and anonymous pipes, such as pipes
      *  connected to an exec'd process).
@@ -346,7 +346,7 @@
 }
 
 static int
-handleStdinAvailable(jlong fd, long *pbytes) {
+handleStdinAvailable(FD fd, long *pbytes) {
     HANDLE han;
     DWORD numEventsRead = 0;    /* Number of events read from buffer */
     DWORD numEvents = 0;        /* Number of events in buffer */
@@ -412,8 +412,8 @@
  * denied".
  */
 
-JNIEXPORT int
-handleSync(jlong fd) {
+int
+handleSync(FD fd) {
     /*
      * From the documentation:
      *
@@ -443,7 +443,7 @@
 
 
 int
-handleSetLength(jlong fd, jlong length) {
+handleSetLength(FD fd, jlong length) {
     HANDLE h = (HANDLE)fd;
     long high = (long)(length >> 32);
     DWORD ret;
@@ -459,7 +459,7 @@
 
 JNIEXPORT
 jint
-handleRead(jlong fd, void *buf, jint len)
+handleRead(FD fd, void *buf, jint len)
 {
     DWORD read = 0;
     BOOL result = 0;
@@ -482,7 +482,7 @@
     return (jint)read;
 }
 
-static jint writeInternal(jlong fd, const void *buf, jint len, jboolean append)
+static jint writeInternal(FD fd, const void *buf, jint len, jboolean append)
 {
     BOOL result = 0;
     DWORD written = 0;
@@ -510,13 +510,11 @@
     return (jint)written;
 }
 
-JNIEXPORT
-jint handleWrite(jlong fd, const void *buf, jint len) {
+jint handleWrite(FD fd, const void *buf, jint len) {
     return writeInternal(fd, buf, len, JNI_FALSE);
 }
 
-JNIEXPORT
-jint handleAppend(jlong fd, const void *buf, jint len) {
+jint handleAppend(FD fd, const void *buf, jint len) {
     return writeInternal(fd, buf, len, JNI_TRUE);
 }
 
@@ -545,7 +543,7 @@
 }
 
 jlong
-handleLseek(jlong fd, jlong offset, jint whence)
+handleLseek(FD fd, jlong offset, jint whence)
 {
     LARGE_INTEGER pos, distance;
     DWORD lowPos = 0;
@@ -569,3 +567,44 @@
     }
     return long_to_jlong(pos.QuadPart);
 }
+
+size_t
+getLastErrorString(char *buf, size_t len)
+{
+    DWORD errval;
+    if (len > 0) {
+        if ((errval = GetLastError()) != 0) {
+            // DOS error
+            size_t n = (size_t)FormatMessage(
+                FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL,
+                errval,
+                0,
+                buf,
+                (DWORD)len,
+                NULL);
+            if (n > 3) {
+                // Drop final '.', CR, LF
+                if (buf[n - 1] == '\n') n--;
+                if (buf[n - 1] == '\r') n--;
+                if (buf[n - 1] == '.') n--;
+                buf[n] = '\0';
+            }
+            return n;
+        }
+
+        if (errno != 0) {
+            // C runtime error that has no corresponding DOS error code
+            const char *err = strerror(errno);
+            size_t n = strlen(err);
+            if (n >= len)
+                n = len - 1;
+
+            strncpy(buf, err, n);
+            buf[n] = '\0';
+            return n;
+        }
+    }
+
+    return 0;
+}
--- a/jdk/src/windows/native/java/io/io_util_md.h	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/native/java/io/io_util_md.h	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,12 @@
 #include "jni_util.h"
 
 /*
- * Prototypes for functions in io_util_md.c called from io_util,
+ * Macros to use the right data type for file descriptors
+ */
+#define FD jlong
+
+/*
+ * Prototypes for functions in io_util_md.c called from io_util.c,
  * FileDescriptor.c, FileInputStream.c, FileOutputStream.c
  */
 WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
@@ -35,26 +40,20 @@
 WCHAR* getPrefixed(const WCHAR* path, int pathlen);
 WCHAR* currentDir(int di);
 int currentDirLength(const WCHAR* path, int pathlen);
-void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
-int handleAvailable(jlong fd, jlong *pbytes);
-JNIEXPORT int handleSync(jlong fd);
-int handleSetLength(jlong fd, jlong length);
-JNIEXPORT jint handleRead(jlong fd, void *buf, jint len);
-JNIEXPORT jint handleWrite(jlong fd, const void *buf, jint len);
-JNIEXPORT jint handleAppend(jlong fd, const void *buf, jint len);
+int handleAvailable(FD fd, jlong *pbytes);
+int handleSync(FD fd);
+int handleSetLength(FD fd, jlong length);
+JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
+jint handleWrite(FD fd, const void *buf, jint len);
+jint handleAppend(FD fd, const void *buf, jint len);
 jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
-jlong handleLseek(jlong fd, jlong offset, jint whence);
+jlong handleLseek(FD fd, jlong offset, jint whence);
 
 /*
  * Returns an opaque handle to file named by "path".  If an error occurs,
  * returns -1 and an exception is pending.
  */
-jlong winFileHandleOpen(JNIEnv *env, jstring path, int flags);
-
-/*
- * Macros to use the right data type for file descriptors
- */
-#define FD jlong
+FD winFileHandleOpen(JNIEnv *env, jstring path, int flags);
 
 /*
  * Macros to set/get fd from the java.io.FileDescriptor.
--- a/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Fri Mar 15 23:31:19 2013 -0700
@@ -1021,6 +1021,33 @@
         throwWindowsException(env, GetLastError());
 }
 
+JNIEXPORT jboolean JNICALL
+Java_sun_nio_fs_WindowsNativeDispatcher_AccessCheck(JNIEnv* env,
+    jclass this, jlong token, jlong securityInfo, jint accessMask,
+    jint genericRead, jint genericWrite, jint genericExecute, jint genericAll)
+{
+    HANDLE hImpersonatedToken = (HANDLE)jlong_to_ptr(token);
+    PSECURITY_DESCRIPTOR security = (PSECURITY_DESCRIPTOR)jlong_to_ptr(securityInfo);
+    DWORD checkAccessRights = (DWORD)accessMask;
+    GENERIC_MAPPING mapping = {
+        genericRead,
+        genericWrite,
+        genericExecute,
+        genericAll};
+    PRIVILEGE_SET privileges = {0};
+    DWORD privilegesLength = sizeof(privileges);
+    DWORD grantedAccess = 0;
+    BOOL result = FALSE;
+
+    /* checkAccessRights is in-out parameter */
+    MapGenericMask(&checkAccessRights, &mapping);
+    if (AccessCheck(security, hImpersonatedToken, checkAccessRights,
+            &mapping, &privileges, &privilegesLength, &grantedAccess, &result) == 0)
+        throwWindowsException(env, GetLastError());
+
+    return (result == FALSE) ? JNI_FALSE : JNI_TRUE;
+}
+
 JNIEXPORT jlong JNICALL
 Java_sun_nio_fs_WindowsNativeDispatcher_LookupPrivilegeValue0(JNIEnv* env,
     jclass this, jlong name)
@@ -1037,35 +1064,6 @@
     return ptr_to_jlong(pLuid);
 }
 
-JNIEXPORT jlong JNICALL
-Java_sun_nio_fs_WindowsNativeDispatcher_BuildTrusteeWithSid(JNIEnv* env,
-    jclass this, jlong sid)
-{
-    PSID pSid = (HANDLE)jlong_to_ptr(sid);
-    PTRUSTEE_W pTrustee = LocalAlloc(0, sizeof(TRUSTEE_W));
-
-    if (pTrustee == NULL) {
-        JNU_ThrowInternalError(env, "Unable to allocate TRUSTEE_W structure");
-    } else {
-        BuildTrusteeWithSidW(pTrustee, pSid);
-    }
-    return ptr_to_jlong(pTrustee);
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_fs_WindowsNativeDispatcher_GetEffectiveRightsFromAcl(JNIEnv* env,
-    jclass this, jlong acl, jlong trustee)
-{
-    ACCESS_MASK access;
-    PACL pAcl = (PACL)jlong_to_ptr(acl);
-    PTRUSTEE pTrustee = (PTRUSTEE)jlong_to_ptr(trustee);
-
-    if (GetEffectiveRightsFromAcl(pAcl, pTrustee, &access) != ERROR_SUCCESS) {
-        throwWindowsException(env, GetLastError());
-    }
-    return (jint)access;
-}
-
 JNIEXPORT void JNICALL
 Java_sun_nio_fs_WindowsNativeDispatcher_CreateSymbolicLink0(JNIEnv* env,
     jclass this, jlong linkAddress, jlong targetAddress, jint flags)
--- a/jdk/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Fri Mar 15 23:31:19 2013 -0700
@@ -611,7 +611,12 @@
 
 int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen) {
     if (pGetLocaleInfoEx) {
-        return pGetLocaleInfoEx((LPWSTR)langtag, type, data, buflen);
+        if (wcscmp(L"und", (LPWSTR)langtag) == 0) {
+            // defaults to "en"
+            return pGetLocaleInfoEx(L"en", type, data, buflen);
+        } else {
+            return pGetLocaleInfoEx((LPWSTR)langtag, type, data, buflen);
+        }
     } else {
         // If we ever wanted to support WinXP, we will need extra module from
         // MS...
@@ -622,7 +627,12 @@
 
 int getCalendarInfoWrapper(const jchar *langtag, CALID id, LPCWSTR reserved, CALTYPE type, LPWSTR data, int buflen, LPDWORD val) {
     if (pGetCalendarInfoEx) {
-        return pGetCalendarInfoEx((LPWSTR)langtag, id, reserved, type, data, buflen, val);
+        if (wcscmp(L"und", (LPWSTR)langtag) == 0) {
+            // defaults to "en"
+            return pGetCalendarInfoEx(L"en", id, reserved, type, data, buflen, val);
+        } else {
+            return pGetCalendarInfoEx((LPWSTR)langtag, id, reserved, type, data, buflen, val);
+        }
     } else {
         // If we ever wanted to support WinXP, we will need extra module from
         // MS...
--- a/jdk/test/java/nio/channels/DatagramChannel/Connect.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/Connect.java	Fri Mar 15 23:31:19 2013 -0700
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @bug 4313882 7183800
  * @summary Test DatagramChannel's send and receive methods
  * @author Mike McCloskey
  */
@@ -88,6 +89,9 @@
                 bb.put("hello".getBytes());
                 bb.flip();
                 InetAddress address = InetAddress.getLocalHost();
+                if (address.isLoopbackAddress()) {
+                    address = InetAddress.getLoopbackAddress();
+                }
                 InetSocketAddress isa = new InetSocketAddress(address, port);
                 dc.connect(isa);
                 dc.write(bb);
--- a/jdk/test/java/nio/channels/DatagramChannel/ConnectedSend.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/ConnectedSend.java	Fri Mar 15 23:31:19 2013 -0700
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4849277
+ * @bug 4849277 7183800
  * @summary Test DatagramChannel send while connected
  * @author Mike McCloskey
  */
@@ -46,14 +46,18 @@
 
         DatagramChannel sndChannel = DatagramChannel.open();
         sndChannel.socket().bind(null);
+        InetAddress address = InetAddress.getLocalHost();
+        if (address.isLoopbackAddress()) {
+            address = InetAddress.getLoopbackAddress();
+        }
         InetSocketAddress sender = new InetSocketAddress(
-            InetAddress.getLocalHost(),
+            address,
             sndChannel.socket().getLocalPort());
 
         DatagramChannel rcvChannel = DatagramChannel.open();
         rcvChannel.socket().bind(null);
         InetSocketAddress receiver = new InetSocketAddress(
-            InetAddress.getLocalHost(),
+            address,
             rcvChannel.socket().getLocalPort());
 
         rcvChannel.connect(sender);
@@ -80,14 +84,18 @@
     private static void test2() throws Exception {
         DatagramChannel sndChannel = DatagramChannel.open();
         sndChannel.socket().bind(null);
+        InetAddress address = InetAddress.getLocalHost();
+        if (address.isLoopbackAddress()) {
+            address = InetAddress.getLoopbackAddress();
+        }
         InetSocketAddress sender = new InetSocketAddress(
-            InetAddress.getLocalHost(),
+            address,
             sndChannel.socket().getLocalPort());
 
         DatagramChannel rcvChannel = DatagramChannel.open();
         rcvChannel.socket().bind(null);
         InetSocketAddress receiver = new InetSocketAddress(
-            InetAddress.getLocalHost(),
+            address,
             rcvChannel.socket().getLocalPort());
 
         rcvChannel.connect(sender);
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java	Fri Mar 15 23:31:19 2013 -0700
@@ -133,8 +133,11 @@
         dc.close();
 
         dc = DatagramChannel.open();
-
-        InetSocketAddress isa = new InetSocketAddress(InetAddress.getLocalHost(), port);
+        InetAddress address = InetAddress.getLocalHost();
+        if (address.isLoopbackAddress()) {
+            address = InetAddress.getLoopbackAddress();
+        }
+        InetSocketAddress isa = new InetSocketAddress(address, port);
 
         dc.connect(isa);
         return dc;
--- a/jdk/test/java/util/logging/LoggerResourceBundleRace.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/test/java/util/logging/LoggerResourceBundleRace.java	Fri Mar 15 23:31:19 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +23,14 @@
 
 /*
  * @test
- * @bug     7045594
+ * @bug     7045594 8002070
  * @summary ResourceBundle setting race in Logger.getLogger(name, rbName)
  * @author  Daniel D. Daugherty
  * @build RacingThreadsTest LoggerResourceBundleRace
- * @run main LoggerResourceBundleRace
+ * @run main/othervm LoggerResourceBundleRace
+ *
+ * (In samevm mode, the bundle classes don't end up in the classpath.)
  */
-
 import java.util.ListResourceBundle;
 import java.util.MissingResourceException;
 import java.util.concurrent.atomic.AtomicInteger;
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnectionIdTest.java	Thu Mar 14 19:26:02 2013 -0700
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnectionIdTest.java	Fri Mar 15 23:31:19 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4901808
+ * @bug 4901808 7183800
  * @summary Check that RMI connection ids include client host name
  * @author Eamonn McManus
  * @run clean RMIConnectionIdTest
@@ -60,7 +60,7 @@
         }
         String clientAddr = rest.substring(0, spaceIndex);
         InetAddress clientInetAddr = InetAddress.getByName(clientAddr);
-        InetAddress localAddr = InetAddress.getLocalHost();
+        InetAddress localAddr = clientInetAddr.isLoopbackAddress() ? InetAddress.getLoopbackAddress() : InetAddress.getLocalHost();
         System.out.println("InetAddresses: local=" + localAddr + "; " +
                            "connectionId=" + clientInetAddr);
         if (!localAddr.equals(clientInetAddr)) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/http/HttpClient/IsAvailable.java	Fri Mar 15 23:31:19 2013 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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 8009650
+ * @summary HttpClient available() check throws SocketException when connection
+ * has been closed
+ */
+
+import java.net.URL;
+import java.net.ServerSocket;
+import sun.net.www.http.HttpClient;
+import java.security.*;
+import java.lang.reflect.Method;
+
+public class IsAvailable {
+
+    public static void main(String[] args) throws Exception {
+        int readTimeout = 20;
+        ServerSocket ss = new ServerSocket(0);
+
+        URL url1 = new URL("http://localhost:" + ss.getLocalPort());
+        HttpClient c1 = HttpClient.New(url1);
+
+        Method available = HttpClient.class.
+                getDeclaredMethod("available", null);
+        available.setAccessible(true);
+
+        c1.setReadTimeout(readTimeout);
+        boolean a = (boolean) available.invoke(c1);
+        if (!a) {
+            throw new RuntimeException("connection should be available");
+        }
+        if (c1.getReadTimeout() != readTimeout) {
+            throw new RuntimeException("read timeout has been altered");
+        }
+
+        c1.closeServer();
+
+        a = (boolean) available.invoke(c1);
+        if (a) {
+            throw new RuntimeException("connection shouldn't be available");
+        }
+
+        ss.close();
+    }
+}