< prev index next >

test/jdk/sun/nio/cs/TestIBMBugs.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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.

@@ -20,11 +20,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /* @test
- * @bug 6371437 6371422 6371416 6371619 5058184 6371431 6639450 6569191 6577466
+ * @bug 6371437 6371422 6371416 6371619 5058184 6371431 6639450 6569191 6577466 8214533
  * @summary Check if the problems reported in above bugs have been fixed
  * @modules jdk.charsets
  */
 
 import java.io.*;

@@ -219,10 +219,34 @@
         if(!cb.toString().equals(expectedStringfromBytes)) {
             throw new Exception("IBM943C failed to decode");
         }
     }
 
+    private static void bug8214533 () throws Exception {
+        String csName = "x-IBM29626C";
+        String osName = System.getProperty("os.name", "unknownOS");
+        if(osName.startsWith("AIX")) {
+            Charset cs = Charset.forName(csName);
+            byte[] ba = new byte[]{(byte)0x5c, (byte)0x90, (byte)0xa1, (byte)0xa1};
+            char[] ca = new char[]{'\\', '\u0090', '\u3000'};
+            ByteBuffer bb = ByteBuffer.wrap(ba);
+            CharBuffer cb = cs.decode(bb);
+            if(!Arrays.equals(ca, Arrays.copyOf(cb.array(), cb.limit()))) {
+                throw new Exception("IBM29626C failed to decode");
+            }
+            cb = CharBuffer.wrap(ca);
+            bb = cs.encode(cb);
+            if (!Arrays.equals(ba, Arrays.copyOf(bb.array(), bb.limit()))) {
+                throw new Exception("IBM29626C failed to encode");
+            }
+        } else {
+            if (Charset.isSupported(csName)) {
+                throw new Exception("IBM29626C should not be supported on non AIX");
+            }
+        }
+    }
+
     public static void main (String[] args) throws Exception {
         bug6577466();
         // need to be tested before any other IBM949C test case
         bug6639450();
         bug6371437();

@@ -230,7 +254,8 @@
         bug6371416();
         bug6371619();
         bug6371431();
         bug6569191();
         bug8202329();
+        bug8214533();
     }
 }
< prev index next >