changeset 55368:41b79b3e21fb

8220281: IBM-858 alias name is missing on IBM00858 charset Summary: Add aliases into IBM charsets Reviewed-by: naoto
author itakiguchi
date Fri, 15 Mar 2019 00:49:13 +0900
parents 641768acb12e
children 2ab55d39fb5b
files make/data/charsetmapping/charsets test/jdk/sun/nio/cs/TestIBMBugs.java
diffstat 2 files changed, 99 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/make/data/charsetmapping/charsets	Fri Mar 08 09:58:56 2019 -0800
+++ b/make/data/charsetmapping/charsets	Fri Mar 15 00:49:13 2019 +0900
@@ -440,6 +440,8 @@
     alias   cp00858
     alias   858
     alias   PC-Multilingual-850+euro
+    alias   ibm858
+    alias   ibm-858
 
 charset IBM862 IBM862
     package sun.nio.cs
@@ -1389,6 +1391,7 @@
      alias   cp833
      alias   ibm833
      alias   ibm-833
+     alias   833
 
 
 charset x-IBM834 IBM834 # EBCDIC DBCS-only Korean
@@ -1590,6 +1593,8 @@
     alias   cp01140
     alias   1140
     alias   ebcdic-us-037+euro
+    alias   ibm1140
+    alias   ibm-1140
 
 charset IBM01141 IBM1141
     package sun.nio.cs.ext
@@ -1601,6 +1606,8 @@
     alias   cp01141
     alias   1141
     alias   ebcdic-de-273+euro
+    alias   ibm1141
+    alias   ibm-1141
 
 charset IBM01142 IBM1142
     package sun.nio.cs.ext
@@ -1613,6 +1620,8 @@
     alias   1142
     alias   ebcdic-no-277+euro
     alias   ebcdic-dk-277+euro
+    alias   ibm1142
+    alias   ibm-1142
 
 charset IBM01143 IBM1143
     package sun.nio.cs.ext
@@ -1625,6 +1634,8 @@
     alias   1143
     alias   ebcdic-fi-278+euro
     alias   ebcdic-se-278+euro
+    alias   ibm1143
+    alias   ibm-1143
 
 charset IBM01144 IBM1144
     package sun.nio.cs.ext
@@ -1636,6 +1647,8 @@
     alias   cp01144
     alias   1144
     alias   ebcdic-it-280+euro
+    alias   ibm1144
+    alias   ibm-1144
 
 charset IBM01145 IBM1145
     package sun.nio.cs.ext
@@ -1647,6 +1660,8 @@
     alias   cp01145
     alias   1145
     alias   ebcdic-es-284+euro
+    alias   ibm1145
+    alias   ibm-1145
 
 charset IBM01146 IBM1146
     package sun.nio.cs.ext
@@ -1658,6 +1673,8 @@
     alias   cp01146
     alias   1146
     alias   ebcdic-gb-285+euro
+    alias   ibm1146
+    alias   ibm-1146
 
 charset IBM01147 IBM1147
     package sun.nio.cs.ext
@@ -1669,6 +1686,8 @@
     alias   cp01147
     alias   1147
     alias   ebcdic-fr-277+euro
+    alias   ibm1147
+    alias   ibm-1147
 
 charset IBM01148 IBM1148
     package sun.nio.cs.ext
@@ -1680,6 +1699,8 @@
     alias   cp01148
     alias   1148
     alias   ebcdic-international-500+euro
+    alias   ibm1148
+    alias   ibm-1148
 
 charset IBM01149 IBM1149
     package sun.nio.cs.ext
@@ -1691,6 +1712,8 @@
     alias   cp01149
     alias   1149
     alias   ebcdic-s-871+euro
+    alias   ibm1149
+    alias   ibm-1149
 
 charset IBM290 IBM290
     package sun.nio.cs.ext
--- a/test/jdk/sun/nio/cs/TestIBMBugs.java	Fri Mar 08 09:58:56 2019 -0800
+++ b/test/jdk/sun/nio/cs/TestIBMBugs.java	Fri Mar 15 00:49:13 2019 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 6371437 6371422 6371416 6371619 5058184 6371431 6639450 6569191 6577466 8212794
+ * @bug 6371437 6371422 6371416 6371619 5058184 6371431 6639450 6569191 6577466 8212794 8220281
  * @summary Check if the problems reported in above bugs have been fixed
  * @modules jdk.charsets
  */
