RFR 4358774: Add null InputStream and OutputStream

Brian Burkhalter brian.burkhalter at oracle.com
Sat Dec 9 01:09:12 UTC 2017


On Dec 8, 2017, at 5:06 PM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:

> On 08/12/2017 16:49, Brian Burkhalter wrote:
>> I agree it looks strange but it is intentional as it matches the existing InputStream.read(byte[],int,in) [1]. (I will remove line 167 as part of this patch.) Note that the IOE for the stream being closed would not be thrown in the current code until line 173.
> 
> Yes it is match the behavior, but both have a different specifications:
> In the old methods there is a notion: "<p> If <code>len</code> is zero, then no bytes are read and <code>0</code> is returned;" but in the new method we have only one strong statement: "After the stream has been closed, these methods all throw {@code IOException}."

Indeed you are correct. As we are trying to match the behavior I think the spec will need to be tweaked a little. The problem is that there is not a method-by-method specification in this case. This will need to be reexamined.

Thanks,

Brian


More information about the core-libs-dev mailing list