[OpenJDK 2D-Dev] 8187898: PrintStream should override FilterOutputStream#write(byte[]) with a method that has no throws clause
Brian Burkhalter
brian.burkhalter at oracle.com
Thu Jul 18 15:32:36 UTC 2019
Resuming this topic, what is the general view on the three possible paths:
1. Override write(byte[]) at the risk of incompatibility.
2. Instead add writeBytes(byte[]) as in ByteArrayOutputStream.
3. Resolve as Won’t Fix.
For 2 or 3 the incorrect class level statement about overriding all methods not to throw IOE would need to be dealt with.
Thanks,
Brian
> On Jul 15, 2019, at 1:07 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>
> There is however this problematic statement in the PrintStream class doc that neither of the two alternative versions of the fix addresses:
>
> "Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method.”
>
> In both cases this would need to be changed as it is incorrect.
>
> Brian
>
>> On Jul 15, 2019, at 10:14 AM, Brian Burkhalter <brian.burkhalter at oracle.com <mailto:brian.burkhalter at oracle.com>> wrote:
>>
>> Here is an alternative version which adds a writeBytes(byte[]) method instead of overriding write(byte[]):
>>
>> http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.00/ <http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.00/> <http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.00/ <http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.00/>>
>>
>> This has the advantage of allowing new code to call writeBytes() without a try-catch block without introducing a compatibility issue for code which is already calling write(byte[]) in a try-catch block.
More information about the core-libs-dev
mailing list