From 9e2008bf5e9a63b640eefc6cc7ec5c4f344c4266 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Wed, 17 Dec 2025 08:44:46 +0000 Subject: [PATCH] 8373676: Test javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java fails on a machine without IPV6 Reviewed-by: jpai, dfuchs --- .../net/ssl/HttpsURLConnection/SubjectAltNameIP.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java b/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java index 2def2f69d6e..cbd2089e7bd 100644 --- a/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java +++ b/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java @@ -30,7 +30,7 @@ * @modules java.base/sun.net.util * @comment Insert -Djavax.net.debug=all into the following lines to enable SSL debugging * @run main/othervm SubjectAltNameIP 127.0.0.1 - * @run main/othervm SubjectAltNameIP [::1] + * @run main/othervm SubjectAltNameIP ::1 */ import javax.net.ssl.HandshakeCompletedListener; @@ -166,14 +166,19 @@ public class SubjectAltNameIP { } public static void main(String[] args) throws Exception { + boolean isIpv6Addr = IPAddressUtil.isIPv6LiteralAddress(args[0]); - if (IPAddressUtil.isIPv6LiteralAddress(args[0]) && !IPSupport.hasIPv6()) { + if (isIpv6Addr && !IPSupport.hasIPv6()) { throw new SkippedException("Skipping test - IPv6 is not supported"); } /* * Start the tests. */ - new SubjectAltNameIP(args[0]); + if (isIpv6Addr) { // use the URL notion wrapper + new SubjectAltNameIP("[" + args[0] + "]"); + } else { + new SubjectAltNameIP(args[0]); + } } Thread serverThread = null;