RFR: 8254574: PrintWriter handling of InterruptedIOException is not documented

Brian Burkhalter bpb at openjdk.java.net
Wed Feb 16 22:43:04 UTC 2022


On Wed, 16 Feb 2022 22:32:21 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Remove reference to `java.io.InterruptedIOException` from `java.io.PrintStream`, and make the specifications of `checkError()`, `setError()`, and `clearError()` consistent between `java.io.PrintStream` and `java.io.PrintWriter`.

In the various methods which print there is still this sort of construct

        try {
            // print operation which can throw IOException
        }
        catch (InterruptedIOException x) {
            Thread.currentThread().interrupt();
        }
        catch (IOException x) {
            trouble = true;
        }

where an `InterruptedIOException` causes the current thread to be interrupted. Should this PR also excise these interrupts (as vestigial)? There is no longer any description of this in the specifications of the two print stream classes although in theory an, e.g., `OutputStream` which throws `InterruptedIOException` could be passed in.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7507


More information about the core-libs-dev mailing list