commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1084615 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
Date Wed, 23 Mar 2011 15:39:13 GMT
Author: sebb
Date: Wed Mar 23 15:39:12 2011
New Revision: 1084615

URL: http://svn.apache.org/viewvc?rev=1084615&view=rev
Log:
Use SSLContextUtils to create the context correctly when TrustManager or KeyManager is null

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3SClient.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3SClient.java?rev=1084615&r1=1084614&r2=1084615&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3SClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3SClient.java Wed
Mar 23 15:39:12 2011
@@ -29,6 +29,8 @@ import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 
+import org.apache.commons.net.util.SSLContextUtils;
+
 /**
  * POP3 over SSL processing. Copied from FTPSClient.java and modified to suit POP3.
  * If implicit mode is selected (NOT the default), SSL/TLS negotiation starts right
@@ -177,25 +179,7 @@ public class POP3SClient extends POP3Cli
     {
         if (context == null)
         {
-            try
-            {
-                context = SSLContext.getInstance(protocol);
-                context.init(new KeyManager[] { getKeyManager() },
-                             new TrustManager[] { getTrustManager() },
-                             null);
-            }
-            catch (KeyManagementException e)
-            {
-                IOException ioe = new IOException("Could not initialize SSL context");
-                ioe.initCause(e);
-                throw ioe;
-            }
-            catch (NoSuchAlgorithmException e)
-            {
-                IOException ioe = new IOException("Could not initialize SSL context");
-                ioe.initCause(e);
-                throw ioe;
-            }
+            context = SSLContextUtils.createSSLContext(protocol, getKeyManager(), getTrustManager());
         }
     }
 



Mime
View raw message