Summary
Change specification of java.io.PipedOutputStream.write(byte[],int,int) to indicate that an IOException is thrown when the stream is closed and an attempt is made to write a positive number of bytes.
Problem
The specification of java.io.PipedOutputStream.write(byte[],int,int) indicates that an IOException is always thrown if the stream is closed but this is not the case if the number of bytes to be written is zero.
Solution
Revise the specification to match longstanding behavior.
Specification
--- a/src/java.base/share/classes/java/io/PipedOutputStream.java
+++ b/src/java.base/share/classes/java/io/PipedOutputStream.java
@@ -135,10 +135,11 @@ public void write(int b) throws IOException {
* @param b {@inheritDoc}
* @param off {@inheritDoc}
* @param len {@inheritDoc}
+ * @throws IndexOutOfBoundsException {@inheritDoc}
* @throws IOException if the pipe is <a href=#BROKEN> broken</a>,
* {@link #connect(java.io.PipedInputStream) unconnected},
- * closed, or if an I/O error occurs.
- * @throws IndexOutOfBoundsException {@inheritDoc}
+ * closed and {@code len} is greater than zero,
+ * or if an I/O error occurs.
*/
@Override
public void write(byte[] b, int off, int len) throws IOException {
- csr of
-
JDK-8367943 PipedOutputStream write(0, 0) successful after close()
-
- In Progress
-