8170523: Some PKCS11 test cases are ignored with security manager
authormli
Mon, 05 Dec 2016 19:06:55 -0800
changeset 42366 b1483ec50db1
parent 42365 5e640c2994d6
child 42367 2625312d491c
8170523: Some PKCS11 test cases are ignored with security manager Summary: Get OS distro before enabling security manager Reviewed-by: mullan Contributed-by: John Jiang <sha.jiang@oracle.com>
jdk/test/sun/security/pkcs11/PKCS11Test.java
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Mon Dec 05 17:04:02 2016 -0800
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Mon Dec 05 19:06:55 2016 -0800
@@ -642,6 +642,8 @@
     static final boolean badNSSVersion =
             getNSSVersion() >= 3.11 && getNSSVersion() < 3.12;
 
+    private static final String distro = distro();
+
     static final boolean badSolarisSparc =
             System.getProperty("os.name").equals("SunOS") &&
             System.getProperty("os.arch").equals("sparcv9") &&
@@ -735,13 +737,17 @@
      * Get the identifier for the operating system distribution
      */
     static String getDistro() {
+        return distro;
+    }
+
+    private static String distro() {
         try (BufferedReader in =
             new BufferedReader(new InputStreamReader(
                 Runtime.getRuntime().exec("uname -v").getInputStream()))) {
 
             return in.readLine();
         } catch (Exception e) {
-            return "";
+            throw new RuntimeException("Failed to determine distro.", e);
         }
     }