diff --git a/test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java b/test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java index e0dfaa541c4..76897e224bf 100644 --- a/test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java +++ b/test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,10 @@ * -Dtest.libs=N ReplayCacheTestProc */ -import java.io.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; import java.nio.BufferUnderflowException; import java.nio.channels.SeekableByteChannel; import java.nio.file.Files; @@ -43,13 +46,19 @@ import java.nio.file.StandardOpenOption; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; +import java.util.HexFormat; +import java.util.List; +import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; import jdk.test.lib.process.Proc; +import jtreg.SkippedException; import sun.security.jgss.GSSUtil; import sun.security.krb5.internal.rcache.AuthTime; @@ -126,8 +135,7 @@ public static void main0(String[] args) throws Exception { libs = userLibs.split(","); if (Arrays.asList(libs).contains("N") && !isNativeLibAvailable()) { // Skip test when native GSS libs are not available in running platform - System.out.println("Native mode not available - skipped"); - return; + throw new SkippedException("Native mode not available - skipped"); } KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true); diff --git a/test/jdk/sun/security/krb5/config/ConfPlusProp.java b/test/jdk/sun/security/krb5/config/ConfPlusProp.java index b7dc4924fc8..98e4818f073 100644 --- a/test/jdk/sun/security/krb5/config/ConfPlusProp.java +++ b/test/jdk/sun/security/krb5/config/ConfPlusProp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,14 @@ * @bug 6857795 * @bug 6858589 * @bug 6972005 + * @library /test/lib/ * @modules java.security.jgss/sun.security.krb5 * @compile -XDignore.symbol.file ConfPlusProp.java * @run main/othervm ConfPlusProp * @summary krb5.conf ignored if system properties on realm and kdc are provided */ +import jtreg.SkippedException; import sun.security.krb5.Config; public class ConfPlusProp { @@ -38,9 +40,8 @@ public class ConfPlusProp { public static void main(String[] args) throws Exception { if (System.getenv("USERDNSDOMAIN") != null || System.getenv("LOGONSERVER") != null) { - System.out.println( - "Looks like a Windows machine in a domain. Skip test."); - return; + throw new SkippedException( + "Test cannot run in a domain."); } new ConfPlusProp().run(); } diff --git a/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java b/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java index f7a7fabca31..aa3f3e1ae7b 100644 --- a/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java +++ b/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,6 +49,7 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; +import jtreg.SkippedException; /* * @test @@ -250,8 +251,7 @@ static void testConstraint(String[] trustNames, String[] certNames, Exception serverException = serverFuture.get(TIMEOUT, TimeUnit.MILLISECONDS); if (serverException instanceof SocketTimeoutException || clientOut.contains("SocketTimeoutException")) { - System.out.println("The communication gets timeout and skips the test."); - return; + throw new SkippedException("The communication gets timeout."); } if (pass) { diff --git a/test/jdk/sun/security/util/Resources/Usages.java b/test/jdk/sun/security/util/Resources/Usages.java index 447a4cb4913..e5f6a15ce28 100644 --- a/test/jdk/sun/security/util/Resources/Usages.java +++ b/test/jdk/sun/security/util/Resources/Usages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,12 @@ * java.base/sun.security.tools.keytool.resources * jdk.jartool/sun.security.tools.jarsigner.resources * @summary Check usages of security-related Resources files + * @library /test/lib/ * @run main/othervm Usages */ +import jtreg.SkippedException; + import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; @@ -149,7 +152,7 @@ public static void main(String[] args) { if (Files.exists(SRC)) { MAP.forEach(Usages::check); } else { - System.out.println("No src directory. Test skipped."); + throw new SkippedException("No src directory"); } }