changeset 2154:d6d2de6ee2d1

Merge
author lana
date Fri, 19 Feb 2010 15:13:37 -0800
parents 2ba381560071 a9b4fde406d4
children b396584a3e64
files
diffstat 153 files changed, 25199 insertions(+), 667 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Feb 12 19:58:10 2010 +0300
+++ b/.hgtags	Fri Feb 19 15:13:37 2010 -0800
@@ -55,3 +55,7 @@
 1143e498f813b8223b5e3a696d79da7ff7c25354 jdk7-b78
 918920710d65432a2d54fdf407c1524a5571c4ad jdk7-b79
 049cfaaa9a7374e3768a79969a799e8b59ad52fa jdk7-b80
+10b993d417fcdb40480dad7032ac241f4b87f1af jdk7-b81
+69ef657320ad5c35cfa12e4d8322d877e778f8b3 jdk7-b82
+9027c6b9d7e2c9ca04a1add691b5b50d0f22b1aa jdk7-b83
+7cb9388bb1a16365fa5118c5efa38b1cd58be40d jdk7-b84
--- a/make/common/shared/Defs-java.gmk	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/common/shared/Defs-java.gmk	Fri Feb 19 15:13:37 2010 -0800
@@ -138,6 +138,10 @@
 # Needed for javah
 JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
 
+# Needed for javadoc to ensure it builds documentation
+# against the newly built classes
+JAVADOCFLAGS += -bootclasspath $(CLASSBINDIR)
+
 # Needed for JAVADOC and BOOT_JAVACFLAGS
 NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
 
@@ -155,14 +159,15 @@
 		-jar $(JAVAH_JAR) $(JAVAHFLAGS)
   JAVADOC_CMD = $(BOOT_JAVA_CMD) \
 		"-Xbootclasspath/p:$(JAVADOC_JAR)$(CLASSPATH_SEPARATOR)$(JAVAC_JAR)$(CLASSPATH_SEPARATOR)$(DOCLETS_JAR)" \
-		-jar $(JAVADOC_JAR)
+		-jar $(JAVADOC_JAR) $(JAVADOCFLAGS)
 else
   # If no explicit tools, use boot tools (add VM flags in this case)
   JAVAC_CMD     = $(JAVA_TOOLS_DIR)/javac $(JAVAC_JVM_FLAGS) \
 		  $(JAVACFLAGS)
   JAVAH_CMD     = $(JAVA_TOOLS_DIR)/javah \
 		  $(JAVAHFLAGS)
-  JAVADOC_CMD   = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%)
+  JAVADOC_CMD   = $(JAVA_TOOLS_DIR)/javadoc $(JAVA_TOOLS_FLAGS:%=-J%) \
+  		  $(JAVADOCFLAGS)
 endif
 
 # Override of what javac to use (see deploy workspace)
--- a/make/common/shared/Sanity.gmk	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/common/shared/Sanity.gmk	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2005-2010 Sun Microsystems, Inc.  All Rights Reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -1093,6 +1093,7 @@
 # Check for existence of misc Hotspot imported files
 ######################################################
 HOTSPOT_INCLUDE_FILE_LIST  = jvmti.h
+HOTSPOT_INCLUDE_FILE_LIST  += jvmticmlr.h
 #HOTSPOT_INCLUDE_FILE_LIST += jni.h jni_md.h
 #HOTSPOT_INCLUDE_FILE_LIST += jvm.h jvm_md.h
 #HOTSPOT_INCLUDE_FILE_LIST += jmm.h
--- a/make/docs/Makefile	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/docs/Makefile	Fri Feb 19 15:13:37 2010 -0800
@@ -69,7 +69,7 @@
 THIS_YEAR := $(shell $(DATE) | $(SED) -e 's/  / /g' | $(CUT) -d' ' -f6)
 TRADEMARK = &\#x2122;
 
-IGNORED_TAGS =	beaninfo revised since.unbundled spec Note ToDo
+IGNORED_TAGS =	beaninfo revised since.unbundled spec specdefault Note ToDo
 
 JLS3_URL = http://java.sun.com/docs/books/jls/
 JLS3_CITE = <a href="$(JLS3_URL)"> \
--- a/make/java/jvm/Makefile	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/java/jvm/Makefile	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright 1995-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 1995-2010 Sun Microsystems, Inc.  All Rights Reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,8 @@
 
 FILES_h = $(INCLUDEDIR)/jni.h 			\
 	  $(PLATFORM_INCLUDE)/jni_md.h		\
-          $(INCLUDEDIR)/jvmti.h			\
+	  $(INCLUDEDIR)/jvmti.h			\
+	  $(INCLUDEDIR)/jvmticmlr.h		\
 	  $(INCLUDEDIR)/classfile_constants.h
 
 $(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
--- a/make/java/sun_nio/Makefile	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/java/sun_nio/Makefile	Fri Feb 19 15:13:37 2010 -0800
@@ -31,7 +31,7 @@
 PACKAGE = sun.nio
 PRODUCT = sun
 
-OTHER_JAVACFLAGS += -Xlint:serial -Werror
+OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
 include $(BUILDDIR)/common/Defs.gmk
 
 #
--- a/make/javax/swing/beaninfo/SwingBeans.gmk	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/javax/swing/beaninfo/SwingBeans.gmk	Fri Feb 19 15:13:37 2010 -0800
@@ -25,7 +25,7 @@
 
 #
 # Makefile to build the BeanInfo generation tool (ie, a doclet), and
-# then the beaninfo itself.  Swing versions prior to 1.2 is no longer
+# then the beaninfo itself.  Swing versions prior to 1.2 are no longer
 # built.
 #
 # This makefile could be a lot simpler if we made it more regular.
@@ -44,13 +44,12 @@
 	$(MAKE) DEBUG_FLAG=true make-swing-beans
 
 
-LOCAL_JAVADOC   = $(JAVADOC_CMD) $(JAVADOCFLAGS)
 # get the absolute path to the jar command.
 PREFIX          = 1.2
-JAVADOCFLAGS    = $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION)
+JAVADOCFLAGS    += $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION)
 SWINGPKG        = javax/swing
 LOCAL_JAVAC_FLAGS = $(OTHER_JAVACFLAGS)
-# since LOCAL_JAVADOC runs on ALT_BOOTDIR, the doclet and all its classes must be compiled to match
+# since JAVADOC_CMD runs on ALT_BOOTDIR, the doclet and all its classes must be compiled to match
 DOCLET_JAVAC_FLAGS = -source 6 -target 6
 
 include FILES.gmk
@@ -114,7 +113,7 @@
 
 .javadoc.beanlist:
 	if [ -s $(TEMPDIR)/.beans.list ]; \
-	then $(LOCAL_JAVADOC) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \
+	then $(JAVADOC_CMD) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \
 	    $(shell if [ -s $(TEMPDIR)/.beans.list ]; then $(CAT) $(TEMPDIR)/.beans.list; fi); \
 	fi
 	@$(java-vm-cleanup)
--- a/make/mkdemo/jvmti/Makefile	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/mkdemo/jvmti/Makefile	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright 2004-2006 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,13 @@
 
 # Can be built in any order, the JRE version of hprof and java_crw_demo are
 #   really built in make/java.
-#   The hprof target here just deliveres the sources and README files.
+#   The hprof target here just delivers the sources and README files.
 #   The java_crw_demo and agent_util files are copied into each demo that
 #   uses them.
 SUBDIRS = \
 	  versionCheck \
-          gctest \
+	  compiledMethodLoad \
+	  gctest \
 	  heapViewer \
 	  heapTracker \
 	  minst \
--- a/make/mkdemo/jvmti/README.txt	Fri Feb 12 19:58:10 2010 +0300
+++ b/make/mkdemo/jvmti/README.txt	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 Basically you want to mimic the jvmti demo agent "mtrace".
 
-* Create and populate a source directory at src/demo/jvmti
-  (Try and re-use code in agent_util area like src/demo/jvmti/mtrace)
+* Create and populate a source directory at src/share/demo/jvmti
+  (Try and re-use code in agent_util area like src/share/demo/jvmti/mtrace)
   (This should include a small README.txt document on what this demo is)
 
 * Make sure the appropriate "demo" copyright notice is added to all the
@@ -44,7 +44,7 @@
 * Create test directory at test/demo/jvmti, create at least one test
   (Use test/demo/jvmti/mtrace as a template)
 
-* Don't forget to SCCS in all the new files
+* Don't forget to check in all the new files
 
 * Build and create images (cd make && gnumake && gnumake images)
   (Do this on Solaris, Linux, and at least one Windows platform)
@@ -54,5 +54,5 @@
 * Run the tests: cd test/demo/jvmti && runregress .
   (Do this on Solaris, Linux, and at least one Windows platform)
 
