[OpenJDK 2D-Dev] 8187898: PrintStream should override FilterOutputStream#write(byte[]) with a method that has no throws clause

David Holmes david.holmes at oracle.com
Wed Jul 24 01:31:00 UTC 2019


Jumping in here as this change is starting to really confuse me ...

On 24/07/2019 2:41 am, Brian Burkhalter wrote:
> 
> 
>> On Jul 23, 2019, at 8:27 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>>
>>> On Jul 23, 2019, at 8:20 AM, Alan Bateman <Alan.Bateman at oracle.com <mailto:Alan.Bateman at oracle.com>> wrote:
>>>
>>> On 23/07/2019 16:08, Brian Burkhalter wrote:
>>>>
>>>> I don’t see what you mean.
>>>>     @Override
>>>>     public void write(byte buf[]) throws IOException {
>>>>         super.write(buf);
>>>>     }
>>>> Should “trouble” be set and the IOE re-thrown?
>>>>
>>> super.write(byte[]) will invoke PrintStream overrides write(byte[], int, int) so IOE won't be thrown (and why the proposed change to the class description isn't right). The method description is probably the best place to describe the behavior.
> 
> Here is an update which accounts for the foregoing comments.
> 
> http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.02/

  609     @Override
  610     public void write(byte buf[]) throws IOException {
  611         super.write(buf, 0, buf.length);
  612     }

This is wrong! The whole point of this bug is to ensure that PrintStream 
methods honour its contract of NEVER throwing IOException. I mean that 
is what the bug synopsis and description are all about!

David
-----

> Thanks,
> 
> Brian
> 


More information about the core-libs-dev mailing list