8254574: PrintWriter handling of InterruptedIOException should be removed

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2022-03-10 18:25:53 +00:00
parent 1f295239b9
commit b13cacc575
2 changed files with 10 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -464,22 +464,11 @@ public class PrintStream extends FilterOutputStream
} }
/** /**
* Flushes the stream and checks its error state. The internal error state * Flushes the stream if it's not closed and checks its error state.
* is set to {@code true} when the underlying output stream throws an
* {@code IOException} other than {@code InterruptedIOException},
* and when the {@code setError} method is invoked. If an operation
* on the underlying output stream throws an
* {@code InterruptedIOException}, then the {@code PrintStream}
* converts the exception back into an interrupt by doing:
* <pre>{@code
* Thread.currentThread().interrupt();
* }</pre>
* or the equivalent.
* *
* @return {@code true} if and only if this stream has encountered an * @return {@code true} if and only if this stream has encountered an
* {@code IOException} other than * {@code IOException}, or the {@code setError} method has been
* {@code InterruptedIOException}, or the * invoked
* {@code setError} method has been invoked
*/ */
public boolean checkError() { public boolean checkError() {
if (out != null) if (out != null)
@ -504,7 +493,7 @@ public class PrintStream extends FilterOutputStream
} }
/** /**
* Clears the internal error state of this stream. * Clears the error state of this stream.
* *
* <p> This method will cause subsequent invocations of {@link * <p> This method will cause subsequent invocations of {@link
* #checkError()} to return {@code false} until another write * #checkError()} to return {@code false} until another write

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -428,9 +428,9 @@ public class PrintWriter extends Writer {
/** /**
* Flushes the stream if it's not closed and checks its error state. * Flushes the stream if it's not closed and checks its error state.
* *
* @return {@code true} if the print stream has encountered an error, * @return {@code true} if and only if this stream has encountered an
* either on the underlying output stream or during a format * {@code IOException}, or the {@code setError} method has been
* conversion. * invoked
*/ */
public boolean checkError() { public boolean checkError() {
if (out != null) { if (out != null) {
@ -445,7 +445,7 @@ public class PrintWriter extends Writer {
} }
/** /**
* Indicates that an error has occurred. * Sets the error state of the stream to {@code true}.
* *
* <p> This method will cause subsequent invocations of {@link * <p> This method will cause subsequent invocations of {@link
* #checkError()} to return {@code true} until {@link * #checkError()} to return {@code true} until {@link