Java 14 - Change in InetSocketAddress.toString() behaviour seems to be causing issues

Chris Hegarty chris.hegarty at oracle.com
Wed Apr 1 13:10:26 UTC 2020



> On 1 Apr 2020, at 13:48, Jaikiran Pai <jai.forums2013 at gmail.com> wrote:
>>>> ...
>>> Now that you explained it to me, I see what you mean and what that javadoc means. I hadn't paid attention to the "This String is constructed by calling toString() on the InetAddress and concatenating the port number (with a colon)". Looking at the javadoc on InetAddress.toString(), it does state the returned string to be of the form "hostname/literal IP           address" (example: google.com/172.217.160.142). So when it says that "<unresolved> is displayed in place of the address literal", it actually is talking about the part that follows the "/" character in the output returned by the InetAddress.toString().
>>> 
>>> I'll be honest - I didn't even know that up until this release, the output of this API was something like google.com/172.217.160.142:80. I had it in my mind that the output was google.com:80. That's why when the new javadoc said "in place of the address literal", I thought it was talking about replacing "google.com" with "<unresolved>"
>>> 
>>> I don't know if it's just me who couldn't fully understand it until this was explained. For me, a {@link InetSocket.toString()} in the javadoc and a couple of example representations of what the output of toString() would look like would have made it easier. But I do understand that the javadoc may not be the right place for such level of details.
>>> 
We can improve the spec wording of this method.

I filed the following issue to track just that:
  https://bugs.openjdk.java.net/browse/JDK-8241995

-Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20200401/18b0088f/attachment.htm>


More information about the net-dev mailing list