|
|
9bf359 |
# HG changeset patch
|
|
|
9bf359 |
# User andrew
|
|
|
9bf359 |
# Date 1352129932 0
|
|
|
9bf359 |
# Node ID e9c857dcb964dbfa5eef3a3590244cb4d999cf7a
|
|
|
9bf359 |
# Parent 1406789608b76d0906881979335d685855f44190
|
|
|
9bf359 |
Allow multiple PKCS11 library initialisation to be a non-critical error.
|
|
|
9bf359 |
|
|
|
9bf359 |
diff -r 1406789608b7 -r e9c857dcb964 src/share/classes/sun/security/pkcs11/Config.java
|
|
|
9bf359 |
--- jdk8/jdk/src/share/classes/sun/security/pkcs11/Config.java Tue Oct 30 13:05:14 2012 +0000
|
|
|
9bf359 |
+++ jdk8/jdk/src/share/classes/sun/security/pkcs11/Config.java Mon Nov 05 15:38:52 2012 +0000
|
|
|
9bf359 |
@@ -52,6 +52,7 @@
|
|
|
9bf359 |
static final int ERR_HALT = 1;
|
|
|
9bf359 |
static final int ERR_IGNORE_ALL = 2;
|
|
|
9bf359 |
static final int ERR_IGNORE_LIB = 3;
|
|
|
9bf359 |
+ static final int ERR_IGNORE_MULTI_INIT = 4;
|
|
|
9bf359 |
|
|
|
9bf359 |
// same as allowSingleThreadedModules but controlled via a system property
|
|
|
9bf359 |
// and applied to all providers. if set to false, no SunPKCS11 instances
|
|
|
9bf359 |
@@ -980,6 +981,8 @@
|
|
|
9bf359 |
handleStartupErrors = ERR_IGNORE_LIB;
|
|
|
9bf359 |
} else if (val.equals("halt")) {
|
|
|
9bf359 |
handleStartupErrors = ERR_HALT;
|
|
|
9bf359 |
+ } else if (val.equals("ignoreMultipleInitialisation")) {
|
|
|
9bf359 |
+ handleStartupErrors = ERR_IGNORE_MULTI_INIT;
|
|
|
9bf359 |
} else {
|
|
|
9bf359 |
throw excToken("Invalid value for handleStartupErrors:");
|
|
|
9bf359 |
}
|
|
|
9bf359 |
diff -r 1406789608b7 -r e9c857dcb964 src/share/classes/sun/security/pkcs11/SunPKCS11.java
|
|
|
9bf359 |
--- jdk8/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java Tue Oct 30 13:05:14 2012 +0000
|
|
|
9bf359 |
+++ jdk8/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java Mon Nov 05 15:38:52 2012 +0000
|
|
|
9bf359 |
@@ -168,26 +168,37 @@
|
|
|
9bf359 |
String nssLibraryDirectory = config.getNssLibraryDirectory();
|
|
|
9bf359 |
String nssSecmodDirectory = config.getNssSecmodDirectory();
|
|
|
9bf359 |
boolean nssOptimizeSpace = config.getNssOptimizeSpace();
|
|
|
9bf359 |
+ int errorHandling = config.getHandleStartupErrors();
|
|
|
9bf359 |
|
|
|
9bf359 |
if (secmod.isInitialized()) {
|
|
|
9bf359 |
if (nssSecmodDirectory != null) {
|
|
|
9bf359 |
String s = secmod.getConfigDir();
|
|
|
9bf359 |
if ((s != null) &&
|
|
|
9bf359 |
(s.equals(nssSecmodDirectory) == false)) {
|
|
|
9bf359 |
- throw new ProviderException("Secmod directory "
|
|
|
9bf359 |
- + nssSecmodDirectory
|
|
|
9bf359 |
- + " invalid, NSS already initialized with "
|
|
|
9bf359 |
- + s);
|
|
|
9bf359 |
+ String msg = "Secmod directory " + nssSecmodDirectory
|
|
|
9bf359 |
+ + " invalid, NSS already initialized with " + s;
|
|
|
9bf359 |
+ if (errorHandling == Config.ERR_IGNORE_MULTI_INIT ||
|
|
|
9bf359 |
+ errorHandling == Config.ERR_IGNORE_ALL) {
|
|
|
9bf359 |
+ throw new UnsupportedOperationException(msg);
|
|
|
9bf359 |
+ } else {
|
|
|
9bf359 |
+ throw new ProviderException(msg);
|
|
|
9bf359 |
+ }
|
|
|
9bf359 |
}
|
|
|
9bf359 |
}
|
|
|
9bf359 |
if (nssLibraryDirectory != null) {
|
|
|
9bf359 |
String s = secmod.getLibDir();
|
|
|
9bf359 |
if ((s != null) &&
|
|
|
9bf359 |
(s.equals(nssLibraryDirectory) == false)) {
|
|
|
9bf359 |
- throw new ProviderException("NSS library directory "
|
|
|
9bf359 |
+ String msg = "NSS library directory "
|
|
|
9bf359 |
+ nssLibraryDirectory
|
|
|
9bf359 |
+ " invalid, NSS already initialized with "
|
|
|
9bf359 |
- + s);
|
|
|
9bf359 |
+ + s;
|
|
|
9bf359 |
+ if (errorHandling == Config.ERR_IGNORE_MULTI_INIT ||
|
|
|
9bf359 |
+ errorHandling == Config.ERR_IGNORE_ALL) {
|
|
|
9bf359 |
+ throw new UnsupportedOperationException(msg);
|
|
|
9bf359 |
+ } else {
|
|
|
9bf359 |
+ throw new ProviderException(msg);
|
|
|
9bf359 |
+ }
|
|
|
9bf359 |
}
|
|
|
9bf359 |
}
|
|
|
9bf359 |
} else {
|