RFR: 8299827: Add resolved IP address in connection exception for sockets

Alan Bateman alanb at openjdk.org
Fri Jan 13 09:01:15 UTC 2023


On Thu, 12 Jan 2023 08:21:35 GMT, Ralf Schmelter <rschmelter at openjdk.org> wrote:

> This change adds the resolved IP address to the exception text of a failed socket connection. This helps if the connection failed because of stale DNS entries.

src/java.base/share/classes/sun/net/util/SocketExceptions.java line 83:

> 81:                 sb.append('(');
> 82:                 sb.append(resolvedAddr);
> 83:                 sb.append(')');

An alternative here might be to just use addr.toString() as it already handles both the resolved and unresolved cases and uses the most usual convention of hostname/ipaddress.

-------------

PR: https://git.openjdk.org/jdk/pull/11961


More information about the net-dev mailing list