test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java
changeset 58248 e6231dbaa862
parent 51460 97e361fe3433
--- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java	Fri Sep 20 22:11:45 2019 +0000
+++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java	Sat Sep 21 08:06:00 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -67,6 +67,13 @@
         String configName = BASE + SEP + "nss.cfg";
         Provider p = getSunPKCS11(configName);
 
+        if (improperNSSVersion(p)) {
+            System.out.println(
+                    "Skip test due to improper NSS version in [3.28, 3.35). "
+                    + "See JDK-8180837 for more detatils.");
+            return;
+        }
+
         System.out.println(p);
         Security.addProvider(p);
 
@@ -125,4 +132,13 @@
         System.out.println("OK");
     }
 
+    private static boolean improperNSSVersion(Provider p) {
+        double nssVersion = getNSSVersion();
+        if (p.getName().equalsIgnoreCase("SunPKCS11-NSSKeyStore")
+                && nssVersion >= 3.28 && nssVersion < 3.35) {
+            return true;
+        }
+
+        return false;
+    }
 }