Java 14 - Change in InetSocketAddress.toString() behaviour seems to be causing issues
Jaikiran Pai
jai.forums2013 at gmail.com
Sat Mar 28 06:43:29 UTC 2020
There's an issue raised in Quarkus repo[1], where Apache Kafka
(embedded) no longer starts on Java 14. From what I can see the root
cause is this[2].
JDK-8225499[3] changed the implementation (and even the javadoc) of the
InetSocketAddress.toString() which now reads[4]:
"...
If the address is unresolved, <unresolved> is displayed in place of the
address literal.
"
Previously, until as recent as Java 13[5], it used to be:
"...
If the address is unresolved then the part before the colon will only
contain the hostname.
"
So this looks like an intentional(?) breakage in that toString() API
semantics? I do see that it did make it to the release notes of this
version, but given how conservative Java has been in terms of breaking
changes, is this change too quick in introducing such a breaking change?
By the way, keeping aside the breaking nature of this change, the
current javadoc, I think doesn't reflect what the current implementation
returns for unresolved addresses. The javadoc states:
"If the address is unresolved, |<unresolved>| is displayed in place of
the address literal."
Note, the "in place of the address literal" part. However, in the
current implementation[6], it returns something like -
"localhost/<unresolved>:2182". So it doesn't just display the
"<unresolved>" literal in the address part but suffixes it to the
address part. Should that be clarified?
[1] https://github.com/quarkusio/quarkus/issues/8212
[2] https://github.com/quarkusio/quarkus/issues/8212#issuecomment-605403656
[3] https://bugs.openjdk.java.net/browse/JDK-8225499
[4]
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/net/InetSocketAddress.html#toString()
[5]
https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/net/InetSocketAddress.html#toString()
[6]
https://hg.openjdk.java.net/jdk/jdk/file/f2a0b262efea/src/java.base/share/classes/java/net/InetSocketAddress.java#l108
-Jaikiran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20200328/d3d1f617/attachment.htm>
More information about the net-dev
mailing list