6998860: Signed jar file verification is currently creating many extra new Sun providers.
Reviewed-by: mchung
--- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java Tue Dec 07 13:29:20 2010 +0000
+++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java Wed Dec 08 10:21:48 2010 -0800
@@ -44,6 +44,16 @@
private static final Debug debug = Debug.getInstance("jar");
+ /**
+ * Holder class to lazily load Sun provider. NOTE: if
+ * Providers.getSunProvider returned a cached provider, we could avoid the
+ * need for caching the provider with this holder class; we should try to
+ * revisit this in JDK 8.
+ */
+ private static class SunProviderHolder {
+ private static final Provider instance = Providers.getSunProvider();
+ }
+
/** the created digest objects */
HashMap<String, MessageDigest> createdDigests;
@@ -125,7 +135,7 @@
try {
digest = MessageDigest.getInstance
- (algorithm, Providers.getSunProvider());
+ (algorithm, SunProviderHolder.instance);
createdDigests.put(algorithm, digest);
} catch (NoSuchAlgorithmException nsae) {
// ignore