JDK-6766844 : ByteArrayInputStream#read with a byte array of length 0 not consistent with InputStream when at EOF
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_7
  • CPU: generic,x86
  • Submitted: 2008-11-03
  • Updated: 2021-07-15
  • Resolved: 2021-07-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 18
17 b31Fixed 18Fixed
Related Reports
CSR :  
Duplicate :  
Relates :  
Relates :  
Description
When InputStream#read is invoked with a byte[] of length 0 then 0 is returned without attempting to read any bytes. ByteArrayInputStream breaks this contract for the case that all bytes have been read. In that case it returns -1 instead of 0.

Comments
Changeset: f46a9172 Author: Brian Burkhalter <bpb@openjdk.org> Date: 2021-07-08 19:05:29 +0000 URL: https://git.openjdk.java.net/jdk17/commit/f46a9172700a3e2d63cb772e604120bb6f60d4b0
08-07-2021