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
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Config.java Fri Dec 12 00:19:17 2014 +0000
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Config.java Fri Dec 12 00:23:32 2014 +0000
@@ -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/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java Fri Dec 12 00:19:17 2014 +0000
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java Fri Dec 12 00:23:32 2014 +0000
@@ -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/jdk/test/sun/security/pkcs11/Provider/cspSpace.cfg Fri Dec 12 00:23:32 2014 +0000
@@ -0,0 +1,5 @@
+showInfo = false
+name = test
+library = C:\pki DLL\x64\acpkcs211.dll
+
+