The testcase[1] got following error:
..........................................................................java.lang.RuntimeException: U_ILLEGAL_ARGUMENT_ERROR
FAILED
at com.ibm.icu4jni.common.ErrorCode.getException(ErrorCode.java:45)
at com.ibm.icu4jni.charset.CharsetDecoderICU.implReplaceWith(CharsetDecoderICU.java:106)
at java.nio.charset.CharsetDecoder.replaceWith(CharsetDecoder.java:271)
at T.main(T.java:87)
[1]
public static void main(String[] args) {
try {
for (int i = 0; i < 10000000; i++) {
CharsetProviderICU provider = new CharsetProviderICU();
Charset cs = provider.charsetForName("UTF-8");
CharsetDecoder cd = cs.newDecoder();
cd = cd.replaceWith("a");
String str = "abc";
cd.decode(ByteBuffer.wrap("string".getBytes("UTF-8")),
CharBuffer.wrap(new char[1024]), false);
if (i % 50000 == 0) {
System.out.print(".");
System.out.flush();
}
}
System.out.println("PASSED");
} catch (Throwable e) {
e.printStackTrace();
System.out.println("FAILED");
}
}
The Charset in SUN5.0_08 does not have this problem. I consider that it caused by memory leak in somewhere.