[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
Mon Jul 15 20:07:22 UTC 2019


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> 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