--- a/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java Thu Apr 11 12:22:23 2013 +0900
+++ b/jdk/src/share/classes/com/sun/crypto/provider/SunJCE.java Thu Apr 11 17:57:08 2013 +0100
@@ -91,6 +91,10 @@
/* Are we debugging? -- for developers */
static final boolean debug = false;
+ // Instance of this provider, so we don't have to call the provider list
+ // to find ourselves or run the risk of not being in the list.
+ private static volatile SunJCE instance = null;
+
// lazy initialize SecureRandom to avoid potential recursion if Sun
// provider has not been installed yet
private static class SecureRandomHolder {
@@ -770,5 +774,17 @@
return null;
}
});
+
+ if (instance == null) {
+ instance = this;
+ }
+ }
+
+ // Return the instance of this class or create one if needed.
+ static SunJCE getInstance() {
+ if (instance == null) {
+ return new SunJCE();
+ }
+ return instance;
}
}