RFR: 8373676: Test javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java fails on a machine without IPV6 [v2]

Daniel Fuchs dfuchs at openjdk.org
Tue Dec 16 15:15:25 UTC 2025


On Tue, 16 Dec 2025 14:18:00 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> It's a bit odd that this `sun.net.util.IPAddressUtil.isIPv6LiteralAddress("[::1]")` returns false where as `InetAddress.ofLiteral("[::1]")` returns a valid `InetAddress`. But `IPAddressUtil` is an internal implementation util, so that's what the expectation maybe of that implementation. The change to this test looks OK to me.

FWIW `InetAddress.ofLiteral` accepts the enclosing "[]" because that's what `InetAddress.getByName` does.
And as you noted `sun.net.util.IPAddressUtil.isIPv6LiteralAddress` is an internal API - it parses the literal according to the IPv6 literal syntax (which doesn't include the "[]")

    jshell> InetAddress.getByName("[::1]")
    $1 ==> /0:0:0:0:0:0:0:1

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

PR Comment: https://git.openjdk.org/jdk/pull/28825#issuecomment-3661050387


More information about the net-dev mailing list