--- a/src/java.base/share/classes/java/net/ServerSocket.java Thu May 30 13:39:13 2019 +0300
+++ b/src/java.base/share/classes/java/net/ServerSocket.java Thu May 30 12:36:04 2019 +0100
@@ -817,7 +817,8 @@
* Returns the implementation address and implementation port of
* this socket as a {@code String}.
* <p>
- * If there is a security manager set, its {@code checkConnect} method is
+ * If there is a security manager set, and this socket is
+ * {@linkplain #isBound bound}, its {@code checkConnect} method is
* called with the local address and {@code -1} as its arguments to see
* if the operation is allowed. If the operation is not allowed,
* an {@code InetAddress} representing the
@@ -831,7 +832,7 @@
return "ServerSocket[unbound]";
InetAddress in;
if (System.getSecurityManager() != null)
- in = InetAddress.getLoopbackAddress();
+ in = getInetAddress();
else
in = impl.getInetAddress();
return "ServerSocket[addr=" + in +