branch | niosocketimpl-branch |
changeset 57242 | c37938e150b7 |
parent 57239 | 7636aef1b197 |
child 57252 | d70fc9bc1430 |
--- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java Mon Mar 04 08:13:31 2019 +0000 +++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java Tue Mar 05 10:02:36 2019 +0000 @@ -151,6 +151,9 @@ * Throws SocketException if the socket is not open. */ private void ensureOpen() throws SocketException { + int state = this.state; + if (state == ST_NEW) + throw new SocketException("Socket not created"); if (state >= ST_CLOSING) throw new SocketException("Socket closed"); }