6986789: Sun pkcs11 provider fails to parse path name containing "+"
authorvaleriep
Tue, 12 Apr 2011 16:09:17 -0700
changeset 9261 efb29ab3324e
parent 9260 d01f7f35fdf4
child 9262 8d4c68eccc47
6986789: Sun pkcs11 provider fails to parse path name containing "+" Summary: Modified to accept '+' as valid character. Reviewed-by: weijun
jdk/src/share/classes/sun/security/pkcs11/Config.java
jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java
jdk/test/sun/security/pkcs11/Provider/cspPlus.cfg
--- a/jdk/src/share/classes/sun/security/pkcs11/Config.java	Tue Apr 12 15:57:28 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/Config.java	Tue Apr 12 16:09:17 2011 -0700
@@ -343,6 +343,7 @@
         st.wordChars('{', '{'); // need {} for property subst
         st.wordChars('}', '}');
         st.wordChars('*', '*');
+        st.wordChars('+', '+');
         st.wordChars('~', '~');
         // XXX check ASCII table and add all other characters except special
 
--- a/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Tue Apr 12 15:57:28 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Tue Apr 12 16:09:17 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -22,8 +22,8 @@
  */
 /**
  * @test
- * @bug 6581254
- * @summary Allow "~" in config to support windows short path
+ * @bug 6581254 6986789
+ * @summary Allow '~' and '+' in config file
  * @author Valerie Peng
  */
 
@@ -32,17 +32,21 @@
 
 public class ConfigShortPath {
 
+    private static final String[] configNames = { "csp.cfg", "cspPlus.cfg" };
+
     public static void main(String[] args) {
         String testSrc = System.getProperty("test.src", ".");
-        String configFile = testSrc + File.separator + "csp.cfg";
-        System.out.println("Testing against " + configFile);
-        try {
-            Provider p = new sun.security.pkcs11.SunPKCS11(configFile);
-        } catch (ProviderException pe) {
-            String cause = pe.getCause().getMessage();
-            if (cause.indexOf("Unexpected token") != -1) {
-                // re-throw to indicate test failure
-                throw pe;
+        for (int i = 0; i < configNames.length; i++) {
+            String configFile = testSrc + File.separator + configNames[i];
+            System.out.println("Testing against " + configFile);
+            try {
+                Provider p = new sun.security.pkcs11.SunPKCS11(configFile);
+            } catch (ProviderException pe) {
+                String cause = pe.getCause().getMessage();
+                if (cause.indexOf("Unexpected token") != -1) {
+                    // re-throw to indicate test failure
+                    throw pe;
+                }
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Provider/cspPlus.cfg	Tue Apr 12 16:09:17 2011 -0700
@@ -0,0 +1,4 @@
+showInfo = false
+name = NSS
+nssSecmodDirectory = /export/local/38289.JDK7.PIT.JSN-TL+7-b112_pit_security_oel5.5-x64-32/results/ResultDir/KeytoolNSS/db
+nssLibraryDirectory = /export/local/common/testbase/7/security/tools/lib/nss/Linux2.6