changeset 10460:a163c50c000a

8062170: java.security.ProviderException: Error parsing configuration with space Summary: Updated to parse library path as a line which can contain quoted strings. Reviewed-by: vinnie
author igerasim
date Wed, 21 Jan 2015 13:52:27 +0300
parents b71db2c41bda
children 7c5e79c7648f
files src/share/classes/sun/security/pkcs11/Config.java test/sun/security/pkcs11/Provider/ConfigShortPath.java test/sun/security/pkcs11/Provider/cspSpace.cfg
diffstat 3 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/pkcs11/Config.java	Tue Jan 20 20:29:12 2015 +0000
+++ b/src/share/classes/sun/security/pkcs11/Config.java	Wed Jan 21 13:52:27 2015 +0300
@@ -584,16 +584,24 @@
     }
 
     private String parseLine() throws IOException {
-        String s = parseWord();
+        // allow quoted string as part of line
+        String s = null;
         while (true) {
             int token = nextToken();
             if ((token == TT_EOL) || (token == TT_EOF)) {
                 break;
             }
-            if (token != TT_WORD) {
+            if (token != TT_WORD && token != '\"') {
                 throw excToken("Unexpected value");
             }
-            s = s + " " + st.sval;
+            if (s == null) {
+                s = st.sval;
+            } else {
+                s = s + " " + st.sval;
+            }
+        }
+        if (s == null) {
+            throw excToken("Unexpected empty line");
         }
         return s;
     }
@@ -653,7 +661,9 @@
     //
 
     private String parseLibrary(String keyword) throws IOException {
-        String lib = parseStringEntry(keyword);
+        checkDup(keyword);
+        parseEquals();
+        String lib = parseLine();
         lib = expand(lib);
         int i = lib.indexOf("/$ISA/");
         if (i != -1) {
--- a/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Tue Jan 20 20:29:12 2015 +0000
+++ b/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Wed Jan 21 13:52:27 2015 +0300
@@ -22,8 +22,8 @@
  */
 /**
  * @test
- * @bug 6581254 6986789 7196009
- * @summary Allow '~', '+' and quoted paths in config file
+ * @bug 6581254 6986789 7196009 8062170
+ * @summary Allow '~', '+', and quoted paths in config file
  * @author Valerie Peng
  */
 
@@ -34,7 +34,7 @@
 public class ConfigShortPath {
 
     private static final String[] configNames = {
-        "csp.cfg", "cspPlus.cfg", "cspQuotedPath.cfg"
+        "csp.cfg", "cspPlus.cfg", "cspSpace.cfg", "cspQuotedPath.cfg"
     };
 
     public static void main(String[] args) throws Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/pkcs11/Provider/cspSpace.cfg	Wed Jan 21 13:52:27 2015 +0300
@@ -0,0 +1,5 @@
+showInfo = false
+name = test
+library = C:\pki DLL\x64\acpkcs211.dll
+
+