summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2013-08-13 17:31:27 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-08-13 17:31:27 -0700
commit9313bee990b014afd6b1d66b0f802f9a36792c7f (patch)
treeb2fc598903c244a6a95082aa927314fd04c01c5e
parent3be157fc74e12c82abfa92ee804a35dfb68f4410 (diff)
parent40ff03b8ad09a7452b6a4e0916ce404ad31afc34 (diff)
downloadandroid_external_apache-http-9313bee990b014afd6b1d66b0f802f9a36792c7f.tar.gz
android_external_apache-http-9313bee990b014afd6b1d66b0f802f9a36792c7f.tar.bz2
android_external_apache-http-9313bee990b014afd6b1d66b0f802f9a36792c7f.zip
am 40ff03b8: am 8868084e: Do not initialize SSLSocketFactory too early
* commit '40ff03b8ad09a7452b6a4e0916ce404ad31afc34': Do not initialize SSLSocketFactory too early
-rw-r--r--src/org/apache/http/conn/ssl/SSLSocketFactory.java19
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;