You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2012/02/13 20:19:35 UTC
svn commit: r1243661 - in
/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl:
SSLInitializationException.java SSLSocketFactory.java
Author: olegk
Date: Mon Feb 13 19:19:35 2012
New Revision: 1243661
URL: http://svn.apache.org/viewvc?rev=1243661&view=rev
Log:
Fixed problem with the system SSL context initialization (seems to affect Windows only)
Added:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java (with props)
Modified:
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
Added: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java?rev=1243661&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java (added)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java Mon Feb 13 19:19:35 2012
@@ -0,0 +1,37 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.conn.ssl;
+
+public class SSLInitializationException extends IllegalStateException {
+
+ private static final long serialVersionUID = -8243587425648536702L;
+
+ public SSLInitializationException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLInitializationException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java?rev=1243661&r1=1243660&r2=1243661&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java Mon Feb 13 19:19:35 2012
@@ -296,12 +296,9 @@ public class SSLSocketFactory implements
tmfactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
- if (trustStorePassword == null) {
- trustStorePassword = "changeit";
- }
FileInputStream instream = new FileInputStream(trustStoreFile);
try {
- trustStore.load(instream, trustStorePassword.toCharArray());
+ trustStore.load(instream, trustStorePassword != null ? trustStorePassword.toCharArray() : null);
} finally {
instream.close();
}
@@ -360,7 +357,7 @@ public class SSLSocketFactory implements
try {
return createSSLContext(TLS, null, null, null, null, null);
} catch (Exception ex) {
- throw new IllegalStateException("Failure initializing default SSL context", ex);
+ throw new SSLInitializationException("Failure initializing default SSL context", ex);
}
}
@@ -368,7 +365,7 @@ public class SSLSocketFactory implements
try {
return createSystemSSLContext(TLS, null);
} catch (Exception ex) {
- throw new IllegalStateException("Failure initializing default system SSL context", ex);
+ throw new SSLInitializationException("Failure initializing default system SSL context", ex);
}
}