src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
Print this page
rev 11078 : 8025619: (fc) FileInputStream.getChannel on closed stream returns FileChannel that doesn't know that stream is closed
Summary: If the stream is closed ensure getChannel() returns a closed channel. Also, FileKey.create() should throw an IOException directly instead of wrapping it in an Error.
Reviewed-by: TBD
*** 108,117 ****
--- 108,120 ----
}
// -- Standard channel operations --
protected void implCloseChannel() throws IOException {
+ if (!fd.valid())
+ return; // nothing to do
+
// Release and invalidate any locks that we still hold
if (fileLockTable != null) {
for (FileLock fl: fileLockTable.removeAll()) {
synchronized (fl) {
if (fl.isValid()) {