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

Phil Race philip.race at oracle.com
Fri Jul 12 20:02:08 UTC 2019


> Not my call, but in PSPrinterJob.java (970-977) it might be cleaner to just delete the unused code and comment.

Dilemma - since at 1036 we are throwing an Exception and the comment at 970-ish suggests
the author was intending to do what s/he did at 1036 but never got around to it.

I think I'd be more inclined to make the code at 970 like that at 1036.
But
(1) then the comment surely can go
(2) I don't know why at 1034 you changed from PrinterIOException to PrinterException.

And whilst great you are fixing up this code, we are but a small fraction of the world's code
that use java.io and I wonder if this is worth the compatibility risk ?

-phil



On 7/12/19 12:54 PM, Brian Burkhalter wrote:
> Here is new webrev incorporating the two changes below.
>
> http://cr.openjdk.java.net/~bpb/8187898/webrev.01/
>
> Thanks,
>
> Brian
>
>> On Jul 12, 2019, at 12:01 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>>
>>> On Jul 12, 2019, at 11:17 AM, Roger Riggs <Roger.Riggs at oracle.com <mailto:Roger.Riggs at oracle.com>> wrote:
>>>
>>> Would it be appropriate to add @Override to the new method (and perhaps existing overridden methods).
>> Yes, I think so.
>>
>>> Previously, calling FilterOutputStream.write(byte[]) would delegate to write(byte[], 0, length).
>>> The proposed change duplicates the code and changes the ways that overridden classes might see the call.
>>> What's the benefit of duplicating the code and calling out.write(buf)?
>> Probably nothing. Probably better to call write(b,0,b.length) directly.
>>
>>> Not my call, but in PSPrinterJob.java (970-977) it might be cleaner to just delete the unused code and comment.
>> I agree but I was waiting for a suggestion from a 2D reviewer.



More information about the 2d-dev mailing list