< prev index next >
test/sun/nio/cs/TestISO2022JP.java
Print this page
rev 13451 : 8211382: ISO2022JP and GB18030 NIO converter issues
Reviewed-by: sherman, rriggs
*** 1,7 ****
/*
! * Copyright (c) 2008, 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 4626545 4879522 4913711 4119445
@summary Check full coverage encode/decode for ISO-2022-JP
*/
/*
* Tests the NIO converter for J2RE >= 1.4.1
--- 20,30 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
! @bug 4626545 4879522 4913711 4119445 8211382
@summary Check full coverage encode/decode for ISO-2022-JP
*/
/*
* Tests the NIO converter for J2RE >= 1.4.1
*** 606,612 ****
--- 606,625 ----
byte[] encoded = testStr3.getBytes("ISO-2022-JP");
for (int i = 0; i < expected.length; i++) {
if (encoded[i] != expected[i])
throw new Exception("ISO-2022-JP Decoder error");
}
+
+ // Test for 11 iso2022jp decoder
+ encoded = new byte[] {
+ (byte)0x1B, (byte)0x28, (byte)0x49, (byte)0x60,
+ (byte)0x1B, (byte)0x28, (byte)0x42,
+ };
+ String unexpectedStr = "\uffa0";
+ String expectedStr = "\ufffd";
+ if (new String(encoded, "ISO2022JP").equals(unexpectedStr)) {
+ throw new Exception("ISO2022JP Decoder error: \\uFFA0");
+ } else if (!new String(encoded, "ISO2022JP").equals(expectedStr)) {
+ throw new Exception("ISO2022JP Decoder error: \\uFFFD");
+ }
}
}
< prev index next >