changeset 2121:e79d95ea2e81

Merge
author lana
date Mon, 08 Feb 2010 23:59:22 -0800
parents 9027c6b9d7e2 445b9928fb70
children 89b0235188b5
files
diffstat 87 files changed, 23432 insertions(+), 300 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/shared/Sanity.gmk	Thu Feb 04 11:19:33 2010 -0800
+++ b/make/common/shared/Sanity.gmk	Mon Feb 08 23:59:22 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/java/jvm/Makefile	Thu Feb 04 11:19:33 2010 -0800
+++ b/make/java/jvm/Makefile	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/make/java/sun_nio/Makefile	Mon Feb 08 23:59:22 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/mkdemo/jvmti/Makefile	Thu Feb 04 11:19:33 2010 -0800
+++ b/make/mkdemo/jvmti/Makefile	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/make/mkdemo/jvmti/README.txt	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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/security/cert/PKIXParameters.java	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/java/security/cert/PKIXParameters.java	Mon Feb 08 23:59:22 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/util/regex/Pattern.java	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/java/util/regex/Pattern.java	Mon Feb 08 23:59:22 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/sun/io/ByteToCharUTF8.java	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/io/ByteToCharUTF8.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/io/CharToByteUnicode.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/io/CharacterEncoding.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/io/Converters.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/net/ftp/impl/FtpClient.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/nio/cs/AbstractCharsetProvider.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/security/krb5/internal/ktab/KeyTabInputStream.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/security/pkcs11/P11Key.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/classes/sun/security/tools/KeyTool.java	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/demo/jvmti/index.html	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/share/native/java/net/net_util.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/java/net/Inet4AddressImpl.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/java/net/Inet6AddressImpl.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/java/net/NetworkInterface.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/java/net/net_util_md.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/java/net/net_util_md.h	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/sun/net/spi/SdpProvider.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/sun/nio/ch/Net.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/solaris/native/sun/nio/ch/SctpNet.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/src/windows/native/java/net/NetworkInterface_winXP.c	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/demo/jvmti/heapTracker/HeapTrackerTest.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/demo/jvmti/hprof/CpuTimesTest.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/demo/jvmti/minst/MinstTest.java	Mon Feb 08 23:59:22 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	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/demo/jvmti/mtrace/TraceJFrame.java	Mon Feb 08 23:59:22 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/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java	Thu Feb 04 11:19:33 2010 -0800
+++ b/test/java/awt/TextArea/UsingWithMouse/SelectionAutoscrollTest.java	Mon Feb 08 23:59:22 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() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/InterfaceAddress/NetworkPrefixLength.java	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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	Mon Feb 08 23:59:22 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));
+    }
+
+    static void testChannelRead(String csn, int limit, long seed, int max)
+        throws IOException
+    {
+        log.println("  read channel");
+        testRead(csn, limit, seed, max,
+                 Channels.newReader(new Source(csn, seed, limit), csn));
+    }
+
+
+    static final int LIMIT = 1 << 21;
+
+    static void test(String csn, int limit, long seed, int max)
+        throws Exception
+    {
+        log.println();
+        log.println(csn);
+
+        testStreamWrite(csn, limit, seed);
+        testChannelWrite(csn, limit, seed);
+        testStreamRead(csn, limit, seed, max);
+        testChannelRead(csn, limit, seed, max);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (System.getProperty("os.arch").equals("ia64")) {
+            // This test requires 54 minutes on an Itanium-1 processor
+            return;
+        }
+
+        int ai = 0, an = args.length;
+
+        int limit;
+        if (ai < an)
+            limit = 1 << Integer.parseInt(args[ai++]);
+        else
+            limit = LIMIT;
+        log.println("limit = " + limit);
+
+        long seed;
+        if (ai < an)
+            seed = Long.parseLong(args[ai++]);
+        else
+            seed = System.currentTimeMillis();
+        log.println("seed = " + seed);
+
+        test("UTF-8", limit, seed, Integer.MAX_VALUE);
+        test("US-ASCII", limit, seed, 0x7f);
+        test("ISO-8859-1", limit, seed, 0xff);
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/Check.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,152 @@
+/*
+ * 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 4712786
+ * @summary Check charsets against reference files
+ *
+ * @build Util
+ * @run main Check shift_jis ref.shift_jis
+ * @run main/othervm -Dsun.nio.cs.map=Windows-31J/Shift_JIS Check shift_jis ref.windows-31j
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+import java.nio.charset.*;
+import java.util.*;
+import java.util.regex.*;
+
+
+public class Check {
+
+    private static PrintStream log = System.err;
+
+    private static final int UNICODE_SIZE = (1 << 16);
+
+    private final String csName;
+    private final String refName;
+    private byte[][] bytes = new byte[UNICODE_SIZE][]; // Indexed by char
+
+    private int errors = 0;
+
+    private Check(String csn, String refn) {
+        csName = csn;
+        refName = refn;
+    }
+
+    private Check load()
+        throws IOException
+    {
+        File fn = new File(System.getProperty("test.src", "."), refName);
+        FileChannel fc = new FileInputStream(fn).getChannel();
+        ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+        CharBuffer cb = Charset.forName("US-ASCII").decode(bb);
+        Pattern p = Pattern.compile("^(\\p{XDigit}+) +(\\p{XDigit}+)$",
+                                    Pattern.MULTILINE);
+        Matcher m = p.matcher(cb);
+        while (m.find()) {
+            char c = (char)Integer.parseInt(m.group(1), 16);
+            String v = m.group(2);
+            int nb = v.length() >> 1;
+            byte[] ba = new byte[nb];
+            for (int i = 0; i < nb; i++) {
+                ba[i] = (byte)Integer.parseInt(v.substring(i << 1, (i << 1) + 2),
+                                               16);
+            }
+            bytes[c] = ba;
+        }
+        return this;
+    }
+
+    private void error() {
+        if (++errors >= 100)
+            throw new RuntimeException("100 errors occurred (there might be more)");
+    }
+
+    private void mismatch(String s, byte[] expected, byte[] got) {
+        log.println("Encoding mismatch on \""
+                    + Util.toString(s)
+                    + "\": Expected {"
+                    + Util.toString(expected)
+                    + "}, got {"
+                    + Util.toString(got)
+                    + "}");
+        error();
+    }
+
+    private void mismatch(int i, byte[] ba, String expected, String got) {
+        log.println("Decoding mismatch on \""
+                    + Util.toString((char)i)
+                    + "\", input {"
+                    + Util.toString(ba)
+                    + "}: Expected \""
+                    + Util.toString(expected)
+                    + "\", got \""
+                    + Util.toString(got)
+                    + "\"");
+        error();
+    }
+
+    private void check()
+        throws IOException
+    {
+
+        // String.getBytes(String csn)
+        for (int i = 0; i < UNICODE_SIZE; i++) {
+            if (bytes[i] == null)
+                continue;
+            String s = new String(new char[]{ (char)i });
+            byte[] ba = s.getBytes(csName);
+            if (Util.cmp(ba, bytes[i]) >= 0)
+                mismatch(s, bytes[i], ba);
+        }
+        log.println("String.getBytes(\"" + csName + "\") okay");
+
+        // String(byte[] ba, String csn)
+        for (int i = 0; i < UNICODE_SIZE; i++) {
+            if (bytes[i] == null)
+                continue;
+            String r = new String(new char[]{ (char)i });
+            String s = new String(bytes[i], csName);
+            if (!r.equals(s))
+                mismatch(i, bytes[i], r, s);
+        }
+        log.println("String(byte[] ba, \"" + csName + "\") okay");
+
+        // To be really thorough we should test OutputStreamWriter,
+        // InputStreamReader, and Charset{De,En}Coder here also,
+        // but the above will do for now.
+
+        if (errors > 0) {
+            throw new RuntimeException(errors + " error(s) occurred");
+        }
+
+    }
+
+    // Usage: Check charsetName referenceFileName
+    public static void main(String[] args) throws Exception {
+        new Check(args[0], args[1]).load().check();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/CheckSJISMappingProp.sh	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+#
+# Copyright 2003 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 Verify that sun.nio.cs.map property interpreted in ja multibyte locales
+# @bug 4879123
+# @build SJISPropTest
+#
+# @run shell/timeout=300 CheckSJISMappingProp.sh
+
+# set platform-dependent variables
+
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux ) ;;
+  # Skip locale test for Windows
+  Windows* )
+    echo "Passed"; exit 0 ;;
+  * ) echo "Unrecognized system!" ;  exit 1 ;;
+esac
+
+expectPass() {
+  if [ $1 -eq 0 ]
+  then echo "--- passed as expected"
+  else
+    echo "--- failed"
+    exit $1
+  fi
+}
+
+
+JAVA="${TESTJAVA}/bin/java -cp ${TESTCLASSES}"
+runTest() {
+  echo "Testing:" ${1}
+  LC_ALL="$1" ; export LC_ALL
+  locale
+  # Firstly, test with property set
+  # (shift_jis should map to windows-31J charset) 
+  ${JAVA} -Dsun.nio.cs.map="Windows-31J/Shift_JIS" SJISPropTest MS932
+  expectPass $?
+
+  # Next, test without property set - "shift_jis" follows IANA conventions
+  # and should map to the sun.nio.cs.ext.Shift_JIS charset
+  ${JAVA} SJISPropTest Shift_JIS
+  expectPass $?
+}
+
+# Run the test in the common Solaris/Linux locales
+# Tests will simply run in current locale if locale isn't supported
+# on the test machine/platform
+
+for i in "ja" "ja_JP.PCK" "ja_JP.eucJP"  ; do
+  runTest ${i}
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/Errors.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,220 @@
+/*
+ * 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 Check that error cases are replaced correctly in String/ISR/OSW
+ * @bug 4457851
+ *
+ * @build Errors Util
+ * @run main Errors
+ */
+
+import java.io.*;
+import java.nio.*;
+
+
+public class Errors {
+
+    static PrintStream log = System.err;
+    static int failures = 0;
+
+    static final byte Q = (byte)'?';
+    static final byte X = (byte)'x';
+    static final byte Y = (byte)'y';
+    static final byte Z = (byte)'z';
+
+    static abstract class Test {
+
+        protected final String csn;
+        protected final String what;
+
+        Test(String csn, String what) {
+            this.csn = csn;
+            this.what = what;
+        }
+
+        abstract byte[] enc(String s) throws IOException;
+
+        Test test(String s, byte[] ref) {
+            log.print("  " + Util.toString(s.toCharArray()));
+            byte[] ba = null;
+            try {
+                ba = enc(s);
+            } catch (IOException x) {
+                log.println(" -e-> ERROR: " + x.getClass().getName());
+                failures++;
+                return this;
+            }
+            log.println(" -e-> " + Util.toString(ba));
+            int i = Util.cmp(ba, ref);
+            if (i >= 0) {
+                log.println("    ERROR: Mismatch at index " + i
+                            + ", expected: " + Util.toString(ref));
+                failures++;
+            }
+            return this;
+        }
+
+        abstract String dec(byte[] ba) throws IOException;
+
+        Test test(byte[] ba, String ref) {
+            log.print("  " + Util.toString(ba));
+            String s = null;
+            try {
+                s = dec(ba);
+            } catch (IOException x) {
+                log.println(" -d-> ERROR: " + x.getClass().getName());
+                failures++;
+                return this;
+            }
+            log.println(" -d-> " + Util.toString(s.toCharArray()));
+            char[] ca = s.toCharArray();
+            char[] refa = ref.toCharArray();
+            int i = Util.cmp(ca, refa);
+            if (i >= 0) {
+                log.println("    ERROR: Mismatch at index " + i
+                            + ", expected: " + Util.toString(refa));
+                failures++;
+            }
+            return this;
+        }
+
+        Test run() {
+            log.println(csn + ", " + what);
+
+            test("xyzzy", new byte[] { X, Y, Z, Z, Y });
+
+            // Malformed surrogates
+            test("\uD800x", new byte[] { Q, X });
+            test("\uDC00x", new byte[] { Q, X });
+            test("\uD800\uDB00x", new byte[] { Q, Q, X });
+
+            return this;
+        }
+
+    }
+
+    static class TestStream extends Test {
+
+        TestStream(String csn) {
+            super(csn, "I/O streams");
+        }
+
+        byte[] enc(String s) throws IOException {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            Writer wr = new OutputStreamWriter(bos, csn);
+            wr.write(s);
+            wr.close();
+            return bos.toByteArray();
+        }
+
+        String dec(byte[] ba) throws IOException {
+            ByteArrayInputStream bis = new ByteArrayInputStream(ba);
+            Reader rd = new InputStreamReader(bis, csn);
+            char[] ca = new char[1024];
+            int n = rd.read(ca);
+            String s = new String(ca, 0, n);
+            rd.close();
+            return s;
+        }
+
+    }
+
+    static class TestString extends Test {
+
+        TestString(String csn) {
+            super(csn, "strings");
+        }
+
+        byte[] enc(String s) throws IOException {
+            return s.getBytes(csn);
+        }
+
+        String dec(byte[] ba) throws IOException {
+            return new String(ba, 0, ba.length, csn);
+        }
+
+    }
+
+    static void test_US_ASCII(Test t) {
+        t.run();
+        t.test("\u0080", new byte[] { Q });
+        t.test("\u0100", new byte[] { Q });
+        t.test("\uD800\uDC00", new byte[] { Q });
+        t.test("\uF000", new byte[] { Q });
+        t.test("\uFFFE", new byte[] { Q });
+        t.test("\uFFFF", new byte[] { Q });
+        t.test(new byte[] { X, (byte)0x7f, Y }, "x\u007Fy");
+        t.test(new byte[] { X, (byte)0x80, Y }, "x\uFFFDy");
+        t.test(new byte[] { (byte)0xf0, (byte)0xf0 }, "\uFFFD\uFFFD");
+    }
+
+    static void test_ISO_8859_1(Test t) {
+        t.run();
+        t.test("\u0080", new byte[] { (byte)0x80 });
+        t.test("\u0100", new byte[] { Q });
+        t.test("\uD800\uDC00x", new byte[] { Q, X });
+        t.test("\uF000", new byte[] { Q });
+        t.test("\uFFFE", new byte[] { Q });
+        t.test("\uFFFF", new byte[] { Q });
+        t.test(new byte[] { X, (byte)0x7f, Y }, "x\u007Fy");
+        t.test(new byte[] { X, (byte)0x80, Y }, "x\u0080y");
+        t.test(new byte[] { (byte)0xf0, (byte)0xf0 }, "\u00F0\u00F0");
+    }
+
+    static void test_UTF_8(Test t) {
+        t.run();
+        t.test("\u0080", new byte[] { (byte)0xC2, (byte)0x80 });
+        t.test("\u0100", new byte[] { (byte)0xC4, (byte)0x80 });
+        t.test("\uD800\uDC00",
+               new byte[] { (byte)0xF0, (byte)0x90, (byte)0x80, (byte)0x80 });
+        t.test("\uF000", new byte[] { (byte)0xEF, (byte)0x80, (byte)0x80 });
+        t.test("\uFFFE", new byte[] { (byte)0xEF, (byte)0xBF, (byte)0xBE });
+        t.test("\uFFFF", new byte[] { (byte)0xEF, (byte)0xBF, (byte)0xBF });
+        t.test(new byte[] { X, (byte)0x7f, Y }, "x\u007Fy");
+        t.test(new byte[] { X, (byte)0x80, Y }, "x\uFFFDy");
+        t.test(new byte[] { (byte)0xf0, (byte)0xf0 }, "\uFFFD");
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        test_US_ASCII(new TestString("US-ASCII"));
+        test_US_ASCII(new TestStream("US-ASCII"));
+
+        test_ISO_8859_1(new TestString("ISO-8859-1"));
+        test_ISO_8859_1(new TestStream("ISO-8859-1"));
+
+        test_ISO_8859_1(new TestString("ISO-8859-15"));
+        test_ISO_8859_1(new TestStream("ISO-8859-15"));
+
+        test_UTF_8(new TestString("UTF-8"));
+        test_UTF_8(new TestStream("UTF-8"));
+
+        if (failures > 0) {
+            log.println();
+            throw new Exception("Tests failed: " + failures);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/FullRead.java	Mon Feb 08 23:59:22 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
+ * @summary Ensure that InputStreamReader reads as many characters as possible
+ */
+
+// InputStreamReader is not required by its spec to read as many characters as
+// possible upon each invocation of read(char[], int, int), but many programs
+// (e.g., javac) depend upon this behavior.
+
+import java.io.*;
+
+
+public class FullRead {
+
+    static int MAX_LEN = 1 << 16;
+
+    static void test(File f, int len) throws Exception {
+        FileOutputStream fo = new FileOutputStream(f);
+        for (int i = 0; i < len; i++)
+            fo.write('x');
+        fo.close();
+
+        FileInputStream fi = new FileInputStream(f);
+        Reader rd = new InputStreamReader(fi, "US-ASCII");
+        char[] cb = new char[MAX_LEN + 100];
+        int n = rd.read(cb, 0, cb.length);
+        System.out.println(len + " : " + n);
+        if (len != n)
+            throw new Exception("Expected " + len + ", read " + n);
+    }
+
+    public static void main(String[] args) throws Exception {
+        File f = File.createTempFile("foo", "bar");
+        f.deleteOnExit();
+        System.out.println(f);
+
+        for (int i = 4; i <= MAX_LEN; i <<= 1)
+            test(f, i);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/IOCoders.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,103 @@
+/*
+ * 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 ISR/OSW constructors that take coders
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class IOCoders {
+
+    static Charset ascii = Charset.forName("US-ASCII");
+
+    static void isrPositive() throws Exception {
+        ByteArrayInputStream bis
+            = new ByteArrayInputStream(new byte[] { (byte)'h', (byte)'i' });
+        InputStreamReader isr
+            = new InputStreamReader(bis,
+                                    ascii.newDecoder()
+                                    .onMalformedInput(CodingErrorAction.REPORT)
+                                    .onUnmappableCharacter(CodingErrorAction.REPORT));
+        BufferedReader br = new BufferedReader(isr);
+        if (!br.readLine().equals("hi"))
+            throw new Exception();
+    }
+
+    static void isrNegative() throws Exception {
+        ByteArrayInputStream bis
+            = new ByteArrayInputStream(new byte[] { (byte)0xff, (byte)0xff });
+        InputStreamReader isr
+            = new InputStreamReader(bis,
+                                    ascii.newDecoder()
+                                    .onMalformedInput(CodingErrorAction.REPORT)
+                                    .onUnmappableCharacter(CodingErrorAction.REPORT));
+        BufferedReader br = new BufferedReader(isr);
+        try {
+            br.readLine();
+        } catch (MalformedInputException x) {
+            return;
+        }
+        throw new Exception();
+    }
+
+    static void oswPositive() throws Exception {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        OutputStreamWriter osw
+            = new OutputStreamWriter(bos,
+                                     ascii.newEncoder()
+                                     .onMalformedInput(CodingErrorAction.REPORT)
+                                     .onUnmappableCharacter(CodingErrorAction.REPORT));
+        osw.write("hi");
+        osw.close();
+        if (!ascii.decode(ByteBuffer.wrap(bos.toByteArray()))
+            .toString().equals("hi"))
+            throw new Exception();
+    }
+
+    static void oswNegative() throws Exception {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        OutputStreamWriter osw
+            = new OutputStreamWriter(bos,
+                                     ascii.newEncoder()
+                                     .onMalformedInput(CodingErrorAction.REPORT)
+                                     .onUnmappableCharacter(CodingErrorAction.REPORT));
+        try {
+            osw.write("\u00A0\u00A1");
+        } catch (UnmappableCharacterException x) {
+            return;
+        }
+        throw new Exception();
+    }
+
+    public static void main(String[] args) throws Exception {
+        isrPositive();
+        isrNegative();
+        oswPositive();
+        oswNegative();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/IsLegalReplacement.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,93 @@
+/*
+ * 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 4821286
+ * @summary Check correctness of CharsetEncoder.isLegalReplacement(byte[])
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.*;
+
+
+public class IsLegalReplacement {
+
+    static PrintStream out = System.err;
+    static int errors = 0;
+
+    static String toString(byte[] ba) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < ba.length; i++) {
+            byte b = ba[i];
+            if (i > 0)
+                sb.append(' ');
+            sb.append(Integer.toHexString((b >> 4) & 0xf));
+            sb.append(Integer.toHexString((b >> 0) & 0xf));
+        }
+        return sb.toString();
+    }
+
+    static CoderResult ilr(String csn, byte[] repl) {
+        CharsetDecoder dec = Charset.forName(csn).newDecoder();
+        dec.onMalformedInput(CodingErrorAction.REPORT);
+        dec.onUnmappableCharacter(CodingErrorAction.REPORT);
+        ByteBuffer bb = ByteBuffer.wrap(repl);
+        CharBuffer cb = CharBuffer.allocate((int)(bb.remaining()
+                                                  * dec.maxCharsPerByte()));
+        return dec.decode(bb, cb, true);
+    }
+
+    static void test(String csn, byte[] repl, boolean expected)
+        throws Exception
+    {
+        CharsetEncoder enc = Charset.forName(csn).newEncoder();
+        out.print(csn + ": " + toString(repl) + ": ");
+        if (enc.isLegalReplacement(repl) == expected) {
+            out.print("Okay");
+        } else {
+            out.print("Wrong: Expected " + expected);
+            errors++;
+        }
+        out.println(" (" + ilr(csn, repl) + ")");
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        test("UTF-16", new byte [] { (byte)0xd8, 0, (byte)0xdc, 0 }, true);
+        test("UTF-16", new byte [] { (byte)0xdc, 0, (byte)0xd8, 0 }, false);
+        test("UTF-16", new byte [] { (byte)0xd8, 0 }, false);
+        test("UTF-16BE", new byte [] { (byte)0xd8, 0, (byte)0xdc, 0 }, true);
+        test("UTF-16BE", new byte [] { (byte)0xdc, 0, (byte)0xd8, 0 }, false);
+        test("UTF-16BE", new byte [] { (byte)0xd8, 0 }, false);
+        test("UTF-16LE", new byte [] { 0, (byte)0xd8, 0, (byte)0xdc }, true);
+        test("UTF-16LE", new byte [] { 0, (byte)0xdc, 0, (byte)0xd8 }, false);
+        test("UTF-16LE", new byte [] { 0, (byte)0xd8 }, false);
+
+        if (errors > 0)
+            throw new Exception(errors + " error(s) occurred");
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/ResetISO2022JP.java	Mon Feb 08 23:59:22 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 6226510
+   @summary Check that ISO-2022-JP's encoder correctly resets to ASCII mode
+   @author Martin Buchholz
+ */
+
+import java.nio.*;
+import java.nio.charset.*;
+
+public class ResetISO2022JP {
+
+    public static void main(String[] args) throws Exception {
+        if (! (encode(true).equals(encode(false))))
+            throw new Exception("Mismatch!");
+    }
+
+    static String encode(boolean reuseEncoder) {
+        String s = "\u3042\u3043\u3044";
+
+        CharsetEncoder e = Charset.forName("ISO-2022-JP").newEncoder();
+
+        if (reuseEncoder) {
+            // I'm turning japanese. Yes I'm turning japanese.  Yes I think so!
+            e.encode(CharBuffer.wrap(s), ByteBuffer.allocate(64), true);
+
+            // Should put encoder back into ASCII mode
+            e.reset();
+        }
+
+        ByteBuffer bb = ByteBuffer.allocate(64);
+        e.encode(CharBuffer.wrap(s), bb, true);
+        e.flush(bb);
+        bb.flip();
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < bb.limit(); i++)
+            sb.append(String.format("%02x ", bb.get(i)));
+        System.out.println(sb);
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/SJISPropTest.java	Mon Feb 08 23:59:22 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.
+ */
+
+/*
+ *
+ *
+ * Regression test class run by CheckSJISMappingProp.sh to verify
+ * that sun.nio.cs.map property is correctly interpreted in
+ * multibyte Japanese locales
+ *
+ */
+
+public class SJISPropTest {
+    public static void main(String[] args) throws Exception {
+        boolean sjisIsMS932 = false;
+
+        if (args[0].equals("MS932"))
+                sjisIsMS932 = true;
+        byte[] testBytes = { (byte)0x81, (byte)0x60 };
+
+        // JIS X based Shift_JIS and Windows-31J differ
+        // in a number of mappings including this one.
+
+        String expectedMS932 = new String("\uFF5E");
+        String expectedSJIS = new String("\u301C");
+
+        // Alias "shift_jis" will map to Windows-31J
+        // if the sun.nio.cs.map system property is defined as
+        // "Windows-31J/Shift_JIS". This should work in all
+        // multibyte (especially Japanese) locales.
+
+        String s = new String(testBytes, "shift_jis");
+
+        if (sjisIsMS932 && !s.equals(expectedMS932))
+            throw new Exception("not MS932");
+        else if (!sjisIsMS932 && !s.equals(expectedSJIS))
+            throw new Exception("not SJIS");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/StreamTimeout.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,137 @@
+/*
+ * 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 4521942
+ * @summary Ensure that InputStreamReaders work properly
+ *          when the underlying byte stream times out
+ */
+
+import java.net.*;
+import java.io.*;
+
+
+public class StreamTimeout {
+
+    private static PrintStream log = System.err;
+
+    private static String charset = "US-ASCII";
+
+    private static Object lock = new Object();
+    private static synchronized void waitABit(int millisec) {
+        synchronized(lock) {
+            try {
+                lock.wait(millisec);
+            } catch (InterruptedException e) {
+                //ignore
+            }
+        }
+    }
+
+    private static class Client extends Thread {
+        public void run() {
+            try {
+                Socket so = new Socket("127.0.0.1", 22222);
+                Writer wr = new OutputStreamWriter(so.getOutputStream(),
+                                                   charset);
+                wr.write("ab");
+                wr.flush();
+            } catch (IOException x) {
+                log.print("Unexpected exception in writer: ");
+                x.printStackTrace();
+                System.exit(1);
+            }
+        }
+    }
+
+    private static void gobble(InputStream is, Reader rd,
+                               int ec, boolean force)
+        throws Exception
+    {
+        int a = is.available();
+        boolean r = rd.ready();
+        log.print("" + a + " bytes available, "
+                  + "reader " + (r ? "" : "not ") + "ready");
+        if (!r && !force) {
+            log.println();
+            return;
+        }
+        int c;
+        try {
+            c = rd.read();
+        } catch (InterruptedIOException x) {
+            log.println();
+            throw x;
+        }
+        log.println(", read() ==> "
+                    + (c >= 0 ? ("'" + (char)c + "'" ): "EOF"));
+        if (c != ec)
+            throw new Exception("Incorrect value read: Expected "
+                                + ec + ", read " + (char)c);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (args.length > 0)
+            charset = args[0];
+
+        ServerSocket ss = new ServerSocket(22222);
+        Thread cl = new Client();
+        cl.start();
+        Socket s = ss.accept();
+        s.setSoTimeout(150);
+        InputStream is = s.getInputStream();
+        Reader rd = new InputStreamReader(is, charset);
+
+        while (is.available() <= 0)
+            Thread.yield();
+
+        gobble(is, rd, 'a', false);
+        gobble(is, rd, 'b', false);
+        gobble(is, rd, -1, false);
+
+        boolean caught = false;
+        try {
+            gobble(is, rd, -1, true);
+        } catch (InterruptedIOException e) {
+            log.println("Read timed out, as expected");
+            caught = true;
+        }
+        if (!caught) {
+            log.println("Read did not time out, test inapplicable");
+            return;
+        }
+
+        caught = false;
+        try {
+            gobble(is, rd, -1, true);
+        } catch (InterruptedIOException x) {
+            log.println("Second read timed out, as expected");
+            caught = true;
+        }
+        if (!caught)
+            throw new Exception("Second read completed");
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/Surrogate.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+public class Surrogate {
+
+    public static final int UCS4_SURROGATE_MIN = 0x10000;
+    public static final int UCS4_MAX = (1 << 20) + UCS4_SURROGATE_MIN - 1;
+
+    // UTF-16 surrogate-character ranges
+    //
+    public static final char MIN_HIGH = '\uD800';
+    public static final char MAX_HIGH = '\uDBFF';
+    public static final char MIN_LOW  = '\uDC00';
+    public static final char MAX_LOW  = '\uDFFF';
+    public static final char MIN = MIN_HIGH;
+    public static final char MAX = MAX_LOW;
+
+    public static boolean neededFor(int uc) {
+        return (uc >= UCS4_SURROGATE_MIN) && (uc <= UCS4_MAX);
+    }
+
+    public static boolean isHigh(int c) {
+        return (MIN_HIGH <= c) && (c <= MAX_HIGH);
+    }
+
+    static char high(int uc) {
+        return (char)(0xd800 | (((uc - UCS4_SURROGATE_MIN) >> 10) & 0x3ff));
+    }
+
+    public static boolean isLow(int c) {
+        return (MIN_LOW <= c) && (c <= MAX_LOW);
+    }
+
+    static char low(int uc) {
+        return (char)(0xdc00 | ((uc - UCS4_SURROGATE_MIN) & 0x3ff));
+    }
+
+    public static boolean is(int c) {
+        return (MIN <= c) && (c <= MAX);
+    }
+
+    static int toUCS4(char c, char d) {
+        return (((c & 0x3ff) << 10) | (d & 0x3ff)) + 0x10000;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/Surrogates.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,90 @@
+/*
+ * 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 Check that array-crossing surrogate pairs are handled properly
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+
+public class Surrogates {
+
+    static PrintStream log = System.err;
+
+    static char[] input;
+    static byte[] output;
+
+    static final int LEN = 128;
+
+    static void initData() throws IOException {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < LEN; i++) {
+            int c = Surrogate.UCS4_SURROGATE_MIN + 1;
+            sb.append(Surrogate.high(c));
+            sb.append(Surrogate.low(c));
+        }
+        input = sb.toString().toCharArray();
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        OutputStreamWriter osw
+            = new OutputStreamWriter(bos, Charset.forName("UTF-8"));
+        osw.write(input);
+        osw.close();
+        output = bos.toByteArray();
+    }
+
+    static void testLeftovers(boolean doMalformed)
+        throws Exception
+    {
+        log.print("Leftover surrogates, doMalformed = " + doMalformed);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        OutputStreamWriter osw
+            = new OutputStreamWriter(bos, Charset.forName("UTF-8"));
+        for (int i = 0; i < input.length; i += 7)
+            osw.write(input, i, Math.min(input.length - i, 7));
+        if (doMalformed)
+            osw.write(input, 0, 1);
+        osw.close();
+        byte[] result = bos.toByteArray();
+
+        // Ignore a trailing '?' if we wrote a malformed final surrogate
+        int rl = result.length + (doMalformed ? -1 : 0);
+
+        if (rl != output.length)
+            throw new Exception("Incorrect result length "
+                                + rl + ", expected " + output.length);
+        for (int i = 0; i < output.length; i++)
+            if (result[i] != output[i])
+                throw new Exception("Unexpected result value at index " + i);
+        log.println(": Passed");
+    }
+
+    public static void main(String[] args) throws Exception {
+        initData();
+        testLeftovers(false);
+        testLeftovers(true);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/Util.java	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+
+public class Util {
+
+    private Util() { }
+
+    // Returns -1 if equal, o.w. returns index of first difference
+    //
+    public static int cmp(byte[] ba, byte[] bb) {
+        int n = Math.min(ba.length, bb.length);
+        for (int i = 0; i < n; i++) {
+            if ((i >= ba.length) || (i >= bb.length))
+                return i;
+            if (ba[i] != bb[i])
+                return i;
+        }
+        if (ba.length != bb.length)
+            return 0;
+        return -1;
+    }
+
+    // Returns -1 if equal, o.w. returns index of first difference
+    //
+    public static int cmp(char[] ca, char[] cb) {
+        int n = Math.min(ca.length, cb.length);
+        for (int i = 0; i < n; i++) {
+            if ((i >= ca.length) || (i >= cb.length))
+                return i;
+            if (ca[i] != cb[i])
+                return i;
+        }
+        if (ca.length != cb.length)
+            return 0;
+        return -1;
+    }
+
+    public static String toString(byte[] ba, int off, int len) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = off; i < off + len; i++) {
+            int c = ba[i];
+            if (c == '\\') {
+                sb.append("\\\\");
+                continue;
+            }
+            if ((c >= ' ') && (c < 0x7f)) {
+                sb.append((char)c);
+                continue;
+            }
+            sb.append("\\x");
+            sb.append(Integer.toHexString(c & 0xff));
+        }
+        return sb.toString();
+    }
+
+    public static String toString(byte[] ba) {
+        return toString(ba, 0, ba.length);
+    }
+
+    public static String toString(char[] ca, int off, int len) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = off; i < off + len; i++) {
+            char c = ca[i];
+            if (c == '\\') {
+                sb.append("\\\\");
+                continue;
+            }
+            if ((c >= ' ') && (c < 0x7f)) {
+                sb.append(c);
+                continue;
+            }
+            sb.append("\\u");
+            String s = Integer.toHexString(c);
+            while (s.length() < 4)
+                s = "0" + s;
+            sb.append(s);
+        }
+        return sb.toString();
+    }
+
+    public static String toString(char[] ca) {
+        return toString(ca, 0, ca.length);
+    }
+
+    public static String toString(String s) {
+        return toString(s.toCharArray());
+    }
+
+    public static String toString(char c) {
+        return toString(new char[]{ c });
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/charset/coders/ref.shift_jis	Mon Feb 08 23:59:22 2010 -0800
@@ -0,0 +1,7072 @@
+0 00
+1 01
+2 02
+3 03
+4 04
+5 05
+6 06
+7 07
+8 08
+9 09
+a 0a
+b 0b
+c 0c
+d 0d
+e 0e
+f 0f
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+1a 1a
+1b 1b
+1c 1c
+1d 1d
+1e 1e
+1f 1f
+20 20
+21 21
+22 22
+23 23
+24 24
+25 25
+26 26
+27 27
+28 28
+29 29
+2a 2a
+2b 2b
+2c 2c
+2d 2d
+2e 2e
+2f 2f
+30 30
+31 31
+32 32
+33 33
+34 34
+35 35
+36 36
+37 37
+38 38
+39 39
+3a 3a
+3b 3b
+3c 3c
+3d 3d
+3e 3e
+3f 3f
+40 40
+41 41
+42 42
+43 43
+44 44
+45 45
+46 46
+47 47
+48 48
+49 49
+4a 4a
+4b 4b
+4c 4c
+4d 4d
+4e 4e
+4f 4f
+50 50
+51 51
+52 52
+53 53
+54 54
+55 55
+56 56
+57 57
+58 58
+59 59
+5a 5a
+5b 5b
+5c 5c
+5d 5d
+5e 5e
+5f 5f
+60 60
+61 61
+62 62
+63 63
+64 64
+65 65
+66 66
+67 67
+68 68
+69 69
+6a 6a
+6b 6b
+6c 6c
+6d 6d
+6e 6e
+6f 6f
+70 70
+71 71
+72 72
+73 73
+74 74
+75 75
+76 76
+77 77
+78 78
+79 79
+7a 7a
+7b 7b
+7c 7c
+7d 7d
+7e 7e
+7f 7f
+a2 8191
+a3 8192
+#a5 5c
+a7 8198
+a8 814e
+ac 81ca
+b0 818b
+b1 817d
+b4 814c
+b6 81f7
+d7 817e
+f7 8180
+391 839f
+392 83a0
+393 83a1
+394 83a2
+395 83a3
+396 83a4
+397 83a5
+398 83a6
+399 83a7
+39a 83a8
+39b 83a9
+39c 83aa
+39d 83ab
+39e 83ac
+39f 83ad
+3a0 83ae
+3a1 83af
+3a3 83b0
+3a4 83b1
+3a5 83b2
+3a6 83b3
+3a7 83b4
+3a8 83b5
+3a9 83b6
+3b1 83bf
+3b2 83c0
+3b3 83c1
+3b4 83c2
+3b5 83c3
+3b6 83c4
+3b7 83c5
+3b8 83c6
+3b9 83c7
+3ba 83c8
+3bb 83c9
+3bc 83ca
+3bd 83cb
+3be 83cc
+3bf 83cd
+3c0 83ce
+3c1 83cf
+3c3 83d0
+3c4 83d1
+3c5 83d2
+3c6 83d3
+3c7 83d4
+3c8 83d5
+3c9 83d6
+401 8446
+410 8440
+411 8441
+412 8442
+413 8443
+414 8444
+415 8445
+416 8447
+417 8448
+418 8449
+419 844a
+41a 844b
+41b 844c
+41c 844d
+41d 844e
+41e 844f
+41f 8450
+420 8451
+421 8452
+422 8453
+423 8454
+424 8455
+425 8456
+426 8457
+427 8458
+428 8459
+429 845a
+42a 845b
+42b 845c
+42c 845d
+42d 845e
+42e 845f
+42f 8460
+430 8470
+431 8471
+432 8472
+433 8473
+434 8474
+435 8475
+436 8477
+437 8478
+438 8479
+439 847a
+43a 847b
+43b 847c
+43c 847d
+43d 847e
+43e 8480
+43f 8481
+440 8482
+441 8483
+442 8484
+443 8485
+444 8486
+445 8487
+446 8488
+447 8489
+448 848a
+449 848b
+44a 848c
+44b 848d
+44c 848e
+44d 848f
+44e 8490
+44f 8491
+451 8476
+2010 815d
+2014 815c
+2016 8161
+2018 8165
+2019 8166
+201c 8167
+201d 8168
+2020 81f5
+2021 81f6
+2025 8164
+2026 8163
+2030 81f1
+2032 818c
+2033 818d
+203b 81a6
+#203e 7e
+2103 818e
+212b 81f0
+2190 81a9
+2191 81aa
+2192 81a8
+2193 81ab
+21d2 81cb
+21d4 81cc
+2200 81cd
+2202 81dd
+2203 81ce
+2207 81de
+2208 81b8
+220b 81b9
+2212 817c
+221a 81e3
+221d 81e5
+221e 8187
+2220 81da
+2227 81c8
+2228 81c9
+2229 81bf
+222a 81be
+222b 81e7
+222c 81e8
+2234 8188
+2235 81e6
+223d 81e4
+2252 81e0
+2260 8182
+2261 81df
+2266 8185
+2267 8186
+226a 81e1
+226b 81e2
+2282 81bc
+2283 81bd
+2286 81ba
+2287 81bb
+22a5 81db
+2312 81dc
+2500 849f
+2501 84aa
+2502 84a0
+2503 84ab
+250c 84a1
+250f 84ac
+2510 84a2
+2513 84ad
+2514 84a4
+2517 84af
+2518 84a3
+251b 84ae
+251c 84a5
+251d 84ba
+2520 84b5
+2523 84b0
+2524 84a7
+2525 84bc
+2528 84b7
+252b 84b2
+252c 84a6
+252f 84b6
+2530 84bb
+2533 84b1
+2534 84a8
+2537 84b8
+2538 84bd
+253b 84b3
+253c 84a9
+253f 84b9
+2542 84be
+254b 84b4
+25a0 81a1
+25a1 81a0
+25b2 81a3
+25b3 81a2
+25bc 81a5
+25bd 81a4
+25c6 819f
+25c7 819e
+25cb 819b
+25ce 819d
+25cf 819c
+25ef 81fc
+2605 819a
+2606 8199
+2640 818a
+2642 8189
+266a 81f4
+266d 81f3
+266f 81f2
+3000 8140
+3001 8141
+3002 8142
+3003 8156
+3005 8158
+3006 8159
+3007 815a
+3008 8171
+3009 8172
+300a 8173
+300b 8174
+300c 8175
+300d 8176
+300e 8177
+300f 8178
+3010 8179
+3011 817a
+3012 81a7
+3013 81ac
+3014 816b
+3015 816c
+301c 8160
+3041 829f
+3042 82a0
+3043 82a1
+3044 82a2
+3045 82a3
+3046 82a4
+3047 82a5
+3048 82a6
+3049 82a7
+304a 82a8
+304b 82a9
+304c 82aa
+304d 82ab
+304e 82ac
+304f 82ad
+3050 82ae
+3051 82af
+3052 82b0
+3053 82b1
+3054 82b2
+3055 82b3
+3056 82b4
+3057 82b5
+3058 82b6
+3059 82b7
+305a 82b8
+305b 82b9
+305c 82ba
+305d 82bb
+305e 82bc
+305f 82bd
+3060 82be
+3061 82bf
+3062 82c0
+3063 82c1
+3064 82c2
+3065 82c3
+3066 82c4
+3067 82c5
+3068 82c6
+3069 82c7
+306a 82c8
+306b 82c9
+306c 82ca
+306d 82cb
+306e 82cc
+306f 82cd
+3070 82ce
+3071 82cf
+3072 82d0
+3073 82d1
+3074 82d2
+3075 82d3
+3076 82d4
+3077 82d5
+3078 82d6
+3079 82d7
+307a 82d8
+307b 82d9
+307c 82da
+307d 82db
+307e 82dc
+307f 82dd
+3080 82de
+3081 82df
+3082 82e0
+3083 82e1
+3084 82e2
+3085 82e3
+3086 82e4
+3087 82e5
+3088 82e6
+3089 82e7
+308a 82e8
+308b 82e9
+308c 82ea
+308d 82eb
+308e 82ec
+308f 82ed
+3090 82ee
+3091 82ef
+3092 82f0
+3093 82f1
+309b 814a
+309c 814b
+309d 8154
+309e 8155
+30a1 8340
+30a2 8341
+30a3 8342
+30a4 8343
+30a5 8344
+30a6 8345
+30a7 8346
+30a8 8347
+30a9 8348
+30aa 8349
+30ab 834a
+30ac 834b
+30ad 834c
+30ae 834d
+30af 834e
+30b0 834f
+30b1 8350
+30b2 8351
+30b3 8352
+30b4 8353
+30b5 8354
+30b6 8355
+30b7 8356
+30b8 8357
+30b9 8358
+30ba 8359
+30bb 835a
+30bc 835b
+30bd 835c
+30be 835d
+30bf 835e
+30c0 835f
+30c1 8360
+30c2 8361
+30c3 8362
+30c4 8363
+30c5 8364
+30c6 8365
+30c7 8366
+30c8 8367
+30c9 8368
+30ca 8369
+30cb 836a
+30cc 836b
+30cd 836c
+30ce 836d
+30cf 836e
+30d0 836f
+30d1 8370
+30d2 8371
+30d3 8372
+30d4 8373
+30d5 8374
+30d6 8375
+30d7 8376
+30d8 8377
+30d9 8378
+30da 8379
+30db 837a
+30dc 837b
+30dd 837c
+30de 837d
+30df 837e
+30e0 8380
+30e1 8381
+30e2 8382
+30e3 8383
+30e4 8384
+30e5 8385
+30e6 8386
+30e7 8387
+30e8 8388
+30e9 8389
+30ea 838a
+30eb 838b
+30ec 838c
+30ed 838d
+30ee 838e
+30ef 838f
+30f0 8390
+30f1 8391
+30f2 8392
+30f3 8393
+30f4 8394
+30f5 8395
+30f6 8396
+30fb 8145
+30fc 815b
+30fd 8152
+30fe 8153
+4e00 88ea
+4e01 929a
+4e03 8eb5
+4e07 969c
+4e08 8fe4
+4e09 8e4f
+4e0a 8fe3
+4e0b 89ba
+4e0d 9573
+4e0e 975e
+4e10 98a0
+4e11 894e
+4e14 8a8e
+4e15 98a1
+4e16 90a2
+4e17 99c0
+4e18 8b75
+4e19 95b8
+4e1e 8fe5
+4e21 97bc
+4e26 95c0
+4e2a 98a2
+4e2d 9286
+4e31 98a3
+4e32 8bf8
+4e36 98a4
+4e38 8adb
+4e39 924f
+4e3b 8ee5
+4e3c 98a5
+4e3f 98a6
+4e42 98a7
+4e43 9454
+4e45 8b76
+4e4b 9456
+4e4d 93e1
+4e4e 8cc1
+4e4f 9652
+4e55 e568
+4e56 98a8
+4e57 8fe6
+4e58 98a9
+4e59 89b3
+4e5d 8be3
+4e5e 8cee
+4e5f 96e7
+4e62 9ba4
+4e71 9790
+4e73 93fb
+4e7e 8aa3
+4e80 8b54
+4e82 98aa
+4e85 98ab
+4e86 97b9
+4e88 975c
+4e89 9188
+4e8a 98ad
+4e8b 8e96
+4e8c 93f1
+4e8e 98b0
+4e91 895d
+4e92 8cdd
+4e94 8cdc
+4e95 88e4
+4e98 986a
+4e99 9869
+4e9b 8db1
+4e9c 889f
+4e9e 98b1
+4e9f 98b2
+4ea0 98b3
+4ea1 9653
+4ea2 98b4
+4ea4 8cf0
+4ea5 88e5
+4ea6 9692
+4ea8 8b9c
+4eab 8b9d
+4eac 8b9e
+4ead 92e0
+4eae 97ba
+4eb0 98b5
+4eb3 98b6
+4eb6 98b7
+4eba 906c
+4ec0 8f59
+4ec1 906d
+4ec2 98bc
+4ec4 98ba
+4ec6 98bb
+4ec7 8b77
+4eca 8da1
+4ecb 89ee
+4ecd 98b9
+4ece 98b8
+4ecf 95a7
+4ed4 8e65
+4ed5 8e64
+4ed6 91bc
+4ed7 98bd
+4ed8 9574
+4ed9 90e5
+4edd 8157
+4ede 98be
+4edf 98c0
+4ee3 91e3
+4ee4 97df
+4ee5 88c8
+4eed 98bf
+4eee 89bc
+4ef0 8bc2
+4ef2 9287
+4ef6 8c8f
+4ef7 98c1
+4efb 9443
+4f01 8ae9
+4f09 98c2
+4f0a 88c9
+4f0d 8cde
+4f0e 8aea
+4f0f 959a
+4f10 94b0
+4f11 8b78
+4f1a 89ef
+4f1c 98e5
+4f1d 9360
+4f2f 948c
+4f30 98c4
+4f34 94ba
+4f36 97e0
+4f38 904c
+4f3a 8e66
+4f3c 8e97
+4f3d 89be
+4f43 92cf
+4f46 9241
+4f47 98c8
+4f4d 88ca
+4f4e 92e1
+4f4f 8f5a
+4f50 8db2
+4f51 9743
+4f53 91cc
+4f55 89bd
+4f57 98c7
+4f59 975d
+4f5a 98c3
+4f5b 98c5
+4f5c 8dec
+4f5d 98c6
+4f5e 9b43
+4f69 98ce
+4f6f 98d1
+4f70 98cf
+4f73 89c0
+4f75 95b9
+4f76 98c9
+4f7b 98cd
+4f7c 8cf1
+4f7f 8e67
+4f83 8aa4
+4f86 98d2
+4f88 98ca
+4f8b 97e1
+4f8d 8e98
+4f8f 98cb
+4f91 98d0
+4f96 98d3
+4f98 98cc
+4f9b 8b9f
+4f9d 88cb
+4fa0 8ba0
+4fa1 89bf
+4fab 9b44
+4fad 9699
+4fae 958e
+4faf 8cf2
+4fb5 904e
+4fb6 97b5
+4fbf 95d6
+4fc2 8c57
+4fc3 91a3
+4fc4 89e2
+4fca 8f72
+4fce 98d7
+4fd0 98dc
+4fd1 98da
+4fd4 98d5
+4fd7 91ad
+4fd8 98d8
+4fda 98db
+4fdb 98d9
+4fdd 95db
+4fdf 98d6
+4fe1 904d
+4fe3 9693
+4fe4 98dd
+4fe5 98de
+4fee 8f43
+4fef 98eb
+4ff3 946f
+4ff5 9555
+4ff6 98e6
+4ff8 95ee
+4ffa 89b4
+4ffe 98ea
+5005 98e4
+5006 98ed
+5009 9171
+500b 8cc2
+500d 947b
+500f e0c5
+5011 98ec
+5012 937c
+5014 98e1
+5016 8cf4
+5019 8cf3
+501a 98df
+501f 8ed8
+5021 98e7
+5023 95ed
+5024 926c
+5025 98e3
+5026 8c91
+5028 98e0
+5029 98e8
+502a 98e2
+502b 97cf
+502c 98e9
+502d 9860
+5036 8be4
+5039 8c90
+5043 98ee
+5047 98ef
+5048 98f3
+5049 88cc
+504f 95ce
+5050 98f2
+5055 98f1
+5056 98f5
+505a 98f4
+505c 92e2
+5065 8c92
+506c 98f6
+5072 8ec3
+5074 91a4
+5075 92e3
+5076 8bf4
+5078 98f7
+507d 8b55
+5080 98f8
+5085 98fa
+508d 9654
+5091 8c86
+5098 8e50
+5099 94f5
+509a 98f9
+50ac 8dc3
+50ad 9762
+50b2 98fc
+50b3 9942
+50b4 98fb
+50b5 8dc2
+50b7 8f9d
+50be 8c58
+50c2 9943
+50c5 8bcd
+50c9 9940
+50ca 9941
+50cd 93ad
+50cf 919c
+50d1 8ba1
+50d5 966c
+50d6 9944
+50da 97bb
+50de 9945
+50e3 9948
+50e5 9946
+50e7 916d
+50ed 9947
+50ee 9949
+50f5 994b
+50f9 994a
+50fb 95c6
+5100 8b56
+5101 994d
+5102 994e
+5104 89ad
+5109 994c
+5112 8ef2
+5114 9951
+5115 9950
+5116 994f
+5118 98d4
+511a 9952
+511f 8f9e
+5121 9953
+512a 9744
+5132 96d7
+5137 9955
+513a 9954
+513b 9957
+513c 9956
+513f 9958
+5140 9959
+5141 88f2
+5143 8cb3
+5144 8c5a
+5145 8f5b
+5146 929b
+5147 8ba2
+5148 90e6
+5149 8cf5
+514b 8d8e
+514c 995b
+514d 96c6
+514e 9365
+5150 8e99
+5152 995a
+5154 995c
+515a 937d
+515c 8a95
+5162 995d
+5165 93fc
+5168 9153
+5169 995f
+516a 9960
+516b 94aa
+516c 8cf6
+516d 985a
+516e 9961
+5171 8ba4
+5175 95ba
+5176 91b4
+5177 8bef
+5178 9354
+517c 8c93
+5180 9962
+5182 9963
+5185 93e0
+5186 897e
+5189 9966
+518a 8dfb
+518c 9965
+518d 8dc4
+518f 9967
+5190 e3ec
+5191 9968
+5192 9660
+5193 9969
+5195 996a
+5196 996b
+5197 8fe7
+5199 8eca
+51a0 8aa5
+51a2 996e
+51a4 996c
+51a5 96bb
+51a6 996d
+51a8 9579
+51a9 996f
+51aa 9970
+51ab 9971
+51ac 937e
+51b0 9975
+51b1 9973
+51b2 9974
+51b3 9972
+51b4 8de1
+51b5 9976
+51b6 96e8
+51b7 97e2
+51bd 9977
+51c4 90a6
+51c5 9978
+51c6 8f79
+51c9 9979
+51cb 929c
+51cc 97bd
+51cd 9380
+51d6 99c3
+51db 997a
+51dc eaa3
+51dd 8bc3
+51e0 997b
+51e1 967d
+51e6 8f88
+51e7 91fa
+51e9 997d
+51ea 93e2
+51ed 997e
+51f0 9980
+51f1 8a4d
+51f5 9981
+51f6 8ba5
+51f8 93ca
+51f9 899a
+51fa 8f6f
+51fd 949f
+51fe 9982
+5200 9381
+5203 906e
+5204 9983
+5206 95aa
+5207 90d8
+5208 8aa0
+520a 8aa7
+520b 9984
+520e 9986
+5211 8c59
+5214 9985
+5217 97f1
+521d 8f89
+5224 94bb
+5225 95ca
+5227 9987
+5229 9798
+522a 9988
+522e 9989
+5230 939e
+5233 998a
+5236 90a7
+5237 8dfc
+5238 8c94
+5239 998b
+523a 8e68
+523b 8d8f
+5243 92e4
+5244 998d
+5247 91a5
+524a 8ded
+524b 998e
+524c 998f
+524d 914f
+524f 998c
+5254 9991
+5256 9655
+525b 8d84
+525e 9990
+5263 8c95
+5264 8ddc
+5265 948d
+5269 9994
+526a 9992
+526f 959b
+5270 8fe8
+5271 999b
+5272 8a84
+5273 9995
+5274 9993
+5275 916e
+527d 9997
+527f 9996
+5283 8a63
+5287 8c80
+5288 999c
+5289 97ab
+528d 9998
+5291 999d
+5292 999a
+5294 9999
+529b 97cd
+529f 8cf7
+52a0 89c1
+52a3 97f2
+52a9 8f95
+52aa 9377
+52ab 8d85
+52ac 99a0
+52ad 99a1
+52b1 97e3
+52b4 984a
+52b5 99a3
+52b9 8cf8
+52bc 99a2
+52be 8a4e
+52c1 99a4
+52c3 9675
+52c5 92ba
+52c7 9745
+52c9 95d7
+52cd 99a5
+52d2 e8d3
+52d5 93ae
+52d7 99a6
+52d8 8aa8
+52d9 96b1
+52dd 8f9f
+52de 99a7
+52df 95e5
+52e0 99ab
+52e2 90a8
+52e3 99a8
+52e4 8bce
+52e6 99a9
+52e7 8aa9
+52f2 8c4d
+52f3 99ac
+52f5 99ad
+52f8 99ae
+52f9 99af
+52fa 8ed9
+52fe 8cf9
+52ff 96dc
+5301 96e6
+5302 93f5
+5305 95ef
+5306 99b0
+5308 99b1
+530d 99b3
+530f 99b5
+5310 99b4
+5315 99b6
+5316 89bb
+5317 966b
+5319 8dfa
+531a 99b7
+531d 9178
+5320 8fa0
+5321 8ba7
+5323 99b8
+532a 94d9
+532f 99b9
+5331 99ba
+5333 99bb
+5338 99bc
+5339 9543
+533a 8be6
+533b 88e3
+533f 93bd
+5340 99bd
+5341 8f5c
+5343 90e7
+5345 99bf
+5346 99be
+5347 8fa1
+5348 8cdf
+5349 99c1
+534a 94bc
+534d 99c2
+5351 94da
+5352 91b2
+5353 91ec
+5354 8ba6
+5357 93ec
+5358 9250
+535a 948e
+535c 966d
+535e 99c4
+5360 90e8
+5366 8c54
+5369 99c5
+536e 99c6
+536f 894b
+5370 88f3
+5371 8aeb
+5373 91a6
+5374 8b70
+5375 9791
+5377 99c9
+5378 89b5
+537b 99c8
+537f 8ba8
+5382 99ca
+5384 96ef
+5396 99cb
+5398 97d0
+539a 8cfa
+539f 8cb4
+53a0 99cc
+53a5 99ce
+53a6 99cd
+53a8 907e
+53a9 8958
+53ad 897d
+53ae 99cf
+53b0 99d0
+53b3 8cb5
+53b6 99d1
+53bb 8b8e
+53c2 8e51
+53c3 99d2
+53c8 9694
+53c9 8db3
+53ca 8b79
+53cb 9746
+53cc 916f
+53cd 94bd
+53ce 8efb
+53d4 8f66
+53d6 8ee6
+53d7 8ef3
+53d9 8f96
+53db 94be
+53df 99d5
+53e1 8962
+53e2 9170
+53e3 8cfb
+53e4 8cc3
+53e5 8be5
+53e8 99d9
+53e9 9240
+53ea 91fc
+53eb 8ba9
+53ec 8fa2
+53ed 99da
+53ee 99d8
+53ef 89c2
+53f0 91e4
+53f1 8eb6
+53f2 8e6a
+53f3 8945
+53f6 8a90
+53f7 8d86
+53f8 8e69
+53fa 99db
+5401 99dc
+5403 8b68
+5404 8a65
+5408 8d87
+5409 8b67
+540a 92dd
+540b 8944
+540c 93af
+540d 96bc
+540e 8d40
+540f 9799
+5410 9366
+5411 8cfc
+541b 8c4e
+541d 99e5
+541f 8be1
+5420 9669
+5426 94db
+5429 99e4
+542b 8adc
+542c 99df
+542d 99e0
+542e 99e2
+5436 99e3
+5438 8b7a
+5439 9081
+543b 95ab
+543c 99e1
+543d 99dd
+543e 8ce1
+5440 99de
+5442 9843
+5446 95f0
+5448 92e6
+5449 8ce0
+544a 8d90
+544e 99e6
+5451 93db
+545f 99ea
+5468 8efc
+546a 8ef4
+5470 99ed
+5471 99eb
+5473 96a1
+5475 99e8
+5476 99f1
+5477 99ec
+547b 99ef
+547c 8cc4
+547d 96bd
+5480 99f0
+5484 99f2
+5486 99f4
+548b 8dee
+548c 9861
+548e 99e9
+548f 99e7
+5490 99f3
+5492 99ee
+54a2 99f6
+54a4 9a42
+54a5 99f8
+54a8 99fc
+54ab 9a40
+54ac 99f9
+54af 9a5d
+54b2 8de7
+54b3 8a50
+54b8 99f7
+54bc 9a44
+54bd 88f4
+54be 9a43
+54c0 88a3
+54c1 9569
+54c2 9a41
+54c4 99fa
+54c7 99f5
+54c8 99fb
+54c9 8dc6
+54d8 9a45
+54e1 88f5
+54e2 9a4e
+54e5 9a46
+54e6 9a47
+54e8 8fa3
+54e9 9689
+54ed 9a4c
+54ee 9a4b
+54f2 934e
+54fa 9a4d
+54fd 9a4a
+5504 8953
+5506 8db4
+5507 904f
+550f 9a48
+5510 9382
+5514 9a49
+5516 88a0
+552e 9a53
+552f 9742
+5531 8fa5
+5533 9a59
+5538 9a58
+5539 9a4f
+553e 91c1
+5540 9a50
+5544 91ed
+5545 9a55
+5546 8fa4
+554c 9a52
+554f 96e2
+5553 8c5b
+5556 9a56
+5557 9a57
+555c 9a54
+555d 9a5a
+5563 9a51
+557b 9a60
+557c 9a65
+557e 9a61
+5580 9a5c
+5583 9a66
+5584 9150
+5587 9a68
+5589 8d41
+558a 9a5e
+558b 929d
+5598 9a62
+5599 9a5b
+559a 8aab
+559c 8aec
+559d 8a85
+559e 9a63
+559f 9a5f
+55a7 8c96
+55a8 9a69
+55a9 9a67
+55aa 9172
+55ab 8b69
+55ac 8baa
+55ae 9a64
+55b0 8bf2
+55b6 8963
+55c4 9a6d
+55c5 9a6b
+55c7 9aa5
+55d4 9a70
+55da 9a6a
+55dc 9a6e
+55df 9a6c
+55e3 8e6b
+55e4 9a6f
+55f7 9a72
+55f9 9a77
+55fd 9a75
+55fe 9a74
+5606 9251
+5609 89c3
+5614 9a71
+5616 9a73
+5617 8fa6
+5618 8952
+561b 9a76
+5629 89dc
+562f 9a82
+5631 8ffa
+5632 9a7d
+5634 9a7b
+5636 9a7c
+5638 9a7e
+5642 895c
+564c 9158
+564e 9a78
+5650 9a79
+565b 8a9a
+5664 9a81
+5668 8aed
+566a 9a84
+566b 9a80
+566c 9a83
+5674 95ac
+5678 93d3
+567a 94b6
+5680 9a86
+5686 9a85
+5687 8a64
+568a 9a87
+568f 9a8a
+5694 9a89
+56a0 9a88
+56a2 9458
+56a5 9a8b
+56ae 9a8c
+56b4 9a8e
+56b6 9a8d
+56bc 9a90
+56c0 9a93
+56c1 9a91
+56c2 9a8f
+56c3 9a92
+56c8 9a94
+56ce 9a95
+56d1 9a96
+56d3 9a97
+56d7 9a98
+56d8 9964
+56da 8efa
+56db 8e6c
+56de 89f1
+56e0 88f6
+56e3 9263
+56ee 9a99
+56f0 8da2
+56f2 88cd
+56f3 907d
+56f9 9a9a
+56fa 8cc5
+56fd 8d91
+56ff 9a9c
+5700 9a9b
+5703 95de
+5704 9a9d
+5708 9a9f
+5709 9a9e
+570b 9aa0
+570d 9aa1
+570f 8c97
+5712 8980
+5713 9aa2
+5716 9aa4
+5718 9aa3
+571c 9aa6
+571f 9379
+5726 9aa7
+5727 88b3
+5728 8ddd
+572d 8c5c
+5730 926e
+5737 9aa8
+5738 9aa9
+573b 9aab
+5740 9aac
+5742 8de2
+5747 8bcf
+574a 9656
+574e 9aaa
+574f 9aad
+5750 8dbf
+5751 8d42
+5761 9ab1
+5764 8da3
+5766 9252
+5769 9aae
+576a 92d8
+577f 9ab2
+5782 9082
+5788 9ab0
+5789 9ab3
+578b 8c5e
+5793 9ab4
+57a0 9ab5
+57a2 8d43
+57a3 8a5f
+57a4 9ab7
+57aa 9ab8
+57b0 9ab9
+57b3 9ab6
+57c0 9aaf
+57c3 9aba
+57c6 9abb
+57cb 9684
+57ce 8fe9
+57d2 9abd
+57d3 9abe
+57d4 9abc
+57d6 9ac0
+57dc 9457
+57df 88e6
+57e0 9575
+57e3 9ac1
+57f4 8ffb
+57f7 8eb7
+57f9 947c
+57fa 8aee
+57fc 8de9
+5800 9678
+5802 93b0
+5805 8c98
+5806 91cd
+580a 9abf
+580b 9ac2
+5815 91c2
+5819 9ac3
+581d 9ac4
+5821 9ac6
+5824 92e7
+582a 8aac
+582f ea9f
+5830 8981
+5831 95f1
+5834 8fea
+5835 9367
+583a 8de4
+583d 9acc
+5840 95bb
+5841 97db
+584a 89f2
+584b 9ac8
+5851 9159
+5852 9acb
+5854 9383
+5857 9368
+5858 9384
+5859 94b7
+585a 92cb
+585e 8dc7
+5862 9ac7
+5869 8996
+586b 9355
+5870 9ac9
+5872 9ac5
+5875 906f
+5879 9acd
+587e 8f6d
+5883 8bab
+5885 9ace
+5893 95e6
+5897 919d
+589c 92c4
+589f 9ad0
+58a8 966e
+58ab 9ad1
+58ae 9ad6
+58b3 95ad
+58b8 9ad5
+58b9 9acf
+58ba 9ad2
+58bb 9ad4
+58be 8da4
+58c1 95c7
+58c5 9ad7
+58c7 9264
+58ca 89f3
+58cc 8feb
+58d1 9ad9
+58d3 9ad8
+58d5 8d88
+58d7 9ada
+58d8 9adc
+58d9 9adb
+58dc 9ade
+58de 9ad3
+58df 9ae0
+58e4 9adf
+58e5 9add
+58eb 8e6d
+58ec 9070
+58ee 9173
+58ef 9ae1
+58f0 90ba
+58f1 88eb
+58f2 9484
+58f7 92d9
+58f9 9ae3
+58fa 9ae2
+58fb 9ae4
+58fc 9ae5
+58fd 9ae6
+5902 9ae7
+5909 95cf
+590a 9ae8
+590f 89c4
+5910 9ae9
+5915 975b
+5916 8a4f
+5918 99c7
+5919 8f67
+591a 91bd
+591b 9aea
+591c 96e9
+5922 96b2
+5925 9aec
+5927 91e5
+5929 9356
+592a 91be
+592b 9576
+592c 9aed
+592d 9aee
+592e 899b
+5931 8eb8
+5932 9aef
+5937 88ce
+5938 9af0
+593e 9af1
+5944 8982
+5947 8aef
+5948 93de
+5949 95f2
+594e 9af5
+594f 9174
+5950 9af4
+5951 8c5f
+5954 967a
+5955 9af3
+5957 9385
+5958 9af7
+595a 9af6
+5960 9af9
+5962 9af8
+5965 899c
+5967 9afa
+5968 8fa7
+5969 9afc
+596a 9244
+596c 9afb
+596e 95b1
+5973 8f97
+5974 937a
+5978 9b40
+597d 8d44
+5981 9b41
+5982 9440
+5983 94dc
+5984 96cf
+598a 9444
+598d 9b4a
+5993 8b57
+5996 9764
+5999 96ad
+599b 9baa
+599d 9b42
+59a3 9b45
+59a5 91c3
+59a8 9657
+59ac 9369
+59b2 9b46
+59b9 9685
+59bb 8dc8
+59be 8fa8
+59c6 9b47
+59c9 8e6f
+59cb 8e6e
+59d0 88b7
+59d1 8cc6
+59d3 90a9
+59d4 88cf
+59d9 9b4b
+59da 9b4c
+59dc 9b49
+59e5 8957
+59e6 8aad
+59e8 9b48
+59ea 96c3
+59eb 9550
+59f6 88a6
+59fb 88f7
+59ff 8e70
+5a01 88d0
+5a03 88a1
+5a09 9b51
+5a11 9b4f
+5a18 96ba
+5a1a 9b52
+5a1c 9b50
+5a1f 9b4e
+5a20 9050
+5a25 9b4d
+5a29 95d8
+5a2f 8ce2
+5a35 9b56
+5a36 9b57
+5a3c 8fa9
+5a40 9b53
+5a41 984b
+5a46 946b
+5a49 9b55
+5a5a 8da5
+5a62 9b58
+5a66 9577
+5a6a 9b59
+5a6c 9b54
+5a7f 96b9
+5a92 947d
+5a9a 9b5a
+5a9b 9551
+5abc 9b5b
+5abd 9b5f
+5abe 9b5c
+5ac1 89c5
+5ac2 9b5e
+5ac9 8eb9
+5acb 9b5d
+5acc 8c99
+5ad0 9b6b
+5ad6 9b64
+5ad7 9b61
+5ae1 9284
+5ae3 9b60
+5ae6 9b62
+5ae9 9b63
+5afa 9b65
+5afb 9b66
+5b09 8af0
+5b0b 9b68
+5b0c 9b67
+5b16 9b69
+5b22 8fec
+5b2a 9b6c
+5b2c 92da
+5b30 8964
+5b32 9b6a
+5b36 9b6d
+5b3e 9b6e
+5b40 9b71
+5b43 9b6f
+5b45 9b70
+5b50 8e71
+5b51 9b72
+5b54 8d45
+5b55 9b73
+5b57 8e9a
+5b58 91b6
+5b5a 9b74
+5b5b 9b75
+5b5c 8e79
+5b5d 8d46
+5b5f 96d0
+5b63 8b47
+5b64 8cc7
+5b65 9b76
+5b66 8a77
+5b69 9b77
+5b6b 91b7
+5b70 9b78
+5b71 9ba1
+5b73 9b79
+5b75 9b7a
+5b78 9b7b
+5b7a 9b7d
+5b80 9b7e
+5b83 9b80
+5b85 91ee
+5b87 8946
+5b88 8ee7
+5b89 88c0
+5b8b 9176
+5b8c 8aae
+5b8d 8eb3
+5b8f 8d47
+5b95 9386
+5b97 8f40
+5b98 8aaf
+5b99 9288
+5b9a 92e8
+5b9b 88b6
+5b9c 8b58
+5b9d 95f3
+5b9f 8ec0
+5ba2 8b71
+5ba3 90e9
+5ba4 8eba
+5ba5 9747
+5ba6 9b81
+5bae 8b7b
+5bb0 8dc9
+5bb3 8a51
+5bb4 8983
+5bb5 8faa
+5bb6 89c6
+5bb8 9b82
+5bb9 9765
+5bbf 8f68
+5bc2 8ee2
+5bc3 9b83
+5bc4 8af1
+5bc5 93d0
+5bc6 96a7
+5bc7 9b84
+5bc9 9b85
+5bcc 9578
+5bd0 9b87
+5bd2 8aa6
+5bd3 8bf5
+5bd4 9b86
+5bdb 8ab0
+5bdd 9051
+5bde 9b8b
+5bdf 8e40
+5be1 89c7
+5be2 9b8a
+5be4 9b88
+5be5 9b8c
+5be6 9b89
+5be7 944a
+5be8 9ecb
+5be9 9052
+5beb 9b8d
+5bee 97be
+5bf0 9b8e
+5bf3 9b90
+5bf5 929e
+5bf6 9b8f
+5bf8 90a1
+5bfa 8e9b
+5bfe 91ce
+5bff 8ef5
+5c01 9595
+5c02 90ea
+5c04 8ecb
+5c05 9b91
+5c06 8fab
+5c07 9b92
+5c08 9b93
+5c09 88d1
+5c0a 91b8
+5c0b 9071
+5c0d 9b94
+5c0e 93b1
+5c0f 8fac
+5c11 8fad
+5c13 9b95
+5c16 90eb
+5c1a 8fae
+5c20 9b96
+5c22 9b97
+5c24 96de
+5c28 9b98
+5c2d 8bc4
+5c31 8f41
+5c38 9b99
+5c39 9b9a
+5c3a 8eda
+5c3b 904b
+5c3c 93f2
+5c3d 9073
+5c3e 94f6
+5c3f 9441
+5c40 8bc7
+5c41 9b9b
+5c45 8b8f
+5c46 9b9c
+5c48 8bfc
+5c4a 93cd
+5c4b 89ae
+5c4d 8e72
+5c4e 9b9d
+5c4f 9ba0
+5c50 9b9f
+5c51 8bfb
+5c53 9b9e
+5c55 9357
+5c5e 91ae
+5c60 936a
+5c61 8ec6
+5c64 9177
+5c65 979a
+5c6c 9ba2
+5c6e 9ba3
+5c6f 93d4
+5c71 8e52
+5c76 9ba5
+5c79 9ba6
+5c8c 9ba7
+5c90 8af2
+5c91 9ba8
+5c94 9ba9
+5ca1 89aa
+5ca8 915a
+5ca9 8ae2
+5cab 9bab
+5cac 96a6
+5cb1 91d0
+5cb3 8a78
+5cb6 9bad
+5cb7 9baf
+5cb8 8add
+5cbb 9bac
+5cbc 9bae
+5cbe 9bb1
+5cc5 9bb0
+5cc7 9bb2
+5cd9 9bb3
+5ce0 93bb
+5ce1 8bac
+5ce8 89e3
+5ce9 9bb4
+5cea 9bb9
+5ced 9bb7
+5cef 95f5
+5cf0 95f4
+5cf6 9387
+5cfa 9bb6
+5cfb 8f73
+5cfd 9bb5
+5d07 9092
+5d0b 9bba
+5d0e 8de8
+5d11 9bc0
+5d14 9bc1
+5d15 9bbb
+5d16 8a52
+5d17 9bbc
+5d18 9bc5
+5d19 9bc4
+5d1a 9bc3
+5d1b 9bbf
+5d1f 9bbe
+5d22 9bc2
+5d29 95f6
+5d4b 9bc9
+5d4c 9bc6
+5d4e 9bc8
+5d50 9792
+5d52 9bc7
+5d5c 9bbd
+5d69 9093
+5d6c 9bca
+5d6f 8db5
+5d73 9bcb
+5d76 9bcc
+5d82 9bcf
+5d84 9bce
+5d87 9bcd
+5d8b 9388
+5d8c 9bb8
+5d90 9bd5
+5d9d 9bd1
+5da2 9bd0
+5dac 9bd2
+5dae 9bd3
+5db7 9bd6
+5dba 97e4
+5dbc 9bd7
+5dbd 9bd4
+5dc9 9bd8
+5dcc 8ade
+5dcd 9bd9
+5dd2 9bdb
+5dd3 9bda
+5dd6 9bdc
+5ddb 9bdd
+5ddd 90ec
+5dde 8f42
+5de1 8f84
+5de3 9183
+5de5 8d48
+5de6 8db6
+5de7 8d49
+5de8 8b90
+5deb 9bde
+5dee 8db7
+5df1 8cc8
+5df2 9bdf
+5df3 96a4
+5df4 9462
+5df5 9be0
+5df7 8d4a
+5dfb 8aaa
+5dfd 9246
+5dfe 8bd0
+5e02 8e73
+5e03 957a
+5e06 94bf
+5e0b 9be1
+5e0c 8af3
+5e11 9be4
+5e16 929f
+5e19 9be3
+5e1a 9be2
+5e1b 9be5
+5e1d 92e9
+5e25 9083
+5e2b 8e74
+5e2d 90c8
+5e2f 91d1
+5e30 8b41
+5e33 92a0
+5e36 9be6
+5e37 9be7
+5e38 8fed
+5e3d 9658
+5e40 9bea
+5e43 9be9
+5e44 9be8
+5e45 959d
+5e47 9bf1
+5e4c 9679
+5e4e 9beb
+5e54 9bed
+5e55 968b
+5e57 9bec
+5e5f 9bee
+5e61 94a6
+5e62 9bef
+5e63 95bc
+5e64 9bf0
+5e72 8ab1
+5e73 95bd
+5e74 944e
+5e75 9bf2
+5e76 9bf3
+5e78 8d4b
+5e79 8ab2
+5e7a 9bf4
+5e7b 8cb6
+5e7c 9763
+5e7d 9748
+5e7e 8af4
+5e7f 9bf6
+5e81 92a1
+5e83 8d4c
+5e84 8faf
+5e87 94dd
+5e8a 8fb0
+5e8f 8f98
+5e95 92ea
+5e96 95f7
+5e97 9358
+5e9a 8d4d
+5e9c 957b
+5ea0 9bf7
+5ea6 9378
+5ea7 8dc0
+5eab 8cc9
+5ead 92eb
+5eb5 88c1
+5eb6 8f8e
+5eb7 8d4e
+5eb8 9766
+5ec1 9bf8
+5ec2 9bf9
+5ec3 9470
+5ec8 9bfa
+5ec9 97f5
+5eca 984c
+5ecf 9bfc
+5ed0 9bfb
+5ed3 8a66
+5ed6 9c40
+5eda 9c43
+5edb 9c44
+5edd 9c42
+5edf 955f
+5ee0 8fb1
+5ee1 9c46
+5ee2 9c45
+5ee3 9c41
+5ee8 9c47
+5ee9 9c48
+5eec 9c49
+5ef0 9c4c
+5ef1 9c4a
+5ef3 9c4b
+5ef4 9c4d
+5ef6 8984
+5ef7 92ec
+5ef8 9c4e
+5efa 8c9a
+5efb 89f4
+5efc 9455
+5efe 9c4f
+5eff 93f9
+5f01 95d9
+5f03 9c50
+5f04 984d
+5f09 9c51
+5f0a 95be
+5f0b 9c54
+5f0c 989f
+5f0d 98af
+5f0f 8eae
+5f10 93f3
+5f11 9c55
+5f13 8b7c
+5f14 92a2
+5f15 88f8
+5f16 9c56
+5f17 95a4
+5f18 8d4f
+5f1b 926f
+5f1f 92ed
+5f25 96ed
+5f26 8cb7
+5f27 8cca
+5f29 9c57
+5f2d 9c58
+5f2f 9c5e
+5f31 8ee3
+5f35 92a3
+5f37 8bad
+5f38 9c59
+5f3c 954a
+5f3e 9265
+5f41 9c5a
+5f48 9c5b
+5f4a 8bae
+5f4c 9c5c
+5f4e 9c5d
+5f51 9c5f
+5f53 9396
+5f56 9c60
+5f57 9c61
+5f59 9c62
+5f5c 9c53
+5f5d 9c52
+5f61 9c63
+5f62 8c60
+5f66 9546
+5f69 8dca
+5f6a 9556
+5f6b 92a4
+5f6c 956a
+5f6d 9c64
+5f70 8fb2
+5f71 8965
+5f73 9c65
+5f77 9c66
+5f79 96f0
+5f7c 94de
+5f7f 9c69
+5f80 899d
+5f81 90aa
+5f82 9c68
+5f83 9c67
+5f84 8c61
+5f85 91d2
+5f87 9c6d
+5f88 9c6b
+5f8a 9c6a
+5f8b 97a5
+5f8c 8ce3
+5f90 8f99
+5f91 9c6c
+5f92 936b
+5f93 8f5d
+5f97 93be
+5f98 9c70
+5f99 9c6f
+5f9e 9c6e
+5fa0 9c71
+5fa1 8ce4
+5fa8 9c72
+5fa9 959c
+5faa 8f7a
+5fad 9c73
+5fae 94f7
+5fb3 93bf
+5fb4 92a5
+5fb9 934f
+5fbc 9c74
+5fbd 8b4a
+5fc3 9053
+5fc5 954b
+5fcc 8af5
+5fcd 9445
+5fd6 9c75
+5fd7 8e75
+5fd8 9659
+5fd9 965a
+5fdc 899e
+5fdd 9c7a
+5fe0 9289
+5fe4 9c77
+5feb 89f5
+5ff0 9cab
+5ff1 9c79
+5ff5 944f
+5ff8 9c78
+5ffb 9c76
+5ffd 8d9a
+5fff 9c7c
+600e 9c83
+600f 9c89
+6010 9c81
+6012 937b
+6015 9c86
+6016 957c
+6019 9c80
+601b 9c85
+601c 97e5
+601d 8e76
+6020 91d3
+6021 9c7d
+6025 8b7d
+6026 9c88
+6027 90ab
+6028 8985
+6029 9c82
+602a 89f6
+602b 9c87
+602f 8baf
+6031 9c84
+603a 9c8a
+6041 9c8c
+6042 9c96
+6043 9c94
+6046 9c91
+604a 9c90
+604b 97f6
+604d 9c92
+6050 8bb0
+6052 8d50
+6055 8f9a
+6059 9c99
+605a 9c8b
+605f 9c8f
+6060 9c7e
+6062 89f8
+6063 9c93
+6064 9c95
+6065 9270
+6068 8da6
+6069 89b6
+606a 9c8d
+606b 9c98
+606c 9c97
+606d 8bb1
+606f 91a7
+6070 8a86
+6075 8c62
+6077 9c8e
+6081 9c9a
+6083 9c9d
+6084 9c9f
+6089 8ebb
+608b 9ca5
+608c 92ee
+608d 9c9b
+6092 9ca3
+6094 89f7
+6096 9ca1
+6097 9ca2
+609a 9c9e
+609b 9ca0
+609f 8ce5
+60a0 9749
+60a3 8ab3
+60a6 8978
+60a7 9ca4
+60a9 9459
+60aa 88ab
+60b2 94df
+60b3 9c7b
+60b4 9caa
+60b5 9cae
+60b6 96e3
+60b8 9ca7
+60bc 9389
+60bd 9cac
+60c5 8fee
+60c6 9cad
+60c7 93d5
+60d1 9866
+60d3 9ca9
+60d8 9caf
+60da 8d9b
+60dc 90c9
+60df 88d2
+60e0 9ca8
+60e1 9ca6
+60e3 9179
+60e7 9c9c
+60e8 8e53
+60f0 91c4
+60f1 9cbb
+60f3 917a
+60f4 9cb6
+60f6 9cb3
+60f7 9cb4
+60f9 8ee4
+60fa 9cb7
+60fb 9cba
+6100 9cb5
+6101 8f44
+6103 9cb8
+6106 9cb2
+6108 96fa
+6109 96f9
+610d 9cbc
+610e 9cbd
+610f 88d3
+6115 9cb1
+611a 8bf0
+611b 88a4
+611f 8ab4
+6121 9cb9
+6127 9cc1
+6128 9cc0
+612c 9cc5
+6134 9cc6
+613c 9cc4
+613d 9cc7
+613e 9cbf
+613f 9cc3
+6142 9cc8
+6144 9cc9
+6147 9cbe
+6148 8e9c
+614a 9cc2
+614b 91d4
+614c 8d51
+614d 9cb0
+614e 9054
+6153 9cd6
+6155 95e7
+6158 9ccc
+6159 9ccd
+615a 9cce
+615d 9cd5
+615f 9cd4
+6162 969d
+6163 8ab5
+6165 9cd2
+6167 8c64
+6168 8a53
+616b 9ccf
+616e 97b6
+616f 9cd1
+6170 88d4
+6171 9cd3
+6173 9cca
+6174 9cd0
+6175 9cd7
+6176 8c63
+6177 9ccb
+617e 977c
+6182 974a
+6187 9cda
+618a 9cde
+618e 919e
+6190 97f7
+6191 9cdf
+6194 9cdc
+6196 9cd9
+6199 9cd8
+619a 9cdd
+61a4 95ae
+61a7 93b2
+61a9 8c65
+61ab 9ce0
+61ac 9cdb
+61ae 9ce1
+61b2 8c9b
+61b6 89af
+61ba 9ce9
+61be 8ab6
+61c3 9ce7
+61c6 9ce8
+61c7 8da7
+61c8 9ce6
+61c9 9ce4
+61ca 9ce3
+61cb 9cea
+61cc 9ce2
+61cd 9cec
+61d0 89f9
+61e3 9cee
+61e6 9ced
+61f2 92a6
+61f4 9cf1
+61f6 9cef
+61f7 9ce5
+61f8 8c9c
+61fa 9cf0
+61fc 9cf4
+61fd 9cf3
+61fe 9cf5
+61ff 9cf2
+6200 9cf6
+6208 9cf7
+6209 9cf8
+620a 95e8
+620c 9cfa
+620d 9cf9
+620e 8f5e
+6210 90ac
+6211 89e4
+6212 89fa
+6214 9cfb
+6216 88bd
+621a 90ca
+621b 9cfc
+621d e6c1
+621e 9d40
+621f 8c81