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

Ralf Schmelter rschmelter at openjdk.org
Mon Jan 16 09:34:34 UTC 2023


On Sat, 14 Jan 2023 08:10:25 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/share/classes/sun/net/util/SocketExceptions.java line 75:
>> 
>>> 73:         sb.append(": ");
>>> 74:         sb.append(addr.toString());
>>> 75:         String enhancedMsg = sb.toString();
>> 
>> do you need extra "enhancedMsg" ? you can directly use "return create(e, sb.toString());"
>
> Yes, and can reduced further with String.join
> 
> return create(e, String.join(": ", e.getMessage(), addr.toString()));

Cool, that's really short. I've updated the PR.

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

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


More information about the net-dev mailing list