-Contact: jk-svc-group@sun.com for more information or help.
+Contact: serviceability-dev@openjdk.java.net for more information or help.
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mkdemo/jvmti/compiledMethodLoad/Makefile	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,41 @@
+#
+# Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+BUILDDIR = ../../..
+PRODUCT = demo/jvmti
+DEMONAME = compiledMethodLoad
+include $(BUILDDIR)/common/Defs.gmk
+
+DEMO_ROOT       = $(SHARE_SRC)/demo/jvmti/$(DEMONAME)
+DEMO_TOPFILES   = ./README.txt
+DEMO_DESTDIR    = $(DEMODIR)/jvmti/$(DEMONAME)
+
+DEMO_OBJECTS = agent_util.$(OBJECT_SUFFIX)
+
+#
+# Demo jar building rules.
+#
+include $(BUILDDIR)/common/Demo.gmk
+
--- a/src/share/classes/java/awt/GraphicsEnvironment.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/awt/GraphicsEnvironment.java	Fri Feb 19 15:13:37 2010 -0800
@@ -110,7 +110,7 @@
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
-                localEnv = new HeadlessGraphicsEnvironment(localEnv);
+                ge = new HeadlessGraphicsEnvironment(ge);
             }
         } catch (ClassNotFoundException e) {
             throw new Error("Could not find class: "+nm);
--- a/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -146,6 +146,8 @@
      * @param  out The code output stream.
      * @return An expression whose value is <code>oldInstance</code>.
      *
+     * @throws NullPointerException if {@code out} is {@code null}
+     *
      * @see #DefaultPersistenceDelegate(String[])
      */
     protected Expression instantiate(Object oldInstance, Encoder out) {
@@ -367,6 +369,8 @@
      * @param newInstance The instance that is to be modified.
      * @param out The stream to which any initialization statements should be written.
      *
+     * @throws NullPointerException if {@code out} is {@code null}
+     *
      * @see java.beans.Introspector#getBeanInfo
      * @see java.beans.PropertyDescriptor
      */
--- a/src/share/classes/java/beans/Encoder.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/beans/Encoder.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,54 +112,82 @@
 
     /**
      * Returns the persistence delegate for the given type.
-     * The persistence delegate is calculated
-     * by applying the following of rules in order:
-     * <ul>
+     * The persistence delegate is calculated by applying
+     * the following rules in order:
+     * <ol>
      * <li>
-     * If the type is an array, an internal persistence
-     * delegate is returned which will instantiate an
-     * array of the appropriate type and length, initializing
-     * each of its elements as if they are properties.
+     * If a persistence delegate is associated with the given type
+     * by using the {@link #setPersistenceDelegate} method
+     * it is returned.
      * <li>
-     * If the type is a proxy, an internal persistence
-     * delegate is returned which will instantiate a
-     * new proxy instance using the static
-     * "newProxyInstance" method defined in the
-     * Proxy class.
+     * A persistence delegate is then looked up by the name
+     * composed of the the fully qualified name of the given type
+     * and the "PersistenceDelegate" postfix.
+     * For example, a persistence delegate for the {@code Bean} class
+     * should be named {@code BeanPersistenceDelegate}
+     * and located in the same package.
+     * <pre>
+     * public class Bean { ... }
+     * public class BeanPersistenceDelegate { ... }</pre>
+     * The instance of the {@code BeanPersistenceDelegate} class
+     * is returned for the {@code Bean} class.
      * <li>
-     * If the BeanInfo for this type has a <code>BeanDescriptor</code>
-     * which defined a "persistenceDelegate" property, this
-     * value is returned.
+     * If the type is {@code null},
+     * a shared internal persistence delegate is returned
+     * that encodes {@code null} value.
      * <li>
-     * In all other cases the default persistence delegate
-     * is returned. The default persistence delegate assumes
-     * the type is a <em>JavaBean</em>, implying that it has a default constructor
-     * and that its state may be characterized by the matching pairs
-     * of "setter" and "getter" methods returned by the Introspector.
+     * If the type is a {@code enum} declaration,
+     * a shared internal persistence delegate is returned
+     * that encodes constants of this enumeration
+     * by their names.
+     * <li>
+     * If the type is a primitive type or the corresponding wrapper,
+     * a shared internal persistence delegate is returned
+     * that encodes values of the given type.
+     * <li>
+     * If the type is an array,
+     * a shared internal persistence delegate is returned
+     * that encodes an array of the appropriate type and length,
+     * and each of its elements as if they are properties.
+     * <li>
+     * If the type is a proxy,
+     * a shared internal persistence delegate is returned
+     * that encodes a proxy instance by using
+     * the {@link java.lang.reflect.Proxy#newProxyInstance} method.
+     * <li>
+     * If the {@link BeanInfo} for this type has a {@link BeanDescriptor}
+     * which defined a "persistenceDelegate" attribute,
+     * the value of this named attribute is returned.
+     * <li>
+     * In all other cases the default persistence delegate is returned.
+     * The default persistence delegate assumes the type is a <em>JavaBean</em>,
+     * implying that it has a default constructor and that its state
+     * may be characterized by the matching pairs of "setter" and "getter"
+     * methods returned by the {@link Introspector} class.
      * The default constructor is the constructor with the greatest number
      * of parameters that has the {@link ConstructorProperties} annotation.
-     * If none of the constructors have the {@code ConstructorProperties} annotation,
+     * If none of the constructors has the {@code ConstructorProperties} annotation,
      * then the nullary constructor (constructor with no parameters) will be used.
-     * For example, in the following the nullary constructor
-     * for {@code Foo} will be used, while the two parameter constructor
-     * for {@code Bar} will be used.
-     * <code>
-     *   public class Foo {
+     * For example, in the following code fragment, the nullary constructor
+     * for the {@code Foo} class will be used,
+     * while the two-parameter constructor
+     * for the {@code Bar} class will be used.
+     * <pre>
+     * public class Foo {
      *     public Foo() { ... }
      *     public Foo(int x) { ... }
-     *   }
-     *   public class Bar {
+     * }
+     * public class Bar {
      *     public Bar() { ... }
      *     &#64;ConstructorProperties({"x"})
      *     public Bar(int x) { ... }
      *     &#64;ConstructorProperties({"x", "y"})
      *     public Bar(int x, int y) { ... }
-     *   }
-     * </code>
-     * </ul>
+     * }</pre>
+     * </ol>
      *
-     * @param  type The type of the object.
-     * @return The persistence delegate for this type of object.
+     * @param type  the class of the objects
+     * @return the persistence delegate for the given type
      *
      * @see #setPersistenceDelegate
      * @see java.beans.Introspector#getBeanInfo
@@ -176,21 +204,18 @@
     }
 
     /**
-     * Sets the persistence delegate associated with this <code>type</code> to
-     * <code>persistenceDelegate</code>.
+     * Associates the specified persistence delegate with the given type.
      *
-     * @param  type The class of objects that <code>persistenceDelegate</code> applies to.
-     * @param  persistenceDelegate The persistence delegate for instances of <code>type</code>.
+     * @param type  the class of objects that the specified persistence delegate applies to
+     * @param delegate  the persistence delegate for instances of the given type
      *
      * @see #getPersistenceDelegate
      * @see java.beans.Introspector#getBeanInfo
      * @see java.beans.BeanInfo#getBeanDescriptor
      */
-    public void setPersistenceDelegate(Class<?> type,
-                                       PersistenceDelegate persistenceDelegate)
-    {
+    public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate) {
         synchronized (this.finder) {
-            this.finder.register(type, persistenceDelegate);
+            this.finder.register(type, delegate);
         }
     }
 
--- a/src/share/classes/java/beans/Expression.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/beans/Expression.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,12 +51,19 @@
     private Object value = unbound;
 
     /**
-     * Creates a new <code>Statement</code> object with a <code>target</code>,
-     * <code>methodName</code> and <code>arguments</code> as per the parameters.
+     * Creates a new {@link Expression} object
+     * for the specified target object to invoke the method
+     * specified by the name and by the array of arguments.
+     * <p>
+     * The {@code target} and the {@code methodName} values should not be {@code null}.
+     * Otherwise an attempt to execute this {@code Expression}
+     * will result in a {@code NullPointerException}.
+     * If the {@code arguments} value is {@code null},
+     * an empty array is used as the value of the {@code arguments} property.
      *
-     * @param target The target of this expression.
-     * @param methodName The methodName of this expression.
-     * @param arguments The arguments of this expression. If <code>null</code> then an empty array will be used.
+     * @param target  the target object of this expression
+     * @param methodName  the name of the method to invoke on the specified target
+     * @param arguments  the array of arguments to invoke the specified method
      *
      * @see #getValue
      */
@@ -66,16 +73,23 @@
     }
 
     /**
-     * Creates a new <code>Expression</code> object for a method
-     * that returns a result. The result will never be calculated
-     * however, since this constructor uses the <code>value</code>
-     * parameter to set the value property by calling the
-     * <code>setValue</code> method.
+     * Creates a new {@link Expression} object with the specified value
+     * for the specified target object to invoke the  method
+     * specified by the name and by the array of arguments.
+     * The {@code value} value is used as the value of the {@code value} property,
+     * so the {@link #getValue} method will return it
+     * without executing this {@code Expression}.
+     * <p>
+     * The {@code target} and the {@code methodName} values should not be {@code null}.
+     * Otherwise an attempt to execute this {@code Expression}
+     * will result in a {@code NullPointerException}.
+     * If the {@code arguments} value is {@code null},
+     * an empty array is used as the value of the {@code arguments} property.
      *
-     * @param value The value of this expression.
-     * @param target The target of this expression.
-     * @param methodName The methodName of this expression.
-     * @param arguments The arguments of this expression. If <code>null</code> then an empty array will be used.
+     * @param value  the value of this expression
+     * @param target  the target object of this expression
+     * @param methodName  the name of the method to invoke on the specified target
+     * @param arguments  the array of arguments to invoke the specified method
      *
      * @see #setValue
      */
--- a/src/share/classes/java/beans/Introspector.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/beans/Introspector.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1996-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 import com.sun.beans.finder.BeanInfoFinder;
 import com.sun.beans.finder.ClassFinder;
 
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
@@ -39,6 +41,7 @@
 import java.util.EventListener;
 import java.util.List;
 import java.util.TreeMap;
+import java.util.WeakHashMap;
 
 import sun.awt.AppContext;
 import sun.reflect.misc.ReflectUtil;
@@ -155,11 +158,11 @@
             return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
         }
         synchronized (BEANINFO_CACHE) {
-            WeakCache<Class<?>, BeanInfo> beanInfoCache =
-                    (WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
+            Map<Class<?>, BeanInfo> beanInfoCache =
+                    (Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
 
             if (beanInfoCache == null) {
-                beanInfoCache = new WeakCache<Class<?>, BeanInfo>();
+                beanInfoCache = new WeakHashMap<Class<?>, BeanInfo>();
                 AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
             }
             BeanInfo beanInfo = beanInfoCache.get(beanClass);
@@ -341,7 +344,7 @@
 
     public static void flushCaches() {
         synchronized (BEANINFO_CACHE) {
-            WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
+            Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
             if (beanInfoCache != null) {
                 beanInfoCache.clear();
             }
@@ -369,7 +372,7 @@
             throw new NullPointerException();
         }
         synchronized (BEANINFO_CACHE) {
-            WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
+            Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
             if (beanInfoCache != null) {
                 beanInfoCache.put(clz, null);
             }
@@ -1458,7 +1461,7 @@
     private PropertyDescriptor[] properties;
     private int defaultProperty;
     private MethodDescriptor[] methods;
-    private BeanInfo targetBeanInfo;
+    private final Reference<BeanInfo> targetBeanInfoRef;
 
     public GenericBeanInfo(BeanDescriptor beanDescriptor,
                 EventSetDescriptor[] events, int defaultEvent,
@@ -1470,7 +1473,7 @@
         this.properties = properties;
         this.defaultProperty = defaultProperty;
         this.methods = methods;
-        this.targetBeanInfo = targetBeanInfo;
+        this.targetBeanInfoRef = new SoftReference<BeanInfo>(targetBeanInfo);
     }
 
     /**
@@ -1509,7 +1512,7 @@
                 methods[i] = new MethodDescriptor(old.methods[i]);
             }
         }
-        targetBeanInfo = old.targetBeanInfo;
+        this.targetBeanInfoRef = old.targetBeanInfoRef;
     }
 
     public PropertyDescriptor[] getPropertyDescriptors() {
@@ -1537,6 +1540,7 @@
     }
 
     public java.awt.Image getIcon(int iconKind) {
+        BeanInfo targetBeanInfo = this.targetBeanInfoRef.get();
         if (targetBeanInfo != null) {
             return targetBeanInfo.getIcon(iconKind);
         }
--- a/src/share/classes/java/beans/PersistenceDelegate.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/beans/PersistenceDelegate.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,6 +105,8 @@
      *
      * @param oldInstance The instance that will be created by this expression.
      * @param out The stream to which this expression will be written.
+     *
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     public void writeObject(Object oldInstance, Encoder out) {
         Object newInstance = out.get(oldInstance);
@@ -158,6 +160,8 @@
      * @param oldInstance The instance that will be created by this expression.
      * @param out The stream to which this expression will be written.
      * @return An expression whose value is <code>oldInstance</code>.
+     *
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     protected abstract Expression instantiate(Object oldInstance, Encoder out);
 
@@ -196,6 +200,8 @@
      * @param oldInstance The instance to be copied.
      * @param newInstance The instance that is to be modified.
      * @param out The stream to which any initialization statements should be written.
+     *
+     * @throws NullPointerException if {@code out} is {@code null}
      */
     protected void initialize(Class<?> type,
                               Object oldInstance, Object newInstance,
--- a/src/share/classes/java/beans/Statement.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/beans/Statement.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,13 +69,19 @@
     ClassLoader loader;
 
     /**
-     * Creates a new <code>Statement</code> object with a <code>target</code>,
-     * <code>methodName</code> and <code>arguments</code> as per the parameters.
+     * Creates a new {@link Statement} object
+     * for the specified target object to invoke the method
+     * specified by the name and by the array of arguments.
+     * <p>
+     * The {@code target} and the {@code methodName} values should not be {@code null}.
+     * Otherwise an attempt to execute this {@code Expression}
+     * will result in a {@code NullPointerException}.
+     * If the {@code arguments} value is {@code null},
+     * an empty array is used as the value of the {@code arguments} property.
      *
-     * @param target The target of this statement.
-     * @param methodName The methodName of this statement.
-     * @param arguments The arguments of this statement. If <code>null</code> then an empty array will be used.
-     *
+     * @param target  the target object of this statement
+     * @param methodName  the name of the method to invoke on the specified target
+     * @param arguments  the array of arguments to invoke the specified method
      */
     @ConstructorProperties({"target", "methodName", "arguments"})
     public Statement(Object target, String methodName, Object[] arguments) {
@@ -85,27 +91,36 @@
     }
 
     /**
-     * Returns the target of this statement.
+     * Returns the target object of this statement.
+     * If this method returns {@code null},
+     * the {@link #execute} method
+     * throws a {@code NullPointerException}.
      *
-     * @return The target of this statement.
+     * @return the target object of this statement
      */
     public Object getTarget() {
         return target;
     }
 
     /**
-     * Returns the name of the method.
+     * Returns the name of the method to invoke.
+     * If this method returns {@code null},
+     * the {@link #execute} method
+     * throws a {@code NullPointerException}.
      *
-     * @return The name of the method.
+     * @return the name of the method
      */
     public String getMethodName() {
         return methodName;
     }
 
     /**
-     * Returns the arguments of this statement.
+     * Returns the arguments for the method to invoke.
+     * The number of arguments and their types
+     * must match the method being  called.
+     * {@code null} can be used as a synonym of an empty array.
      *
-     * @return the arguments of this statement.
+     * @return the array of arguments
      */
     public Object[] getArguments() {
         return arguments;
@@ -154,6 +169,9 @@
         }
 
         Object[] arguments = getArguments();
+        if (arguments == null) {
+            arguments = emptyArray;
+        }
         // Class.forName() won't load classes outside
         // of core from a class inside core. Special
         // case this method.
@@ -285,7 +303,9 @@
         Object target = getTarget();
         String methodName = getMethodName();
         Object[] arguments = getArguments();
-
+        if (arguments == null) {
+            arguments = emptyArray;
+        }
         StringBuffer result = new StringBuffer(instanceName(target) + "." + methodName + "(");
         int n = arguments.length;
         for(int i = 0; i < n; i++) {
--- a/src/share/classes/java/security/cert/PKIXParameters.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/security/cert/PKIXParameters.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -663,15 +663,23 @@
      */
     public Object clone() {
         try {
-            Object copy = super.clone();
-            // Must clone these because addCertStore, et al. modify them
+            PKIXParameters copy = (PKIXParameters)super.clone();
+
+            // must clone these because addCertStore, et al. modify them
             if (certStores != null) {
-                certStores = new ArrayList<CertStore>(certStores);
+                copy.certStores = new ArrayList<CertStore>(certStores);
             }
             if (certPathCheckers != null) {
-                certPathCheckers =
-                        new ArrayList<PKIXCertPathChecker>(certPathCheckers);
+                copy.certPathCheckers =
+                    new ArrayList<PKIXCertPathChecker>(certPathCheckers.size());
+                for (PKIXCertPathChecker checker : certPathCheckers) {
+                    copy.certPathCheckers.add(
+                                    (PKIXCertPathChecker)checker.clone());
+                }
             }
+
+            // other class fields are immutable to public, don't bother
+            // to clone the read-only fields.
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
--- a/src/share/classes/java/text/CollationElementIterator.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/text/CollationElementIterator.java	Fri Feb 19 15:13:37 2010 -0800
@@ -232,7 +232,7 @@
                     buffer = makeReorderedBuffer(consonant, value, buffer, true);
                     value = buffer[0];
                     expIndex = 1;
-                } else {
+                } else if (consonant != NormalizerBase.DONE) {
                     text.previous();
                 }
             }
@@ -242,7 +242,7 @@
                     buffer = makeReorderedBuffer(consonant, value, buffer, true);
                     value = buffer[0];
                     expIndex = 1;
-                } else {
+                } else if (consonant != NormalizerBase.DONE) {
                     text.previous();
                 }
             }
--- a/src/share/classes/java/text/RuleBasedBreakIterator.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/text/RuleBasedBreakIterator.java	Fri Feb 19 15:13:37 2010 -0800
@@ -621,6 +621,8 @@
         return handleNext();
     }
 
+    private int cachedLastKnownBreak = BreakIterator.DONE;
+
     /**
      * Advances the iterator backwards, to the last boundary preceding this one.
      * @return The position of the last boundary position preceding this one.
@@ -638,8 +640,16 @@
         // the current position), but not necessarily the last one before
         // where we started
         int start = current();
-        getPrevious();
-        int lastResult = handlePrevious();
+        int lastResult = cachedLastKnownBreak;
+        if (lastResult >= start || lastResult <= BreakIterator.DONE) {
+            getPrevious();
+            lastResult = handlePrevious();
+        } else {
+            //it might be better to check if handlePrevious() give us closer
+            //safe value but handlePrevious() is slow too
+            //So, this has to be done carefully
+            text.setIndex(lastResult);
+        }
         int result = lastResult;
 
         // iterate forward from the known break position until we pass our
@@ -653,6 +663,7 @@
         // set the current iteration position to be the last break position
         // before where we started, and then return that value
         text.setIndex(lastResult);
+        cachedLastKnownBreak = lastResult;
         return lastResult;
     }
 
@@ -757,7 +768,8 @@
         // then we can just use next() to get our return value
         text.setIndex(offset);
         if (offset == text.getBeginIndex()) {
-            return handleNext();
+            cachedLastKnownBreak = handleNext();
+            return cachedLastKnownBreak;
         }
 
         // otherwise, we have to sync up first.  Use handlePrevious() to back
@@ -767,10 +779,19 @@
         // position at or before our starting position.  Advance forward
         // from here until we've passed the starting position.  The position
         // we stop on will be the first break position after the specified one.
-        int result = handlePrevious();
+        int result = cachedLastKnownBreak;
+        if (result >= offset || result <= BreakIterator.DONE) {
+            result = handlePrevious();
+        } else {
+            //it might be better to check if handlePrevious() give us closer
+            //safe value but handlePrevious() is slow too
+            //So, this has to be done carefully
+            text.setIndex(result);
+        }
         while (result != BreakIterator.DONE && result <= offset) {
             result = handleNext();
         }
+        cachedLastKnownBreak = result;
         return result;
     }
 
@@ -865,6 +886,8 @@
             text = new SafeCharIterator(newText);
         }
         text.first();
+
+        cachedLastKnownBreak = BreakIterator.DONE;
     }
 
 
--- a/src/share/classes/java/util/Date.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/util/Date.java	Fri Feb 19 15:13:37 2010 -0800
@@ -953,7 +953,7 @@
      * without affecting its internal state.
      */
     static final long getMillisOf(Date date) {
-        if (date.cdate == null) {
+        if (date.cdate == null || date.cdate.isNormalized()) {
             return date.fastTime;
         }
         BaseCalendar.Date d = (BaseCalendar.Date) date.cdate.clone();
--- a/src/share/classes/java/util/regex/Pattern.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/java/util/regex/Pattern.java	Fri Feb 19 15:13:37 2010 -0800
@@ -861,6 +861,14 @@
     private transient int patternLength;
 
     /**
+     * If the Start node might possibly match supplementary characters.
+     * It is set to true during compiling if
+     * (1) There is supplementary char in pattern, or
+     * (2) There is complement node of Category or Block
+     */
+    private transient boolean hasSupplementary;
+
+    /**
      * Compiles the given regular expression into a pattern.  </p>
      *
      * @param  regex
@@ -1481,7 +1489,7 @@
         // Use double zero to terminate pattern
         temp = new int[patternLength + 2];
 
-        boolean hasSupplementary = false;
+        hasSupplementary = false;
         int c, count = 0;
         // Convert all chars into code points
         for (int x = 0; x < patternLength; x += Character.charCount(c)) {
@@ -1787,7 +1795,8 @@
      * character or unpaired surrogate.
      */
     private static final boolean isSupplementary(int ch) {
-        return ch >= Character.MIN_SUPPLEMENTARY_CODE_POINT || isSurrogate(ch);
+        return ch >= Character.MIN_SUPPLEMENTARY_CODE_POINT ||
+               Character.isSurrogate((char)ch);
     }
 
     /**
@@ -1885,7 +1894,7 @@
                     } else {
                         oneLetter = false;
                     }
-                    node = family(oneLetter).maybeComplement(comp);
+                    node = family(oneLetter, comp);
                 } else {
                     unread();
                     node = atom();
@@ -2001,7 +2010,7 @@
                             unread();
                         else
                             oneLetter = false;
-                        return family(oneLetter).maybeComplement(comp);
+                        return family(oneLetter, comp);
                     }
                 }
                 unread();
@@ -2404,7 +2413,7 @@
                     unread();
                 else
                     oneLetter = false;
-                return family(oneLetter).maybeComplement(comp);
+                return family(oneLetter, comp);
             } else { // ordinary escape
                 unread();
                 ch = escape(true, true);
@@ -2450,9 +2459,12 @@
     /**
      * Parses a Unicode character family and returns its representative node.
      */
-    private CharProperty family(boolean singleLetter) {
+    private CharProperty family(boolean singleLetter,
+                                boolean maybeComplement)
+    {
         next();
         String name;
+        CharProperty node;
 
         if (singleLetter) {
             int c = temp[cursor];
@@ -2477,12 +2489,18 @@
         }
 
         if (name.startsWith("In")) {
-            return unicodeBlockPropertyFor(name.substring(2));
+            node = unicodeBlockPropertyFor(name.substring(2));
         } else {
             if (name.startsWith("Is"))
                 name = name.substring(2);
-            return charPropertyNodeFor(name);
-        }
+            node = charPropertyNodeFor(name);
+        }
+        if (maybeComplement) {
+            if (node instanceof Category || node instanceof Block)
+                hasSupplementary = true;
+            node = node.complement();
+        }
+        return node;
     }
 
     /**
@@ -2495,9 +2513,7 @@
         } catch (IllegalArgumentException iae) {
             throw error("Unknown character block name {" + name + "}");
         }
-        return new CharProperty() {
-                boolean isSatisfiedBy(int ch) {
-                    return block == Character.UnicodeBlock.of(ch);}};
+        return new Block(block);
     }
 
     /**
@@ -2968,13 +2984,6 @@
     // Utility methods for code point support
     //
 
-    /**
-     * Tests a surrogate value.
-     */
-    private static final boolean isSurrogate(int c) {
-        return c >= Character.MIN_HIGH_SURROGATE && c <= Character.MAX_LOW_SURROGATE;
-    }
-
     private static final int countChars(CharSequence seq, int index,
                                         int lengthInCodePoints) {
         // optimization
@@ -3174,20 +3183,17 @@
                 matcher.hitEnd = true;
                 return false;
             }
-            boolean ret = false;
             int guard = matcher.to - minLength;
             for (; i <= guard; i++) {
-                if (ret = next.match(matcher, i, seq))
-                    break;
-                if (i == guard)
-                    matcher.hitEnd = true;
+                if (next.match(matcher, i, seq)) {
+                    matcher.first = i;
+                    matcher.groups[0] = matcher.first;
+                    matcher.groups[1] = matcher.last;
+                    return true;
+                }
             }
-            if (ret) {
-                matcher.first = i;
-                matcher.groups[0] = matcher.first;
-                matcher.groups[1] = matcher.last;
-            }
-            return ret;
+            matcher.hitEnd = true;
+            return false;
         }
         boolean study(TreeInfo info) {
             next.study(info);
@@ -3209,27 +3215,28 @@
                 matcher.hitEnd = true;
                 return false;
             }
-            boolean ret = false;
             int guard = matcher.to - minLength;
             while (i <= guard) {
-                if ((ret = next.match(matcher, i, seq)) || i == guard)
+                //if ((ret = next.match(matcher, i, seq)) || i == guard)
+                if (next.match(matcher, i, seq)) {
+                    matcher.first = i;
+                    matcher.groups[0] = matcher.first;
+                    matcher.groups[1] = matcher.last;
+                    return true;
+                }
+                if (i == guard)
                     break;
                 // Optimization to move to the next character. This is
                 // faster than countChars(seq, i, 1).
                 if (Character.isHighSurrogate(seq.charAt(i++))) {
-                    if (i < seq.length() && Character.isLowSurrogate(seq.charAt(i))) {
+                    if (i < seq.length() &&
+                        Character.isLowSurrogate(seq.charAt(i))) {
                         i++;
                     }
                 }
-                if (i == guard)
-                    matcher.hitEnd = true;
             }
-            if (ret) {
-                matcher.first = i;
-                matcher.groups[0] = matcher.first;
-                matcher.groups[1] = matcher.last;
-            }
-            return ret;
+            matcher.hitEnd = true;
+            return false;
         }
     }
 
@@ -3461,9 +3468,6 @@
                     boolean isSatisfiedBy(int ch) {
                         return ! CharProperty.this.isSatisfiedBy(ch);}};
         }
-        CharProperty maybeComplement(boolean complement) {
-            return complement ? complement() : this;
-        }
         boolean match(Matcher matcher, int i, CharSequence seq) {
             if (i < matcher.to) {
                 int ch = Character.codePointAt(seq, i);
@@ -3548,6 +3552,20 @@
         }
     }
 
+
+    /**
+     * Node class that matches a Unicode block.
+     */
+    static final class Block extends CharProperty {
+        final Character.UnicodeBlock block;
+        Block(Character.UnicodeBlock block) {
+            this.block = block;
+        }
+        boolean isSatisfiedBy(int ch) {
+            return block == Character.UnicodeBlock.of(ch);
+        }
+    }
+
     /**
      * Node class that matches a Unicode category.
      */
--- a/src/share/classes/javax/swing/MultiUIDefaults.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/MultiUIDefaults.java	Fri Feb 19 15:13:37 2010 -0800
@@ -27,6 +27,7 @@
 
 import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -89,11 +90,7 @@
 
     @Override
     public int size() {
-        int n = super.size();
-        for (UIDefaults table : tables) {
-            n += (table != null) ? table.size() : 0;
-        }
-        return n;
+        return entrySet().size();
     }
 
     @Override
@@ -104,40 +101,26 @@
     @Override
     public Enumeration<Object> keys()
     {
-        Enumeration[] enums = new Enumeration[1 + tables.length];
-        enums[0] = super.keys();
-        for(int i = 0; i < tables.length; i++) {
-            UIDefaults table = tables[i];
-            if (table != null) {
-                enums[i + 1] = table.keys();
-            }
-        }
-        return new MultiUIDefaultsEnumerator(enums);
+        return new MultiUIDefaultsEnumerator(
+                MultiUIDefaultsEnumerator.Type.KEYS, entrySet());
     }
 
     @Override
     public Enumeration<Object> elements()
     {
-        Enumeration[] enums = new Enumeration[1 + tables.length];
-        enums[0] = super.elements();
-        for(int i = 0; i < tables.length; i++) {
-            UIDefaults table = tables[i];
-            if (table != null) {
-                enums[i + 1] = table.elements();
-            }
-        }
-        return new MultiUIDefaultsEnumerator(enums);
+        return new MultiUIDefaultsEnumerator(
+                MultiUIDefaultsEnumerator.Type.ELEMENTS, entrySet());
     }
 
     @Override
     public Set<Entry<Object, Object>> entrySet() {
         Set<Entry<Object, Object>> set = new HashSet<Entry<Object, Object>>();
-        if (tables == null) return set;
-        for (UIDefaults table : tables) {
-            if (table != null) {
-                set.addAll(table.entrySet());
+        for (int i = tables.length - 1; i >= 0; i--) {
+            if (tables[i] != null) {
+                set.addAll(tables[i].entrySet());
             }
         }
+        set.addAll(super.entrySet());
         return set;
     }
 
@@ -152,50 +135,46 @@
 
     private static class MultiUIDefaultsEnumerator implements Enumeration<Object>
     {
-        Enumeration[] enums;
-        int n = 0;
+        public static enum Type { KEYS, ELEMENTS };
+        private Iterator<Entry<Object, Object>> iterator;
+        private Type type;
 
-        MultiUIDefaultsEnumerator(Enumeration[] enums) {
-            this.enums = enums;
+        MultiUIDefaultsEnumerator(Type type, Set<Entry<Object, Object>> entries) {
+            this.type = type;
+            this.iterator = entries.iterator();
         }
 
         public boolean hasMoreElements() {
-            for(int i = n; i < enums.length; i++) {
-                Enumeration e = enums[i];
-                if ((e != null) && (e.hasMoreElements())) {
-                    return true;
-                }
-            }
-            return false;
+            return iterator.hasNext();
         }
 
         public Object nextElement() {
-            for(; n < enums.length; n++) {
-                Enumeration e = enums[n];
-                if ((e != null) && (e.hasMoreElements())) {
-                    return e.nextElement();
-                }
+            switch (type) {
+                case KEYS: return iterator.next().getKey();
+                case ELEMENTS: return iterator.next().getValue();
+                default: return null;
             }
-            return null;
         }
     }
 
     @Override
     public Object remove(Object key)
     {
-        Object value = super.remove(key);
-        if (value != null) {
-            return value;
+        Object value = null;
+        for (int i = tables.length - 1; i >= 0; i--) {
+            if (tables[i] != null) {
+                Object v = tables[i].remove(key);
+                if (v != null) {
+                    value = v;
+                }
+            }
+        }
+        Object v = super.remove(key);
+        if (v != null) {
+            value = v;
         }
 
-        for (UIDefaults table : tables) {
-            value = (table != null) ? table.remove(key) : null;
-            if (value != null) {
-                return value;
-            }
-        }
-
-        return null;
+        return value;
     }
 
     @Override
--- a/src/share/classes/javax/swing/plaf/nimbus/Defaults.template	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/nimbus/Defaults.template	Fri Feb 19 15:13:37 2010 -0800
@@ -90,6 +90,10 @@
      */
     private Map<String, Region> registeredRegions =
             new HashMap<String, Region>();
+
+    private Map<JComponent, Map<Region, SynthStyle>> overridesCache =
+            new WeakHashMap<JComponent, Map<Region, SynthStyle>>();
+    
     /**
      * Our fallback style to avoid NPEs if the proper style cannot be found in
      * this class. Not sure if relying on DefaultSynthStyle is the best choice.
@@ -251,7 +255,11 @@
         }
 
         //return the style, if found, or the default style if not found
-        return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp);
+        return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp, r);
+    }
+
+    public void clearOverridesCache(JComponent c) {
+        overridesCache.remove(c);
     }
 
     /*
@@ -457,15 +465,6 @@
          * Cached shared style.
          */
         private NimbusStyle style;
-        /**
-         * A weakly referenced hash map such that if the reference JComponent
-         * key is garbage collected then the entry is removed from the map.
-         * This cache exists so that when a JComponent has nimbus overrides
-         * in its client map, a unique style will be created and returned
-         * for that JComponent instance, always. In such a situation each
-         * JComponent instance must have its own instance of NimbusStyle.
-         */
-        private WeakHashMap<JComponent, WeakReference<NimbusStyle>> overridesCache;
 
         /**
          * Create a new LazyStyle.
@@ -513,17 +512,21 @@
          * Gets the style. Creates it if necessary.
          * @return the style
          */
-        SynthStyle getStyle(JComponent c) {
+        SynthStyle getStyle(JComponent c, Region r) {
             // if the component has overrides, it gets its own unique style
             // instead of the shared style.
             if (c.getClientProperty("Nimbus.Overrides") != null) {
-                if (overridesCache == null)
-                    overridesCache = new WeakHashMap<JComponent, WeakReference<NimbusStyle>>();
-                WeakReference<NimbusStyle> ref = overridesCache.get(c);
-                NimbusStyle s = ref == null ? null : ref.get();
+                Map<Region, SynthStyle> map = overridesCache.get(c);
+                SynthStyle s = null;
+                if (map == null) {
+                    map = new HashMap<Region, SynthStyle>();
+                    overridesCache.put(c, map);
+                } else {
+                    s = map.get(r);
+                }
                 if (s == null) {
                     s = new NimbusStyle(prefix, c);
-                    overridesCache.put(c, new WeakReference<NimbusStyle>(s));
+                    map.put(r, s);
                 }
                 return s;
             }
--- a/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Fri Feb 19 15:13:37 2010 -0800
@@ -280,11 +280,15 @@
     protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
         String eName = ev.getPropertyName();
 
-        // Always update when overrides or size variant change
-        if ("Nimbus.Overrides" == eName ||
+        // These properties affect style cached inside NimbusDefaults (6860433)
+        if ("name" == eName ||
+            "ancestor" == eName ||
+            "Nimbus.Overrides" == eName ||
             "Nimbus.Overrides.InheritDefaults" == eName ||
             "JComponent.sizeVariant" == eName) {
 
+            JComponent c = (JComponent) ev.getSource();
+            defaults.clearOverridesCache(c);
             return true;
         }
 
--- a/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -237,7 +237,16 @@
     // ********************************
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -250,7 +259,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -264,7 +279,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         AbstractButton b = (AbstractButton)context.getComponent();
--- a/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -137,7 +137,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -151,7 +160,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -166,7 +181,8 @@
      * This implementation does not perform any actions.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -305,7 +305,16 @@
     // begin ComponentUI Implementation
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -319,7 +328,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -333,7 +348,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         hasFocus = comboBox.hasFocus();
--- a/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -152,7 +152,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -166,7 +175,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -180,7 +195,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -439,7 +439,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -453,7 +462,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -467,7 +482,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -148,7 +148,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -164,7 +173,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
--- a/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -194,7 +194,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -208,7 +217,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -222,7 +237,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -156,12 +156,16 @@
     }
 
     /**
-     * Notifies this UI delegate that it's time to paint the specified
-     * component.  This method is invoked by <code>JComponent</code>
-     * when the specified component is being painted.
-     */
-    /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -175,7 +179,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -189,7 +199,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JLabel label = (JLabel)context.getComponent();
--- a/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -57,7 +57,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint
      */
     @Override
     public void update(Graphics g, JComponent c) {
--- a/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -125,7 +125,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -139,7 +148,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -153,7 +168,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -227,7 +227,16 @@
 
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -240,7 +249,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -254,7 +269,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext accContext = getContext(menuItem,
--- a/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -227,7 +227,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -241,7 +250,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -255,7 +270,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext accContext = getContext(menuItem,
--- a/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -149,7 +149,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -163,7 +172,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -177,7 +192,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -136,7 +136,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -150,7 +159,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -164,7 +179,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         // do actual painting
--- a/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -132,7 +132,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -146,7 +155,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -160,7 +175,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -193,7 +193,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -208,7 +217,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -222,7 +237,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JProgressBar pBar = (JProgressBar)context.getComponent();
--- a/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -102,7 +102,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -116,7 +125,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -130,7 +145,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -222,7 +222,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -237,7 +246,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -251,7 +266,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext subcontext = getContext(scrollbar,
--- a/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -64,7 +64,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -78,7 +87,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -92,7 +107,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         Border vpBorder = scrollpane.getViewportBorder();
--- a/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -135,7 +135,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -151,7 +160,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -165,7 +180,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JSeparator separator = (JSeparator)context.getComponent();
--- a/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -788,7 +788,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -802,7 +811,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -815,7 +830,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         recalculateIfInsetsChanged();
--- a/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -283,7 +283,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -298,7 +307,13 @@
 
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -312,7 +327,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -269,7 +269,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -283,7 +292,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -297,7 +312,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         // This is done to update package private variables in
--- a/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -92,8 +92,8 @@
     private SynthStyle tabAreaStyle;
     private SynthStyle tabContentStyle;
 
-    private Rectangle textRect;
-    private Rectangle iconRect;
+    private Rectangle textRect = new Rectangle();
+    private Rectangle iconRect = new Rectangle();
 
     private Rectangle tabAreaBounds = new Rectangle();
 
@@ -115,11 +115,6 @@
         return new SynthTabbedPaneUI();
     }
 
-    private SynthTabbedPaneUI() {
-        textRect = new Rectangle();
-        iconRect = new Rectangle();
-    }
-
     private boolean scrollableTabLayoutEnabled() {
         return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
     }
@@ -362,7 +357,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -409,7 +413,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -423,7 +433,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         int selectedIndex = tabPane.getSelectedIndex();
--- a/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -123,7 +123,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -137,7 +146,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -151,7 +166,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, context.getComponent());
--- a/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -256,7 +256,16 @@
 //
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -279,7 +288,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -293,7 +308,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         Rectangle clip = g.getClipBounds();
--- a/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -123,7 +123,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -140,7 +149,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
--- a/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -161,7 +161,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -182,7 +191,8 @@
      * model to potentially be updated asynchronously.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
--- a/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -198,7 +198,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -213,7 +222,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -258,7 +273,8 @@
      * Paints the toolbar.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         if (handleIcon != null && toolBar.isFloatable()) {
--- a/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -121,7 +121,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -144,7 +153,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -158,7 +173,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         JToolTip tip = (JToolTip)context.getComponent();
--- a/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -250,7 +250,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -273,7 +282,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -287,7 +302,8 @@
      * Paints the specified component.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
         paintContext = context;
--- a/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Fri Feb 19 15:13:37 2010 -0800
@@ -150,7 +150,16 @@
     }
 
     /**
-     * @inheritDoc
+     * Notifies this UI delegate to repaint the specified component.
+     * This method paints the component background, then calls
+     * the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * <p>In general, this method does not need to be overridden by subclasses.
+     * All Look and Feel rendering code should reside in the {@code paint} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void update(Graphics g, JComponent c) {
@@ -174,7 +183,13 @@
     }
 
     /**
-     * @inheritDoc
+     * Paints the specified component according to the Look and Feel.
+     * <p>This method is not used by Synth Look and Feel.
+     * Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
+     *
+     * @param g the {@code Graphics} object used for painting
+     * @param c the component being painted
+     * @see #paint(SynthContext,Graphics)
      */
     @Override
     public void paint(Graphics g, JComponent c) {
@@ -188,7 +203,8 @@
      * Paints the specified component. This implementation does nothing.
      *
      * @param context context for the component being painted
-     * @param g {@code Graphics} object used for painting
+     * @param g the {@code Graphics} object used for painting
+     * @see #update(Graphics,JComponent)
      */
     protected void paint(SynthContext context, Graphics g) {
     }
--- a/src/share/classes/sun/font/FontManagerFactory.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/font/FontManagerFactory.java	Fri Feb 19 15:13:37 2010 -0800
@@ -68,38 +68,34 @@
             return instance;
         }
 
-        String fmClassName = AccessController.doPrivileged(
-                new GetPropertyAction("sun.font.fontmanager",
-                                      DEFAULT_CLASS));
+        AccessController.doPrivileged(new PrivilegedAction() {
 
-        try {
-            @SuppressWarnings("unchecked")
-            ClassLoader cl = (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return ClassLoader.getSystemClassLoader();
-                    }
-                });
+            public Object run() {
+                try {
+                    String fmClassName =
+                            System.getProperty("sun.font.fontmanager",
+                                               DEFAULT_CLASS);
+                    ClassLoader cl = ClassLoader.getSystemClassLoader();
+                    Class fmClass = Class.forName(fmClassName, true, cl);
+                    instance = (FontManager) fmClass.newInstance();
+                } catch (ClassNotFoundException ex) {
+                    InternalError err = new InternalError();
+                    err.initCause(ex);
+                    throw err;
 
-            @SuppressWarnings("unchecked")
-            Class fmClass = Class.forName(fmClassName, true, cl);
-            instance = (FontManager) fmClass.newInstance();
+                } catch (InstantiationException ex) {
+                    InternalError err = new InternalError();
+                    err.initCause(ex);
+                    throw err;
 
-        } catch (ClassNotFoundException ex) {
-            InternalError err = new InternalError();
-            err.initCause(ex);
-            throw err;
-
-        } catch (InstantiationException ex) {
-            InternalError err = new InternalError();
-            err.initCause(ex);
-            throw err;
-
-        } catch (IllegalAccessException ex) {
-            InternalError err = new InternalError();
-            err.initCause(ex);
-            throw err;
-        }
+                } catch (IllegalAccessException ex) {
+                    InternalError err = new InternalError();
+                    err.initCause(ex);
+                    throw err;
+                }
+                return null;
+            }
+        });
 
         return instance;
     }
--- a/src/share/classes/sun/font/FontUtilities.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/font/FontUtilities.java	Fri Feb 19 15:13:37 2010 -0800
@@ -32,9 +32,9 @@
 import java.io.InputStreamReader;
 import java.security.AccessController;
 
+import java.security.PrivilegedAction;
 import javax.swing.plaf.FontUIResource;
 
-import sun.security.action.GetPropertyAction;
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -42,79 +42,82 @@
  */
 public final class FontUtilities {
 
-    public static final boolean isSolaris;
+    public static boolean isSolaris;
 
-    public static final boolean isLinux;
+    public static boolean isLinux;
 
-    public static final boolean isSolaris8;
+    public static boolean isSolaris8;
 
-    public static final boolean isSolaris9;
+    public static boolean isSolaris9;
 
-    public static final boolean isOpenSolaris;
+    public static boolean isOpenSolaris;
 
-    public static final boolean useT2K;
+    public static boolean useT2K;
 
-    public static final boolean isWindows;
+    public static boolean isWindows;
 
-    public static final boolean isOpenJDK;
+    public static boolean isOpenJDK;
 
     static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
 
     // This static initializer block figures out the OS constants.
     static {
 
-        String osName = AccessController.doPrivileged(
-                                new GetPropertyAction("os.name", "unknownOS"));
-        isSolaris = osName.startsWith("SunOS");
+        AccessController.doPrivileged(new PrivilegedAction () {
+            public Object run() {
+                String osName = System.getProperty("os.name", "unknownOS");
+                isSolaris = osName.startsWith("SunOS");
 
-        isLinux = osName.startsWith("Linux");
+                isLinux = osName.startsWith("Linux");
 
-        String t2kStr = AccessController.doPrivileged(
-                              new GetPropertyAction("sun.java2d.font.scaler"));
-        if (t2kStr != null) {
-            useT2K = "t2k".equals(t2kStr);
-        } else {
-            useT2K = false;
-        }
-        if (isSolaris) {
-            String version = AccessController.doPrivileged(
-                                   new GetPropertyAction("os.version", "0.0"));
-            isSolaris8 = version.startsWith("5.8");
-            isSolaris9 = version.startsWith("5.9");
-            float ver = Float.parseFloat(version);
-            if (ver > 5.10f) {
-                File f = new File("/etc/release");
-                String line = null;
-                try {
-                    FileInputStream fis = new FileInputStream(f);
-                    InputStreamReader isr = new InputStreamReader(
+                String t2kStr = System.getProperty("sun.java2d.font.scaler");
+                if (t2kStr != null) {
+                    useT2K = "t2k".equals(t2kStr);
+                } else {
+                    useT2K = false;
+                }
+                if (isSolaris) {
+                    String version = System.getProperty("os.version", "0.0");
+                    isSolaris8 = version.startsWith("5.8");
+                    isSolaris9 = version.startsWith("5.9");
+                    float ver = Float.parseFloat(version);
+                    if (ver > 5.10f) {
+                        File f = new File("/etc/release");
+                        String line = null;
+                        try {
+                            FileInputStream fis = new FileInputStream(f);
+                            InputStreamReader isr = new InputStreamReader(
                                                             fis, "ISO-8859-1");
-                    BufferedReader br = new BufferedReader(isr);
-                    line = br.readLine();
-                    fis.close();
-                } catch (Exception ex) {
-                    // Nothing to do here.
-                }
-                if (line != null && line.indexOf("OpenSolaris") >= 0) {
-                    isOpenSolaris = true;
+                            BufferedReader br = new BufferedReader(isr);
+                            line = br.readLine();
+                            fis.close();
+                        } catch (Exception ex) {
+                            // Nothing to do here.
+                        }
+                        if (line != null && line.indexOf("OpenSolaris") >= 0) {
+                            isOpenSolaris = true;
+                        } else {
+                            isOpenSolaris = false;
+                        }
+                    } else {
+                        isOpenSolaris = false;
+                    }
                 } else {
+                    isSolaris8 = false;
+                    isSolaris9 = false;
                     isOpenSolaris = false;
                 }
-            } else {
-                isOpenSolaris= false;
+                isWindows = osName.startsWith("Windows");
+                String jreLibDirName = System.getProperty("java.home", "")
+                                                      + File.separator + "lib";
+                String jreFontDirName =
+                        jreLibDirName + File.separator + "fonts";
+                File lucidaFile = new File(jreFontDirName + File.separator
+                                           + LUCIDA_FILE_NAME);
+                isOpenJDK = !lucidaFile.exists();
+                return null;
             }
-        } else {
-            isSolaris8 = false;
-            isSolaris9 = false;
-            isOpenSolaris = false;
-        }
-        isWindows = osName.startsWith("Windows");
-        String jreLibDirName = AccessController.doPrivileged(
-               new GetPropertyAction("java.home","")) + File.separator + "lib";
-        String jreFontDirName = jreLibDirName + File.separator + "fonts";
-        File lucidaFile =
-                new File(jreFontDirName + File.separator + LUCIDA_FILE_NAME);
-        isOpenJDK = !lucidaFile.exists();
+        });
     }
 
     /**
--- a/src/share/classes/sun/io/ByteToCharUTF8.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/io/ByteToCharUTF8.java	Fri Feb 19 15:13:37 2010 -0800
@@ -113,7 +113,7 @@
                         savedSize = 1;
                     } else {
                         savedSize = 2;
-                        savedBytes[1] = (byte)input[byteOff++];
+                        savedBytes[1] = input[byteOff++];
                     }
                     break;
                 }
@@ -135,11 +135,11 @@
                         savedSize = 1;
                     } else if (byteOff + 1 >= inEnd) {
                         savedSize = 2;
-                        savedBytes[1] = (byte)input[byteOff++];
+                        savedBytes[1] = input[byteOff++];
                     } else {
                         savedSize = 3;
-                        savedBytes[1] = (byte)input[byteOff++];
-                        savedBytes[2] = (byte)input[byteOff++];
+                        savedBytes[1] = input[byteOff++];
+                        savedBytes[2] = input[byteOff++];
                     }
                     break;
                 }
@@ -154,10 +154,10 @@
                     throw new MalformedInputException();
                 }
                 // this byte sequence is UTF16 character
-                int ucs4 = (int)(0x07 & byte1) << 18 |
-                           (int)(0x3f & byte2) << 12 |
-                           (int)(0x3f & byte3) <<  6 |
-                           (int)(0x3f & byte4);
+                int ucs4 = (0x07 & byte1) << 18 |
+                           (0x3f & byte2) << 12 |
+                           (0x3f & byte3) <<  6 |
+                           (0x3f & byte4);
                 outputChar[0] = (char)((ucs4 - 0x10000) / 0x400 + 0xd800);
                 outputChar[1] = (char)((ucs4 - 0x10000) % 0x400 + 0xdc00);
                 outputSize = 2;
--- a/src/share/classes/sun/io/CharToByteUnicode.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/io/CharToByteUnicode.java	Fri Feb 19 15:13:37 2010 -0800
@@ -46,7 +46,7 @@
     protected int byteOrder = UNKNOWN;
 
     public CharToByteUnicode() {
-        String enc = (String) java.security.AccessController.doPrivileged(
+        String enc = java.security.AccessController.doPrivileged(
            new sun.security.action.GetPropertyAction("sun.io.unicode.encoding",
                                                           "UnicodeBig"));
         if (enc.equals("UnicodeBig"))
--- a/src/share/classes/sun/io/CharacterEncoding.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/io/CharacterEncoding.java	Fri Feb 19 15:13:37 2010 -0800
@@ -50,11 +50,11 @@
 
     private static boolean sjisIsMS932;
 
-    private static Map aliasTable;
+    private static Map<String,String> aliasTable;
     private static volatile boolean installedAll;
 
     static {
-        aliasTable = new HashMap(460, 1.0f);                    /* MDA */
+        aliasTable = new HashMap<>(460, 1.0f);                    /* MDA */
 
         aliasTable.put("us-ascii",              "ASCII");
         aliasTable.put("ascii",                 "ASCII");
@@ -119,11 +119,11 @@
         }
         // need to use Locale.US so we can load ISO converters in tr_TR locale
         String lower = name.toLowerCase(Locale.US);
-        String val = (String) aliasTable.get(lower);
+        String val = aliasTable.get(lower);
 
         if (val == null && !installedAll) {
             installAll();
-            val = (String) aliasTable.get(lower);
+            val = aliasTable.get(lower);
         }
         return val;
     }
@@ -131,7 +131,7 @@
     private static synchronized void installAll() {
         if (!installedAll) {
             GetPropertyAction a = new GetPropertyAction("sun.nio.cs.map");
-            String map = ((String)AccessController.doPrivileged(a));
+            String map = AccessController.doPrivileged(a);
             if (map != null) {
                 sjisIsMS932 = map.equalsIgnoreCase("Windows-31J/Shift_JIS");
             } else {
@@ -857,9 +857,9 @@
      * Auto Detect converter.
      */
     static String getSJISName() {
-        String encodeName = (String) AccessController.doPrivileged(
-                                                new PrivilegedAction() {
-            public Object run() {
+        String encodeName = AccessController.doPrivileged(
+                                               new PrivilegedAction<String>() {
+            public String run() {
                 String osName = System.getProperty("os.name");
                 if (osName.equals("Solaris") || osName.equals("SunOS")){
                     return "PCK";
@@ -880,9 +880,9 @@
 
 
     static String getEUCJPName() {
-      String encodeName = (String) AccessController.doPrivileged(
-                                              new PrivilegedAction() {
-          public Object run() {
+      String encodeName = AccessController.doPrivileged(
+                                              new PrivilegedAction<String>() {
+          public String run() {
               String osName = System.getProperty("os.name");
               if (osName.equals("Solaris") || osName.equals("SunOS"))
                   return "eucJP-open";
--- a/src/share/classes/sun/io/Converters.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/io/Converters.java	Fri Feb 19 15:13:37 2010 -0800
@@ -85,10 +85,11 @@
      * this code can be involved in the startup sequence it's important to keep
      * the footprint down.
      */
-    private static SoftReference[][] classCache
-        = new SoftReference[][] {
-            new SoftReference[CACHE_SIZE],
-            new SoftReference[CACHE_SIZE]
+    @SuppressWarnings("unchecked")
+    private static SoftReference<Object[]>[][] classCache
+        = (SoftReference<Object[]>[][]) new SoftReference<?>[][] {
+            new SoftReference<?>[CACHE_SIZE],
+            new SoftReference<?>[CACHE_SIZE]
         };
 
     private static void moveToFront(Object[] oa, int i) {
@@ -98,28 +99,28 @@
         oa[0] = ob;
     }
 
-    private static Class cache(int type, Object encoding) {
-        SoftReference[] srs = classCache[type];
+    private static Class<?> cache(int type, Object encoding) {
+        SoftReference<Object[]>[] srs = classCache[type];
         for (int i = 0; i < CACHE_SIZE; i++) {
-            SoftReference sr = srs[i];
+            SoftReference<Object[]> sr = srs[i];
             if (sr == null)
                 continue;
-            Object[] oa = (Object[])sr.get();
+            Object[] oa = sr.get();
             if (oa == null) {
                 srs[i] = null;
                 continue;
             }
             if (oa[1].equals(encoding)) {
                 moveToFront(srs, i);
-                return (Class)oa[0];
+                return (Class<?>)oa[0];
             }
         }
         return null;
     }
 
-    private static Class cache(int type, Object encoding, Class c) {
-        SoftReference[] srs = classCache[type];
-        srs[CACHE_SIZE - 1] = new SoftReference(new Object[] { c, encoding });
+    private static Class<?> cache(int type, Object encoding, Class<?> c) {
+        SoftReference<Object[]>[] srs = classCache[type];
+        srs[CACHE_SIZE - 1] = new SoftReference<Object[]>(new Object[] { c, encoding });
         moveToFront(srs, CACHE_SIZE - 1);
         return c;
     }
@@ -129,12 +130,12 @@
      */
     public static boolean isCached(int type, String encoding) {
         synchronized (lock) {
-            SoftReference[] srs = classCache[type];
+            SoftReference<Object[]>[] srs = classCache[type];
             for (int i = 0; i < CACHE_SIZE; i++) {
-                SoftReference sr = srs[i];
+                SoftReference<Object[]> sr = srs[i];
                 if (sr == null)
                     continue;
-                Object[] oa = (Object[])sr.get();
+                Object[] oa = sr.get();
                 if (oa == null) {
                     srs[i] = null;
                     continue;
@@ -152,9 +153,9 @@
     private static String getConverterPackageName() {
         String cp = converterPackageName;
         if (cp != null) return cp;
-        java.security.PrivilegedAction pa =
+        java.security.PrivilegedAction<String> pa =
             new sun.security.action.GetPropertyAction("file.encoding.pkg");
-        cp = (String)java.security.AccessController.doPrivileged(pa);
+        cp = java.security.AccessController.doPrivileged(pa);
         if (cp != null) {
             /* Property is set, so take it as the true converter package */
             converterPackageName = cp;
@@ -168,9 +169,9 @@
     public static String getDefaultEncodingName() {
         synchronized (lock) {
             if (defaultEncoding == null) {
-                java.security.PrivilegedAction pa =
+                java.security.PrivilegedAction<String> pa =
                     new sun.security.action.GetPropertyAction("file.encoding");
-                defaultEncoding = (String)java.security.AccessController.doPrivileged(pa);
+                defaultEncoding = java.security.AccessController.doPrivileged(pa);
             }
         }
         return defaultEncoding;
@@ -194,7 +195,7 @@
      * encoding, or throw an UnsupportedEncodingException if no such class can
      * be found
      */
-    private static Class getConverterClass(int type, String encoding)
+    private static Class<?> getConverterClass(int type, String encoding)
         throws UnsupportedEncodingException
     {
         String enc = null;
@@ -241,7 +242,7 @@
      * Instantiate the given converter class, or throw an
      * UnsupportedEncodingException if it cannot be instantiated
      */
-    private static Object newConverter(String enc, Class c)
+    private static Object newConverter(String enc, Class<?> c)
         throws UnsupportedEncodingException
     {
         try {
@@ -261,7 +262,7 @@
     static Object newConverter(int type, String enc)
         throws UnsupportedEncodingException
     {
-        Class c;
+        Class<?> c;
         synchronized (lock) {
             c = cache(type, enc);
             if (c == null) {
@@ -279,9 +280,9 @@
      * not yet defined, return a class that implements the fallback default
      * encoding, which is just ISO 8859-1.
      */
-    private static Class getDefaultConverterClass(int type) {
+    private static Class<?> getDefaultConverterClass(int type) {
         boolean fillCache = false;
-        Class c;
+        Class<?> c;
 
         /* First check the class cache */
         c = cache(type, DEFAULT_NAME);
@@ -325,7 +326,7 @@
      * encoding cannot be determined.
      */
     static Object newDefaultConverter(int type) {
-        Class c;
+        Class<?> c;
         synchronized (lock) {
             c = getDefaultConverterClass(type);
         }
--- a/src/share/classes/sun/net/ftp/impl/FtpClient.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/net/ftp/impl/FtpClient.java	Fri Feb 19 15:13:37 2010 -0800
@@ -671,6 +671,10 @@
         }
         if (!issueCommand(cmd)) {
             s.close();
+            if (getLastReplyCode() == FtpReplyCode.FILE_UNAVAILABLE) {
+                // Ensure backward compatibility
+                throw new FileNotFoundException(cmd);
+            }
             throw new sun.net.ftp.FtpProtocolException(cmd + ":" + getResponseString(), getLastReplyCode());
         }
         return s;
@@ -688,7 +692,16 @@
         Socket clientSocket;
 
         if (passiveMode) {
-            return openPassiveDataConnection(cmd);
+            try {
+                return openPassiveDataConnection(cmd);
+            } catch (sun.net.ftp.FtpProtocolException e) {
+                // If Passive mode failed, fall back on PORT
+                // Otherwise throw exception
+                String errmsg = e.getMessage();
+                if (!errmsg.startsWith("PASV") && !errmsg.startsWith("EPSV")) {
+                    throw e;
+                }
+            }
         }
         ServerSocket portSocket;
         InetAddress myAddress;
--- a/src/share/classes/sun/nio/cs/AbstractCharsetProvider.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/nio/cs/AbstractCharsetProvider.java	Fri Feb 19 15:13:37 2010 -0800
@@ -48,23 +48,23 @@
 
     /* Maps canonical names to class names
      */
-    private Map classMap
-        = new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+    private Map<String,String> classMap
+        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
 
     /* Maps alias names to canonical names
      */
-    private Map aliasMap
-        = new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+    private Map<String,String> aliasMap
+        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
 
     /* Maps canonical names to alias-name arrays
      */
-    private Map aliasNameMap
-        = new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+    private Map<String,String[]> aliasNameMap
+        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
 
     /* Maps canonical names to soft references that hold cached instances
      */
-    private Map cache
-        = new TreeMap(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+    private Map<String,SoftReference<Charset>> cache
+        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
 
     private String packagePrefix;
 
@@ -79,13 +79,13 @@
     /* Add an entry to the given map, but only if no mapping yet exists
      * for the given name.
      */
-    private static void put(Map m, String name, Object value) {
+    private static <K,V> void put(Map<K,V> m, K name, V value) {
         if (!m.containsKey(name))
             m.put(name, value);
     }
 
-    private static void remove(Map m, String name) {
-        Object x  = m.remove(name);
+    private static <K,V> void remove(Map<K,V> m, K name) {
+        V x  = m.remove(name);
         assert (x != null);
     }
 
@@ -116,22 +116,22 @@
     protected void init() { }
 
     private String canonicalize(String charsetName) {
-        String acn = (String)aliasMap.get(charsetName);
+        String acn = aliasMap.get(charsetName);
         return (acn != null) ? acn : charsetName;
     }
 
     private Charset lookup(String csn) {
 
         // Check cache first
-        SoftReference sr = (SoftReference)cache.get(csn);
+        SoftReference<Charset> sr = cache.get(csn);
         if (sr != null) {
-            Charset cs = (Charset)sr.get();
+            Charset cs = sr.get();
             if (cs != null)
                 return cs;
         }
 
         // Do we even support this charset?
-        String cln = (String)classMap.get(csn);
+        String cln = classMap.get(csn);
 
         if (cln == null)
             return null;
@@ -139,12 +139,12 @@
         // Instantiate the charset and cache it
         try {
 
-            Class c = Class.forName(packagePrefix + "." + cln,
-                                    true,
-                                    this.getClass().getClassLoader());
+            Class<?> c = Class.forName(packagePrefix + "." + cln,
+                                       true,
+                                       this.getClass().getClassLoader());
 
             Charset cs = (Charset)c.newInstance();
-            cache.put(csn, new SoftReference(cs));
+            cache.put(csn, new SoftReference<Charset>(cs));
             return cs;
         } catch (ClassNotFoundException x) {
             return null;
@@ -164,21 +164,21 @@
 
     public final Iterator<Charset> charsets() {
 
-        final ArrayList ks;
+        final ArrayList<String> ks;
         synchronized (this) {
             init();
-            ks = new ArrayList(classMap.keySet());
+            ks = new ArrayList<>(classMap.keySet());
         }
 
         return new Iterator<Charset>() {
-                Iterator i = ks.iterator();
+                Iterator<String> i = ks.iterator();
 
                 public boolean hasNext() {
                     return i.hasNext();
                 }
 
                 public Charset next() {
-                    String csn = (String)i.next();
+                    String csn = i.next();
                     return lookup(csn);
                 }
 
@@ -191,7 +191,7 @@
     public final String[] aliases(String charsetName) {
         synchronized (this) {
             init();
-            return (String[])aliasNameMap.get(charsetName);
+            return aliasNameMap.get(charsetName);
         }
     }
 
--- a/src/share/classes/sun/security/krb5/internal/ktab/KeyTabInputStream.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/security/krb5/internal/ktab/KeyTabInputStream.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
 public class KeyTabInputStream extends KrbDataInputStream implements KeyTabConstants {
 
     boolean DEBUG = Krb5.DEBUG;
-    static int index;
+    int index;
 
     public KeyTabInputStream(InputStream is) {
         super(is);
--- a/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java	Fri Feb 19 15:13:37 2010 -0800
@@ -40,6 +40,8 @@
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
+import sun.security.util.DerValue;
+
 /**
  * EC KeyFactory implemenation.
  *
@@ -201,7 +203,16 @@
 
     private PublicKey generatePublic(ECPoint point, ECParameterSpec params) throws PKCS11Exception {
         byte[] encodedParams = ECParameters.encodeParameters(params);
-        byte[] encodedPoint = ECParameters.encodePoint(point, params.getCurve());
+        byte[] encodedPoint = null;
+        DerValue pkECPoint = new DerValue(DerValue.tag_OctetString,
+            ECParameters.encodePoint(point, params.getCurve()));
+
+        try {
+            encodedPoint = pkECPoint.toByteArray();
+        } catch (IOException e) {
+            throw new IllegalArgumentException("Could not DER encode point", e);
+        }
+
         CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
             new CK_ATTRIBUTE(CKA_CLASS, CKO_PUBLIC_KEY),
             new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_EC),
--- a/src/share/classes/sun/security/pkcs11/P11Key.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/security/pkcs11/P11Key.java	Fri Feb 19 15:13:37 2010 -0800
@@ -45,6 +45,8 @@
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
+import sun.security.util.DerValue;
+
 /**
  * Key implementation classes.
  *
@@ -1000,8 +1002,16 @@
             try {
                 params = P11ECKeyFactory.decodeParameters
                             (attributes[1].getByteArray());
+                DerValue wECPoint = new DerValue(attributes[0].getByteArray());
+                if (wECPoint.getTag() != DerValue.tag_OctetString)
+                    throw new IOException("Unexpected tag: " +
+                        wECPoint.getTag());
+                params = P11ECKeyFactory.decodeParameters
+                            (attributes[1].getByteArray());
                 w = P11ECKeyFactory.decodePoint
-                            (attributes[0].getByteArray(), params.getCurve());
+                    (wECPoint.getDataBytes(), params.getCurve());
+
+
             } catch (Exception e) {
                 throw new RuntimeException("Could not parse key values", e);
             }
--- a/src/share/classes/sun/security/tools/KeyTool.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/classes/sun/security/tools/KeyTool.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,7 @@
 
 import static java.security.KeyStore.*;
 import static sun.security.tools.KeyTool.Command.*;
+import static sun.security.tools.KeyTool.Option.*;
 
 /**
  * This tool manages keystores.
@@ -150,77 +151,77 @@
 
     enum Command {
         CERTREQ("Generates a certificate request",
-            "-alias", "-sigalg", "-file", "-keypass", "-keystore",
-            "-storepass", "-storetype", "-providername", "-providerclass",
-            "-providerarg", "-providerpath", "-v", "-protected"),
+            ALIAS, SIGALG, FILEOUT, KEYPASS, KEYSTORE,
+            STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
+            PROVIDERARG, PROVIDERPATH, V, PROTECTED),
         CHANGEALIAS("Changes an entry's alias",
-            "-alias", "-destalias", "-keypass", "-keystore", "-storepass",
-            "-storetype", "-providername", "-providerclass", "-providerarg",
-            "-providerpath", "-v", "-protected"),
+            ALIAS, DESTALIAS, KEYPASS, KEYSTORE, STOREPASS,
+            STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
+            PROVIDERPATH, V, PROTECTED),
         DELETE("Deletes an entry",
-            "-alias", "-keystore", "-storepass", "-storetype",
-            "-providername", "-providerclass", "-providerarg",
-            "-providerpath", "-v", "-protected"),
+            ALIAS, KEYSTORE, STOREPASS, STORETYPE,
+            PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
+            PROVIDERPATH, V, PROTECTED),
         EXPORTCERT("Exports certificate",
-            "-rfc", "-alias", "-file", "-keystore", "-storepass",
-            "-storetype", "-providername", "-providerclass", "-providerarg",
-            "-providerpath", "-v", "-protected"),
+            RFC, ALIAS, FILEOUT, KEYSTORE, STOREPASS,
+            STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
+            PROVIDERPATH, V, PROTECTED),
         GENKEYPAIR("Generates a key pair",
-            "-alias", "-keyalg", "-keysize", "-sigalg", "-destalias",
-            "-startdate", "-ext", "-validity", "-keypass", "-keystore",
-            "-storepass", "-storetype", "-providername", "-providerclass",
-            "-providerarg", "-providerpath", "-v", "-protected"),
+            ALIAS, KEYALG, KEYSIZE, SIGALG, DESTALIAS,
+            STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE,
+            STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
+            PROVIDERARG, PROVIDERPATH, V, PROTECTED),
         GENSECKEY("Generates a secret key",
-            "-alias", "-keypass", "-keyalg", "-keysize", "-keystore",
-            "-storepass", "-storetype", "-providername", "-providerclass",
-            "-providerarg", "-providerpath", "-v", "-protected"),
+            ALIAS, KEYPASS, KEYALG, KEYSIZE, KEYSTORE,
+            STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
+            PROVIDERARG, PROVIDERPATH, V, PROTECTED),
         GENCERT("Generates certificate from a certificate request",
-            "-rfc", "-infile", "-outfile", "-alias", "-sigalg",
-            "-startdate", "-ext", "-validity", "-keypass", "-keystore",
-            "-storepass", "-storetype", "-providername", "-providerclass",
-            "-providerarg", "-providerpath", "-v", "-protected"),
+            RFC, INFILE, OUTFILE, ALIAS, SIGALG,
+            STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE,
+            STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
+            PROVIDERARG, PROVIDERPATH, V, PROTECTED),
         IDENTITYDB("Imports entries from a JDK 1.1.x-style identity database",
-            "-file", "-storetype", "-keystore", "-storepass", "-providername",
-            "-providerclass", "-providerarg", "-providerpath", "-v"),
+            FILEIN, STORETYPE, KEYSTORE, STOREPASS, PROVIDERNAME,
+            PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V),
         IMPORTCERT("Imports a certificate or a certificate chain",
-            "-noprompt", "-trustcacerts", "-protected", "-alias", "-file",
-            "-keypass", "-keystore", "-storepass", "-storetype",
-            "-providername", "-providerclass", "-providerarg",
-            "-providerpath", "-v"),
+            NOPROMPT, TRUSTCACERTS, PROTECTED, ALIAS, FILEIN,
+            KEYPASS, KEYSTORE, STOREPASS, STORETYPE,
+            PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
+            PROVIDERPATH, V),
         IMPORTKEYSTORE("Imports one or all entries from another keystore",
-            "-srckeystore", "-destkeystore", "-srcstoretype",
-            "-deststoretype", "-srcstorepass", "-deststorepass",
-            "-srcprotected", "-srcprovidername", "-destprovidername",
-            "-srcalias", "-destalias", "-srckeypass", "-destkeypass",
-            "-noprompt", "-providerclass", "-providerarg", "-providerpath",
-            "-v"),
+            SRCKEYSTORE, DESTKEYSTORE, SRCSTORETYPE,
+            DESTSTORETYPE, SRCSTOREPASS, DESTSTOREPASS,
+            SRCPROTECTED, SRCPROVIDERNAME, DESTPROVIDERNAME,
+            SRCALIAS, DESTALIAS, SRCKEYPASS, DESTKEYPASS,
+            NOPROMPT, PROVIDERCLASS, PROVIDERARG, PROVIDERPATH,
+            V),
         KEYCLONE("Clones a key entry",
-            "-alias", "-destalias", "-keypass", "-new", "-storetype",
-            "-keystore", "-storepass", "-providername", "-providerclass",
-            "-providerarg", "-providerpath", "-v"),
+            ALIAS, DESTALIAS, KEYPASS, NEW, STORETYPE,
+            KEYSTORE, STOREPASS, PROVIDERNAME, PROVIDERCLASS,
+            PROVIDERARG, PROVIDERPATH, V),
         KEYPASSWD("Changes the key password of an entry",
-            "-alias", "-keypass", "-new", "-keystore", "-storepass",
-            "-storetype", "-providername", "-providerclass", "-providerarg",
-            "-providerpath", "-v"),
+            ALIAS, KEYPASS, NEW, KEYSTORE, STOREPASS,
+            STORETYPE, PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
+            PROVIDERPATH, V),
         LIST("Lists entries in a keystore",
-            "-rfc", "-alias", "-keystore", "-storepass", "-storetype",
-            "-providername", "-providerclass", "-providerarg",
-            "-providerpath", "-v", "-protected"),
+            RFC, ALIAS, KEYSTORE, STOREPASS, STORETYPE,
+            PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
+            PROVIDERPATH, V, PROTECTED),
         PRINTCERT("Prints the content of a certificate",
-            "-rfc", "-file", "-sslserver", "-jarfile", "-v"),
+            RFC, FILEIN, SSLSERVER, JARFILE, V),
         PRINTCERTREQ("Prints the content of a certificate request",
-            "-file", "-v"),
+            FILEIN, V),
         SELFCERT("Generates a self-signed certificate",
-            "-alias", "-sigalg", "-dname", "-startdate", "-validity", "-keypass",
-            "-storetype", "-keystore", "-storepass", "-providername",
-            "-providerclass", "-providerarg", "-providerpath", "-v"),
+            ALIAS, SIGALG, DNAME, STARTDATE, VALIDITY, KEYPASS,
+            STORETYPE, KEYSTORE, STOREPASS, PROVIDERNAME,
+            PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V),
         STOREPASSWD("Changes the store password of a keystore",
-            "-new", "-keystore", "-storepass", "-storetype", "-providername",
-            "-providerclass", "-providerarg", "-providerpath", "-v");
+            NEW, KEYSTORE, STOREPASS, STORETYPE, PROVIDERNAME,
+            PROVIDERCLASS, PROVIDERARG, PROVIDERPATH, V);
 
         final String description;
-        final String[] options;
-        Command(String d, String... o) {
+        final Option[] options;
+        Command(String d, Option... o) {
             description = d;
             options = o;
         }
@@ -230,50 +231,60 @@
         }
     };
 
-    private static String[][] options = {
-        // name, arg, description
-        {"-alias", "<alias>", "alias name of the entry to process"},
-        {"-destalias", "<destalias>", "destination alias"},
-        {"-destkeypass", "<arg>", "destination key password"},
-        {"-destkeystore", "<destkeystore>", "destination keystore name"},
-        {"-destprotected", null, "destination keystore password protected"},
-        {"-destprovidername", "<destprovidername>", "destination keystore provider name"},
-        {"-deststorepass", "<arg>", "destination keystore password"},
-        {"-deststoretype", "<deststoretype>", "destination keystore type"},
-        {"-dname", "<dname>", "distinguished name"},
-        {"-ext", "<value>", "X.509 extension"},
-        {"-file", "<filename>", "output file name"},
-        {"-file", "<filename>", "input file name"},
-        {"-infile", "<filename>", "input file name"},
-        {"-keyalg", "<keyalg>", "key algorithm name"},
-        {"-keypass", "<arg>", "key password"},
-        {"-keysize", "<keysize>", "key bit size"},
-        {"-keystore", "<keystore>", "keystore name"},
-        {"-new", "<arg>", "new password"},
-        {"-noprompt", null, "do not prompt"},
-        {"-outfile", "<filename>", "output file name"},
-        {"-protected", null, "password through protected mechanism"},
-        {"-providerarg", "<arg>", "provider argument"},
-        {"-providerclass", "<providerclass>", "provider class name"},
-        {"-providername", "<providername>", "provider name"},
-        {"-providerpath", "<pathlist>", "provider classpath"},
-        {"-rfc", null, "output in RFC style"},
-        {"-sigalg", "<sigalg>", "signature algorithm name"},
-        {"-srcalias", "<srcalias>", "source alias"},
-        {"-srckeypass", "<arg>", "source keystore password"},
-        {"-srckeystore", "<srckeystore>", "source keystore name"},
-        {"-srcprotected", null, "source keystore password protected"},
-        {"-srcprovidername", "<srcprovidername>", "source keystore provider name"},
-        {"-srcstorepass", "<arg>", "source keystore password"},
-        {"-srcstoretype", "<srcstoretype>", "source keystore type"},
-        {"-sslserver", "<server[:port]>", "SSL server host and port"},
-        {"-jarfile", "<filename>", "signed jar file"},
-        {"-startdate", "<startdate>", "certificate validity start date/time"},
-        {"-storepass", "<arg>", "keystore password"},
-        {"-storetype", "<storetype>", "keystore type"},
-        {"-trustcacerts", null, "trust certificates from cacerts"},
-        {"-v", null, "verbose output"},
-        {"-validity", "<valDays>", "validity number of days"},
+    enum Option {
+        ALIAS("alias", "<alias>", "alias name of the entry to process"),
+        DESTALIAS("destalias", "<destalias>", "destination alias"),
+        DESTKEYPASS("destkeypass", "<arg>", "destination key password"),
+        DESTKEYSTORE("destkeystore", "<destkeystore>", "destination keystore name"),
+        DESTPROTECTED("destprotected", null, "destination keystore password protected"),
+        DESTPROVIDERNAME("destprovidername", "<destprovidername>", "destination keystore provider name"),
+        DESTSTOREPASS("deststorepass", "<arg>", "destination keystore password"),
+        DESTSTORETYPE("deststoretype", "<deststoretype>", "destination keystore type"),
+        DNAME("dname", "<dname>", "distinguished name"),
+        EXT("ext", "<value>", "X.509 extension"),
+        FILEOUT("file", "<filename>", "output file name"),
+        FILEIN("file", "<filename>", "input file name"),
+        INFILE("infile", "<filename>", "input file name"),
+        KEYALG("keyalg", "<keyalg>", "key algorithm name"),
+        KEYPASS("keypass", "<arg>", "key password"),
+        KEYSIZE("keysize", "<keysize>", "key bit size"),
+        KEYSTORE("keystore", "<keystore>", "keystore name"),
+        NEW("new", "<arg>", "new password"),
+        NOPROMPT("noprompt", null, "do not prompt"),
+        OUTFILE("outfile", "<filename>", "output file name"),
+        PROTECTED("protected", null, "password through protected mechanism"),
+        PROVIDERARG("providerarg", "<arg>", "provider argument"),
+        PROVIDERCLASS("providerclass", "<providerclass>", "provider class name"),
+        PROVIDERNAME("providername", "<providername>", "provider name"),
+        PROVIDERPATH("providerpath", "<pathlist>", "provider classpath"),
+        RFC("rfc", null, "output in RFC style"),
+        SIGALG("sigalg", "<sigalg>", "signature algorithm name"),
+        SRCALIAS("srcalias", "<srcalias>", "source alias"),
+        SRCKEYPASS("srckeypass", "<arg>", "source keystore password"),
+        SRCKEYSTORE("srckeystore", "<srckeystore>", "source keystore name"),
+        SRCPROTECTED("srcprotected", null, "source keystore password protected"),
+        SRCPROVIDERNAME("srcprovidername", "<srcprovidername>", "source keystore provider name"),
+        SRCSTOREPASS("srcstorepass", "<arg>", "source keystore password"),
+        SRCSTORETYPE("srcstoretype", "<srcstoretype>", "source keystore type"),
+        SSLSERVER("sslserver", "<server[:port]>", "SSL server host and port"),
+        JARFILE("jarfile", "<filename>", "signed jar file"),
+        STARTDATE("startdate", "<startdate>", "certificate validity start date/time"),
+        STOREPASS("storepass", "<arg>", "keystore password"),
+        STORETYPE("storetype", "<storetype>", "keystore type"),
+        TRUSTCACERTS("trustcacerts", null, "trust certificates from cacerts"),
+        V("v", null, "verbose output"),
+        VALIDITY("validity", "<valDays>", "validity number of days");
+
+        final String name, arg, description;
+        Option(String name, String arg, String description) {
+            this.name = name;
+            this.arg = arg;
+            this.description = description;
+        }
+        @Override
+        public String toString() {
+            return "-" + name;
+        }
     };
 
     private static final Class[] PARAM_STRING = { String.class };
@@ -344,10 +355,10 @@
 
             // Check if the last option needs an arg
             if (i == args.length - 1) {
-                for (String[] option: options) {
+                for (Option option: Option.values()) {
                     // Only options with an arg need to be checked
-                    if (collator.compare(flags, option[0]) == 0) {
-                        if (option[1] != null) errorNeedArgument(flags);
+                    if (collator.compare(flags, option.toString()) == 0) {
+                        if (option.arg != null) errorNeedArgument(flags);
                         break;
                     }
                 }
@@ -3792,21 +3803,13 @@
             // Length of left side of options list
             int lenLeft = 0;
             for (int j=0; j<left.length; j++) {
-                for (String[] opt: options) {
-                    if (collator.compare(opt[0], command.options[j]) == 0) {
-                        left[j] = opt[0];
-                        if (opt[1] != null) left[j] += " " + opt[1];
-                        if (left[j].length() > lenLeft) {
-                            lenLeft = left[j].length();
-                        }
-                        right[j] = rb.getString(opt[2]);
-                        found = true;
-                        break;
-                    }
+                Option opt = command.options[j];
+                left[j] = opt.toString();
+                if (opt.arg != null) left[j] += " " + opt.arg;
+                if (left[j].length() > lenLeft) {
+                    lenLeft = left[j].length();
                 }
-                if (!found) {
-                    throw new RuntimeException("ERROR: CANNOT FIND " + command.options[j]);
-                }
+                right[j] = rb.getString(opt.description);
             }
             for (int j=0; j<left.length; j++) {
                 System.err.printf(" %-" + lenLeft + "s  %s\n",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/demo/jvmti/compiledMethodLoad/README.txt	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,42 @@
+#
+# Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   - Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#
+#   - Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+#   - Neither the name of Sun Microsystems nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+compiledMethodLoad
+
+This agent library traces CompiledMethodLoad events along
+with the HotSpot specific compile_info parameter.
+
+You can use this agent library as follows:
+
+    java -agentlib:compiledMethodLoad ...
+
+See ${JAVA_HOME}/demo/jvmti/index.html for help running and building agents.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/demo/jvmti/compiledMethodLoad/compiledMethodLoad.c	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Sun Microsystems nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "jni.h"
+#include "jvmti.h"
+#include "jvmticmlr.h"
+
+#include "agent_util.h"
+
+/* Global static data */
+static char          OUTPUT_FILE[] = "compiledMethodLoad.txt";
+static FILE         *fp;
+static jvmtiEnv     *jvmti;
+static jrawMonitorID lock;
+
+/* print a jvmtiCompiledMethodLoadDummyRecord */
+void
+print_dummy_record(jvmtiCompiledMethodLoadDummyRecord* record,
+    jvmtiEnv* jvmti, FILE* fp) {
+
+    if (record != NULL) {
+        fprintf(fp, "Dummy record detected containing message: %s\n",
+            (char *)record->message);
+    }
+}
+
+/* print the specified stack frames */
+void
+print_stack_frames(PCStackInfo* record, jvmtiEnv *jvmti, FILE* fp) {
+    if (record != NULL && record->methods != NULL) {
+        int i;
+
+        for (i = 0; i < record->numstackframes; i++) {
+            jvmtiError err;
+            char* method_name = NULL;
+            char* class_name = NULL;
+            char* method_signature = NULL;
+            char* class_signature = NULL;
+            char* generic_ptr_method = NULL;
+            char* generic_ptr_class = NULL;
+            jmethodID id;
+            jclass declaringclassptr;
+            id = record->methods[i];
+
+            err = (*jvmti)->GetMethodDeclaringClass(jvmti, id,
+                      &declaringclassptr);
+            check_jvmti_error(jvmti, err, "get method declaring class");
+
+            err = (*jvmti)->GetClassSignature(jvmti, declaringclassptr,
+                      &class_signature, &generic_ptr_class);
+            check_jvmti_error(jvmti, err, "get class signature");
+
+            err = (*jvmti)->GetMethodName(jvmti, id, &method_name,
+                      &method_signature, &generic_ptr_method);
+            check_jvmti_error(jvmti, err, "get method name");
+
+            fprintf(fp, "%s::%s %s %s @%d\n", class_signature, method_name,
+                method_signature,
+                generic_ptr_method == NULL ? "" : generic_ptr_method,
+                record->bcis[i]);
+
+            if (method_name != NULL) {
+                err = (*jvmti)->Deallocate(jvmti, (unsigned char*)method_name);
+                check_jvmti_error(jvmti, err, "deallocate method_name");
+            }
+            if (method_signature != NULL) {
+                err = (*jvmti)->Deallocate(jvmti,
+                          (unsigned char*)method_signature);
+                check_jvmti_error(jvmti, err, "deallocate method_signature");
+            }
+            if (generic_ptr_method != NULL) {
+                err = (*jvmti)->Deallocate(jvmti,
+                          (unsigned char*)generic_ptr_method);
+                check_jvmti_error(jvmti, err, "deallocate generic_ptr_method");
+            }
+            if (class_name != NULL) {
+                err = (*jvmti)->Deallocate(jvmti, (unsigned char*)class_name);
+                check_jvmti_error(jvmti, err, "deallocate class_name");
+            }
+            if (class_signature != NULL) {
+                err = (*jvmti)->Deallocate(jvmti,
+                          (unsigned char*)class_signature);
+                check_jvmti_error(jvmti, err, "deallocate class_signature");
+            }
+            if (generic_ptr_class != NULL) {
+                err = (*jvmti)->Deallocate(jvmti,
+                          (unsigned char*)generic_ptr_class);
+                check_jvmti_error(jvmti, err, "deallocate generic_ptr_class");
+            }
+        }
+    }
+}
+
+/* print a jvmtiCompiledMethodLoadInlineRecord */
+void
+print_inline_info_record(jvmtiCompiledMethodLoadInlineRecord* record,
+    jvmtiEnv *jvmti, FILE* fp) {
+
+    if (record != NULL && record->pcinfo != NULL) {
+        int numpcs = record->numpcs;
+        int i;
+
+        for (i = 0; i < numpcs; i++) {
+            PCStackInfo pcrecord = (record->pcinfo[i]);
+            fprintf(fp, "PcDescriptor(pc=0x%lx):\n", (jint)(pcrecord.pc));
+            print_stack_frames(&pcrecord, jvmti, fp);
+        }
+    }
+}
+
+/* decode kind of CompiledMethodLoadRecord and print */
+void
+print_records(jvmtiCompiledMethodLoadRecordHeader* list, jvmtiEnv *jvmti,
+    FILE* fp)
+{
+    jvmtiCompiledMethodLoadRecordHeader* curr = list;
+    fprintf(fp, "\nPrinting PC Descriptors\n\n");
+    while (curr != NULL) {
+        switch (curr->kind) {
+        case JVMTI_CMLR_DUMMY:
+            print_dummy_record((jvmtiCompiledMethodLoadDummyRecord *)curr,
+                jvmti, fp);
+            break;
+
+        case JVMTI_CMLR_INLINE_INFO:
+            print_inline_info_record(
+                (jvmtiCompiledMethodLoadInlineRecord *)curr, jvmti, fp);
+            break;
+
+        default:
+            fprintf(fp, "Warning: unrecognized record: kind=%d\n", curr->kind);
+            break;
+        }
+
+        curr = (jvmtiCompiledMethodLoadRecordHeader *)curr->next;
+    }
+}
+
+/* Callback for JVMTI_EVENT_COMPILED_METHOD_LOAD */
+void JNICALL
+compiled_method_load(jvmtiEnv *jvmti, jmethodID method, jint code_size,
+    const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map,
+    const void* compile_info)
+{
+    jvmtiError err;
+    char* name = NULL;
+    char* signature = NULL;
+    char* generic_ptr = NULL;
+    jvmtiCompiledMethodLoadRecordHeader* pcs;
+
+    err = (*jvmti)->RawMonitorEnter(jvmti, lock);
+    check_jvmti_error(jvmti, err, "raw monitor enter");
+
+    err = (*jvmti)->GetMethodName(jvmti, method, &name, &signature,
+              &generic_ptr);
+    check_jvmti_error(jvmti, err, "get method name");
+
+    fprintf(fp, "\nCompiled method load event\n");
+    fprintf(fp, "Method name %s %s %s\n\n", name, signature,
+        generic_ptr == NULL ? "" : generic_ptr);
+    pcs = (jvmtiCompiledMethodLoadRecordHeader *)compile_info;
+    if (pcs != NULL) {
+        print_records(pcs, jvmti, fp);
+    }
+
+    if (name != NULL) {
+        err = (*jvmti)->Deallocate(jvmti, (unsigned char*)name);
+        check_jvmti_error(jvmti, err, "deallocate name");
+    }
+    if (signature != NULL) {
+        err = (*jvmti)->Deallocate(jvmti, (unsigned char*)signature);
+        check_jvmti_error(jvmti, err, "deallocate signature");
+    }
+    if (generic_ptr != NULL) {
+        err = (*jvmti)->Deallocate(jvmti, (unsigned char*)generic_ptr);
+        check_jvmti_error(jvmti, err, "deallocate generic_ptr");
+    }
+
+    err = (*jvmti)->RawMonitorExit(jvmti, lock);
+    check_jvmti_error(jvmti, err, "raw monitor exit");
+}
+
+/* Agent_OnLoad() is called first, we prepare for a COMPILED_METHOD_LOAD
+ * event here.
+ */
+JNIEXPORT jint JNICALL
+Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
+{
+    jint                rc;
+    jvmtiError          err;
+    jvmtiCapabilities   capabilities;
+    jvmtiEventCallbacks callbacks;
+
+    fp = fopen(OUTPUT_FILE, "w");
+    if (fp == NULL) {
+        fatal_error("ERROR: %s: Unable to create output file\n", OUTPUT_FILE);
+        return -1;
+    }
+
+    /* Get JVMTI environment */
+    rc = (*vm)->GetEnv(vm, (void **)&jvmti, JVMTI_VERSION);
+    if (rc != JNI_OK) {
+        fatal_error(
+            "ERROR: Unable to create jvmtiEnv, GetEnv failed, error=%d\n", rc);
+        return -1;
+    }
+
+    /* add JVMTI capabilities */
+    memset(&capabilities,0, sizeof(capabilities));
+    capabilities.can_generate_compiled_method_load_events = 1;
+    err = (*jvmti)->AddCapabilities(jvmti, &capabilities);
+    check_jvmti_error(jvmti, err, "add capabilities");
+
+    /* set JVMTI callbacks for events */
+    memset(&callbacks, 0, sizeof(callbacks));
+    callbacks.CompiledMethodLoad = &compiled_method_load;
+    err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, sizeof(callbacks));
+    check_jvmti_error(jvmti, err, "set event callbacks");
+
+    /* enable JVMTI events */
+    err = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE,
+                        JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
+    check_jvmti_error(jvmti, err, "set event notify");
+
+    /* create coordination monitor */
+    err = (*jvmti)->CreateRawMonitor(jvmti, "agent lock", &lock);
+    check_jvmti_error(jvmti, err, "create raw monitor");
+
+    return 0;
+}
+
+/* Agent_OnUnload() is called last */
+JNIEXPORT void JNICALL
+Agent_OnUnload(JavaVM *vm)
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/demo/jvmti/compiledMethodLoad/sample.makefile.txt	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,148 @@
+#
+# Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   - Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#
+#   - Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+#   - Neither the name of Sun Microsystems nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+########################################################################
+#
+# Sample GNU Makefile for building JVMTI Demo compiledMethodLoad
+#
+#  Example uses:    
+#       gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparc]
+#       gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparcv9]
+#       gnumake JDK=<java_home> OSNAME=linux   [OPT=true]
+#       gnumake JDK=<java_home> OSNAME=win32   [OPT=true]
+#
+########################################################################
+
+# Source lists
+LIBNAME=compiledMethodLoad
+SOURCES=compiledMethodLoad.c ../agent_util/agent_util.c
+
+# Solaris Sun C Compiler Version 5.5
+ifeq ($(OSNAME), solaris)
+    # Sun Solaris Compiler options needed
+    COMMON_FLAGS=-mt -KPIC
+    # Options that help find errors
+    COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+    # Check LIBARCH for any special compiler options
+    LIBARCH=$(shell uname -p)
+    ifeq ($(LIBARCH), sparc)
+        COMMON_FLAGS+=-xarch=v8 -xregs=no%appl
+    endif
+    ifeq ($(LIBARCH), sparcv9)
+        COMMON_FLAGS+=-xarch=v9 -xregs=no%appl
+    endif
+    ifeq ($(OPT), true)
+        CFLAGS=-xO2 $(COMMON_FLAGS) 
+    else
+        CFLAGS=-g $(COMMON_FLAGS)
+    endif
+    # Object files needed to create library
+    OBJECTS=$(SOURCES:%.c=%.o)
+    # Library name and options needed to build it
+    LIBRARY=lib$(LIBNAME).so
+    LDFLAGS=-z defs -ztext
+    # Libraries we are dependent on
+    LIBRARIES= -lc
+    # Building a shared library
+    LINK_SHARED=$(LINK.c) -G -o $@
+endif
+
+# Linux GNU C Compiler
+ifeq ($(OSNAME), linux)
+    # GNU Compiler options needed to build it
+    COMMON_FLAGS=-fno-strict-aliasing -fPIC -fno-omit-frame-pointer
+    # Options that help find errors
+    COMMON_FLAGS+= -W -Wall  -Wno-unused -Wno-parentheses
+    ifeq ($(OPT), true)
+        CFLAGS=-O2 $(COMMON_FLAGS) 
+    else
+        CFLAGS=-g $(COMMON_FLAGS) 
+    endif
+    # Object files needed to create library
+    OBJECTS=$(SOURCES:%.c=%.o)
+    # Library name and options needed to build it
+    LIBRARY=lib$(LIBNAME).so
+    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
+    # Libraries we are dependent on
+    LIBRARIES=-lc
+    # Building a shared library
+    LINK_SHARED=$(LINK.c) -shared -o $@
+endif
+
+# Windows Microsoft C/C++ Optimizing Compiler Version 12
+ifeq ($(OSNAME), win32)
+    CC=cl
+    # Compiler options needed to build it
+    COMMON_FLAGS=-Gy -DWIN32
+    # Options that help find errors
+    COMMON_FLAGS+=-W0 -WX
+    ifeq ($(OPT), true)
+        CFLAGS= -Ox -Op -Zi $(COMMON_FLAGS) 
+    else
+        CFLAGS= -Od -Zi $(COMMON_FLAGS) 
+    endif
+    # Object files needed to create library
+    OBJECTS=$(SOURCES:%.c=%.obj)
+    # Library name and options needed to build it
+    LIBRARY=$(LIBNAME).dll
+    LDFLAGS=
+    # Libraries we are dependent on
+    LIBRARIES=
+    # Building a shared library
+    LINK_SHARED=link -dll -out:$@
+endif
+
+# Common -I options
+CFLAGS += -I.
+CFLAGS += -I../agent_util
+CFLAGS += -I$(JDK)/include -I$(JDK)/include/$(OSNAME)
+
+# Default rule
+all: $(LIBRARY)
+
+# Build native library
+$(LIBRARY): $(OBJECTS)
+	$(LINK_SHARED) $(OBJECTS) $(LIBRARIES)
+
+# Cleanup the built bits
+clean:
+	rm -f $(LIBRARY) $(OBJECTS)
+
+# Simple tester
+test: all
+	LD_LIBRARY_PATH=`pwd` $(JDK)/bin/java -agentlib:$(LIBNAME) -version
+
+# Compilation rule only needed on Windows
+ifeq ($(OSNAME), win32)
+%.obj: %.c
+	$(COMPILE.c) $<
+endif
+
--- a/src/share/demo/jvmti/index.html	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/demo/jvmti/index.html	Fri Feb 19 15:13:37 2010 -0800
@@ -100,6 +100,13 @@
 </li>
 
 <li>
+<A HREF="compiledMethodLoad">compiledMethodLoad</A>
+<br>
+This is a small agent that traces CompiledMethodLoad events along
+with the HotSpot specific compile_info parameter.
+</li>
+
+<li>
 <A HREF="mtrace">mtrace</A>
 <br>
 This is a small agent that does method tracing.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/javavm/export/jvmticmlr.h	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * This header file defines the data structures sent by the VM
+ * through the JVMTI CompiledMethodLoad callback function via the
+ * "void * compile_info" parameter. The memory pointed to by the
+ * compile_info parameter may not be referenced after returning from
+ * the CompiledMethodLoad callback. These are VM implementation
+ * specific data structures that may evolve in future releases. A
+ * JVMTI agent should interpret a non-NULL compile_info as a pointer
+ * to a region of memory containing a list of records. In a typical
+ * usage scenario, a JVMTI agent would cast each record to a
+ * jvmtiCompiledMethodLoadRecordHeader, a struct that represents
+ * arbitrary information. This struct contains a kind field to indicate
+ * the kind of information being passed, and a pointer to the next
+ * record. If the kind field indicates inlining information, then the
+ * agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
+ * This record contains an array of PCStackInfo structs, which indicate
+ * for every pc address what are the methods on the invocation stack.
+ * The "methods" and "bcis" fields in each PCStackInfo struct specify a
+ * 1-1 mapping between these inlined methods and their bytecode indices.
+ * This can be used to derive the proper source lines of the inlined
+ * methods.
+ */
+
+#ifndef _JVMTI_CMLR_H_
+#define _JVMTI_CMLR_H_
+
+enum {
+    JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
+    JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
+
+    JVMTI_CMLR_MAJOR_VERSION   = 0x00000001,
+    JVMTI_CMLR_MINOR_VERSION   = 0x00000000
+
+    /*
+     * This comment is for the "JDK import from HotSpot" sanity check:
+     * version: 1.0.0
+     */
+};
+
+typedef enum {
+    JVMTI_CMLR_DUMMY       = 1,
+    JVMTI_CMLR_INLINE_INFO = 2
+} jvmtiCMLRKind;
+
+/*
+ * Record that represents arbitrary information passed through JVMTI
+ * CompiledMethodLoadEvent void pointer.
+ */
+typedef struct _jvmtiCompiledMethodLoadRecordHeader {
+  jvmtiCMLRKind kind;     /* id for the kind of info passed in the record */
+  jint majorinfoversion;  /* major and minor info version values. Init'ed */
+  jint minorinfoversion;  /* to current version value in jvmtiExport.cpp. */
+
+  struct _jvmtiCompiledMethodLoadRecordHeader* next;
+} jvmtiCompiledMethodLoadRecordHeader;
+
+/*
+ * Record that gives information about the methods on the compile-time
+ * stack at a specific pc address of a compiled method. Each element in
+ * the methods array maps to same element in the bcis array.
+ */
+typedef struct _PCStackInfo {
+  void* pc;             /* the pc address for this compiled method */
+  jint numstackframes;  /* number of methods on the stack */
+  jmethodID* methods;   /* array of numstackframes method ids */
+  jint* bcis;           /* array of numstackframes bytecode indices */
+} PCStackInfo;
+
+/*
+ * Record that contains inlining information for each pc address of
+ * an nmethod.
+ */
+typedef struct _jvmtiCompiledMethodLoadInlineRecord {
+  jvmtiCompiledMethodLoadRecordHeader header;  /* common header for casting */
+  jint numpcs;          /* number of pc descriptors in this nmethod */
+  PCStackInfo* pcinfo;  /* array of numpcs pc descriptors */
+} jvmtiCompiledMethodLoadInlineRecord;
+
+/*
+ * Dummy record used to test that we can pass records with different
+ * information through the void pointer provided that they can be cast
+ * to a jvmtiCompiledMethodLoadRecordHeader.
+ */
+
+typedef struct _jvmtiCompiledMethodLoadDummyRecord {
+  jvmtiCompiledMethodLoadRecordHeader header;  /* common header for casting */
+  char message[50];
+} jvmtiCompiledMethodLoadDummyRecord;
+
+#endif
--- a/src/share/native/java/net/net_util.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/share/native/java/net/net_util.c	Fri Feb 19 15:13:37 2010 -0800
@@ -162,10 +162,11 @@
 JNIEXPORT jint JNICALL
 NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
 {
-    jint family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
-        AF_INET : AF_INET6;
+    jint family = AF_INET;
 
 #ifdef AF_INET6
+    family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
+        AF_INET : AF_INET6;
     if (him->sa_family == AF_INET6) {
 #ifdef WIN32
         struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
--- a/src/solaris/native/java/net/Inet4AddressImpl.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/java/net/Inet4AddressImpl.c	Fri Feb 19 15:13:37 2010 -0800
@@ -46,11 +46,6 @@
 #define HENT_BUF_SIZE 1024
 #define BIG_HENT_BUF_SIZE 10240  /* a jumbo-sized one */
 
-#ifndef __GLIBC__
-/* gethostname() is in libc.so but I can't find a header file for it */
-extern int gethostname(char *buf, int buf_len);
-#endif
-
 /************************************************************************
  * Inet4AddressImpl
  */
--- a/src/solaris/native/java/net/Inet6AddressImpl.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/java/net/Inet6AddressImpl.c	Fri Feb 19 15:13:37 2010 -0800
@@ -49,10 +49,6 @@
 #define NI_MAXHOST 1025
 #endif
 
-#ifndef __GLIBC__
-/* gethostname() is in libc.so but I can't find a header file for it */
-extern int gethostname(char *buf, int buf_len);
-#endif
 
 /************************************************************************
  * Inet6AddressImpl
@@ -360,8 +356,6 @@
         }
     }
 
-#endif /* AF_INET6 */
-
 cleanupAndReturn:
     {
         struct addrinfo *iterator, *tmp;
@@ -374,7 +368,6 @@
         JNU_ReleaseStringPlatformChars(env, host, hostname);
     }
 
-#ifdef AF_INET6
     if (NET_addrtransAvailable())
         (*freeaddrinfo_ptr)(res);
 #endif /* AF_INET6 */
--- a/src/solaris/native/java/net/NetworkInterface.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/java/net/NetworkInterface.c	Fri Feb 19 15:13:37 2010 -0800
@@ -253,8 +253,12 @@
     (JNIEnv *env, jclass cls, jobject iaObj) {
 
     netif *ifs, *curr;
+#ifdef AF_INET6
     int family = (*env)->GetIntField(env, iaObj, ni_iafamilyID) == IPv4?
         AF_INET : AF_INET6;
+#else
+    int family = AF_INET;
+#endif
     jobject obj = NULL;
     jboolean match = JNI_FALSE;
 
@@ -1528,6 +1532,7 @@
     strcpy((caddr_t)&(lifr.lifr_name), name_utf);
     if (ioctl(sock, SIOCGLIFMTU, (caddr_t)&lifr) >= 0) {
       ret = lifr.lifr_mtu;
+#ifdef AF_INET6
     } else {
       /* Try wIth an IPv6 socket in case the interface has only IPv6 addresses assigned to it */
       close(sock);
@@ -1547,6 +1552,12 @@
                                      "IOCTL failed");
       }
     }
+#else
+    } else {
+        NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
+                                     "IOCTL failed");
+    }
+#endif
 #endif
     close(sock);
   }
--- a/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Fri Feb 19 15:13:37 2010 -0800
@@ -605,8 +605,12 @@
     }
 
     iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&remote_addr, &port);
+#ifdef AF_INET6
     family = (*env)->GetIntField(env, iaObj, ia_familyID) == IPv4?
         AF_INET : AF_INET6;
+#else
+    family = AF_INET;
+#endif
     if (family == AF_INET) { /* this api can't handle IPV6 addresses */
         int address = (*env)->GetIntField(env, iaObj, ia_addressID);
         (*env)->SetIntField(env, addressObj, ia_addressID, address);
@@ -812,9 +816,9 @@
     jboolean retry;
 #ifdef __linux__
     jboolean connected = JNI_FALSE;
-    jobject connectedAddress;
-    jint connectedPort;
-    jlong prevTime;
+    jobject connectedAddress = NULL;
+    jint connectedPort = 0;
+    jlong prevTime = 0;
 #endif
 
     if (IS_NULL(fdObj)) {
@@ -1186,6 +1190,7 @@
  * Set outgoing multicast interface designated by a NetworkInterface.
  * Throw exception if failed.
  */
+#ifdef AF_INET6
 static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject value) {
     static jfieldID ni_indexID;
     int index;
@@ -1222,6 +1227,7 @@
     }
 #endif
 }
+#endif /* AF_INET6 */
 
 /*
  * Set outgoing multicast interface designated by an InetAddress.
@@ -1251,6 +1257,7 @@
  * Set outgoing multicast interface designated by an InetAddress.
  * Throw exception if failed.
  */
+#ifdef AF_INET6
 static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject value) {
     static jclass ni_class;
     if (ni_class == NULL) {
@@ -1272,6 +1279,7 @@
 
     mcast_set_if_by_if_v6(env, this, fd, value);
 }
+#endif
 
 /*
  * Sets the multicast interface.
@@ -1307,6 +1315,7 @@
         /*
          * value is an InetAddress.
          */
+#ifdef AF_INET6
 #ifdef __solaris__
         if (ipv6_available()) {
             mcast_set_if_by_addr_v6(env, this, fd, value);
@@ -1320,12 +1329,16 @@
             mcast_set_if_by_addr_v6(env, this, fd, value);
         }
 #endif
+#else
+        mcast_set_if_by_addr_v4(env, this, fd, value);
+#endif  /* AF_INET6 */
     }
 
     if (opt == java_net_SocketOptions_IP_MULTICAST_IF2) {
         /*
          * value is a NetworkInterface.
          */
+#ifdef AF_INET6
 #ifdef __solaris__
         if (ipv6_available()) {
             mcast_set_if_by_if_v6(env, this, fd, value);
@@ -1339,6 +1352,9 @@
             mcast_set_if_by_if_v6(env, this, fd, value);
         }
 #endif
+#else
+        mcast_set_if_by_if_v4(env, this, fd, value);
+#endif  /* AF_INET6 */
     }
 }
 
@@ -1368,6 +1384,7 @@
 /*
  * Enable/disable local loopback of multicast datagrams.
  */
+#ifdef AF_INET6
 static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value) {
     jclass cls;
     jfieldID fid;
@@ -1397,12 +1414,14 @@
     }
 #endif
 }
+#endif  /* AF_INET6 */
 
 /*
  * Sets the multicast loopback mode.
  */
 static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
                                   jint opt, jobject value) {
+#ifdef AF_INET6
 #ifdef __solaris__
     if (ipv6_available()) {
         mcast_set_loop_v6(env, this, fd, value);
@@ -1416,6 +1435,9 @@
         mcast_set_loop_v6(env, this, fd, value);
     }
 #endif
+#else
+    mcast_set_loop_v4(env, this, fd, value);
+#endif  /* AF_INET6 */
 }
 
 /*
@@ -1838,7 +1860,7 @@
     if (opt == java_net_SocketOptions_SO_BINDADDR) {
         /* find out local IP address */
         SOCKADDR him;
-        int len = 0;
+        socklen_t len = 0;
         int port;
         jobject iaObj;
 
@@ -1941,6 +1963,7 @@
 /*
  * Set hops limit for a socket. Throw exception if failed.
  */
+#ifdef AF_INET6
 static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
     int ittl = (int)ttl;
     if (JVM_SetSockOpt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
@@ -1949,6 +1972,7 @@
                        "Error setting socket option");
     }
 }
+#endif
 
 /*
  * Class:     java_net_PlainDatagramSocketImpl
@@ -1971,6 +1995,7 @@
         fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
     }
     /* setsockopt to be correct ttl */
+#ifdef AF_INET6
 #ifdef __solaris__
     if (ipv6_available()) {
         setHopLimit(env, fd, ttl);
@@ -1986,7 +2011,10 @@
             (*env)->SetIntField(env, this, pdsi_ttlID, ttl);
         }
     }
-#endif
+#endif  // __linux__
+#else
+    setTTL(env, fd, ttl);
+#endif  /* AF_INET6 */
 }
 
 /*
--- a/src/solaris/native/java/net/net_util_md.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/java/net/net_util_md.c	Fri Feb 19 15:13:37 2010 -0800
@@ -319,8 +319,6 @@
 
 #endif /* __solaris */
 
-#endif /* AF_INET6 */
-
     /*
      *  OK we may have the stack available in the kernel,
      *  we should also check if the APIs are available.
@@ -354,6 +352,7 @@
 
     close(fd);
     return JNI_TRUE;
+#endif /* AF_INET6 */
 }
 
 void
--- a/src/solaris/native/java/net/net_util_md.h	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/java/net/net_util_md.h	Fri Feb 19 15:13:37 2010 -0800
@@ -133,7 +133,7 @@
 
 #else
 
-#define SOCKADDR        union { struct sockaddr_in him4 }
+#define SOCKADDR        union { struct sockaddr_in him4; }
 #define SOCKADDR_LEN    sizeof(SOCKADDR)
 
 #endif
--- a/src/solaris/native/sun/net/spi/SdpProvider.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/sun/net/spi/SdpProvider.c	Fri Feb 19 15:13:37 2010 -0800
@@ -44,7 +44,11 @@
 Java_sun_net_spi_SdpProvider_convert(JNIEnv *env, jclass cls, jint fd)
 {
 #ifdef PROTO_SDP
+#ifdef AF_INET6
     int domain = ipv6_available() ? AF_INET6 : AF_INET;
+#else
+    int domain = AF_INET;
+#endif
     int s = socket(domain, SOCK_STREAM, PROTO_SDP);
     if (s < 0) {
         JNU_ThrowIOExceptionWithLastError(env, "socket");
--- a/src/solaris/native/sun/nio/ch/Net.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/sun/nio/ch/Net.c	Fri Feb 19 15:13:37 2010 -0800
@@ -124,6 +124,7 @@
  * Copy IPv6 group, interface index, and IPv6 source address
  * into group_source_req structure.
  */
+#ifdef AF_INET6
 static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
                                jbyteArray source, struct my_group_source_req* req)
 {
@@ -139,7 +140,7 @@
     sin6->sin6_family = AF_INET6;
     COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
 }
-
+#endif
 
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
@@ -159,7 +160,11 @@
 {
     int fd;
     int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
+#ifdef AF_INET6
     int domain = (ipv6_available() && preferIPv6) ? AF_INET6 : AF_INET;
+#else
+    int domain = AF_INET;
+#endif
 
     fd = socket(domain, type, 0);
     if (fd < 0) {
@@ -176,7 +181,7 @@
             return -1;
         }
     }
-#ifdef __linux__
+#if defined(__linux__) && defined(AF_INET6)
     /* By default, Linux uses the route default */
     if (domain == AF_INET6 && type == SOCK_DGRAM) {
         int arg = 1;
@@ -424,6 +429,7 @@
 Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobject fdo,
                                 jbyteArray group, jint index, jbyteArray source)
 {
+#ifdef AF_INET6
     struct ipv6_mreq mreq6;
     struct my_group_source_req req;
     int opt, n, optlen;
@@ -454,12 +460,17 @@
         handleSocketError(env, errno);
     }
     return 0;
+#else
+    JNU_ThrowInternalError(env, "Should not get here");
+    return IOS_THROWN;
+#endif  /* AF_INET6 */
 }
 
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_Net_blockOrUnblock6(JNIEnv *env, jobject this, jboolean block, jobject fdo,
                                     jbyteArray group, jint index, jbyteArray source)
 {
+#ifdef AF_INET6
     struct my_group_source_req req;
     int n;
     int opt = (block) ? MCAST_BLOCK_SOURCE : MCAST_UNBLOCK_SOURCE;
@@ -474,6 +485,10 @@
         handleSocketError(env, errno);
     }
     return 0;
+#else
+    JNU_ThrowInternalError(env, "Should not get here");
+    return IOS_THROWN;
+#endif
 }
 
 JNIEXPORT void JNICALL
--- a/src/solaris/native/sun/nio/ch/SctpNet.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/solaris/native/sun/nio/ch/SctpNet.c	Fri Feb 19 15:13:37 2010 -0800
@@ -168,14 +168,18 @@
   (JNIEnv *env, jclass klass, jboolean oneToOne) {
     int fd;
     struct sctp_event_subscribe event;
+#ifdef AF_INET6
+    int domain = ipv6_available() ? AF_INET6 : AF_INET;
+#else
+    int domain = AF_INET;
+#endif
 
     /* Try to load the socket API extension functions */
     if (!funcsLoaded && !loadSocketExtensionFuncs(env)) {
         return 0;
     }
 
-    fd = socket(ipv6_available() ? AF_INET6 : AF_INET,
-            (oneToOne ? SOCK_STREAM : SOCK_SEQPACKET), IPPROTO_SCTP);
+    fd = socket(domain, (oneToOne ? SOCK_STREAM : SOCK_SEQPACKET), IPPROTO_SCTP);
 
     if (fd < 0) {
         return handleSocketError(env, errno);
--- a/src/windows/native/java/net/NetworkInterface_winXP.c	Fri Feb 12 19:58:10 2010 +0300
+++ b/src/windows/native/java/net/NetworkInterface_winXP.c	Fri Feb 19 15:13:37 2010 -0800
@@ -172,7 +172,7 @@
     DWORD ret;
     IP_ADAPTER_ADDRESSES *ptr, *adapters=0;
     ULONG len=ipinflen, count=0;
-    netif *nif=0, *dup_nif, *last=0, *loopif=0;
+    netif *nif=0, *dup_nif, *last=0, *loopif=0, *curr;
     int tun=0, net=0;
 
     *netifPP = 0;
@@ -197,6 +197,20 @@
         last = nif;
     }
 
+    // Retrieve IPv4 addresses with the IP Helper API
+    curr = *netifPP;
+    while (curr != NULL) {
+        netaddr *netaddrP;
+        ret = enumAddresses_win(env, curr, &netaddrP);
+        if ((*env)->ExceptionOccurred(env)) {
+            free_netaddr(netaddrP);
+            return -1;
+        }
+        curr->addrs = netaddrP;
+        curr->naddrs += ret;
+        curr = curr->next;
+    }
+
     ret = getAdapters (env, &adapters);
     if (ret != ERROR_SUCCESS) {
         goto err;
@@ -350,6 +364,14 @@
         /* address is only usable if dad state is preferred or deprecated */
         if (uni_addr->DadState == IpDadStateDeprecated ||
                 uni_addr->DadState == IpDadStatePreferred) {
+            sock = uni_addr->Address.lpSockaddr;
+
+            // IPv4 addresses already retrieved with enumAddresses_win
+            if (sock->sa_family == AF_INET) {
+                uni_addr = uni_addr->Next;
+                continue;
+            }
+
             curr = (netaddr *)calloc (1, sizeof (netaddr));
             if (curr == 0) {
                 return -1;
@@ -361,15 +383,9 @@
                 prev->next = curr;
             }
             prev = curr;
-            sock = uni_addr->Address.lpSockaddr;
             SOCKETADDRESS_COPY (&curr->addr, sock);
             if (prefix != NULL) {
               curr->mask = (short)prefix->PrefixLength;
-              if (sock->sa_family == AF_INET) {
-                sock = prefix->Address.lpSockaddr;
-                SOCKETADDRESS_COPY(&curr->brdcast, sock);
-                curr->brdcast.him4.sin_addr.s_addr |= htonl((0xffffffff >> curr->mask));
-              }
               prefix = prefix->Next;
             }
             count ++;
--- a/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Fri Feb 19 15:13:37 2010 -0800
@@ -28,7 +28,12 @@
  *     LoginContext
  * @author Brad Wetmore
  *
- * @run main/othervm -Xmx2m TestProviderLeak
+ * @run main/othervm -Xmx2m -XX:OldSize=1m -XX:NewSize=512k TestProviderLeak
+ *
+ * The original test invocation is below, but had to use the above
+ * workaround for bug 6923123.
+ *
+ * run main/othervm -Xmx2m TestProviderLeak
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+/* @test
+ * @bug 6580131
+ * @summary Test jvmti demo compiledMethodLoad
+ *
+ * @compile ../DemoRun.java ../Hello.java
+ * @build CompiledMethodLoadTest
+ * @run main CompiledMethodLoadTest Hello
+ */
+
+public class CompiledMethodLoadTest {
+
+    public static void main(String args[]) throws Exception {
+        DemoRun demo;
+
+        /* Run demo that uses JVMTI compiledMethodLoad agent (no options) */
+        demo = new DemoRun("compiledMethodLoad", "" /* options to compiledMethodLoad */ );
+        demo.runit(args[0]);
+
+        /* Make sure patterns in output look ok */
+        if (demo.output_contains("ERROR")) {
+            throw new RuntimeException("Test failed - ERROR seen in output");
+        }
+
+        /* Must be a pass. */
+        System.out.println("Test passed - cleanly terminated");
+    }
+}
--- a/test/demo/jvmti/heapTracker/HeapTrackerTest.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/demo/jvmti/heapTracker/HeapTrackerTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
 
         /* Make sure patterns in output look ok */
         if (demo.output_contains("ERROR")) {
-            throw new RuntimeException("Test failed - ERROR seen in oputput");
+            throw new RuntimeException("Test failed - ERROR seen in output");
         }
 
         /* Must be a pass. */
--- a/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
 
         /* Make sure patterns in output look ok */
         if (hprof.output_contains("ERROR")) {
-            throw new RuntimeException("Test failed - ERROR seen in oputput");
+            throw new RuntimeException("Test failed - ERROR seen in output");
         }
 
         /* Must be a pass. */
--- a/test/demo/jvmti/hprof/CpuTimesTest.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/demo/jvmti/hprof/CpuTimesTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
 
         /* Make sure patterns in output look ok */
         if (hprof.output_contains("ERROR")) {
-            throw new RuntimeException("Test failed - ERROR seen in oputput");
+            throw new RuntimeException("Test failed - ERROR seen in output");
         }
 
         /* Must be a pass. */
--- a/test/demo/jvmti/minst/MinstTest.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/demo/jvmti/minst/MinstTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2006-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
 
         /* Make sure patterns in output look ok */
         if (demo.output_contains("ERROR")) {
-            throw new RuntimeException("Test failed - ERROR seen in oputput");
+            throw new RuntimeException("Test failed - ERROR seen in output");
         }
 
         /* Must be a pass. */
--- a/test/demo/jvmti/mtrace/TraceJFrame.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/demo/jvmti/mtrace/TraceJFrame.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
 
         /* Make sure patterns in output look ok */
         if (demo.output_contains("ERROR")) {
-            throw new RuntimeException("Test failed - ERROR seen in oputput");
+            throw new RuntimeException("Test failed - ERROR seen in output");
         }
 
         /* Must be a pass. */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/FontClass/FontPrivilege.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5010310 6319835 6904882
+ * @summary test fonts can be created in the presence of a security manager
+ * @run main/othervm/secure=java.lang.SecurityManager FontPrivilege
+ */
+
+import java.awt.Font;
+
+public class FontPrivilege {
+
+    public static void main(String[] args) throws Exception {
+        new Font("Helvetica", Font.PLAIN, 12).getFamily();
+        new Font("foo bar", Font.PLAIN, 12).getFamily();
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/GraphicsEnvironment/TestGetDefScreenDevice.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6896335
+ * @summary Test GraphicsEnvironment.getDefaultScreenDevice() in headless mode
+ * @run main/othervm -Djava.awt.headless=true TestGetDefScreenDevice
+ */
+
+import java.awt.*;
+public class TestGetDefScreenDevice {
+
+    public static void main(String[] args) throws Exception {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        try {
+            ge.getDefaultScreenDevice();
+            throw new Exception("Failed. HeadlessException not thrown");
+        } catch (HeadlessException he) {
+            // OK, test passed.
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/PrintJob/Security/SecurityDialogTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6195901 6195923 6195928 6195933 6491273 6888734
+ * @summary No SecurityException should be thrown when printing to a file
+            using the given policy.
+            Print to file option should be selected.
+ * @run main/othervm/policy=policy SecurityDialogTest
+ */
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.io.*;
+
+
+public class SecurityDialogTest extends Frame implements ActionListener {
+    // Declare things used in the test, like buttons and labels here
+
+    Button nativeDlg, setSecurity;
+        boolean isNative = true;
+
+    public SecurityDialogTest() {
+
+        nativeDlg = new Button("Print Dialog");
+        nativeDlg.addActionListener(this);
+        setSecurity = new Button("Toggle Dialog");
+        setSecurity.addActionListener(this);
+        add("South", nativeDlg);
+        add("North", setSecurity);
+        setSize(300, 300);
+        setVisible(true);
+    }
+
+    public static void main(String args[]) {
+        System.out.println("Native dialog is the default");
+        SecurityDialogTest test = new SecurityDialogTest();
+    }
+
+    public void actionPerformed(ActionEvent e) {
+
+        if (e.getSource() == setSecurity) {
+            if (isNative) {
+                isNative = false;
+                System.out.println("Common dialog is the default");
+
+            } else {
+                isNative = true;
+                System.out.println("Native dialog is the default");
+            }
+            return;
+        }
+
+        JobAttributes  ja = new JobAttributes();
+        PageAttributes pa = new PageAttributes();
+
+        if (isNative) {
+            ja.setDialog(JobAttributes.DialogType.NATIVE);
+        } else {
+            ja.setDialog(JobAttributes.DialogType.COMMON);
+        }
+        ja.setDestination(JobAttributes.DestinationType.FILE);
+        ja.setFileName("mohan.ps");
+
+
+        PrintJob pjob = getToolkit().getPrintJob(this, null, ja, pa);
+
+        if (pjob != null) {
+            Graphics pg = pjob.getGraphics();
+            System.out.println("PJOB: " + pjob);
+            if (pg != null) {
+                System.out.println("Printer Graphics: " + pg);
+                this.printAll(pg);
+                pg.dispose();
+            } else {
+                System.out.println("Printer Graphics is null");
+            }
+            pjob.end();
+            System.out.println("DONE");
+        } else {
+            System.out.println("PJOB is null");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/PrintJob/Security/policy	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* AUTOMATICALLY GENERATED ON Thu Jan 03 15:48:39 PST 2002*/
+/* DO NOT EDIT */
+
+grant {
+ permission java.io.FilePermission "<<ALL FILES>>", "read,write";
+ permission java.lang.RuntimePermission "queuePrintJob"; 
+ permission java.lang.RuntimePermission "setSecurityManager"; 
+};
+
--- a/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -56,6 +56,7 @@
     TextArea textArea;
     Robot robot;
     final int desiredSelectionEnd = ('z'-'a'+1)*2;  // 52
+    final static int SCROLL_DELAY = 10; // ms
 
     public void start () {
         createObjects();
@@ -126,6 +127,8 @@
 
             moveMouseBelowTextArea( tremble%2!=0 );
             Util.waitForIdle( robot );
+            // it is needed to add some small delay on Gnome
+            waitUntilScrollIsPerformed(robot);
         }
 
         robot.mouseRelease( MouseEvent.BUTTON1_MASK );
@@ -141,9 +144,19 @@
     void moveMouseBelowTextArea( boolean shift ) {
         Dimension d = textArea.getSize();
         Point l = textArea.getLocationOnScreen();
+        int x = (int)(l.x+d.width*.5);
         int y = (int)(l.y+d.height*1.5);
         if( shift ) y+=15;
-        robot.mouseMove( (int)(l.x+d.width*.5), y );
+        robot.mouseMove( x, y );
+    }
+
+    void waitUntilScrollIsPerformed(Robot robot) {
+        try {
+            Thread.sleep( SCROLL_DELAY );
+        }
+        catch( Exception e ) {
+            throw new RuntimeException( e );
+        }
     }
 
     void checkResults() {
--- a/test/java/beans/Introspector/6380849/TestBeanInfo.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/java/beans/Introspector/6380849/TestBeanInfo.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /**
- * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 
 import java.beans.BeanInfo;
 import java.beans.Introspector;
+import java.lang.ref.Reference;
 import java.lang.reflect.Field;
 
 import sun.awt.SunToolkit;
@@ -61,9 +62,10 @@
         try {
             actual = Introspector.getBeanInfo(type);
             type = actual.getClass();
-            Field field = type.getDeclaredField("targetBeanInfo"); // NON-NLS: field name
+            Field field = type.getDeclaredField("targetBeanInfoRef"); // NON-NLS: field name
             field.setAccessible(true);
-            actual = (BeanInfo) field.get(actual);
+            Reference ref = (Reference) field.get(actual);
+            actual = (BeanInfo) ref.get();
         }
         catch (Exception exception) {
             throw new Error("unexpected error", exception);
--- a/test/java/beans/Introspector/Test5102804.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/java/beans/Introspector/Test5102804.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,9 @@
 /*
  * @test
  * @bug 5102804
- * @ignore This test is not predictable with regards to GC
  * @summary Tests memory leak
  * @author Sergey Malenkov
+ * @run main/othervm -ms16m -mx16m Test5102804
  */
 
 import java.beans.BeanInfo;
--- a/test/java/beans/XMLEncoder/Test4646747.java	Fri Feb 12 19:58:10 2010 +0300
+++ b/test/java/beans/XMLEncoder/Test4646747.java	Fri Feb 19 15:13:37 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2004-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 4646747
  * @summary Tests that persistence delegate is correct after memory stress
  * @author Mark Davidson
+ * @run main/othervm -ms16m -mx16m Test4646747
  */
 
 import java.beans.DefaultPersistenceDelegate;
@@ -41,11 +42,14 @@
         encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
         // WARNING: This can eat up a lot of memory
         Object[] obs = new Object[10000];
-        for (int i = 0; i < obs.length; i++) {
-            obs[i] = new int[1000];
+        while (obs != null) {
+            try {
+                obs = new Object[obs.length + obs.length / 3];
+            }
+            catch (OutOfMemoryError error) {
+                obs = null;
+            }
         }
-        System.gc();
-        System.gc();
         PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
         if (!(pd instanceof MyPersistenceDelegate))
             throw new Error("persistence delegate has been lost");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/InterfaceAddress/NetworkPrefixLength.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6707289
+ * @summary InterfaceAddress.getNetworkPrefixLength() does not conform to Javadoc
+ */
+
+import java.net.InetAddress;
+import java.net.Inet4Address;
+import java.net.InterfaceAddress;
+import java.net.NetworkInterface;
+import java.util.Enumeration;
+import static java.lang.System.out;
+
+public class NetworkPrefixLength {
+    static boolean passed = true;
+
+    public static void main(String[] args) throws Exception {
+        Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
+
+        while (nics.hasMoreElements()) {
+            NetworkInterface nic = nics.nextElement();
+            for (InterfaceAddress iaddr : nic.getInterfaceAddresses()) {
+                boolean valid = checkPrefix(iaddr);
+                if (!valid) {
+                    passed = false;
+                    debug(nic.getName(), iaddr);
+                }
+            }
+        }
+
+        if (!passed)
+            throw new RuntimeException("Failed: some interfaces have invalid prefix lengths");
+    }
+
+    static boolean checkPrefix(InterfaceAddress iaddr) {
+        InetAddress addr = iaddr.getAddress();
+
+        if (addr instanceof Inet4Address)
+            return checkIPv4PrefixLength(iaddr.getNetworkPrefixLength());
+        else
+            return checkIPv6PrefixLength(iaddr.getNetworkPrefixLength());
+    }
+
+    static boolean checkIPv4PrefixLength(int prefix) {
+        if (prefix >=0 && prefix <= 32)
+            return true;
+
+        return false;
+    }
+
+    static boolean checkIPv6PrefixLength(int prefix) {
+        if (prefix >=0 && prefix <= 128)
+            return true;
+
+        return false;
+    }
+
+    static void debug(String nicName, InterfaceAddress iaddr) {
+        out.println("NIC " + nicName + " has an address with an invalid prefix length:\n" + iaddr);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/AvailableCharsetNames.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4422044
+ * @summary Ensure that keys in available-charset map
+ *          are identical to canonical names
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.*;
+
+
+public class AvailableCharsetNames {
+
+    public static void main(String[] args) throws Exception {
+        Iterator charsetIterator = Charset.availableCharsets().keySet().iterator();
+        while (charsetIterator.hasNext()) {
+            String charsetName = (String) charsetIterator.next();
+            Charset charset = Charset.forName(charsetName);
+            if (!charset.name().equals(charsetName)) {
+                throw new Exception("Error: Charset name mismatch - expected "
+                                   + charsetName + ", got " + charset.name());
+            }
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/CharsetContainmentTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 4626545 4696726
+   @summary Checks the inter containment relationships between NIO charsets
+ */
+
+import java.nio.charset.*;
+
+public class CharsetContainmentTest {
+    static String[] encodings =
+        { "US-ASCII", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-8",
+          "windows-1252", "ISO-8859-1", "ISO-8859-15", "ISO-8859-2",
+          "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6",
+          "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-13",
+          "ISO-2022-JP", "ISO-2022-KR",
+
+          // Temporarily remove ISO-2022-CN-* charsets until full encoder/decoder
+          // support is added (4673614)
+          // "x-ISO-2022-CN-CNS", "x-ISO-2022-CN-GB",
+
+          "x-ISCII91", "GBK", "GB18030", "Big5",
+          "x-EUC-TW", "GB2312", "EUC-KR", "x-Johab", "Big5-HKSCS",
+          "x-MS950-HKSCS", "windows-1251", "windows-1253", "windows-1254",
+          "windows-1255", "windows-1256", "windows-1257", "windows-1258",
+          "x-mswin-936", "x-windows-949", "x-windows-950", "windows-31j",
+          "Shift_JIS", "EUC-JP", "KOI8-R", "TIS-620"
+        };
+
+    static String[][] contains = {
+        { "US-ASCII"},
+           encodings,
+           encodings,
+           encodings,
+           encodings,
+          {"US-ASCII", "windows-1252"},
+          {"US-ASCII", "ISO-8859-1"},
+          {"US-ASCII", "ISO-8859-15"},
+          {"US-ASCII", "ISO-8859-2"},
+          {"US-ASCII", "ISO-8859-3"},
+          {"US-ASCII", "ISO-8859-4"},
+          {"US-ASCII", "ISO-8859-5"},
+          {"US-ASCII", "ISO-8859-6"},
+          {"US-ASCII", "ISO-8859-7"},
+          {"US-ASCII", "ISO-8859-8"},
+          {"US-ASCII", "ISO-8859-9"},
+          {"US-ASCII", "ISO-8859-13"},
+          {"ISO-2022-JP"},
+          {"ISO-2022-KR"},
+          // Temporarily remove ISO-2022-CN-* charsets until full encoder/decoder
+          // support is added (4673614)
+          //{"x-ISO-2022-CN-CNS"},
+          //{"x-ISO-2022-CN-GB"},
+          {"US-ASCII", "x-ISCII91"},
+          {"US-ASCII", "GBK"},
+          encodings,
+          {"US-ASCII", "Big5"},
+          {"US-ASCII", "x-EUC-TW"},
+          {"US-ASCII", "GB2312"},
+          {"US-ASCII", "EUC-KR"},
+          {"US-ASCII", "x-Johab"},
+          {"US-ASCII", "Big5-HKSCS", "Big5"},
+          {"US-ASCII", "x-MS950-HKSCS", "x-windows-950"},
+          {"US-ASCII", "windows-1251"},
+          {"US-ASCII", "windows-1253"},
+          {"US-ASCII", "windows-1254"},
+          {"US-ASCII", "windows-1255"},
+          {"US-ASCII", "windows-1256"},
+          {"US-ASCII", "windows-1257"},
+          {"US-ASCII", "windows-1258"},
+          {"US-ASCII", "x-mswin-936"},
+          {"US-ASCII", "x-windows-949"},
+          {"US-ASCII", "x-windows-950"},
+          {"US-ASCII", "windows-31j" },
+          {"US-ASCII", "Shift_JIS"},
+          {"US-ASCII", "EUC-JP"},
+          {"US-ASCII", "KOI8-R"},
+          {"US-ASCII", "TIS-620"}};
+
+
+    public static void main(String[] args) throws Exception {
+        for (int i = 0; i < encodings.length; i++) {
+            Charset c = Charset.forName(encodings[i]);
+                for (int j = 0 ; j < contains[i].length; j++) {
+                    if (c.contains(Charset.forName(contains[i][j])))
+                        continue;
+                    else {
+                        throw new Exception ("Error: charset " + encodings[i] +
+                                        "doesn't contain " + contains[i][j]);
+                    }
+                }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/Contains.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary Unit test for charset containment
+ * @bug 6798572
+ */
+
+import java.nio.charset.*;
+
+
+public class Contains {
+
+    static void ck(Charset cs1, Charset cs2, boolean cont) throws Exception {
+        if ((cs1.contains(cs2)) != cont)
+            throw new Exception("Wrong answer: "
+                                + cs1.name() + " contains " + cs2.name());
+        System.err.println(cs1.name()
+                           + (cont ? " contains " : " does not contain ")
+                           + cs2.name());
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        Charset us_ascii = Charset.forName("US-ASCII");
+        Charset iso_8859_1 = Charset.forName("ISO-8859-1");
+        Charset iso_8859_15 = Charset.forName("ISO-8859-15");
+        Charset utf_8 = Charset.forName("UTF-8");
+        Charset utf_16be = Charset.forName("UTF-16BE");
+        Charset cp1252 = Charset.forName("CP1252");
+
+        ck(us_ascii, us_ascii, true);
+        ck(us_ascii, iso_8859_1, false);
+        ck(us_ascii, iso_8859_15, false);
+        ck(us_ascii, utf_8, false);
+        ck(us_ascii, utf_16be, false);
+        ck(us_ascii, cp1252, false);
+
+        ck(iso_8859_1, us_ascii, true);
+        ck(iso_8859_1, iso_8859_1, true);
+        ck(iso_8859_1, iso_8859_15, false);
+        ck(iso_8859_1, utf_8, false);
+        ck(iso_8859_1, utf_16be, false);
+        ck(iso_8859_1, cp1252, false);
+
+        ck(iso_8859_15, us_ascii, true);
+        ck(iso_8859_15, iso_8859_1, false);
+        ck(iso_8859_15, iso_8859_15, true);
+        ck(iso_8859_15, utf_8, false);
+        ck(iso_8859_15, utf_16be, false);
+        ck(iso_8859_15, cp1252, false);
+
+        ck(utf_8, us_ascii, true);
+        ck(utf_8, iso_8859_1, true);
+        ck(utf_8, iso_8859_15, true);
+        ck(utf_8, utf_8, true);
+        ck(utf_8, utf_16be, true);
+        ck(utf_8, cp1252, true);
+
+        ck(utf_16be, us_ascii, true);
+        ck(utf_16be, iso_8859_1, true);
+        ck(utf_16be, iso_8859_15, true);
+        ck(utf_16be, utf_8, true);
+        ck(utf_16be, utf_16be, true);
+        ck(utf_16be, cp1252, true);
+
+        ck(cp1252, us_ascii, true);
+        ck(cp1252, iso_8859_1, false);
+        ck(cp1252, iso_8859_15, false);
+        ck(cp1252, utf_8, false);
+        ck(cp1252, utf_16be, false);
+        ck(cp1252, cp1252, true);
+
+        checkUTF();
+    }
+
+    static void checkUTF() throws Exception {
+        for (String utfName : utfNames)
+            for (String csName : charsetNames)
+                ck(Charset.forName(utfName),
+                   Charset.forName(csName),
+                   true);
+    }
+
+    static String[] utfNames = {"utf-16",
+                         "utf-8",
+                         "utf-16le",
+                         "utf-16be",
+                         "x-utf-16le-bom"};
+
+    static String[] charsetNames = {
+        "US-ASCII",
+        "UTF-8",
+        "UTF-16",
+        "UTF-16BE",
+        "UTF-16LE",
+        "x-UTF-16LE-BOM",
+        "GBK",
+        "GB18030",
+        "ISO-8859-1",
+        "ISO-8859-15",
+        "ISO-8859-2",
+        "ISO-8859-3",
+        "ISO-8859-4",
+        "ISO-8859-5",
+        "ISO-8859-6",
+        "ISO-8859-7",
+        "ISO-8859-8",
+        "ISO-8859-9",
+        "ISO-8859-13",
+        "JIS_X0201",
+        "x-JIS0208",
+        "JIS_X0212-1990",
+        "GB2312",
+        "EUC-KR",
+        "x-EUC-TW",
+        "EUC-JP",
+        "x-euc-jp-linux",
+        "KOI8-R",
+        "TIS-620",
+        "x-ISCII91",
+        "windows-1251",
+        "windows-1252",
+        "windows-1253",
+        "windows-1254",
+        "windows-1255",
+        "windows-1256",
+        "windows-1257",
+        "windows-1258",
+        "windows-932",
+        "x-mswin-936",
+        "x-windows-949",
+        "x-windows-950",
+        "windows-31j",
+        "Big5",
+        "Big5-HKSCS",
+        "x-MS950-HKSCS",
+        "ISO-2022-JP",
+        "ISO-2022-KR",
+        "x-ISO-2022-CN-CNS",
+        "x-ISO-2022-CN-GB",
+        "Big5-HKSCS",
+        "x-Johab",
+        "Shift_JIS"
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/Default.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ */
+
+import java.nio.charset.*;
+
+
+public class Default {
+
+    public static void main(String[] args) {
+        System.out.println(Charset.defaultCharset());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/EmptyCharsetName.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4786884
+ * @summary Ensure that passing the empty string to Charset methods and
+ *          constructors causes an IllegalArgumentException to be thrown
+ *
+ * @build EmptyCharsetName
+ * @run main EmptyCharsetName
+ * @run main/othervm -Dsun.nio.cs.bugLevel=1.4 EmptyCharsetName
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class EmptyCharsetName {
+
+    static boolean compat;
+
+    static abstract class Test {
+
+        public abstract void go() throws Exception;
+
+        Test() throws Exception {
+            try {
+                go();
+            } catch (Exception x) {
+                if (compat) {
+                    if (x instanceof UnsupportedCharsetException) {
+                        System.err.println("Thrown as expected: " + x);
+                        return;
+                    }
+                    throw new Exception("Exception thrown", x);
+                }
+                if (x instanceof IllegalCharsetNameException) {
+                    System.err.println("Thrown as expected: " + x);
+                    return;
+                }
+                throw new Exception("Incorrect exception: "
+                                    + x.getClass().getName(),
+                                    x);
+            }
+            if (!compat)
+                throw new Exception("No exception thrown");
+        }
+
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        // If sun.nio.cs.bugLevel == 1.4 then we want the 1.4 behavior
+        String bl = System.getProperty("sun.nio.cs.bugLevel");
+        compat = (bl != null && bl.equals("1.4"));
+
+        new Test() {
+                public void go() throws Exception {
+                    Charset.forName("");
+                }};
+        new Test() {
+                public void go() throws Exception {
+                    Charset.isSupported("");
+                }};
+        new Test() {
+                public void go() throws Exception {
+                    new Charset("", new String[] { }) {
+                            public CharsetDecoder newDecoder() {
+                                return null;
+                            }
+                            public CharsetEncoder newEncoder() {
+                                return null;
+                            }
+                            public boolean contains(Charset cs) {
+                                return false;
+                            }
+                        };
+                }};
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/EncDec.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary Unit test for encode/decode convenience methods
+ */
+
+
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class EncDec {
+
+    public static void main(String[] args) throws Exception {
+        String s = "Hello, world!";
+        ByteBuffer bb = ByteBuffer.allocate(100);
+        bb.put(Charset.forName("ISO-8859-15").encode(s)).flip();
+        String t = Charset.forName("UTF-8").decode(bb).toString();
+        System.err.println(t);
+        if (!t.equals(s))
+            throw new Exception("Mismatch: " + s + " != " + t);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/IllegalCharsetName.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6330020
+ * @summary Ensure Charset.forName/isSupport throws the correct exception
+ *          if the charset names passed in are illegal.
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.*;
+
+public class IllegalCharsetName {
+    public static void main(String[] args) throws Exception {
+        String[] illegalNames = {
+            ".",
+            "_",
+            ":",
+            "-",
+            ".name",
+            "_name",
+            ":name",
+            "-name",
+            "name*name",
+            "name?name"
+        };
+        for (int i = 0; i < illegalNames.length; i++) {
+            try {
+                Charset.forName(illegalNames[i]);
+                throw new Exception("Charset.forName(): No exception thrown");
+            } catch (IllegalCharsetNameException x) { //expected
+            }
+
+            try {
+                Charset.isSupported(illegalNames[i]);
+                throw new Exception("Charset.isSupported(): No exception thrown");
+            } catch (IllegalCharsetNameException x) { //expected
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4777124 6920545
+ * @summary Verify that all Charset subclasses are available through the API
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.charset.Charset;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Vector;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import sun.misc.Launcher;
+
+
+public class NIOCharsetAvailabilityTest {
+
+    public static void main(String[] args) throws Exception {
+        // build the set of all Charset subclasses in the
+        // two known charset implementation packages
+        Set charsets = new HashSet();
+        addCharsets(charsets, "sun.nio.cs");
+        addCharsets(charsets, "sun.nio.cs.ext");
+
+        // remove the charsets that the API says are available
+        Collection availableCharsets = Charset.availableCharsets().values();
+        Iterator iter = availableCharsets.iterator();
+        while (iter.hasNext()) {
+            charsets.remove(((Charset) iter.next()).getClass());
+        }
+
+        // remove the known pseudo-charsets that serve only to implement
+        // other charsets, but shouldn't be known to the public
+        charsets.remove(Class.forName("sun.nio.cs.Unicode"));
+        charsets.remove(Class.forName("sun.nio.cs.ext.HKSCS"));
+        charsets.remove(Class.forName("sun.nio.cs.ext.HKSCS_2001"));
+        charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022"));
+        charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_GB"));
+        charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_CNS"));
+
+        // report the charsets that are implemented but not available
+        iter = charsets.iterator();
+        while (iter.hasNext()) {
+            System.out.println("Unused Charset subclass: " + ((Class) iter.next()).getName());
+        }
+        if (charsets.size() > 0) {
+            throw new RuntimeException();
+        }
+    }
+
+    private static Vector classPathSegments = new Vector();
+
+    private static void addCharsets(Set charsets, final String packageName)
+            throws Exception {
+
+        String classPath =
+            (String) java.security.AccessController.doPrivileged(
+             new sun.security.action.GetPropertyAction("sun.boot.class.path"));
+        String s =
+            (String) java.security.AccessController.doPrivileged(
+             new sun.security.action.GetPropertyAction("java.class.path"));
+
+        // Search combined system and application class path
+        if (s != null && s.length() != 0) {
+            classPath += File.pathSeparator + s;
+        }
+        while (classPath != null && classPath.length() != 0) {
+            int i = classPath.lastIndexOf(java.io.File.pathSeparatorChar);
+            String dir = classPath.substring(i + 1);
+            if (i == -1) {
+                classPath = null;
+            } else {
+                classPath = classPath.substring(0, i);
+            }
+            classPathSegments.insertElementAt(dir, 0);
+        }
+
+        // add extensions from the extension class loader
+        ClassLoader appLoader = Launcher.getLauncher().getClassLoader();
+        URLClassLoader extLoader = (URLClassLoader) appLoader.getParent();
+        URL[] urls = extLoader.getURLs();
+        for (int i = 0; i < urls.length; i++) {
+            try {
+                URI uri = new URI(urls[i].toString());
+                classPathSegments.insertElementAt(uri.getPath(), 0);
+            } catch (URISyntaxException e) {
+            }
+        }
+
+        String[] classList = (String[])
+            java.security.AccessController.doPrivileged(
+                                    new java.security.PrivilegedAction() {
+                public Object run() {
+                    return getClassList(packageName, "");
+                }
+            });
+
+        for (int i = 0; i < classList.length; i++) {
+            try {
+                Class clazz = Class.forName(packageName + "." + classList[i]);
+                Class superclazz = clazz.getSuperclass();
+                while (superclazz != null && !superclazz.equals(Object.class)) {
+                    if (superclazz.equals(Charset.class)) {
+                        charsets.add(clazz);
+                        break;
+                    } else {
+                        superclazz = superclazz.getSuperclass();
+                    }
+                }
+            } catch (ClassNotFoundException e) {
+            }
+        }
+    }
+
+    private static final char ZIPSEPARATOR = '/';
+
+    /**
+     * Walk through CLASSPATH and find class list from a package.
+     * The class names start with prefix string
+     * @param package name, class name prefix
+     * @return class list in an array of String
+     */
+    private static String[] getClassList(String pkgName, String prefix) {
+        Vector listBuffer = new Vector();
+        String packagePath = pkgName.replace('.', File.separatorChar)
+            + File.separatorChar;
+        String zipPackagePath = pkgName.replace('.', ZIPSEPARATOR)
+            + ZIPSEPARATOR;
+        for (int i = 0; i < classPathSegments.size(); i++){
+            String onePath = (String) classPathSegments.elementAt(i);
+            File f = new File(onePath);
+            if (!f.exists())
+                continue;
+            if (f.isFile())
+                scanFile(f, zipPackagePath, listBuffer, prefix);
+            else if (f.isDirectory()) {
+                String fullPath;
+                if (onePath.endsWith(File.separator))
+                    fullPath = onePath + packagePath;
+                else
+                    fullPath = onePath + File.separatorChar + packagePath;
+                File dir = new File(fullPath);
+                if (dir.exists() && dir.isDirectory())
+                    scanDir(dir, listBuffer, prefix);
+            }
+        }
+        String[] classNames = new String[listBuffer.size()];
+        listBuffer.copyInto(classNames);
+        return classNames;
+    }
+
+    private static void addClass (String className, Vector listBuffer, String prefix) {
+        if (className != null && className.startsWith(prefix)
+                    && !listBuffer.contains(className))
+            listBuffer.addElement(className);
+    }
+
+    private static String midString(String str, String pre, String suf) {
+        String midStr;
+        if (str.startsWith(pre) && str.endsWith(suf))
+            midStr = str.substring(pre.length(), str.length() - suf.length());
+        else
+            midStr = null;
+        return midStr;
+    }
+
+    private static void scanDir(File dir, Vector listBuffer, String prefix) {
+        String[] fileList = dir.list();
+        for (int i = 0; i < fileList.length; i++) {
+            addClass(midString(fileList[i], "", ".class"), listBuffer, prefix);
+        }
+    }
+
+    private static void scanFile(File f, String packagePath, Vector listBuffer,
+                String prefix) {
+        try {
+            ZipInputStream zipFile = new ZipInputStream(new FileInputStream(f));
+            ZipEntry entry;
+            while ((entry = zipFile.getNextEntry()) != null) {
+                String eName = entry.getName();
+                if (eName.startsWith(packagePath)) {
+                    if (eName.endsWith(".class")) {
+                        addClass(midString(eName, packagePath, ".class"),
+                                listBuffer, prefix);
+                    }
+                }
+            }
+        } catch (FileNotFoundException e) {
+            System.out.println("file not found:" + e);
+        } catch (IOException e) {
+            System.out.println("file IO Exception:" + e);
+        } catch (Exception e) {
+            System.out.println("Exception:" + e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/NullCharsetName.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4448594
+ * @summary Ensure passing null to Charset.forName throws the correct exception
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.*;
+
+
+public class NullCharsetName {
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Charset.forName(null);
+        } catch (Exception x) {
+            if (x instanceof IllegalArgumentException) {
+                System.err.println("Thrown as expected: " + x);
+                return;
+            }
+            throw new Exception("Incorrect exception: "
+                                + x.getClass().getName(),
+                                x);
+        }
+        throw new Exception("No exception thrown");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/RegisteredCharsets.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,1270 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668
+ * @summary Check that registered charsets are actually registered
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.*;
+
+public class RegisteredCharsets {
+
+    static String [] ianaRegistered = {
+                            "US-ASCII", "UTF8", "Big5", "EUC-JP",
+                            "GBK", "GB18030", "ISO-2022-KR", "ISO-2022-JP",
+                            "GB2312",  // IANA preferred name for "EUC-CN"
+                            "ISO-8859-1", "ISO-8859-2", "ISO-8859-3",
+                            "ISO-8859-4", "ISO-8859-5", "ISO-8859-6",
+                            "ISO-8859-7", "ISO-8859-8", "ISO-8859-9",
+                            "ISO-8859-13", "ISO-8859-15", "windows-1251",
+                            "windows-1252", "windows-1253", "windows-1254",
+                            "windows-1255", "windows-1256", "windows-31j",
+                            "Shift_JIS", "JIS_X0201", "JIS_X0212-1990",
+                            "TIS-620", "Big5-HKSCS",
+                            "ISO-2022-CN",
+                            "IBM850",
+                            "IBM852",
+                            "IBM855",
+                            "IBM857",
+                            "IBM860",
+                            "IBM861",
+                            "IBM862",
+                            "IBM863",
+                            "IBM864",
+                            "IBM865",
+                            "IBM866",
+                            "IBM868",
+                            "IBM869",
+                            "IBM437",
+                            "IBM775",
+                            "IBM037",
+                            "IBM1026",
+                            "IBM273",
+                            "IBM277",
+                            "IBM278",
+                            "IBM280",
+                            "IBM284",
+                            "IBM285",
+                            "IBM297",
+                            "IBM420",
+                            "IBM424",
+                            "IBM500",
+                            "IBM-Thai",
+                            "IBM870",
+                            "IBM871",
+                            "IBM918",
+                            "IBM1047",
+                            "IBM01140",
+                            "IBM01141",
+                            "IBM01142",
+                            "IBM01143",
+                            "IBM01144",
+                            "IBM01145",
+                            "IBM01146",
+                            "IBM01147",
+                            "IBM01148",
+                            "IBM01149",
+                            "IBM00858" };
+
+    static String [] ianaUnRegistered = {
+                            "x-EUC-TW", "x-ISCII91",
+                            "x-windows-949", "x-windows-950",
+                            "x-mswin-936", "x-JIS0208",
+                            "x-ISO-8859-11",
+                            "x-windows-874",
+                            "x-PCK", "x-JISAutoDetect", "x-Johab",
+                            "x-MS950-HKSCS",
+                            "x-Big5-Solaris",
+                            "x-ISO-2022-CN-CNS",
+                            "x-ISO-2022-CN-GB",
+                            "x-MacArabic",
+                            "x-MacCentralEurope",
+                            "x-MacCroatian",
+                            "x-MacCyrillic",
+                            "x-MacDingbat",
+                            "x-MacGreek",
+                            "x-MacHebrew",
+                            "x-MacIceland",
+                            "x-MacRoman",
+                            "x-MacRomania",
+                            "x-MacSymbol",
+                            "x-MacThai",
+                            "x-MacTurkish",
+                            "x-MacUkraine",
+                            "x-IBM942",
+                            "x-IBM942C",
+                            "x-IBM943",
+                            "x-IBM943C",
+                            "x-IBM948",
+                            "x-IBM950",
+                            "x-IBM930",
+                            "x-IBM935",
+                            "x-IBM937",
+                            "x-IBM856",
+                            "x-IBM874",
+                            "x-IBM737",
+                            "x-IBM1006",
+                            "x-IBM1046",
+                            "x-IBM1098",
+                            "x-IBM1025",
+                            "x-IBM1112",
+                            "x-IBM1122",
+                            "x-IBM1123",
+                            "x-IBM1124",
+                            "x-IBM875",
+                            "x-IBM921",
+                            "x-IBM922",
+                            "x-IBM1097",
+                            "x-IBM949",
+                            "x-IBM949C",
+                            "x-IBM939",
+                            "x-IBM933",
+                            "x-IBM1381",
+                            "x-IBM1383",
+                            "x-IBM970",
+                            "x-IBM964",
+                            "x-IBM33722",
+                            "x-IBM1006",
+                            "x-IBM1046",
+                            "x-IBM1097",
+                            "x-IBM1098",
+                            "x-IBM1112",
+                            "x-IBM1122",
+                            "x-IBM1123",
+                            "x-IBM1124",
+                            "x-IBM33722",
+                            "x-IBM737",
+                            "x-IBM856",
+                            "x-IBM874",
+                            "x-IBM875",
+                            "x-IBM922",
+                            "x-IBM933",
+                            "x-IBM964" };
+
+    static void check(String csn, boolean testRegistered) throws Exception {
+        if (!Charset.forName(csn).isRegistered() && testRegistered)
+                throw new Exception("Not registered: " + csn);
+        else if (Charset.forName(csn).isRegistered() && !testRegistered)
+                throw new Exception("Registered: " + csn + "should be unregistered");
+    }
+
+    static void aliasCheck(String canonicalName, String[] aliasNames) throws Exception
+    {
+        for (int k = 0; k < aliasNames.length; k++ ) {
+            Charset cs = Charset.forName(aliasNames[k]);
+            if (!cs.name().equals(canonicalName)) {
+                throw new Exception("Unexpected Canonical name " + canonicalName);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        for (int i = 0; i < ianaRegistered.length ; i++)
+            check(ianaRegistered[i], true);
+
+        for (int i = 0; i < ianaUnRegistered.length ; i++)
+            check(ianaUnRegistered[i], false);
+
+        // Check aliases registered with IANA for all NIO supported
+        // Charset implementations.
+        //
+        // The aliases below are in sync with the IANA registered charset
+        // document at: http://www.iana.org/assignments/character-sets
+        // Last updated 7/25/2002
+
+        aliasCheck("US-ASCII",
+                new String[] {"ascii","ANSI_X3.4-1968",
+                "iso-ir-6","ANSI_X3.4-1986", "ISO_646.irv:1991",
+                "ASCII", "ISO646-US","us","IBM367","cp367",
+                "csASCII", "default"});
+
+        aliasCheck("UTF-8",
+                new String[] {
+                    "UTF8",
+                    "unicode-1-1-utf-8"
+                });
+
+        aliasCheck("UTF-16",
+                new String[] {
+                    "UTF_16",
+                    "utf16"
+                });
+
+        aliasCheck("UTF-16BE",
+                new String[] {
+                    "UTF_16BE",
+                    "ISO-10646-UCS-2",
+                    "X-UTF-16BE",
+                    "UnicodeBigUnmarked"
+                });
+
+        aliasCheck("UTF-16LE",
+                new String[] {
+                    "UTF_16LE",
+                    "X-UTF-16LE",
+                    "UnicodeLittleUnmarked"
+                });
+
+        aliasCheck("Big5",
+                new String[] {
+                    "csBig5"
+                });
+
+        aliasCheck("Big5-HKSCS",
+                new String[] {
+                    "Big5_HKSCS",
+                    "big5hk",
+                    "big5-hkscs",
+                    "big5-hkscs:unicode3.0",
+                    "big5hkscs"
+                });
+
+        aliasCheck("x-MS950-HKSCS",
+                new String[] {
+                    "MS950_HKSCS"
+                });
+
+        aliasCheck("GB18030",
+                new String[] {
+                    "gb18030-2000"
+                });
+
+        aliasCheck("ISO-2022-KR", new String[] {"csISO2022KR"});
+        aliasCheck("ISO-2022-JP", new String[] {"csISO2022JP"});
+        aliasCheck("EUC-KR", new String[] { "csEUCKR"});
+        aliasCheck("ISO-8859-1",
+                new String[] {
+
+                    // IANA aliases
+                    "iso-ir-100",
+                    "ISO_8859-1",
+                    "latin1",
+                    "l1",
+                    "IBM819",
+                    "cp819",
+                    "csISOLatin1",
+
+                    // JDK historical aliases
+                    "819",
+                    "IBM-819",
+                    "ISO8859_1",
+                    "ISO_8859-1:1987",
+                    "ISO_8859_1",
+                    "8859_1",
+                    "ISO8859-1",
+
+                });
+
+        aliasCheck("ISO-8859-2",
+            new String[] {
+                "ISO_8859-2",
+                "ISO_8859-2:1987",
+                "iso-ir-101",
+                "latin2",
+                "l2",
+                "8859_2",
+                "iso_8859-2:1987",
+                "iso8859-2",
+                "ibm912",
+                "ibm-912",
+                "cp912",
+                "912",
+                "csISOLatin2"});
+
+        aliasCheck("ISO-8859-3",
+                new String[] {"latin3",
+                "ISO_8859-3:1988",
+                "iso-ir-109",
+                "l3",
+                "8859_3",
+                "iso_8859-3:1988",
+                "iso8859-3",
+                "ibm913",
+                "ibm-913",
+                "cp913",
+                "913",
+                "csISOLatin3"});
+
+        aliasCheck("ISO-8859-4",
+                new String[] {"csISOLatin4",
+                    "ISO_8859-4:1988",
+                    "iso-ir-110",
+                    "latin4",
+                    "8859_4",
+                    "iso_8859-4:1988",
+                    "iso8859-4",
+                    "ibm914",
+                    "ibm-914",
+                    "cp914",
+                    "914",
+                    "l4"});
+
+        aliasCheck("ISO-8859-5",
+                new String[] {
+                    "iso8859_5", // JDK historical
+                    "8859_5",
+                    "iso-ir-144",
+                    "ISO_8859-5",
+                    "ISO_8859-5:1988",
+                    "ISO8859-5",
+                    "cyrillic",
+                    "ibm915",
+                    "ibm-915",
+                    "915",
+                    "cp915",
+                    "csISOLatinCyrillic"
+                });
+
+        aliasCheck("ISO-8859-6",
+                new String[] {"ISO_8859-6:1987",
+                "iso-ir-127",
+                "ISO_8859-6",
+                "ECMA-114",
+                "ASMO-708",
+                "arabic",
+                "8859_6",
+                "iso_8859-6:1987",
+                "iso8859-6",
+                "ibm1089",
+                "ibm-1089",
+                "cp1089",
+                "1089",
+                "csISOLatinArabic"});
+
+        aliasCheck("ISO-8859-7",
+                new String[] {"ISO_8859-7:1987",
+                "iso-ir-126",
+                "ISO_8859-7",
+                "ELOT_928",
+                "ECMA-118",
+                "greek",
+                "greek8",
+                "8859_7",
+                "iso_8859-7:1987",
+                "iso8859-7",
+                "ibm813",
+                "ibm-813",
+                "cp813",
+                "813",
+                "csISOLatinGreek"});
+
+        aliasCheck("ISO-8859-8",
+                new String[] {
+                "ISO_8859-8:1988",
+                "iso-ir-138",
+                "ISO_8859-8",
+                "hebrew",
+                "8859_8",
+                "iso_8859-8:1988",
+                "iso8859-8",
+                "ibm916",
+                "ibm-916",
+                "cp916",
+                "916",
+                "csISOLatinHebrew"});
+
+        aliasCheck("ISO-8859-9",
+                new String[] {"ISO_8859-9:1989",
+                "iso-ir-148",
+                "ISO_8859-9",
+                "latin5",
+                "l5",
+                "8859_9",
+                "iso8859-9",
+                "ibm920",
+                "ibm-920",
+                "cp920",
+                "920",
+                "csISOLatin5"});
+
+        aliasCheck("ISO-8859-13",
+                new String[] {
+                    "iso8859_13", // JDK historical
+                    "iso_8859-13",
+                    "8859_13",
+                    "ISO8859-13"
+                });
+
+        aliasCheck("ISO-8859-15",
+                new String[] {
+                    // IANA alias
+                    "ISO_8859-15",
+                    // JDK historical aliases
+                    "8859_15",
+                    "ISO-8859-15",
+                    "ISO_8859-15",
+                    "ISO8859-15",
+                    "ISO8859_15",
+                    "IBM923",
+                    "IBM-923",
+                    "cp923",
+                    "923",
+                    "LATIN0",
+                    "LATIN9",
+                    "L9",
+                    "csISOlatin0",
+                    "csISOlatin9",
+                    "ISO8859_15_FDIS"
+
+                });
+
+        aliasCheck("JIS_X0212-1990",
+                new String[] {
+                "iso-ir-159",
+                "csISO159JISX02121990"});
+
+        aliasCheck("JIS_X0201",
+                new String[]{
+                "X0201",
+                "csHalfWidthKatakana"});
+
+        aliasCheck("KOI8-R",
+                new String[] {
+                "KOI8_R",
+                "csKOI8R"});
+
+        aliasCheck("GBK",
+                new String[] {
+                "windows-936"});
+
+        aliasCheck("Shift_JIS",
+                new String[] {
+                "MS_Kanji",
+                "csShiftJIS"});
+
+        aliasCheck("EUC-JP",
+                new String[] {
+                "Extended_UNIX_Code_Packed_Format_for_Japanese",
+                "csEUCPkdFmtJapanese"});
+
+        aliasCheck("Big5", new String[] {"csBig5"});
+
+        aliasCheck("windows-31j", new String[] {"csWindows31J"});
+
+        aliasCheck("x-iso-8859-11",
+                    new String[] { "iso-8859-11", "iso8859_11" });
+
+        aliasCheck("windows-1250",
+                new String[] {
+                    "cp1250",
+                    "cp5346"
+                });
+
+        aliasCheck("windows-1251",
+                new String[] {
+                    "cp1251",
+                    "cp5347",
+                    "ansi-1251"
+                });
+
+        aliasCheck("windows-1252",
+                new String[] {
+                    "cp1252",
+                    "cp5348"
+                });
+
+        aliasCheck("windows-1253",
+                new String[] {
+                    "cp1253",
+                    "cp5349"
+                });
+
+        aliasCheck("windows-1254",
+                new String[] {
+                    "cp1254",
+                    "cp5350"
+                });
+
+        aliasCheck("windows-1255",
+                new String[] {
+                    "cp1255"
+                });
+
+        aliasCheck("windows-1256",
+                new String[] {
+                    "cp1256"
+                });
+
+        aliasCheck("windows-1257",
+                new String[] {
+                    "cp1257",
+                    "cp5353"
+                });
+
+        aliasCheck("windows-1258",
+                new String[] {
+                    "cp1258"
+                });
+
+        aliasCheck("x-windows-874",
+                new String[] {
+                    "ms874", "ms-874", "windows-874" });
+
+        aliasCheck("GB2312",
+                new String[] {
+                    "x-EUC-CN",
+                    "gb2312-80",
+                    "gb2312-1980",
+                    "euc-cn",
+                    "euccn" });
+
+        aliasCheck("x-IBM942" ,
+                new String[] {
+                    "cp942", // JDK historical
+                    "ibm942",
+                    "ibm-942",
+                    "942"
+                });
+
+        aliasCheck("x-IBM942C" ,
+                new String[] {
+                    "cp942C", // JDK historical
+                    "ibm942C",
+                    "ibm-942C",
+                    "942C"
+                } );
+
+        aliasCheck("x-IBM943" ,
+                new String[] {
+                    "cp943", // JDK historical
+                    "ibm943",
+                    "ibm-943",
+                    "943"
+                } );
+
+        aliasCheck("x-IBM943C" ,
+                new String[] {
+                    "cp943c", // JDK historical
+                    "ibm943C",
+                    "ibm-943C",
+                    "943C"
+                } );
+
+        aliasCheck("x-IBM948" ,
+                new String[] {
+                    "cp948", // JDK historical
+                    "ibm948",
+                    "ibm-948",
+                    "948"
+                } );
+
+        aliasCheck("x-IBM950" ,
+                new String[] {
+                    "cp950", // JDK historical
+                    "ibm950",
+                    "ibm-950",
+                    "950"
+                } );
+
+        aliasCheck("x-IBM930" ,
+                new String[] {
+                    "cp930", // JDK historical
+                    "ibm930",
+                    "ibm-930",
+                    "930"
+                } );
+
+        aliasCheck("x-IBM935" ,
+                new String[] {
+                    "cp935", // JDK historical
+                    "ibm935",
+                    "ibm-935",
+                    "935"
+                } );
+
+        aliasCheck("x-IBM937" ,
+                new String[] {
+                    "cp937", // JDK historical
+                    "ibm937",
+                    "ibm-937",
+                    "937"
+                } );
+
+        aliasCheck("IBM850" ,
+                new String[] {
+                    "cp850", // JDK historical
+                    "ibm-850",
+                    "ibm850",
+                    "850",
+                    "cspc850multilingual"
+                } );
+
+        aliasCheck("IBM852" ,
+                new String[] {
+                    "cp852", // JDK historical
+                    "ibm852",
+                    "ibm-852",
+                    "852",
+                    "csPCp852"
+                } );
+
+        aliasCheck("IBM855" ,
+                new String[] {
+                    "cp855", // JDK historical
+                    "ibm-855",
+                    "ibm855",
+                    "855",
+                    "cspcp855"
+                } );
+
+        aliasCheck("x-IBM856" ,
+                new String[] {
+                    "cp856", // JDK historical
+                    "ibm-856",
+                    "ibm856",
+                    "856"
+                } );
+
+        aliasCheck("IBM857" ,
+                new String[] {
+                    "cp857", // JDK historical
+                    "ibm857",
+                    "ibm-857",
+                    "857",
+                    "csIBM857"
+                } );
+
+        aliasCheck("IBM860" ,
+                new String[] {
+                    "cp860", // JDK historical
+                    "ibm860",
+                    "ibm-860",
+                    "860",
+                    "csIBM860"
+                } );
+        aliasCheck("IBM861" ,
+                new String[] {
+                    "cp861", // JDK historical
+                    "ibm861",
+                    "ibm-861",
+                    "861",
+                    "csIBM861"
+                } );
+
+        aliasCheck("IBM862" ,
+                new String[] {
+                    "cp862", // JDK historical
+                    "ibm862",
+                    "ibm-862",
+                    "862",
+                    "csIBM862"
+                } );
+
+        aliasCheck("IBM863" ,
+                new String[] {
+                    "cp863", // JDK historical
+                    "ibm863",
+                    "ibm-863",
+                    "863",
+                    "csIBM863"
+                } );
+
+        aliasCheck("IBM864" ,
+                new String[] {
+                    "cp864", // JDK historical
+                    "ibm864",
+                    "ibm-864",
+                    "864",
+                    "csIBM864"
+                } );
+
+        aliasCheck("IBM865" ,
+                new String[] {
+                    "cp865", // JDK historical
+                    "ibm865",
+                    "ibm-865",
+                    "865",
+                    "csIBM865"
+                } );
+
+        aliasCheck("IBM866" , new String[] {
+                    "cp866", // JDK historical
+                    "ibm866",
+                    "ibm-866",
+                    "866",
+                    "csIBM866"
+                } );
+        aliasCheck("IBM868" ,
+                new String[] {
+                    "cp868", // JDK historical
+                    "ibm868",
+                    "ibm-868",
+                    "868",
+                    "cp-ar",
+                    "csIBM868"
+                } );
+
+        aliasCheck("IBM869" ,
+                new String[] {
+                    "cp869", // JDK historical
+                    "ibm869",
+                    "ibm-869",
+                    "869",
+                    "cp-gr",
+                    "csIBM869"
+                } );
+
+        aliasCheck("IBM437" ,
+                new String[] {
+                    "cp437", // JDK historical
+                    "ibm437",
+                    "ibm-437",
+                    "437",
+                    "cspc8codepage437",
+                    "windows-437"
+                } );
+
+        aliasCheck("x-IBM874" ,
+                new String[] {
+                    "cp874", // JDK historical
+                    "ibm874",
+                    "ibm-874",
+                    "874"
+                } );
+        aliasCheck("x-IBM737" ,
+                new String[] {
+                    "cp737", // JDK historical
+                    "ibm737",
+                    "ibm-737",
+                    "737"
+                } );
+
+        aliasCheck("IBM775" ,
+                new String[] {
+                    "cp775", // JDK historical
+                    "ibm775",
+                    "ibm-775",
+                    "775"
+                } );
+
+        aliasCheck("x-IBM921" ,
+                new String[] {
+                    "cp921", // JDK historical
+                    "ibm921",
+                    "ibm-921",
+                    "921"
+                } );
+
+        aliasCheck("x-IBM1006" ,
+                new String[] {
+                    "cp1006", // JDK historical
+                    "ibm1006",
+                    "ibm-1006",
+                    "1006"
+                } );
+
+        aliasCheck("x-IBM1046" ,
+                new String[] {
+                    "cp1046", // JDK historical
+                    "ibm1046",
+                    "ibm-1046",
+                    "1046"
+                } );
+
+        aliasCheck("IBM1047" ,
+                new String[] {
+                    "cp1047", // JDK historical
+                    "ibm-1047",
+                    "1047"
+                } );
+
+        aliasCheck("x-IBM1098" ,
+                new String[] {
+                    "cp1098", // JDK historical
+                    "ibm1098",
+                    "ibm-1098",
+                    "1098",
+                } );
+
+        aliasCheck("IBM037" ,
+                new String[] {
+                    "cp037", // JDK historical
+                    "ibm037",
+                    "csIBM037",
+                    "cs-ebcdic-cp-us",
+                    "cs-ebcdic-cp-ca",
+                    "cs-ebcdic-cp-wt",
+                    "cs-ebcdic-cp-nl",
+                    "ibm-037",
+                    "ibm-37",
+                    "cpibm37",
+                    "037"
+                } );
+
+        aliasCheck("x-IBM1025" ,
+                new String[] {
+                    "cp1025", // JDK historical
+                    "ibm1025",
+                    "ibm-1025",
+                    "1025"
+                } );
+
+        aliasCheck("IBM1026" ,
+                new String[] {
+                    "cp1026", // JDK historical
+                    "ibm1026",
+                    "ibm-1026",
+                    "1026"
+                } );
+
+        aliasCheck("x-IBM1112" ,
+                new String[] {
+                    "cp1112", // JDK historical
+                    "ibm1112",
+                    "ibm-1112",
+                    "1112"
+                } );
+
+        aliasCheck("x-IBM1122" ,
+                new String[] {
+                    "cp1122", // JDK historical
+                    "ibm1122",
+                    "ibm-1122",
+                    "1122"
+                } );
+
+        aliasCheck("x-IBM1123" ,
+                new String[] {
+                    "cp1123", // JDK historical
+                    "ibm1123",
+                    "ibm-1123",
+                    "1123"
+                } );
+
+        aliasCheck("x-IBM1124" ,
+                new String[] {
+                    "cp1124", // JDK historical
+                    "ibm1124",
+                    "ibm-1124",
+                    "1124"
+                } );
+
+        aliasCheck("IBM273" ,
+                new String[] {
+                    "cp273", // JDK historical
+                    "ibm273",
+                    "ibm-273",
+                    "273"
+                } );
+
+        aliasCheck("IBM277" ,
+                new String[] {
+                    "cp277", // JDK historical
+                    "ibm277",
+                    "ibm-277",
+                    "277"
+                } );
+
+        aliasCheck("IBM278" ,
+                new String[] {
+                    "cp278", // JDK historical
+                    "ibm278",
+                    "ibm-278",
+                    "278",
+                    "ebcdic-sv",
+                    "ebcdic-cp-se",
+                    "csIBM278"
+                } );
+
+        aliasCheck("IBM280" ,
+                new String[] {
+                    "cp280", // JDK historical
+                    "ibm280",
+                    "ibm-280",
+                    "280"
+                } );
+
+        aliasCheck("IBM284" ,
+                new String[] {
+                    "cp284", // JDK historical
+                    "ibm284",
+                    "ibm-284",
+                    "284",
+                    "csIBM284",
+                    "cpibm284"
+                } );
+
+        aliasCheck("IBM285" ,
+                new String[] {
+                    "cp285", // JDK historical
+                    "ibm285",
+                    "ibm-285",
+                    "285",
+                    "ebcdic-cp-gb",
+                    "ebcdic-gb",
+                    "csIBM285",
+                    "cpibm285"
+                } );
+
+        aliasCheck("IBM297" ,
+                new String[] {
+                    "cp297", // JDK historical
+                    "ibm297",
+                    "ibm-297",
+                    "297",
+                    "ebcdic-cp-fr",
+                    "cpibm297",
+                    "csIBM297",
+                } );
+
+        aliasCheck("IBM420" ,
+                new String[] {
+                    "cp420", // JDK historical
+                    "ibm420",
+                    "ibm-420",
+                    "ebcdic-cp-ar1",
+                    "420",
+                    "csIBM420"
+                } );
+
+        aliasCheck("IBM424" ,
+                new String[] {
+                    "cp424", // JDK historical
+                    "ibm424",
+                    "ibm-424",
+                    "424",
+                    "ebcdic-cp-he",
+                    "csIBM424"
+                } );
+
+        aliasCheck("IBM500" ,
+                new String[] {
+                    "cp500", // JDK historical
+                    "ibm500",
+                    "ibm-500",
+                    "500",
+                    "ebcdic-cp-ch",
+                    "ebcdic-cp-bh",
+                    "csIBM500"
+                } );
+
+        aliasCheck("IBM-Thai" ,
+                new String[] {
+                    "cp838", // JDK historical
+                    "ibm838",
+                    "ibm-838",
+                    "ibm838",
+                    "838"
+                } );
+
+        aliasCheck("IBM870" ,
+                new String[] {
+                    "cp870", // JDK historical
+                    "ibm870",
+                    "ibm-870",
+                    "870",
+                    "ebcdic-cp-roece",
+                    "ebcdic-cp-yu",
+                    "csIBM870"
+                } );
+
+        aliasCheck("IBM871" ,
+                new String[] {
+                    "cp871", // JDK historical
+                    "ibm871",
+                    "ibm-871",
+                    "871",
+                    "ebcdic-cp-is",
+                    "csIBM871"
+                } );
+
+        aliasCheck("x-IBM875" ,
+                new String[] {
+                    "cp875", // JDK historical
+                    "ibm875",
+                    "ibm-875",
+                    "875"
+                } );
+
+        aliasCheck("IBM918" ,
+                new String[] {
+                    "cp918", // JDK historical
+                    "ibm-918",
+                    "918",
+                    "ebcdic-cp-ar2"
+                } );
+
+        aliasCheck("x-IBM922" ,
+                new String[] {
+                    "cp922", // JDK historical
+                    "ibm922",
+                    "ibm-922",
+                    "922"
+                } );
+
+        aliasCheck("x-IBM1097" ,
+                new String[] {
+                    "cp1097", // JDK historical
+                    "ibm1097",
+                    "ibm-1097",
+                    "1097"
+                } );
+
+        aliasCheck("x-IBM949" ,
+                new String[] {
+                    "cp949", // JDK historical
+                    "ibm949",
+                    "ibm-949",
+                    "949"
+                } );
+
+        aliasCheck("x-IBM949C" ,
+                new String[] {
+                    "cp949C", // JDK historical
+                    "ibm949C",
+                    "ibm-949C",
+                    "949C"
+                } );
+
+        aliasCheck("x-IBM939" ,
+                new String[] {
+                    "cp939", // JDK historical
+                    "ibm939",
+                    "ibm-939",
+                    "939"
+                } );
+
+        aliasCheck("x-IBM933" ,
+                new String[] {
+                    "cp933", // JDK historical
+                    "ibm933",
+                    "ibm-933",
+                    "933"
+                } );
+
+        aliasCheck("x-IBM1381" ,
+                new String[] {
+                    "cp1381", // JDK historical
+                    "ibm1381",
+                    "ibm-1381",
+                    "1381"
+                } );
+
+        aliasCheck("x-IBM1383" ,
+                new String[] {
+                    "cp1383", // JDK historical
+                    "ibm1383",
+                    "ibm-1383",
+                    "1383"
+                } );
+
+        aliasCheck("x-IBM970" ,
+                new String[] {
+                    "cp970", // JDK historical
+                    "ibm970",
+                    "ibm-970",
+                    "ibm-eucKR",
+                    "970"
+                } );
+
+        aliasCheck("x-IBM964" ,
+                new String[] {
+                    "cp964", // JDK historical
+                    "ibm964",
+                    "ibm-964",
+                    "964"
+                } );
+
+        aliasCheck("x-IBM33722" ,
+                new String[] {
+                    "cp33722", // JDK historical
+                    "ibm33722",
+                    "ibm-33722",
+                    "ibm-5050", // from IBM alias list
+                    "ibm-33722_vascii_vpua", // from IBM alias list
+                    "33722"
+                } );
+
+        aliasCheck("IBM01140" ,
+                new String[] {
+                    "cp1140", // JDK historical
+                    "ccsid01140",
+                    "cp01140",
+                    // "ebcdic-us-037+euro"
+                } );
+
+        aliasCheck("IBM01141" ,
+                new String[] {
+                    "cp1141", // JDK historical
+                    "ccsid01141",
+                    "cp01141",
+                    // "ebcdic-de-273+euro"
+                } );
+
+        aliasCheck("IBM01142" ,
+                new String[] {
+                    "cp1142", // JDK historical
+                    "ccsid01142",
+                    "cp01142",
+                    // "ebcdic-no-277+euro",
+                    // "ebcdic-dk-277+euro"
+                } );
+
+        aliasCheck("IBM01143" ,
+                new String[] {
+                    "cp1143", // JDK historical
+                    "ccsid01143",
+                    "cp01143",
+                    // "ebcdic-fi-278+euro",
+                    // "ebcdic-se-278+euro"
+                } );
+
+        aliasCheck("IBM01144" ,
+                new String[] {
+                    "cp1144", // JDK historical
+                    "ccsid01144",
+                    "cp01144",
+                    // "ebcdic-it-280+euro"
+                } );
+
+        aliasCheck("IBM01145" ,
+                new String[] {
+                    "cp1145", // JDK historical
+                    "ccsid01145",
+                    "cp01145",
+                    // "ebcdic-es-284+euro"
+                } );
+
+        aliasCheck("IBM01146" ,
+                new String[] {
+                    "cp1146", // JDK historical
+                    "ccsid01146",
+                    "cp01146",
+                    // "ebcdic-gb-285+euro"
+                } );
+
+        aliasCheck("IBM01147" ,
+                new String[] {
+                    "cp1147", // JDK historical
+                    "ccsid01147",
+                    "cp01147",
+                    // "ebcdic-fr-277+euro"
+                } );
+
+        aliasCheck("IBM01148" ,
+                new String[] {
+                    "cp1148", // JDK historical
+                    "ccsid01148",
+                    "cp01148",
+                    // "ebcdic-international-500+euro"
+                } );
+
+        aliasCheck("IBM01149" ,
+                new String[] {
+                    "cp1149", // JDK historical
+                    "ccsid01149",
+                    "cp01149",
+                    // "ebcdic-s-871+euro"
+                } );
+
+        aliasCheck("IBM00858" ,
+                new String[] {
+                    "cp858", // JDK historical
+                    "ccsid00858",
+                    "cp00858",
+                    // "PC-Multilingual-850+euro"
+                } );
+
+        aliasCheck("x-MacRoman",
+                new String[] {
+                    "MacRoman" // JDK historical
+                });
+
+        aliasCheck("x-MacCentralEurope",
+                new String[] {
+                    "MacCentralEurope" // JDK historical
+                });
+
+        aliasCheck("x-MacCroatian",
+                new String[] {
+                    "MacCroatian" // JDK historical
+                });
+
+
+        aliasCheck("x-MacCroatian",
+                new String[] {
+                    "MacCroatian" // JDK historical
+                });
+
+
+        aliasCheck("x-MacGreek",
+                new String[] {
+                    "MacGreek" // JDK historical
+                });
+
+        aliasCheck("x-MacCyrillic",
+                new String[] {
+                    "MacCyrillic" // JDK historical
+                });
+
+        aliasCheck("x-MacUkraine",
+                new String[] {
+                    "MacUkraine" // JDK historical
+                });
+
+        aliasCheck("x-MacTurkish",
+                new String[] {
+                    "MacTurkish" // JDK historical
+                });
+
+        aliasCheck("x-MacArabic",
+                new String[] {
+                    "MacArabic" // JDK historical
+                });
+
+        aliasCheck("x-MacHebrew",
+                new String[] {
+                    "MacHebrew" // JDK historical
+                });
+
+        aliasCheck("x-MacIceland",
+                new String[] {
+                    "MacIceland" // JDK historical
+                });
+
+        aliasCheck("x-MacRomania",
+                new String[] {
+                    "MacRomania" // JDK historical
+                });
+
+        aliasCheck("x-MacThai",
+                new String[] {
+                    "MacThai" // JDK historical
+                });
+
+        aliasCheck("x-MacSymbol",
+                new String[] {
+                    "MacSymbol" // JDK historical
+                });
+
+        aliasCheck("x-MacDingbat",
+                new String[] {
+                    "MacDingbat" // JDK historical
+                });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/Charset/default.sh	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+#
+# Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+# @test
+# @bug 4772857
+# @summary Unit test for Charset.defaultCharset
+#
+# @build Default
+# @run shell default.sh
+#
+
+# Command-line usage: sh default.sh [/path/to/build]
+
+if [ -z "$TESTJAVA" ]; then
+  if [ $# -lt 1 ]; then exit 1; fi
+  TESTJAVA=$1; shift
+  TESTSRC=`pwd`
+  TESTCLASSES=`pwd`
+fi
+
+s="`uname -s`"
+if [ "$s" != Linux -a "$s" != SunOS ]; then
+  echo "$s: locale command not supported on this system, skipping..."
+  exit 0
+fi
+
+JAVA=$TESTJAVA/bin/java
+
+tolower() {
+  echo "$1" | tr '[A-Z]' '[a-z]'
+}
+
+go() {
+
+  L="$1"
+  shift
+  if [ "x`locale -a | grep \^$L\$`" != "x$L" ]; then
+    echo "$L: Locale not supported, skipping..."
+    return
+  fi
+
+  ecs="$1"; shift
+
+  echo -n "$L: "
+  cs="`LC_ALL=$L $JAVA -cp $TESTCLASSES Default`"
+  if [ $? != 0 ]; then
+    exit 1
+  elif [ "`tolower $cs`" != "`tolower $ecs`" ]; then
+    echo "$cs, expected $ecs -- ERROR"
+    exit 1
+  else
+    echo "$cs, as expected"
+  fi
+
+}
+
+go  en_US       iso-8859-1
+go  ja_JP.utf8  utf-8
+go  tr_TR       iso-8859-9
+go  C           us-ascii
+
+if [ "$s" = Linux ]; then
+  go  ja_JP        x-euc-jp-linux
+  go  ja_JP.eucjp  x-euc-jp-linux
+  go  ja_JP.ujis   x-euc-jp-linux
+  go  ja_JP.utf8   utf-8
+fi
+
+# Solaris
+if [ "$s" = SunOS ]; then
+  go  ja           x-eucjp-open
+  go  ja_JP.eucJP  x-eucjp-open
+  go  ja_JP.PCK    x-PCK
+  go  ja_JP.UTF-8  utf-8
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/CharsetDecoder/AverageMax.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4853350
+ * @summary Ensure that averages do not exceed maxima
+ *
+ * @build AverageMax
+ * @run main AverageMax
+ * @run main/othervm -Dsun.nio.cs.bugLevel=1.4 AverageMax
+ */
+
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class AverageMax {
+
+    static boolean compat;
+
+    static abstract class Test {
+
+        public abstract void go() throws Exception;
+
+        Test() throws Exception {
+            try {
+                go();
+            } catch (Exception x) {
+                if (compat) {
+                    throw new Exception("Exception thrown", x);
+                }
+                if (x instanceof IllegalArgumentException) {
+                    System.err.println("Thrown as expected: " + x);
+                    return;
+                }
+                throw new Exception("Incorrect exception: "
+                                    + x.getClass().getName(),
+                                    x);
+            }
+            if (!compat)
+                throw new Exception("No exception thrown");
+        }
+
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        // If sun.nio.cs.bugLevel == 1.4 then we want the 1.4 behavior
+        String bl = System.getProperty("sun.nio.cs.bugLevel");
+        compat = (bl != null && bl.equals("1.4"));
+        final Charset ascii = Charset.forName("US-ASCII");
+
+        new Test() {
+                public void go() throws Exception {
+                    new CharsetDecoder(ascii, 3.9f, 1.2f) {
+                            protected CoderResult decodeLoop(ByteBuffer in,
+                                                             CharBuffer out)
+                            {
+                                return null;
+                            }
+                        };
+                }};
+
+        new Test() {
+                public void go() throws Exception {
+                    new CharsetEncoder(ascii, 3.9f, 1.2f) {
+                            protected CoderResult encodeLoop(CharBuffer in,
+                                                             ByteBuffer out)
+                            {
+                                return null;
+                            }
+                        };
+                }};
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/CharsetDecoder/EmptyInput.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4400697
+ * @summary Ensure that CharsetDecoder.decode throws BUE on empty input
+ */
+
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class EmptyInput {
+
+    public static void main(String[] args) throws Exception {
+        ByteBuffer bb = ByteBuffer.allocate(10);
+        bb.flip();
+        CharsetDecoder cd = Charset.forName("US-ASCII").newDecoder();
+        try {
+            cd.decode(bb, CharBuffer.allocate(10), true).throwException();
+        } catch (BufferUnderflowException x) {
+            System.err.println("BufferUnderflowException thrown as expected");
+            return;
+        }
+        throw new Exception("BufferUnderflowException not thrown");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/CharsetEncoder/CanEncode.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4821213
+ * @summary Unit test for CharsetEncoder.canEncode methods
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class CanEncode {
+
+    private static int errors = 0;
+    private static PrintStream out = System.err;
+
+    private static void wrong(CharsetEncoder ce, boolean can, String what) {
+        out.println(ce.charset().name()
+                    + ": Wrong answer for " + what
+                    + ": " + !can);
+        errors++;
+    }
+
+    private static void ck(CharsetEncoder ce, char c, boolean can)
+        throws Exception
+    {
+        if (ce.canEncode(c) != can)
+            wrong(ce, can,
+                  ("'" + c + "' (0x"
+                   + Integer.toHexString(c & 0xffff) + ")"));
+    }
+
+    private static void ck(CharsetEncoder ce, String s, boolean can)
+        throws Exception
+    {
+        if (ce.canEncode(CharBuffer.wrap(s.toCharArray())) != can)
+            wrong(ce, can, "array \"" + s + "\"");
+        if (ce.canEncode(CharBuffer.wrap(s)) != can)
+            wrong(ce, can, "buffer  \"" + s + "\"");
+    }
+
+    private static void test(String csn) throws Exception {
+
+        Charset cs = Charset.forName(csn);
+        CharsetEncoder ce = cs.newEncoder();
+
+        if (cs.name().equals("US-ASCII")) {
+            ck(ce, 'x', true);
+            ck(ce, '\u00B6', false);
+            ck(ce, "x", true);
+            ck(ce, "\u00B6", false);
+            ck(ce, "xyzzy", true);
+            ck(ce, "xy\u00B6", false);
+        }
+
+        // Unpaired surrogates should never be encodable
+        ck(ce, '\ud800', false);
+        ck(ce, '\ud801', false);
+        ck(ce, '\udffe', false);
+        ck(ce, '\udfff', false);
+        ck(ce, "\ud800", false);
+        ck(ce, "\ud801", false);
+        ck(ce, "\udffe", false);
+        ck(ce, "\udfff", false);
+
+    }
+
+    public static void main(String[] args) throws Exception {
+        test("US-ASCII");
+        test("UTF-8");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/CharsetEncoder/Flush.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6227608
+ * @summary Test proper handling of flush()
+ * @author Martin Buchholz
+ */
+
+import java.util.*;
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+public class Flush {
+    private static byte[] contents(ByteBuffer bb) {
+        byte[] contents = new byte[bb.position()];
+        ((ByteBuffer)(bb.duplicate().flip())).get(contents);
+        return contents;
+    }
+
+    private static ByteBuffer extend(ByteBuffer bb) {
+        ByteBuffer x = ByteBuffer.allocate(2*bb.capacity()+10);
+        bb.flip();
+        x.put(bb);
+        return x;
+    }
+
+    private static void realMain(String[] args) throws Throwable {
+        // A japanese character should decode as a 3-byte
+        // switch-to-japanese escape sequence, followed by a 2-byte
+        // encoding of the char itself, followed by a 3-byte return to
+        // ASCII escape sequence.
+        char[] jis0208 = {'\u3001'};
+        CharBuffer cb = CharBuffer.wrap(jis0208);
+        ByteBuffer bb = ByteBuffer.allocate(6);
+        CharsetEncoder enc = Charset.forName("ISO-2022-JP").newEncoder();
+
+        check(enc.encode(cb, bb, true).isUnderflow());
+
+        System.out.println(Arrays.toString(contents(bb)));
+        check(! cb.hasRemaining());
+        equal(contents(bb).length, 3 + 2);
+        equal(bb.get(0), (byte)0x1b);
+
+        //----------------------------------------------------------------
+        // We must be able to recover if flush() returns OVERFLOW
+        //----------------------------------------------------------------
+        check(enc.flush(bb).isOverflow());
+        check(enc.flush(bb).isOverflow());
+        equal(contents(bb).length, 3 + 2);
+
+        bb = extend(bb);
+
+        check(enc.flush(bb).isUnderflow());
+        equal(bb.get(3 + 2), (byte)0x1b);
+        System.out.println(Arrays.toString(contents(bb)));
+        equal(contents(bb).length, 3 + 2 + 3);
+
+        //----------------------------------------------------------------
+        // A final redundant flush() is a no-op
+        //----------------------------------------------------------------
+        check(enc.flush(bb).isUnderflow());
+        check(enc.flush(bb).isUnderflow());
+        equal(contents(bb).length, 3 + 2 + 3);
+
+        //----------------------------------------------------------------
+        // CharsetEncoder.encode(ByteBuffer) must call flush(ByteBuffer)
+        //----------------------------------------------------------------
+        bb = enc.encode(CharBuffer.wrap(jis0208));
+        byte[] expected = "\u001b$B!\"\u001b(B".getBytes("ASCII");
+        byte[] contents = new byte[bb.limit()]; bb.get(contents);
+        check(Arrays.equals(contents, expected));
+    }
+
+    //--------------------- Infrastructure ---------------------------
+    static volatile int passed = 0, failed = 0;
+    static void pass() { passed++; }
+    static void fail() { failed++; Thread.dumpStack(); }
+    static void fail(String msg) { System.out.println(msg); fail(); }
+    static void unexpected(Throwable t) { failed++; t.printStackTrace(); }
+    static void check(boolean cond) { if (cond) pass(); else fail(); }
+    static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) pass();
+        else {System.out.println(x + " not equal to " + y); fail(); }}
+
+    public static void main(String[] args) throws Throwable {
+        try { realMain(args); } catch (Throwable t) { unexpected(t); }
+
+        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+        if (failed > 0) throw new Exception("Some tests failed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/RemovingSunIO/SunioAlias.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,823 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 4454622
+   @summary Check if all supported sun.io encoding names are supported in nio.charset
+ */
+
+import java.util.HashMap;
+import java.util.Set;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.*;
+
+public class SunioAlias {
+    public static void main(String argv[]) throws UnsupportedEncodingException {
+        Set<String> keys = aliasTable.keySet();
+        String s = "testing string";
+        boolean failed = false;
+        for (String alias : keys) {
+            /* See if StringCoding works correctly without sun.io package */
+            try {
+                byte[] bs= s.getBytes(alias);
+                new String(bs, alias);
+
+                Charset csAlias = Charset.forName(alias);
+                Charset csName = Charset.forName(aliasTable.get(alias));
+                if (csName != csAlias) {
+                    System.out.printf("Alias %s and %s is NOT the same charset in nio\n",
+                                      alias, aliasTable.get(alias));
+                }
+            } catch (UnsupportedEncodingException e) {
+                System.out.printf("Alias %s is UnsupportedEncoding\n", alias);
+                failed = true;
+            } catch (IllegalCharsetNameException e) {
+                System.out.printf("Alias %s is IllegalCharsetName\n", alias);
+                failed = true;
+            }
+        }
+        if (failed)
+            throw new UnsupportedEncodingException ("sun.io encoding names are not supported in nio.charset!");
+    }
+    //aliasTable is copy/pasted from sun.io.CharacterEncoding.java
+
+    private static HashMap<String, String> aliasTable;
+    static {
+        aliasTable = new HashMap<String, String>(460, 1.0f);
+
+        /* known failed names... TBD
+        // JIS-defined Shift JIS
+        aliasTable.put("\u30b7\u30d5\u30c8\u7b26\u53f7\u5316\u8868\u73fe",
+                       "SJIS");
+        // Specialized auto-detection for Japanese charsets
+        aliasTable.put("jis auto detect",       "JISAutoDetect");
+        // MIBenum: 1010
+        aliasTable.put("unicode-1-1",       "UnicodeBigUnmarked");
+        */
+        aliasTable.put("unicode",               "UTF-16");
+        aliasTable.put("cspc862latinhebrew",    "Cp862");
+        aliasTable.put("cp-is",                 "Cp861");
+        /*
+        // X11 Compound Text
+        aliasTable.put("x-compound-text",       "COMPOUND_TEXT");
+        aliasTable.put("x11-compound_text",     "COMPOUND_TEXT");
+        */
+        aliasTable.put("us-ascii",              "ASCII");
+        aliasTable.put("ascii",                 "ASCII");
+        aliasTable.put("646",                   "ASCII");       // Solaris POSIX locale
+        aliasTable.put("iso_646.irv:1983",      "ASCII");       // Linux POSIX locale
+        aliasTable.put("ansi_x3.4-1968",        "ASCII");       // Caldera linux
+        aliasTable.put("iso646-us",             "ASCII");
+        aliasTable.put("default",               "ASCII");       // compatibility with obsolete "Default" converters
+        aliasTable.put("ascii7",                "ASCII");       // compatibility with obsolete "Default" converters
+
+        // Core encodings
+        aliasTable.put("8859_1",                "ISO8859_1");
+        aliasTable.put("iso8859_1",             "ISO8859_1");
+        aliasTable.put("utf-8",                 "UTF8");
+        aliasTable.put("utf8",                  "UTF8");
+        aliasTable.put("utf-16le",              "UnicodeLittleUnmarked");
+
+        // Standard encodings used on Solaris and Linux
+        aliasTable.put("iso8859-1",             "ISO8859_1");
+        aliasTable.put("iso8859-2",             "ISO8859_2");
+        aliasTable.put("iso8859-4",             "ISO8859_4");
+        aliasTable.put("iso8859-5",             "ISO8859_5");
+        aliasTable.put("iso8859-6",             "ISO8859_6");
+        aliasTable.put("iso8859-8",             "ISO8859_8");
+        aliasTable.put("iso8859-9",             "ISO8859_9");
+        aliasTable.put("iso8859-13",            "ISO8859_13");
+        aliasTable.put("iso8859-15",            "ISO8859_15");
+        aliasTable.put("5601",                  "EUC_KR");
+        aliasTable.put("ansi-1251",             "Cp1251");
+        aliasTable.put("big5",                  "Big5");
+        aliasTable.put("big5hk",                "Big5_HKSCS");
+        aliasTable.put("eucjp",                 "EUC_JP");
+        aliasTable.put("cns11643",              "EUC_TW");
+        aliasTable.put("gb2312",                "EUC_CN");
+        aliasTable.put("gb18030",               "GB18030");
+        aliasTable.put("gbk",                   "GBK");
+        aliasTable.put("koi8-r",                "KOI8_R");
+        aliasTable.put("tis620.2533",           "TIS620");
+
+        // Windows encodings
+        aliasTable.put("cp1250",                "Cp1250");
+        aliasTable.put("cp1251",                "Cp1251");
+        aliasTable.put("cp1252",                "Cp1252");
+        aliasTable.put("cp1253",                "Cp1253");
+        aliasTable.put("cp1254",                "Cp1254");
+        aliasTable.put("cp1255",                "Cp1255");
+        aliasTable.put("cp1256",                "Cp1256");
+        aliasTable.put("cp1257",                "Cp1257");
+        aliasTable.put("cp1258",                "Cp1258");
+        aliasTable.put("ms874",                 "MS874");
+        aliasTable.put("ms932",                 "MS932");
+        aliasTable.put("ms949",                 "MS949");
+        aliasTable.put("ms950",                 "MS950");
+        aliasTable.put("ms1361",                "MS1361");
+
+        // MIBenum: 4
+        aliasTable.put("8859_1",            "ISO8859_1");
+        aliasTable.put("iso_8859-1:1987",       "ISO8859_1");
+        aliasTable.put("iso-ir-100",            "ISO8859_1");
+        aliasTable.put("iso_8859-1",            "ISO8859_1");
+        aliasTable.put("iso-8859-1",            "ISO8859_1");
+        aliasTable.put("iso8859-1",             "ISO8859_1");
+        aliasTable.put("latin1",                "ISO8859_1");
+        aliasTable.put("l1",                    "ISO8859_1");
+        aliasTable.put("ibm819",                "ISO8859_1");
+        aliasTable.put("ibm-819",               "ISO8859_1");
+        aliasTable.put("cp819",                 "ISO8859_1");
+        aliasTable.put("819",                   "ISO8859_1");
+        aliasTable.put("csisolatin1",           "ISO8859_1");
+
+        // MIBenum: 5
+        aliasTable.put("8859_2",            "ISO8859_2");
+        aliasTable.put("iso_8859-2:1987",       "ISO8859_2");
+        aliasTable.put("iso-ir-101",            "ISO8859_2");
+        aliasTable.put("iso_8859-2",            "ISO8859_2");
+        aliasTable.put("iso-8859-2",            "ISO8859_2");
+        aliasTable.put("iso8859-2",             "ISO8859_2");
+        aliasTable.put("latin2",                "ISO8859_2");
+        aliasTable.put("l2",                    "ISO8859_2");
+        aliasTable.put("ibm912",                "ISO8859_2");
+        aliasTable.put("ibm-912",               "ISO8859_2");
+        aliasTable.put("cp912",                 "ISO8859_2");
+        aliasTable.put("912",                   "ISO8859_2");
+        aliasTable.put("csisolatin2",           "ISO8859_2");
+
+        // MIBenum: 6
+        aliasTable.put("8859_3",            "ISO8859_3");
+        aliasTable.put("iso_8859-3:1988",       "ISO8859_3");
+        aliasTable.put("iso-ir-109",            "ISO8859_3");
+        aliasTable.put("iso_8859-3",            "ISO8859_3");
+        aliasTable.put("iso-8859-3",            "ISO8859_3");
+        aliasTable.put("iso8859-3",             "ISO8859_3");
+        aliasTable.put("latin3",                "ISO8859_3");
+        aliasTable.put("l3",                    "ISO8859_3");
+        aliasTable.put("ibm913",                "ISO8859_3");
+        aliasTable.put("ibm-913",               "ISO8859_3");
+        aliasTable.put("cp913",                 "ISO8859_3");
+        aliasTable.put("913",                   "ISO8859_3");
+        aliasTable.put("csisolatin3",           "ISO8859_3");
+
+        // MIBenum: 7
+        aliasTable.put("8859_4",            "ISO8859_4");
+        aliasTable.put("iso_8859-4:1988",       "ISO8859_4");
+        aliasTable.put("iso-ir-110",            "ISO8859_4");
+        aliasTable.put("iso_8859-4",            "ISO8859_4");
+        aliasTable.put("iso-8859-4",            "ISO8859_4");
+        aliasTable.put("iso8859-4",             "ISO8859_4");
+        aliasTable.put("latin4",                "ISO8859_4");
+        aliasTable.put("l4",                    "ISO8859_4");
+        aliasTable.put("ibm914",                "ISO8859_4");
+        aliasTable.put("ibm-914",               "ISO8859_4");
+        aliasTable.put("cp914",                 "ISO8859_4");
+        aliasTable.put("914",                   "ISO8859_4");
+        aliasTable.put("csisolatin4",           "ISO8859_4");
+
+        // MIBenum: 8
+        aliasTable.put("8859_5",            "ISO8859_5");
+        aliasTable.put("iso_8859-5:1988",       "ISO8859_5");
+        aliasTable.put("iso-ir-144",            "ISO8859_5");
+        aliasTable.put("iso_8859-5",            "ISO8859_5");
+        aliasTable.put("iso-8859-5",            "ISO8859_5");
+        aliasTable.put("iso8859-5",             "ISO8859_5");
+        aliasTable.put("cyrillic",              "ISO8859_5");
+        aliasTable.put("csisolatincyrillic",    "ISO8859_5");
+        aliasTable.put("ibm915",                "ISO8859_5");
+        aliasTable.put("ibm-915",               "ISO8859_5");
+        aliasTable.put("cp915",                 "ISO8859_5");
+        aliasTable.put("915",                   "ISO8859_5");
+
+        // MIBenum: 9
+        aliasTable.put("8859_6",            "ISO8859_6");
+        aliasTable.put("iso_8859-6:1987",       "ISO8859_6");
+        aliasTable.put("iso-ir-127",            "ISO8859_6");
+        aliasTable.put("iso_8859-6",            "ISO8859_6");
+        aliasTable.put("iso-8859-6",            "ISO8859_6");
+        aliasTable.put("iso8859-6",             "ISO8859_6");
+        aliasTable.put("ecma-114",              "ISO8859_6");
+        aliasTable.put("asmo-708",              "ISO8859_6");
+        aliasTable.put("arabic",                "ISO8859_6");
+        aliasTable.put("csisolatinarabic",      "ISO8859_6");
+        aliasTable.put("ibm1089",               "ISO8859_6");
+        aliasTable.put("ibm-1089",              "ISO8859_6");
+        aliasTable.put("cp1089",                "ISO8859_6");
+        aliasTable.put("1089",                  "ISO8859_6");
+
+        // MIBenum: 10
+        aliasTable.put("8859_7",            "ISO8859_7");
+        aliasTable.put("iso_8859-7:1987",       "ISO8859_7");
+        aliasTable.put("iso-ir-126",            "ISO8859_7");
+        aliasTable.put("iso_8859-7",            "ISO8859_7");
+        aliasTable.put("iso-8859-7",            "ISO8859_7");
+        aliasTable.put("iso8859-7",             "ISO8859_7");
+        aliasTable.put("elot_928",              "ISO8859_7");
+        aliasTable.put("ecma-118",              "ISO8859_7");
+        aliasTable.put("greek",                 "ISO8859_7");
+        aliasTable.put("greek8",                "ISO8859_7");
+        aliasTable.put("csisolatingreek",       "ISO8859_7");
+        aliasTable.put("ibm813",                "ISO8859_7");
+        aliasTable.put("ibm-813",               "ISO8859_7");
+        aliasTable.put("cp813",                 "ISO8859_7");
+        aliasTable.put("813",                   "ISO8859_7");
+        aliasTable.put("sun_eu_greek",      "ISO8859_7");
+
+        // MIBenum: 11
+        aliasTable.put("8859_8",            "ISO8859_8");
+        aliasTable.put("iso_8859-8:1988",       "ISO8859_8");
+        aliasTable.put("iso-ir-138",            "ISO8859_8");
+        aliasTable.put("iso_8859-8",            "ISO8859_8");
+        aliasTable.put("iso-8859-8",            "ISO8859_8");
+        aliasTable.put("iso8859-8",             "ISO8859_8");
+        aliasTable.put("hebrew",                "ISO8859_8");
+        aliasTable.put("csisolatinhebrew",      "ISO8859_8");
+        aliasTable.put("ibm916",                "ISO8859_8");
+        aliasTable.put("ibm-916",               "ISO8859_8");
+        aliasTable.put("cp916",                 "ISO8859_8");
+        aliasTable.put("916",                   "ISO8859_8");
+
+        // MIBenum: 12
+        aliasTable.put("8859_9",            "ISO8859_9");
+        aliasTable.put("iso-ir-148",            "ISO8859_9");
+        aliasTable.put("iso_8859-9",            "ISO8859_9");
+        aliasTable.put("iso-8859-9",            "ISO8859_9");
+        aliasTable.put("iso8859-9",             "ISO8859_9");
+        aliasTable.put("latin5",                "ISO8859_9");
+        aliasTable.put("l5",                    "ISO8859_9");
+        aliasTable.put("ibm920",                "ISO8859_9");
+        aliasTable.put("ibm-920",               "ISO8859_9");
+        aliasTable.put("cp920",                 "ISO8859_9");
+        aliasTable.put("920",                   "ISO8859_9");
+        aliasTable.put("csisolatin5",           "ISO8859_9");
+
+        // MIBenum: ???
+        aliasTable.put("8859_13",               "ISO8859_13");
+        aliasTable.put("iso_8859-13",           "ISO8859_13");
+        aliasTable.put("iso-8859-13",           "ISO8859_13");
+        aliasTable.put("iso8859-13",            "ISO8859_13");
+
+
+        // MIBenum: ????
+        aliasTable.put("8859_15",               "ISO8859_15");
+        aliasTable.put("iso-8859-15",           "ISO8859_15");
+        aliasTable.put("iso_8859-15",           "ISO8859_15");
+        aliasTable.put("iso8859-15",            "ISO8859_15");
+        aliasTable.put("ibm923",                "ISO8859_15");
+        aliasTable.put("ibm-923",               "ISO8859_15");
+        aliasTable.put("cp923",                 "ISO8859_15");
+        aliasTable.put("923",                   "ISO8859_15");
+        aliasTable.put("latin0",                "ISO8859_15");
+        aliasTable.put("latin9",                "ISO8859_15");
+        aliasTable.put("csisolatin0",           "ISO8859_15");
+        aliasTable.put("csisolatin9",           "ISO8859_15");
+
+        //For compatibility purpose
+        aliasTable.put("iso8859_15_fdis",       "ISO8859_15");
+
+        // MIBenum: 106
+        aliasTable.put("utf-8",                 "UTF8");
+
+        // Alias recommended in RFC 1641
+        aliasTable.put("unicode-1-1-utf-8",     "UTF8");
+
+        // MIBenum: 1000
+        aliasTable.put("iso-10646-ucs-2",           "UnicodeBigUnmarked");
+
+        // Per Unicode standard
+        aliasTable.put("utf-16be",                  "UnicodeBigUnmarked");
+        aliasTable.put("utf-16le",                  "UnicodeLittleUnmarked");
+        aliasTable.put("utf-16",                    "UTF16");
+
+        // Used by drag-and-drop subsystem
+        aliasTable.put("x-utf-16be",        "UnicodeBigUnmarked");
+        aliasTable.put("x-utf-16le",        "UnicodeLittleUnmarked");
+
+        // MIBenum: ????
+        aliasTable.put("ibm037",                "Cp037");
+        aliasTable.put("ibm-037",               "Cp037");
+        aliasTable.put("cp037",                 "Cp037");
+        aliasTable.put("037",                   "Cp037");
+
+        // MIBenum: ????
+        aliasTable.put("ibm273",                "Cp273");
+        aliasTable.put("ibm-273",               "Cp273");
+        aliasTable.put("cp273",                 "Cp273");
+        aliasTable.put("273",                   "Cp273");
+
+        // MIBenum: ????
+        aliasTable.put("ibm277",                "Cp277");
+        aliasTable.put("ibm-277",               "Cp277");
+        aliasTable.put("cp277",                 "Cp277");
+        aliasTable.put("277",                   "Cp277");
+
+        // MIBenum: ????
+        aliasTable.put("ibm278",                "Cp278");
+        aliasTable.put("ibm-278",               "Cp278");
+        aliasTable.put("cp278",                 "Cp278");
+        aliasTable.put("278",                   "Cp278");
+
+        // MIBenum: ????
+        aliasTable.put("ibm280",                "Cp280");
+        aliasTable.put("ibm-280",               "Cp280");
+        aliasTable.put("cp280",                 "Cp280");
+        aliasTable.put("280",                   "Cp280");
+
+        // MIBenum: ????
+        aliasTable.put("ibm284",                "Cp284");
+        aliasTable.put("ibm-284",               "Cp284");
+        aliasTable.put("cp284",                 "Cp284");
+        aliasTable.put("284",                   "Cp284");
+
+        // MIBenum: ????
+        aliasTable.put("ibm285",                "Cp285");
+        aliasTable.put("ibm-285",               "Cp285");
+        aliasTable.put("cp285",                 "Cp285");
+        aliasTable.put("285",                   "Cp285");
+
+        // MIBenum: ????
+        aliasTable.put("ibm297",                "Cp297");
+        aliasTable.put("ibm-297",               "Cp297");
+        aliasTable.put("cp297",                 "Cp297");
+        aliasTable.put("297",                   "Cp297");
+
+        // MIBenum: ????
+        aliasTable.put("ibm420",                "Cp420");
+        aliasTable.put("ibm-420",               "Cp420");
+        aliasTable.put("cp420",                 "Cp420");
+        aliasTable.put("420",                   "Cp420");
+
+        // MIBenum: ????
+        aliasTable.put("ibm424",                "Cp424");
+        aliasTable.put("ibm-424",               "Cp424");
+        aliasTable.put("cp424",                 "Cp424");
+        aliasTable.put("424",                   "Cp424");
+
+        // MIBenum: 2011
+        aliasTable.put("ibm437",                "Cp437");
+        aliasTable.put("ibm-437",               "Cp437");
+        aliasTable.put("cp437",                 "Cp437");
+        aliasTable.put("437",                   "Cp437");
+        aliasTable.put("cspc8codepage437",      "Cp437");
+
+        // MIBenum: ????
+        aliasTable.put("ibm500",                "Cp500");
+        aliasTable.put("ibm-500",               "Cp500");
+        aliasTable.put("cp500",                 "Cp500");
+        aliasTable.put("500",                   "Cp500");
+
+        // MIBenum: ????
+        aliasTable.put("ibm737",                "Cp737");
+        aliasTable.put("ibm-737",               "Cp737");
+        aliasTable.put("cp737",                 "Cp737");
+        aliasTable.put("737",                   "Cp737");
+
+        // MIBenum: ????
+        aliasTable.put("ibm775",                "Cp775");
+        aliasTable.put("ibm-775",               "Cp775");
+        aliasTable.put("cp775",                 "Cp775");
+        aliasTable.put("775",                   "Cp775");
+
+        // MIBenum: ????
+        aliasTable.put("ibm838",                "Cp838");         /* MDA */
+        aliasTable.put("ibm-838",               "Cp838");         /* MDA */
+        aliasTable.put("cp838",                 "Cp838");         /* MDA */
+        aliasTable.put("838",                   "Cp838");         /* MDA */
+
+        // "Cp850"
+        // MIBenum: 2009
+        aliasTable.put("ibm850",                "Cp850");
+        aliasTable.put("ibm-850",               "Cp850");
+        aliasTable.put("cp850",                 "Cp850");
+        aliasTable.put("850",                   "Cp850");
+        aliasTable.put("cspc850multilingual",   "Cp850");
+
+        // "Cp852"
+        // MIBenum: 2010
+        aliasTable.put("ibm852",                "Cp852");
+        aliasTable.put("ibm-852",               "Cp852");
+        aliasTable.put("cp852",                 "Cp852");
+        aliasTable.put("852",                   "Cp852");
+        aliasTable.put("cspcp852",              "Cp852");
+
+        // "Cp855"
+        // MIBenum: 2046
+        aliasTable.put("ibm855",                "Cp855");
+        aliasTable.put("ibm-855",               "Cp855");
+        aliasTable.put("cp855",                 "Cp855");
+        aliasTable.put("855",                   "Cp855");
+        aliasTable.put("cspcp855",              "Cp855");
+
+        // "Cp855"
+        // MIBenum: ???
+        aliasTable.put("ibm856",                "Cp856");
+        aliasTable.put("ibm-856",               "Cp856");
+        aliasTable.put("cp856",                 "Cp856");
+        aliasTable.put("856",                   "Cp856");
+
+        // "Cp857"
+        // MIBenum: 2047
+        aliasTable.put("ibm857",                "Cp857");
+        aliasTable.put("ibm-857",               "Cp857");
+        aliasTable.put("cp857",                 "Cp857");
+        aliasTable.put("857",                   "Cp857");
+        aliasTable.put("csibm857",              "Cp857");
+
+        // "Cp860"
+        // MIBenum: 2048
+        aliasTable.put("ibm860",                "Cp860");
+        aliasTable.put("ibm-860",               "Cp860");
+        aliasTable.put("cp860",                 "Cp860");
+        aliasTable.put("860",                   "Cp860");
+        aliasTable.put("csibm860",              "Cp860");
+
+        // MIBenum: 2049
+        aliasTable.put("ibm861",                "Cp861");
+        aliasTable.put("ibm-861",               "Cp861");
+        aliasTable.put("cp861",                 "Cp861");
+        aliasTable.put("861",                   "Cp861");
+        aliasTable.put("csibm861",              "Cp861");
+
+        // MIBenum: 2013
+        aliasTable.put("ibm862",                "Cp862");
+        aliasTable.put("ibm-862",               "Cp862");
+        aliasTable.put("cp862",                 "Cp862");
+        aliasTable.put("862",                   "Cp862");
+
+        // MIBenum: 2050
+        aliasTable.put("ibm863",                "Cp863");
+        aliasTable.put("ibm-863",               "Cp863");
+        aliasTable.put("cp863",                 "Cp863");
+        aliasTable.put("863",                   "Cp863");
+        aliasTable.put("csibm863",              "Cp863");
+
+        // MIBenum: 2051
+        aliasTable.put("ibm864",                "Cp864");
+        aliasTable.put("ibm-864",               "Cp864");
+        aliasTable.put("cp864",                 "Cp864");
+        aliasTable.put("csibm864",              "Cp864");
+
+        // MIBenum: 2052
+        aliasTable.put("ibm865",                "Cp865");
+        aliasTable.put("ibm-865",               "Cp865");
+        aliasTable.put("cp865",                 "Cp865");
+        aliasTable.put("865",                   "Cp865");
+        aliasTable.put("csibm865",              "Cp865");
+
+        // MIBenum: ????
+        aliasTable.put("ibm866",                "Cp866");
+        aliasTable.put("ibm-866",               "Cp866");
+        aliasTable.put("cp866",                 "Cp866");
+        aliasTable.put("866",                   "Cp866");
+        aliasTable.put("csibm866",              "Cp866");
+
+        // MIBenum: ????
+        aliasTable.put("ibm868",                "Cp868");
+        aliasTable.put("ibm-868",               "Cp868");
+        aliasTable.put("cp868",                 "Cp868");
+        aliasTable.put("868",                   "Cp868");
+
+        // MIBenum: 2054
+        aliasTable.put("ibm869",                "Cp869");
+        aliasTable.put("ibm-869",               "Cp869");
+        aliasTable.put("cp869",                 "Cp869");
+        aliasTable.put("869",                   "Cp869");
+        aliasTable.put("cp-gr",                 "Cp869");
+        aliasTable.put("csibm869",              "Cp869");
+
+        // MIBenum: ????
+        aliasTable.put("ibm870",                "Cp870");
+        aliasTable.put("ibm-870",               "Cp870");
+        aliasTable.put("cp870",                 "Cp870");
+        aliasTable.put("870",                   "Cp870");
+
+        // MIBenum: ????
+        aliasTable.put("ibm871",                "Cp871");
+        aliasTable.put("ibm-871",               "Cp871");
+        aliasTable.put("cp871",                 "Cp871");
+        aliasTable.put("871",                   "Cp871");
+
+        // MIBenum: ????
+        aliasTable.put("ibm874",                "Cp874");
+        aliasTable.put("ibm-874",               "Cp874");
+        aliasTable.put("cp874",                 "Cp874");
+        aliasTable.put("874",                   "Cp874");
+
+        // MIBenum: ????
+        aliasTable.put("ibm875",                "Cp875");
+        aliasTable.put("ibm-875",               "Cp875");
+        aliasTable.put("cp875",                 "Cp875");
+        aliasTable.put("875",                   "Cp875");
+
+        // MIBenum: ????
+        aliasTable.put("ibm918",                "Cp918");
+        aliasTable.put("ibm-918",               "Cp918");
+        aliasTable.put("cp918",                 "Cp918");
+        aliasTable.put("918",                   "Cp918");
+
+        // MIBenum: ????
+        aliasTable.put("ibm921",                "Cp921");
+        aliasTable.put("ibm-921",               "Cp921");
+        aliasTable.put("cp921",                 "Cp921");
+        aliasTable.put("921",                   "Cp921");
+
+        // MIBenum: ????
+        aliasTable.put("ibm922",                "Cp922");
+        aliasTable.put("ibm-922",               "Cp922");
+        aliasTable.put("cp922",                 "Cp922");
+        aliasTable.put("922",                   "Cp922");
+
+        // MIBenum: ????
+        aliasTable.put("ibm930",                "Cp930");         /* MDA */
+        aliasTable.put("ibm-930",               "Cp930");         /* MDA */
+        aliasTable.put("cp930",                 "Cp930");         /* MDA */
+        aliasTable.put("930",                   "Cp930");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm933",                "Cp933");         /* MDA */
+        aliasTable.put("ibm-933",               "Cp933");         /* MDA */
+        aliasTable.put("cp933",                 "Cp933");         /* MDA */
+        aliasTable.put("933",                   "Cp933");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm935",                "Cp935");         /* MDA */
+        aliasTable.put("ibm-935",               "Cp935");         /* MDA */
+        aliasTable.put("cp935",                 "Cp935");         /* MDA */
+        aliasTable.put("935",                   "Cp935");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm937",                "Cp937");         /* MDA */
+        aliasTable.put("ibm-937",               "Cp937");         /* MDA */
+        aliasTable.put("cp937",                 "Cp937");         /* MDA */
+        aliasTable.put("937",                   "Cp937");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm939",                "Cp939");         /* MDA */
+        aliasTable.put("ibm-939",               "Cp939");         /* MDA */
+        aliasTable.put("cp939",                 "Cp939");         /* MDA */
+        aliasTable.put("939",                   "Cp939");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm942",                "Cp942");         /* MDA */
+        aliasTable.put("ibm-942",               "Cp942");         /* MDA */
+        aliasTable.put("cp942",                 "Cp942");         /* MDA */
+        aliasTable.put("942",                   "Cp942");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm943",                "Cp943");         /* ibm.3158 */
+        aliasTable.put("ibm-943",               "Cp943");         /* ibm.3158 */
+        aliasTable.put("cp943",                 "Cp943");         /* ibm.3158 */
+        aliasTable.put("943",                   "Cp943");         /* ibm.3158 */
+
+        // MIBenum: ????
+        aliasTable.put("ibm948",                "Cp948");         /* MDA */
+        aliasTable.put("ibm-948",               "Cp948");         /* MDA */
+        aliasTable.put("cp948",                 "Cp948");         /* MDA */
+        aliasTable.put("948",                   "Cp948");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm949",                "Cp949");         /* MDA */
+        aliasTable.put("ibm-949",               "Cp949");         /* MDA */
+        aliasTable.put("cp949",                 "Cp949");         /* MDA */
+        aliasTable.put("949",                   "Cp949");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm950",                "Cp950");         /* MDA */
+        aliasTable.put("ibm-950",               "Cp950");         /* MDA */
+        aliasTable.put("cp950",                 "Cp950");         /* MDA */
+        aliasTable.put("950",                   "Cp950");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm964",                "Cp964");         /* MDA */
+        aliasTable.put("ibm-964",               "Cp964");         /* MDA */
+        aliasTable.put("cp964",                 "Cp964");         /* MDA */
+        aliasTable.put("964",                   "Cp964");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm970",                "Cp970");         /* MDA */
+        aliasTable.put("ibm-970",               "Cp970");         /* MDA */
+        aliasTable.put("cp970",                 "Cp970");         /* MDA */
+        aliasTable.put("970",                   "Cp970");         /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm1006",               "Cp1006");
+        aliasTable.put("ibm-1006",              "Cp1006");
+        aliasTable.put("cp1006",                "Cp1006");
+        aliasTable.put("1006",                  "Cp1006");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1025",               "Cp1025");
+        aliasTable.put("ibm-1025",              "Cp1025");
+        aliasTable.put("cp1025",                "Cp1025");
+        aliasTable.put("1025",                  "Cp1025");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1026",               "Cp1026");
+        aliasTable.put("ibm-1026",              "Cp1026");
+        aliasTable.put("cp1026",                "Cp1026");
+        aliasTable.put("1026",                  "Cp1026");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1097",               "Cp1097");
+        aliasTable.put("ibm-1097",              "Cp1097");
+        aliasTable.put("cp1097",                "Cp1097");
+        aliasTable.put("1097",                  "Cp1097");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1098",               "Cp1098");
+        aliasTable.put("ibm-1098",              "Cp1098");
+        aliasTable.put("cp1098",                "Cp1098");
+        aliasTable.put("1098",                  "Cp1098");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1112",               "Cp1112");
+        aliasTable.put("ibm-1112",              "Cp1112");
+        aliasTable.put("cp1112",                "Cp1112");
+        aliasTable.put("1112",                  "Cp1112");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1122",               "Cp1122");
+        aliasTable.put("ibm-1122",              "Cp1122");
+        aliasTable.put("cp1122",                "Cp1122");
+        aliasTable.put("1122",                  "Cp1122");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1123",               "Cp1123");
+        aliasTable.put("ibm-1123",              "Cp1123");
+        aliasTable.put("cp1123",                "Cp1123");
+        aliasTable.put("1123",                  "Cp1123");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1124",               "Cp1124");
+        aliasTable.put("ibm-1124",              "Cp1124");
+        aliasTable.put("cp1124",                "Cp1124");
+        aliasTable.put("1124",                  "Cp1124");
+
+        // MIBenum: ????
+        aliasTable.put("ibm1381",               "Cp1381");        /* MDA */
+        aliasTable.put("ibm-1381",              "Cp1381");        /* MDA */
+        aliasTable.put("cp1381",                "Cp1381");        /* MDA */
+        aliasTable.put("1381",                  "Cp1381");        /* MDA */
+
+        // MIBenum: ????
+        aliasTable.put("ibm1383",               "Cp1383");        /* MDA */
+        aliasTable.put("ibm-1383",              "Cp1383");        /* MDA */
+        aliasTable.put("cp1383",                "Cp1383");        /* MDA */
+        aliasTable.put("1383",                  "Cp1383");        /* MDA */
+
+        // MIBenum: 16/39
+        aliasTable.put("jis",               "ISO2022JP");
+        aliasTable.put("iso-2022-jp",           "ISO2022JP");
+        aliasTable.put("csiso2022jp",           "ISO2022JP");
+        aliasTable.put("jis_encoding",          "ISO2022JP");
+        aliasTable.put("csjisencoding",         "ISO2022JP");
+
+        // MIBenum: 17/2024
+        aliasTable.put("windows-31j",           "MS932");
+        aliasTable.put("cswindows31j",          "MS932");
+
+
+        aliasTable.put("pck", "PCK");       // Case independent PCK alias
+
+        /*if (sjisIsMS932) {
+        aliasTable.put("shift_jis",         "MS932");   // IANA shift jis aliases
+        aliasTable.put("csshiftjis",        "MS932");   // updated per 4556882
+        aliasTable.put("x-sjis",            "MS932");
+        aliasTable.put("ms_kanji",          "MS932");
+        } else {
+        */
+            aliasTable.put("shift_jis",         "SJIS");        // IANA shift jis aliases
+            aliasTable.put("csshiftjis",        "SJIS");
+            aliasTable.put("x-sjis",            "SJIS");
+            aliasTable.put("ms_kanji",          "SJIS");
+            /*
+        }
+            */
+        // MIBenum: 18
+        // Japanese EUC
+        aliasTable.put("eucjis",                    "EUC_JP");
+        aliasTable.put("euc-jp",                    "EUC_JP");
+        aliasTable.put("eucjp",             "EUC_JP");
+        aliasTable.put("extended_unix_code_packed_format_for_japanese",
+                       "EUC_JP");
+        aliasTable.put("cseucpkdfmtjapanese",   "EUC_JP");
+        aliasTable.put("x-euc-jp",          "EUC_JP");
+        aliasTable.put("x-eucjp",           "EUC_JP");
+            aliasTable.put("eucjp-open",            "EUC_JP_Solaris"); // 1.3.1_x compatibility
+
+        // For handing only JIS0202 and JIS0208 in linux
+        aliasTable.put("euc-jp-linux",          "EUC_JP_LINUX");
+
+        // MIBenum: 874
+        aliasTable.put("windows-874",           "MS874");
+
+        // MIBenum: 2250
+        aliasTable.put("windows-1250",          "Cp1250");
+
+        // MIBenum: 2251
+        aliasTable.put("windows-1251",          "Cp1251");
+        aliasTable.put("ansi-1251",             "Cp1251"); // Solaris ru_RU.ANSI1251 locale
+
+        // MIBenum: 2252
+        aliasTable.put("windows-1252",          "Cp1252");
+
+        // MIBenum: 2253
+        aliasTable.put("windows-1253",          "Cp1253");
+
+        // MIBenum: 2254
+        aliasTable.put("windows-1254",          "Cp1254");
+
+        // MIBenum: 2255
+        aliasTable.put("windows-1255",          "Cp1255");
+
+        // MIBenum: 2256
+        aliasTable.put("windows-1256",          "Cp1256");
+
+        // MIBenum: 2257
+        aliasTable.put("windows-1257",          "Cp1257");
+
+        // MIBenum: 2258
+        aliasTable.put("windows-1258",          "Cp1258");
+
+        // MIBenum: ????
+        aliasTable.put("ibm33722",              "Cp33722");       /* MDA */
+        aliasTable.put("ibm-33722",             "Cp33722");       /* MDA */
+        aliasTable.put("cp33722",               "Cp33722");       /* MDA */
+        aliasTable.put("33722",                 "Cp33722");       /* MDA */
+
+        // Russian KOI8-R
+        aliasTable.put("koi8-r",                "KOI8_R");
+        aliasTable.put("koi8",                  "KOI8_R");
+        aliasTable.put("cskoi8r",               "KOI8_R");
+
+        // Simplified Chinese
+        aliasTable.put("gb2312",                    "EUC_CN");
+        aliasTable.put("gb2312-80",                 "EUC_CN");
+        aliasTable.put("gb2312-1980",           "EUC_CN");
+        aliasTable.put("euc-cn",                    "EUC_CN");
+        aliasTable.put("euccn",             "EUC_CN");
+
+        aliasTable.put("big5",              "Big5");
+        aliasTable.put("big5hk",                    "Big5_HKSCS");
+        aliasTable.put("big5-hkscs",        "Big5_HKSCS");
+        // Added for future compatibility, explicit mapping to Unicode 3.0
+        aliasTable.put("big5-hkscs:unicode3.0", "Big5_HKSCS");
+        aliasTable.put("big5_solaris",      "Big5_Solaris");
+
+        // Traditional Chinese
+        aliasTable.put("cns11643",                  "EUC_TW");
+        aliasTable.put("euc-tw",                    "EUC_TW");
+        aliasTable.put("euctw",             "EUC_TW");
+
+        // Korean
+        aliasTable.put("ksc5601",               "EUC_KR");
+        aliasTable.put("euc-kr",                "EUC_KR");
+        aliasTable.put("euckr",                 "EUC_KR");
+        aliasTable.put("ks_c_5601-1987",        "EUC_KR");
+        aliasTable.put("ksc5601-1987",          "EUC_KR");
+        aliasTable.put("ksc5601_1987",          "EUC_KR");
+        aliasTable.put("ksc_5601",              "EUC_KR");
+        aliasTable.put("5601",                  "EUC_KR");
+
+        aliasTable.put("ksc5601-1992",          "Johab");
+        aliasTable.put("ksc5601_1992",          "Johab");
+        aliasTable.put("ms1361",                "Johab");
+
+        aliasTable.put("windows-949",           "MS949");
+
+        //MIBenum: 37
+        aliasTable.put("iso-2022-kr",           "ISO2022KR");
+        aliasTable.put("csiso2022kr",           "ISO2022KR");
+
+        // Thai
+        aliasTable.put("tis620.2533",           "TIS620");
+        aliasTable.put("tis-620",               "TIS620"); // Linux name
+
+        // Variants
+        aliasTable.put("cp942c", "Cp942C");
+        aliasTable.put("cp943c", "Cp943C");
+        aliasTable.put("cp949c", "Cp949C");
+        aliasTable.put("iscii", "ISCII91");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/RemovingSunIO/TestCOMP.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6176819
+   @summary Check if COMPUND_TEXT charset works as expected
+   @run main/timeout=1200 TestCOMP
+ */
+
+import java.util.HashMap;
+import java.util.Set;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.*;
+import java.nio.*;
+
+public class TestCOMP {
+    public static void main(String[] argv) throws CharacterCodingException {
+        String osName = System.getProperty("os.name");
+        if (osName.startsWith("Windows"))
+            return;
+        try {
+            String src =
+                "JIS0208\u4eb0" +
+                "ASCII" +
+                "JIS0212\u4e74\u4e79" +
+                "GB2312\u7279\u5b9a" +
+                "JIS0201\uff67\uff68" +
+                "Johab\uac00\uac01";
+
+            byte[] ba = src.getBytes("COMPOUND_TEXT");
+            /*
+            System.out.print("ba=");
+            for (int i = 0; i < ba.length; i++) {
+                System.out.printf("<%x> ", ba[i] & 0xff);
+            }
+            System.out.println();
+            */
+            String dst = new String(ba, "COMPOUND_TEXT");
+            char[] ca = dst.toCharArray();
+            /*
+            System.out.print("ca=");
+            for (int i = 0; i < ca.length; i++) {
+                System.out.printf("<%x> ", ca[i] & 0xffff);
+            }
+            System.out.println();
+            */
+            if (!src.equals(dst)) {
+                System.out.printf("src=<%s>\n", src);
+                System.out.printf("dst=<%s>\n", dst);
+                throw new CharacterCodingException();
+            }
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/RemovingSunIO/TestUnmappableForLength.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6227339
+   @summary Check if returned CoderResult.unmappableForLength has correct
+            length value.
+ */
+
+import java.nio.charset.*;
+import java.nio.*;
+
+public class TestUnmappableForLength {
+    public static void main(String[] argv) throws CharacterCodingException {
+            byte[] ba = {(byte)0xa2, (byte)0xff};
+            //EUC_TW has its own decodeArrayLoop()
+            testDecode("EUC_TW", ba, 2);
+
+            //EUC_CN uses DoubleByteDecoder's decodeArrayLoop()
+            testDecode("EUC_CN", ba, 2);
+    }
+
+    static void testDecode(String csName, byte[] ba, int expected)
+        throws CharacterCodingException
+    {
+        try {
+            CoderResult cr = Charset
+                .forName(csName)
+                .newDecoder()
+                .decode(ByteBuffer.wrap(ba), CharBuffer.allocate(4), true);
+            if (cr.isUnmappable() && cr.length() != expected) {
+                throw new CharacterCodingException();
+            }
+        } catch (IllegalArgumentException x){
+            x.printStackTrace();
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/BashCache.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4517279
+ * @summary Stochastic test of thread-local coder caches
+ */
+
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.*;
+
+
+public class BashCache {
+
+    private static final int THREADS = 10;
+    private static final int TRIALS = 1000;
+
+    private static final Charset[] charsets
+        = new Charset[] {
+            Charset.forName("US-ASCII"),
+            Charset.forName("UTF-8"),
+            Charset.forName("CP1252"),
+            Charset.forName("UTF-16BE") };
+
+    private static volatile boolean failed = false;
+
+    private static class Basher extends Thread {
+
+        Random rnd = new Random(System.identityHashCode(this));
+
+        public void run() {
+            for (int i = 0; i < TRIALS; i++) {
+                Charset cs = charsets[rnd.nextInt(4)];
+                try {
+                    if (rnd.nextBoolean()) {
+                        cs.encode("hi mom");
+                    } else {
+                        cs.decode(ByteBuffer.wrap(new byte[] {
+                            (byte)'x', (byte)'y',
+                            (byte)'z', (byte)'z',
+                            (byte)'y' }));
+                    }
+                } catch (Exception x) {
+                    x.printStackTrace();
+                    failed = true;
+                    return;
+                }
+                if (rnd.nextBoolean())
+                    Thread.yield();
+            }
+        }
+
+    }
+
+    public static void main(String[] args) throws Exception {
+        Charset cs = Charset.forName("us-ascii");
+        Basher[] bashers = new Basher[THREADS];
+        for (int i = 0; i < THREADS; i++) {
+            bashers[i] = new Basher();
+            bashers[i].start();
+        }
+        for (int i = 0; i < THREADS; i++)
+            bashers[i].join();
+        if (failed)
+            throw new Exception("Test failed");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/BashStreams.java	Fri Feb 19 15:13:37 2010 -0800
@@ -0,0 +1,391 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary Stochastic test of charset-based streams
+ */
+
+import java.io.*;
+import java.util.*;
+import java.nio.*;
+import java.nio.channels.*;
+import java.nio.charset.*;
+
+
+public class BashStreams {
+
+    static final PrintStream log = System.err;
+
+
+    static class CharacterGenerator {
+
+        private final Random rand;
+        private final int max;
+        private final int limit;
+        private int count = 0;
+
+        CharacterGenerator(long seed, String csn, int limit) {
+            rand = new Random(seed);
+            this.max = Surrogate.UCS4_MAX + 1;
+            this.limit = limit;
+        }
+
+        private char[] saved = new char[10];
+        private int savedCount = 0;
+
+        void push(char c) {
+            saved[savedCount++] = c;
+            count--;
+        }
+
+        int count() {
+            return count;
+        }
+
+        boolean hasNext() {
+            return count < limit;
+        }
+
+        char next() {
+            if (count >= limit)
+                throw new RuntimeException("EOF");
+            if (savedCount > 0) {
+                savedCount--;
+                count++;
+                return saved[savedCount];
+            }
+            int c;
+            for (;;) {
+                c = rand.nextInt(max);
+                if (Surrogate.is(c) || (c == 0xfffe) || (c == 0xffff))
+                    continue;
+                if (Surrogate.neededFor(c) && (count == limit - 1))
+                    continue;
+                break;
+            }
+            count++;
+            if (Surrogate.neededFor(c)) {
+                count++;
+                push(Surrogate.low(c));
+                return Surrogate.high(c);
+            }
+            return (char)c;
+        }
+
+    }
+
+
+    static void mismatch(String csn, int count, char c, char d) {
+        throw new RuntimeException(csn + ": Mismatch at count "
+                                   + count
+                                   + ": " + Integer.toHexString(c)
+                                   + " != "
+                                   + Integer.toHexString(d));
+    }
+
+    static void mismatchedEOF(String csn, int count, int cgCount) {
+        throw new RuntimeException(csn + ": Mismatched EOFs: "
+                                   + count
+                                   + " != "
+                                   + cgCount);
+    }
+
+
+    static class Sink                   // One abomination...
+        extends OutputStream
+        implements WritableByteChannel
+    {
+
+        private final String csn;
+        private final CharacterGenerator cg;
+        private int count = 0;
+
+        Sink(String csn, long seed) {
+            this.csn = csn;
+            this.cg = new CharacterGenerator(seed, csn, Integer.MAX_VALUE);
+        }
+
+        public void write(int b) throws IOException {
+            write (new byte[] { (byte)b }, 0, 1);
+        }
+
+        private int check(byte[] ba, int off, int len) throws IOException {
+            String s = new String(ba, off, len, csn);
+            int n = s.length();
+            for (int i = 0; i < n; i++) {
+                char c = s.charAt(i);
+                char d = cg.next();
+                if (c != d) {
+                    if (c == '?') {
+                        if (Surrogate.isHigh(d))
+                            cg.next();
+                        continue;
+                    }
+                    mismatch(csn, count + i, c, d);
+                }
+            }
+            count += n;
+            return len;
+        }
+
+        public void write(byte[] ba, int off, int len) throws IOException {
+            check(ba, off, len);
+        }
+
+        public int write(ByteBuffer bb) throws IOException {
+            int n = check(bb.array(),
+                          bb.arrayOffset() + bb.position(),
+                          bb.remaining());
+            bb.position(bb.position() + n);
+            return n;
+        }
+
+        public void close() {
+            count = -1;
+        }
+
+        public boolean isOpen() {
+            return count >= 0;
+        }
+
+    }
+
+    static void testWrite(String csn, int limit, long seed, Writer w)
+        throws IOException
+    {
+        Random rand = new Random(seed);
+        CharacterGenerator cg = new CharacterGenerator(seed, csn,
+                                                       Integer.MAX_VALUE);
+        int count = 0;
+        char[] ca = new char[16384];
+
+        int n = 0;
+        while (count < limit) {
+            n = rand.nextInt(ca.length);
+            for (int i = 0; i < n; i++)
+                ca[i] = cg.next();
+            w.write(ca, 0, n);
+            count += n;
+        }
+        if (Surrogate.isHigh(ca[n - 1]))
+            w.write(cg.next());
+        w.close();
+    }
+
+    static void testStreamWrite(String csn, int limit, long seed)
+        throws IOException
+    {
+        log.println("  write stream");
+        testWrite(csn, limit, seed,
+                  new OutputStreamWriter(new Sink(csn, seed), csn));
+    }
+
+    static void testChannelWrite(String csn, int limit, long seed)
+        throws IOException
+    {
+        log.println("  write channel");
+        testWrite(csn, limit, seed,
+                  Channels.newWriter(new Sink(csn, seed),
+                                     Charset.forName(csn)
+                                     .newEncoder()
+                                     .onMalformedInput(CodingErrorAction.REPLACE)
+                                     .onUnmappableCharacter(CodingErrorAction.REPLACE),
+                                     8192));
+    }
+
+
+    static class Source                 // ... and another
+        extends InputStream
+        implements ReadableByteChannel
+    {
+
+        private final String csn;
+        private final CharsetEncoder enc;
+        private final CharacterGenerator cg;
+        private int count = 0;
+
+        Source(String csn, long seed, int limit) {
+            this.csn = csn.startsWith("\1") ? csn.substring(1) : csn;
+            this.enc = Charset.forName(this.csn).newEncoder()
+                .onMalformedInput(CodingErrorAction.REPLACE)
+                .onUnmappableCharacter(CodingErrorAction.REPLACE);
+            this.cg = new CharacterGenerator(seed, csn, limit);
+        }
+
+        public int read() throws IOException {
+            byte[] b = new byte[1];
+            read(b);
+            return b[0];
+        }
+
+        private CharBuffer cb = CharBuffer.allocate(8192);
+        private ByteBuffer bb = null;
+
+        public int read(byte[] ba, int off, int len) throws IOException {
+            if (!cg.hasNext())
+                return -1;
+            int end = off + len;
+            int i = off;
+            while (i < end) {
+                if ((bb == null) || !bb.hasRemaining()) {
+                    cb.clear();
+                    while (cb.hasRemaining()) {
+                        if (!cg.hasNext())
+                            break;
+                        char c = cg.next();
+                        if (Surrogate.isHigh(c) && (cb.remaining() == 1)) {
+                            cg.push(c);
+                            break;
+                        }
+                        cb.put(c);
+                    }
+                    cb.flip();
+                    if (!cb.hasRemaining())
+                        break;
+                    bb = enc.encode(cb);
+                }
+                int d = Math.min(bb.remaining(), end - i);
+                bb.get(ba, i, d);
+                i += d;
+            }
+            return i - off;
+        }
+
+        public int read(ByteBuffer bb) throws IOException {
+            int n = read(bb.array(),
+                         bb.arrayOffset() + bb.position(),
+                         bb.remaining());
+            if (n >= 0)
+                bb.position(bb.position() + n);
+            return n;
+        }
+
+        public void close() {
+            count = -1;
+        }
+
+        public boolean isOpen() {
+            return count != -1;
+        }
+
+    }
+
+    static void testRead(String csn, int limit, long seed, int max,
+                         Reader rd)
+        throws IOException
+    {
+        Random rand = new Random(seed);
+        CharacterGenerator cg = new CharacterGenerator(seed, csn, limit);
+        int count = 0;
+        char[] ca = new char[16384];
+
+        int n = 0;
+        while (count < limit) {
+            int rn = rand.nextInt(ca.length);
+            n = rd.read(ca, 0, rn);
+            if (n < 0)
+                break;
+            for (int i = 0; i < n; i++) {
+                char c = ca[i];
+                if (!cg.hasNext())
+                    mismatchedEOF(csn, count + i, cg.count());
+                char d = cg.next();
+                if (c == '?') {
+                    if (Surrogate.isHigh(d)) {
+                        cg.next();
+                        continue;
+                    }
+                    if (d > max)
+                        continue;
+                }
+                if (c != d)
+                    mismatch(csn, count + i, c, d);
+            }
+            count += n;
+        }
+        if (cg.hasNext())
+            mismatchedEOF(csn, count, cg.count());
+        rd.close();
+    }
+
+    static void testStreamRead(String csn, int limit, long seed, int max)
+        throws IOException
+    {
+        log.println("  read stream");
+        testRead(csn, limit, seed, max,
+                 new InputStreamReader(new Source(csn, seed, limit), csn));
+    }