|
1 | 1 | /* |
2 | | - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
27 | 27 | * @requires os.family == "windows" |
28 | 28 | * @library /test/lib |
29 | 29 | * @summary Test "keytool -list" displays correctly same named certificates |
30 | | - * @ignore Uses certutil.exe that isn't guaranteed to be installed |
31 | 30 | */ |
32 | 31 |
|
33 | 32 | import jdk.test.lib.process.ProcessTools; |
34 | 33 |
|
| 34 | +import java.io.IOException; |
35 | 35 | import java.security.KeyStore; |
36 | 36 | import java.util.Collections; |
| 37 | +import jtreg.SkippedException; |
37 | 38 |
|
38 | 39 | public class NonUniqueAliases { |
39 | 40 | public static void main(String[] args) throws Throwable { |
40 | | - |
41 | 41 | try { |
42 | | - String testSrc = System.getProperty("test.src", "."); |
| 42 | + runTest(); |
| 43 | + } catch (IOException ex) { |
| 44 | + // It uses certutil.exe that isn't guaranteed to be installed |
| 45 | + String certutilMsg = "Cannot run program \"certutil\""; |
| 46 | + if (ex.getMessage().contains(certutilMsg)) { |
| 47 | + throw new SkippedException("certutil is not installed"); |
| 48 | + } |
| 49 | + throw ex; |
| 50 | + } |
| 51 | + } |
43 | 52 |
|
| 53 | + private static void runTest() throws Exception { |
| 54 | + String testSrc = System.getProperty("test.src", "."); |
| 55 | + try { |
44 | 56 | // removing the alias NonUniqueName if it already exists |
45 | 57 | ProcessTools.executeCommand("certutil", "-user", "-delstore", "MY", |
46 | 58 | "NonUniqueName"); |
|
0 commit comments