@@ -31,6 +31,8 @@
 import java.nio.*;
 import java.nio.charset.*;
 import java.util.Arrays;
+import java.util.Locale;
+import java.util.HashSet;
 
 public class TestIBMBugs {
 
@@ -250,6 +252,77 @@
         }
     }
 
+    private static void bug8220281 () throws Exception {
+        if (System.getProperty("os.name").contains("AIX")) {
+            /* Following AIX codesets are used for Java default charset. */
+            /* They should be in sun.nio.cs package on AIX platform.     */
+            String[] codesets = new String[] {
+                "IBM-950", "BIG5-HKSCS", "GB18030", "IBM-1046",
+                "IBM-1124", "IBM-1129", "IBM-1252", "IBM-856",
+                "IBM-858", "IBM-921", "IBM-922", "IBM-932", "IBM-943C",
+                "IBM-eucCN", "IBM-eucJP", "IBM-eucKR", "IBM-eucTW",
+                "ISO8859-1", "ISO8859-15", "ISO8859-2", "ISO8859-4",
+                "ISO8859-5", "ISO8859-6", "ISO8859-7", "ISO8859-8",
+                "ISO8859-9", "TIS-620", "UTF-8", };
+            String[] charsets = new String[] {
+                "x-IBM950", "Big5-HKSCS", "GB18030", "x-IBM1046",
+                "x-IBM1124", "x-IBM1129", "windows-1252", "x-IBM856",
+                "IBM00858", "x-IBM921", "x-IBM922", "x-IBM942C",
+                "x-IBM943C", "x-IBM1383", "x-IBM29626C", "x-IBM970",
+                "x-IBM964", "ISO-8859-1", "ISO-8859-15", "ISO-8859-2",
+                "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7",
+                "ISO-8859-8", "ISO-8859-9", "TIS-620", "UTF-8", };
+            for(int i = 0; i < codesets.length; i++) {
+                Charset cs0 = Charset.forName(codesets[i]);
+                if (!"sun.nio.cs".equals(cs0.getClass().getPackage().getName())) {
+                    throw new Exception(cs0.getClass().getCanonicalName()+" faild");
+                }
+                Charset cs1 = Charset.forName(charsets[i]);
+                if (!cs0.equals(cs1)) {
+                    throw new Exception(codesets[i]+"("+cs0.name()+") failed");
+                }
+            }
+        }
+        for(Charset cs : Charset.availableCharsets().values()) {
+            String csName = cs.name().toLowerCase(Locale.ROOT);
+            String suffix = null;
+            HashSet<String> aliases = new HashSet<String>();
+            for(String s : cs.aliases()) {
+                aliases.add(s.toLowerCase(Locale.ROOT));
+            }
+            aliases.add(csName);
+            if (csName.startsWith("x-ibm-")) {
+                suffix = csName.replaceAll("x-ibm-0*", "");
+            } else if (csName.startsWith("x-ibm")) {
+                suffix = csName.replaceAll("x-ibm0*", "");
+            } else if (csName.startsWith("ibm-")) {
+                suffix = csName.replaceAll("ibm-0*", "");
+            } else if (csName.startsWith("ibm")) {
+                suffix = csName.replaceAll("ibm0*", "");
+            }
+            if ("ibm-thai".equals(csName)) {
+                suffix = "838";
+            }
+            if (null != suffix) {
+                while (suffix.length() < 3) {
+                    suffix = "0"+suffix;
+                }
+                if (!aliases.contains("cp"+suffix)) {
+                    throw new Exception(cs.name()+"\t"+"cp"+suffix);
+                }
+                if (!aliases.contains("ibm"+suffix)) {
+                    throw new Exception(cs.name()+"\t"+"ibm"+suffix);
+                }
+                if (!aliases.contains("ibm-"+suffix)) {
+                    throw new Exception(cs.name()+"\t"+"ibm-"+suffix);
+                }
+                if (!aliases.contains(suffix)) {
+                    throw new Exception(cs.name()+"\t"+suffix);
+                }
+            }
+        }
+    }
+
     public static void main (String[] args) throws Exception {
         bug6577466();
         // need to be tested before any other IBM949C test case
@@ -263,5 +336,6 @@
         bug8202329();
         bug8212794();
         bug8213618();
+        bug8220281();
     }
 }