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

Reviewed-by: jpai, dfuchs
This commit is contained in:
Matthias Baesken 2025-12-17 08:44:46 +00:00
parent 386ad61458
commit 9e2008bf5e

View File

@ -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;