author | valeriep |
Tue, 12 Apr 2011 16:09:17 -0700 | |
changeset 9261 | efb29ab3324e |
parent 7808 | 992bb9918576 |
child 9270 | 499a73f29347 |
permissions | -rw-r--r-- |
7808
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
1 |
/* |
9261
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
2 |
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
7808
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
4 |
* |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
8 |
* |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
13 |
* accompanied this code). |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
14 |
* |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
18 |
* |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
21 |
* questions. |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
22 |
*/ |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
23 |
/** |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
24 |
* @test |
9261
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
25 |
* @bug 6581254 6986789 |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
26 |
* @summary Allow '~' and '+' in config file |
7808
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
27 |
* @author Valerie Peng |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
28 |
*/ |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
29 |
|
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
30 |
import java.security.*; |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
31 |
import java.io.*; |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
32 |
|
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
33 |
public class ConfigShortPath { |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
34 |
|
9261
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
35 |
private static final String[] configNames = { "csp.cfg", "cspPlus.cfg" }; |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
36 |
|
7808
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
37 |
public static void main(String[] args) { |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
38 |
String testSrc = System.getProperty("test.src", "."); |
9261
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
39 |
for (int i = 0; i < configNames.length; i++) { |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
40 |
String configFile = testSrc + File.separator + configNames[i]; |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
41 |
System.out.println("Testing against " + configFile); |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
42 |
try { |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
43 |
Provider p = new sun.security.pkcs11.SunPKCS11(configFile); |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
44 |
} catch (ProviderException pe) { |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
45 |
String cause = pe.getCause().getMessage(); |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
46 |
if (cause.indexOf("Unexpected token") != -1) { |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
47 |
// re-throw to indicate test failure |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
48 |
throw pe; |
efb29ab3324e
6986789: Sun pkcs11 provider fails to parse path name containing "+"
valeriep
parents:
7808
diff
changeset
|
49 |
} |
7808
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
50 |
} |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
51 |
} |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
52 |
} |
992bb9918576
6581254: pkcs11 provider fails to parse configuration file contains windows short path
valeriep
parents:
diff
changeset
|
53 |
} |