test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java
changeset 51460 97e361fe3433
parent 47216 71c04702a3d5
--- a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java	Wed Aug 15 00:48:12 2018 -0700
+++ b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java	Wed Aug 15 18:41:18 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -27,7 +27,7 @@
  * @summary make sure we can access the NSS softtoken KeyStore
  *          and use a private key
  * @author Andreas Sterbenz
- * @library ..
+ * @library /test/lib ..
  * @modules jdk.crypto.cryptoki
  * @run main/othervm GetPrivateKey
  * @run main/othervm GetPrivateKey sm policy
@@ -47,6 +47,11 @@
 public class GetPrivateKey extends SecmodTest {
 
     public static void main(String[] args) throws Exception {
+        if (args.length > 1 && "sm".equals(args[0])) {
+            System.setProperty("java.security.policy",
+                    BASE + File.separator + args[1]);
+        }
+
         if (initSecmod() == false) {
             return;
         }
@@ -58,8 +63,6 @@
         Security.addProvider(p);
 
         if (args.length > 1 && "sm".equals(args[0])) {
-            System.setProperty("java.security.policy",
-                    BASE + File.separator + args[1]);
             System.setSecurityManager(new SecurityManager());
         }