changeset 16205:c8b567c5193e

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>
author mli
date Mon, 05 Dec 2016 19:06:55 -0800
parents 51843ad502b5
children 9098b2b9d997
files test/sun/security/pkcs11/PKCS11Test.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/security/pkcs11/PKCS11Test.java	Mon Dec 05 17:04:02 2016 -0800
+++ b/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);
         }
     }