RFR: 8292043: Incorrect decoding near EOF for stateful decoders like UTF-16 [v2]
Naoto Sato
naoto at openjdk.org
Sun Aug 21 23:19:19 UTC 2022
On Sat, 20 Aug 2022 08:03:55 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Modified the test per review suggestion
>
> test/jdk/java/io/InputStreamReader/StatefulDecoderNearEOF.java line 53:
>
>> 51: StandardCharsets.UTF_16.newDecoder().onMalformedInput(CodingErrorAction.REPORT))) {
>> 52: System.out.printf("%04x%n", r.read()); // \u00d8 (wrong, uses UTF-16BE)
>> 53: System.out.printf("%04x%n", r.read()); // EOF
>
> This will pass if either read fails, I think the test should be checking that the first call to read throws MalformedInputException.
>
> Would it be feasible to add a second test where there are characters between the BOM and the truncated high surrogate? It would be possible to decode those characters before it fails at the end of the stream.
Addressed both points.
-------------
PR: https://git.openjdk.org/jdk/pull/9945
More information about the nio-dev
mailing list