On Fri, 25 Jun 2021 01:39:21 GMT, Brian Burkhalter <b...@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

The spec for ByteArrayInputStream.read(byte[], off, len) is pretty specific 
about returning -1 if there is nothing to read.
The spec inherited from InputStream doesn't supercede javadoc of BAIS.
If the implementation is going to change then the spec will need to change too.
It seems safer to document the inconsistency and avoid the risk of infinite 
loops.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4591

Reply via email to