< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2008, 2013, 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. --- 1,7 ---- /* ! * 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,30 **** * 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 * @summary Check if the problems reported in above bugs have been fixed * @modules jdk.charsets */ import java.io.*; --- 20,30 ---- * 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 8212794 * @summary Check if the problems reported in above bugs have been fixed * @modules jdk.charsets */ import java.io.*;
*** 219,228 **** --- 219,261 ---- if(!cb.toString().equals(expectedStringfromBytes)) { throw new Exception("IBM943C failed to decode"); } } + private static void bug8212794 () throws Exception { + { + Charset cs = Charset.forName("x-IBM33722"); + byte[] ba = new byte[]{(byte)0x5c,(byte)0x90,(byte)0xa1,(byte)0xa1}; + char[] ca = new char[]{'\u00A5','\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("IBM33722 failed to decode"); + } + cb = CharBuffer.wrap(ca); + bb = cs.encode(cb); + if(!Arrays.equals(ba, Arrays.copyOf(bb.array(), bb.limit()))) { + throw new Exception("IBM33722 failed to encode"); + } + } + { + Charset cs = Charset.forName("x-IBM964"); + 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("IBM964 failed to decode"); + } + cb = CharBuffer.wrap(ca); + bb = cs.encode(cb); + if(!Arrays.equals(ba, Arrays.copyOf(bb.array(), bb.limit()))) { + throw new Exception("IBM964 failed to encode"); + } + } + } + public static void main (String[] args) throws Exception { bug6577466(); // need to be tested before any other IBM949C test case bug6639450(); bug6371437();
*** 230,236 **** --- 263,270 ---- bug6371416(); bug6371619(); bug6371431(); bug6569191(); bug8202329(); + bug8212794(); } }
< prev index next >