RFR: 6766844: ByteArrayInputStream#read with a byte array of length 0 not consistent with InputStream when at EOF [v2]
Alan Bateman
alanb at openjdk.java.net
Fri Jun 25 07:59:02 UTC 2021
On Fri, 25 Jun 2021 01:39:21 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Modify `java.io.ByteArrayInputStream` methods `read(byte[])` and `read(byte[],int,int)` to return zero per the `InputStream` specification when the byte array actual or specified length is zero.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 6766844: Add bug ID to test
I realize I submitted this issue a long time ago but I think we have to proceed with caution as it is changing long standing behavior. Reading with len==0 will arise with code that is reading in a loop and the "previous read" completely fills the array and reads all remaining bytes. It's possible that there is existing code that will break with this change. I've added the "csr" label for now. If this changes goes ahead then it will need a release note too.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4591
More information about the core-libs-dev
mailing list