diff options
author | Kenny Root <kroot@google.com> | 2013-08-13 17:39:28 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-13 17:39:28 -0700 |
commit | 7e523f42e2545ba9664f56ce31afdf5ceeecaaeb (patch) | |
tree | 8ad2449ee581d15a30db66a19fa8bb8f6a20af55 | |
parent | afcea7f897b0969bdb2fa91459f76031ab35721c (diff) | |
parent | 9313bee990b014afd6b1d66b0f802f9a36792c7f (diff) | |
download | android_external_apache-http-7e523f42e2545ba9664f56ce31afdf5ceeecaaeb.tar.gz android_external_apache-http-7e523f42e2545ba9664f56ce31afdf5ceeecaaeb.tar.bz2 android_external_apache-http-7e523f42e2545ba9664f56ce31afdf5ceeecaaeb.zip |
am 9313bee9: am 40ff03b8: am 8868084e: Do not initialize SSLSocketFactory too early
* commit '9313bee990b014afd6b1d66b0f802f9a36792c7f':
Do not initialize SSLSocketFactory too early
-rw-r--r-- | src/org/apache/http/conn/ssl/SSLSocketFactory.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/org/apache/http/conn/ssl/SSLSocketFactory.java b/src/org/apache/http/conn/ssl/SSLSocketFactory.java index 1be6c3a..9195b4f 100644 --- a/src/org/apache/http/conn/ssl/SSLSocketFactory.java +++ b/src/org/apache/http/conn/ssl/SSLSocketFactory.java @@ -150,19 +150,26 @@ public class SSLSocketFactory implements LayeredSocketFactory { public static final X509HostnameVerifier STRICT_HOSTNAME_VERIFIER = new StrictHostnameVerifier(); - /** - * The factory using the default JVM settings for secure connections. + + /* + * Put defaults into holder class to avoid class preloading creating an + * instance of the classes referenced. */ - private static final SSLSocketFactory DEFAULT_FACTORY = new SSLSocketFactory(); - + private static class NoPreloadHolder { + /** + * The factory using the default JVM settings for secure connections. + */ + private static final SSLSocketFactory DEFAULT_FACTORY = new SSLSocketFactory(); + } + /** * Gets an singleton instance of the SSLProtocolSocketFactory. * @return a SSLProtocolSocketFactory */ public static SSLSocketFactory getSocketFactory() { - return DEFAULT_FACTORY; + return NoPreloadHolder.DEFAULT_FACTORY; } - + private final SSLContext sslcontext; private final javax.net.ssl.SSLSocketFactory socketfactory; private final HostNameResolver nameResolver; |