JDK-8248383 : Clarify java.io.Reader.read(char[], ...) behavior for full array
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 14.0.1
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-06-19
  • Updated: 2022-06-27
  • Resolved: 2020-12-17
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
17 b03Fixed
Related Reports
CSR :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
The documentation for the following java.io.Reader methods does not explain how the methods behave if an array of length 0, respectively length 0 is provided:
- read(char[])
- read(char[], int, int)

It is not clear whether
- 0 should be returned
- -1 should be returned if at end of stream
- An IOException should be thrown if reader is closed

Compare this to the documentation of java.io.InputStream where this is clearly specified.
It appears most of the JDK classes check if the reader is closed and afterwards return 0 in these cases.

Related to JDK-8222329



Comments
Changeset: 143998e4 Author: Brian Burkhalter <bpb@openjdk.org> Date: 2020-12-17 16:29:57 +0000 URL: https://git.openjdk.java.net/jdk/commit/143998e4
17-12-2020

Submitter requesting for detailed verbose of the methods, Moving across to JDK to Dev team evaluation.
26-06-2020