Review quest for bug 8022879: sun/nio/cs/MalformedSurrogates.java fails intermittently

Martin Buchholz martinrb at google.com
Fri Aug 16 14:19:45 UTC 2013


This test remains clearly buggy, at least in theory - the user could have a
default charset named UTFred that does not handle unicode.  I think the
test also depends on the replacement.

The test could be made more robust and also get more coverage by iterating
over all available charsets, (or unconditionally using e.g. US-ASCII)

It's possible to check for encodability using
http://docs.oracle.com/javase/7/docs/api/java/nio/charset/CharsetEncoder.html#canEncode(java.lang.CharSequence)

It's possible to get the replacement byte array using
http://docs.oracle.com/javase/7/docs/api/java/nio/charset/CharsetEncoder.html#replacement()



On Fri, Aug 16, 2013 at 1:37 AM, Eric Wang <yiming.wang at oracle.com> wrote:

> Hi,
>
> Please help to review the fix below for bug https://jbs.oracle.com/bugs/**
> browse/JDK-8022879 <https://jbs.oracle.com/bugs/browse/JDK-8022879>
>
> http://cr.openjdk.java.net/~**ewang/8022879/webrev.00/<http://cr.openjdk.java.net/~ewang/8022879/webrev.00/>
>
> The test has defect as it wouldn't be executed if the file.encoding is
> UTF-8 (lots of test machines in nightly are UTF-8), it also doesn't check
> UTF-16 and UTF-32 which can cause test fail too.
>
> The fix is to check whether the default charset is unicode, if yes, use
> US-ASCII to test instead.
>
> Thanks,
> Eric
>



More information about the core-libs-dev mailing list