summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2013-07-23 20:10:12 -0700
committerThe Android Automerger <android-build@android.com>2013-08-13 15:22:49 -0700
commit2f0e9505248dc19d7fcfed4c1efd7c3daf863f03 (patch)
tree8ad2449ee581d15a30db66a19fa8bb8f6a20af55
parentafcea7f897b0969bdb2fa91459f76031ab35721c (diff)
downloadandroid_external_apache-http-2f0e9505248dc19d7fcfed4c1efd7c3daf863f03.tar.gz
android_external_apache-http-2f0e9505248dc19d7fcfed4c1efd7c3daf863f03.tar.bz2
android_external_apache-http-2f0e9505248dc19d7fcfed4c1efd7c3daf863f03.zip
Do not initialize SSLSocketFactory too early DO NOT MERGE
During Zygote initialization, the class may be preloaded. However we do not want the default instances of SSLSocketFactory initialized, so move those into a holder class so they are only initialized when used. (cherry picked from commit 72017834153711733905dfcf4bfe7b802062692b) Bug: 9984058 Change-Id: I245d3d075c8c3476e9f76579ef7141e447f92011
-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;