changeset 48228:d0cf025a5e79

8187910: Charset MS950_HKSCS not supported in JDK 9 Reviewed-by: alanb
author sherman
date Thu, 30 Nov 2017 11:19:14 -0800
parents b8a119027122
children e14c928c01c8 84ab337fa1e3 78af27007264 f4b990ab4fb5 6240d720e585 44c9d8007630 9240097e2821
files make/data/charsetmapping/charsets make/data/charsetmapping/stdcs-windows make/jdk/src/classes/build/tools/charsetmapping/Main.java src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java.template
diffstat 6 files changed, 102 insertions(+), 94 deletions(-) [+]
line wrap: on
line diff
--- a/make/data/charsetmapping/charsets	Thu Nov 30 18:07:41 2017 +0000
+++ b/make/data/charsetmapping/charsets	Thu Nov 30 11:19:14 2017 -0800
@@ -492,7 +492,7 @@
 
 charset x-MS950-HKSCS MS950_HKSCS
     package sun.nio.cs.ext
-    type    source
+    type    template
     hisname MS950_HKSCS
     ascii   true
     alias   MS950_HKSCS          # JDK historical;
--- a/make/data/charsetmapping/stdcs-windows	Thu Nov 30 18:07:41 2017 +0000
+++ b/make/data/charsetmapping/stdcs-windows	Thu Nov 30 11:19:14 2017 -0800
@@ -13,4 +13,5 @@
 MS936
 MS949
 MS950
+MS950_HKSCS
 MS950_HKSCS_XP
--- a/make/jdk/src/classes/build/tools/charsetmapping/Main.java	Thu Nov 30 18:07:41 2017 +0000
+++ b/make/jdk/src/classes/build/tools/charsetmapping/Main.java	Thu Nov 30 11:19:14 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@
                 new File(args[SRC_DIR], args[CHARSETS]));
             String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
             boolean hasBig5_HKSCS = false;
+            boolean hasMS950_HKSCS = false;
             boolean hasMS950_HKSCS_XP = false;
             boolean hasEUC_TW = false;
             for (String name : osStdcs) {
@@ -63,6 +64,8 @@
                 }
                 if (name.equals("Big5_HKSCS")) {
                     hasBig5_HKSCS = true;
+                } else if (name.equals("MS950_HKSCS")) {
+                    hasMS950_HKSCS = true;
                 } else if (name.equals("MS950_HKSCS_XP")) {
                     hasMS950_HKSCS_XP = true;
                 } else if (name.equals("EUC_TW")) {
@@ -98,12 +101,15 @@
                          args[TEMPLATE],
                          args[OS].endsWith("windows") ? "windows" : "unix");
 
-            // HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
-            if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
+            // HKSCSMapping(2008).java goes std if one of Big5_HKSCS MS950_HKSCS
+            // is in std
+            if (isStandard && (hasBig5_HKSCS || hasMS950_HKSCS) ||
+                isExtended && !(hasBig5_HKSCS  || hasMS950_HKSCS)) {
                 HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
                                    isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
                                    new File(args[COPYRIGHT_SRC], "HKSCS.java"));
             }
+            // HKSCS_XPMapping.java goes together with MS950XP_HKSCS
             if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
                 HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
                                  isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
--- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template	Thu Nov 30 18:07:41 2017 +0000
+++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template	Thu Nov 30 11:19:14 2017 -0800
@@ -31,6 +31,7 @@
 import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HKSCS;
 import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
 import static sun.nio.cs.CharsetMapping.*;
 
 public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
--- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java	Thu Nov 30 18:07:41 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.nio.cs.ext;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.*;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
-{
-    public MS950_HKSCS() {
-        super("x-MS950-HKSCS", ExtendedCharsets.aliasesFor("x-MS950-HKSCS"));
-    }
-
-    public String historicalName() {
-        return "MS950_HKSCS";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof MS950)
-                || (cs instanceof MS950_HKSCS));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    static class Decoder extends HKSCS.Decoder {
-        private static DoubleByte.Decoder ms950 =
-            (DoubleByte.Decoder)new MS950().newDecoder();
-
-        private static char[][] b2cBmp = new char[0x100][];
-        private static char[][] b2cSupp = new char[0x100][];
-        static {
-            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
-            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
-        }
-
-        private Decoder(Charset cs) {
-            super(cs, ms950, b2cBmp, b2cSupp);
-        }
-    }
-
-    private static class Encoder extends HKSCS.Encoder {
-        private static DoubleByte.Encoder ms950 =
-            (DoubleByte.Encoder)new MS950().newEncoder();
-
-        static char[][] c2bBmp = new char[0x100][];
-        static char[][] c2bSupp = new char[0x100][];
-        static {
-            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
-            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
-        }
-
-        private Encoder(Charset cs) {
-            super(cs, ms950, c2bBmp, c2bSupp);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java.template	Thu Nov 30 11:19:14 2017 -0800
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
+{
+    public MS950_HKSCS() {
+        super("x-MS950-HKSCS", $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "MS950_HKSCS";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof MS950)
+                || (cs instanceof MS950_HKSCS));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    static class Decoder extends HKSCS.Decoder {
+        private static DoubleByte.Decoder ms950 =
+            (DoubleByte.Decoder)new MS950().newDecoder();
+
+        private static char[][] b2cBmp = new char[0x100][];
+        private static char[][] b2cSupp = new char[0x100][];
+        static {
+            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
+            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
+        }
+
+        private Decoder(Charset cs) {
+            super(cs, ms950, b2cBmp, b2cSupp);
+        }
+    }
+
+    private static class Encoder extends HKSCS.Encoder {
+        private static DoubleByte.Encoder ms950 =
+            (DoubleByte.Encoder)new MS950().newEncoder();
+
+        static char[][] c2bBmp = new char[0x100][];
+        static char[][] c2bSupp = new char[0x100][];
+        static {
+            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
+            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
+        }
+
+        private Encoder(Charset cs) {
+            super(cs, ms950, c2bBmp, c2bSupp);
+        }
+    }
+}