[jdk17] RFR: 6766844: ByteArrayInputStream#read with a byte array of length 0 not consistent with InputStream when at EOF [v2]
Naoto Sato
naoto at openjdk.java.net
Fri Jul 2 16:58:19 UTC 2021
On Fri, 2 Jul 2021 16:55:18 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Modify the specification of `java.io.ByteArrayInputStream#read(byte[],int,int)` to indicate that `-1` is returned instead of `0` when the stream is at its end and the third parameter, `len`, is zero.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 6766844: Correct error messages in test
test/jdk/java/io/ByteArrayInputStream/ReadAllReadNTransferTo.java line 57:
> 55: }
> 56: if (bais.read(new byte[1], 0, 0) != -1) {
> 57: throw new RuntimeException("read(byte[],int,int) did not return 0");
Should these exception messages be "did not return -1"?
-------------
PR: https://git.openjdk.java.net/jdk17/pull/189
More information about the core-libs-dev
mailing list