--- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java Sun Apr 07 09:39:59 2019 +0100
+++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java Sun Apr 07 18:40:55 2019 +0100
@@ -474,6 +474,8 @@
synchronized (stateLock) {
int state = this.state;
if (state != ST_UNCONNECTED) {
+ if (state == ST_NEW)
+ throw new SocketException("Not created");
if (state == ST_CONNECTING)
throw new SocketException("Connection in progress");
if (state == ST_CONNECTED)
@@ -702,7 +704,8 @@
@Override
protected void accept(SocketImpl si) throws IOException {
NioSocketImpl nsi = (NioSocketImpl) si;
- assert !nsi.server && nsi.state == ST_NEW;
+ if (nsi.state != ST_NEW)
+ throw new SocketException("Not a newly created SocketImpl");
FileDescriptor newfd = new FileDescriptor();
InetSocketAddress[] isaa = new InetSocketAddress[1];