JDK-8224642: Test sun/tools/jcmd/TestJcmdSanity.java fails: Bad file descriptor
    Schmelter, Ralf 
    ralf.schmelter at sap.com
       
    Tue Jun 18 10:34:17 UTC 2019
    
    
  
Hi,
since InputStream imeplements Closeable, calling close multiple times *must* work:
public interface Closeable extends AutoCloseable {
    /**
     * Closes this stream and releases any system resources associated
     * with it. If the stream is already closed then invoking this
     * method has no effect.
     *
     * <p> As noted in {@link AutoCloseable#close()}, cases where the
     * close may fail require careful attention. It is strongly advised
     * to relinquish the underlying resources and to internally
     * <em>mark</em> the {@code Closeable} as closed, prior to throwing
     * the {@code IOException}.
     *
     * @throws IOException if an I/O error occurs
     */
    public void close() throws IOException;
}
So the close() method must be fixed in the same way FileInputStream and friends implement close().
Best regards,
Ralf
    
    
More information about the serviceability-dev
mailing list