test/sun/nio/cs/NIOJISAutoDetectTest.java
Print this page
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 4831163 5053096 5056440
* @summary NIO charset basic verification of JISAutodetect decoder
* @author Martin Buchholz
*/
import java.io.*;
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 4831163 5053096 5056440 8022224
* @summary NIO charset basic verification of JISAutodetect decoder
* @author Martin Buchholz
*/
import java.io.*;
*** 237,246 ****
--- 237,254 ----
check(res.isUnderflow(), "isUnderflow");
check(bb.position() == 2, "bb.position()");
check(cb.position() == 2, "cb.position()");
}
+ // test #8022224
+ Charset cs = Charset.forName("x-JISAutoDetect");
+ ByteBuffer bb = ByteBuffer.wrap(new byte[] { 'a', 0x1b, 0x24, 0x40 });
+ CharBuffer cb = CharBuffer.wrap(new char[10]);
+ CoderResult cr = cs.newDecoder().decode(bb, cb, false);
+ bb.rewind();
+ cb.clear().limit(1);
+ check(cr == cs.newDecoder().decode(bb, cb, false), "#8022224");
if (failures > 0)
throw new RuntimeException(failures + " tests failed");
}