8184916: DisabledAlgorithmConstraints loading should be delayed until needed
Reviewed-by: mullan
--- a/jdk/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java Wed Jul 19 19:30:08 2017 +0100
+++ b/jdk/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java Wed Jul 19 19:31:48 2017 +0100
@@ -59,9 +59,15 @@
/* Are we debugging ? */
private static final Debug debug = Debug.getInstance("jar");
- private static final DisabledAlgorithmConstraints JAR_DISABLED_CHECK =
+ /**
+ * Holder class to delay initialization of DisabledAlgorithmConstraints
+ * until needed.
+ */
+ private static class ConfigurationHolder {
+ static final DisabledAlgorithmConstraints JAR_DISABLED_CHECK =
new DisabledAlgorithmConstraints(
DisabledAlgorithmConstraints.PROPERTY_JAR_DISABLED_ALGS);
+ }
private ArrayList<CodeSigner[]> signerCache;
@@ -371,7 +377,7 @@
Boolean permitted = permittedAlgs.get(algorithm);
if (permitted == null) {
try {
- JAR_DISABLED_CHECK.permits(algorithm,
+ ConfigurationHolder.JAR_DISABLED_CHECK.permits(algorithm,
new ConstraintsParameters(timestamp));
} catch(GeneralSecurityException e) {
permittedAlgs.put(algorithm, Boolean.FALSE);