diff --git a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java index af8f0b987e9..b0ebfc7f8d0 100644 --- a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java @@ -573,6 +573,7 @@ public SocketAddress receive(ByteBuffer dst) throws IOException { throw new IllegalArgumentException("Read-only buffer"); readLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); SocketAddress sender = null; try { @@ -851,6 +852,7 @@ public int send(ByteBuffer src, SocketAddress target) writeLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); int n; boolean completed = false; @@ -1039,6 +1041,7 @@ public int read(ByteBuffer buf) throws IOException { readLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); int n = 0; try { @@ -1069,6 +1072,7 @@ public long read(ByteBuffer[] dsts, int offset, int length) readLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); long n = 0; try { @@ -1152,6 +1156,7 @@ public int write(ByteBuffer buf) throws IOException { writeLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); int n = 0; try { @@ -1182,6 +1187,7 @@ public long write(ByteBuffer[] srcs, int offset, int length) writeLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); long n = 0; try { diff --git a/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java index 1841eebc93c..2f72dee509d 100644 --- a/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java @@ -392,6 +392,7 @@ public SocketChannel accept() throws IOException { acceptLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); try { begin(blocking); diff --git a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java index 6c65a964a65..2bd9d7a7739 100644 --- a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java @@ -955,6 +955,7 @@ public boolean connect(SocketAddress remote) throws IOException { try { writeLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); boolean connected = false; try { @@ -1053,6 +1054,7 @@ public boolean finishConnect() throws IOException { if (isConnected()) return true; + ensureOpen(); boolean blocking = isBlocking(); boolean connected = false; try { diff --git a/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java b/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java index d72a4892ef0..491e0104765 100644 --- a/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java +++ b/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java @@ -306,6 +306,7 @@ public int write(ByteBuffer src) throws IOException { writeLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); int n = 0; try { @@ -334,6 +335,7 @@ public long write(ByteBuffer[] srcs, int offset, int length) throws IOException writeLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); long n = 0; try { diff --git a/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java b/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java index 7be17040b4c..102041dd294 100644 --- a/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java +++ b/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java @@ -306,6 +306,7 @@ public int read(ByteBuffer dst) throws IOException { readLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); int n = 0; try { @@ -334,6 +335,7 @@ public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { readLock.lock(); try { + ensureOpen(); boolean blocking = isBlocking(); long n = 0; try {