write(byte) and add
java.io.PrintStream was supposed to override methods not to throw
IOException as indicated in the class documentation:
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.
java.io.FilterOutputStream was, however, not so overridden. The method is therefore documented as throwing
IOException but never does so.
Also, there is no
write method which has only a byte array parameter and which is not declared to throw
IOException. Callers are thus obliged in this scenario to write a try-catch block even though
IOException will never be thrown.
write(byte) adding clarifying documentation while retaining the existing behavior, and add
Please refer to the specifications of
writeBytes in the attachments.
- csr of
JDK-8187898 PrintStream should override FilterOutputStream#write(byte) with a method that has no throws clause
- relates to
JDK-8305953 PrintStream's method write(byte buf) is declared to throw IOException