Repository: cloudstack
Updated Branches:
  refs/heads/master ef0adc123 -> 784288eaa


cisco-vnmc: Don't create Protocol using deprecated SecureProtocolSocketFactory

Latest httpclient library suggests when creating Protocol object for use
with the apache common httpclient class, they should avoid using the
deprecated Protocol signature which takes in SecureProtocolSocketFactory

Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2bff5956
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2bff5956
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2bff5956

Branch: refs/heads/master
Commit: 2bff5956a94057ecc75cd06180953479c60ae277
Parents: ef0adc1
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
Authored: Fri Aug 29 14:38:42 2014 +0200
Committer: Rohit Yadav <rohit.ya...@shapeblue.com>
Committed: Fri Aug 29 14:39:29 2014 +0200

----------------------------------------------------------------------
 .../network/cisco/CiscoVnmcConnectionImpl.java  |  3 +-
 .../ssl/EasySSLProtocolSocketFactory.java       | 33 +++++++++-----------
 2 files changed, 15 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bff5956/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
index e1caee5..0057e2e 100644
--- 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
@@ -1228,14 +1228,13 @@ public class CiscoVnmcConnectionImpl implements 
CiscoVnmcConnection {
     }
 
     private String sendRequest(String service, String xmlRequest) throws 
ExecutionException {
-        org.apache.commons.httpclient.protocol.Protocol myhttps = null;
         HttpClient client = new HttpClient();
         byte[] response = null;
         PostMethod method = new PostMethod("/xmlIM/" + service);
         method.setRequestBody(xmlRequest);
 
         try {
-            myhttps = new 
org.apache.commons.httpclient.protocol.Protocol("https", new 
EasySSLProtocolSocketFactory(), 443);
+            org.apache.commons.httpclient.protocol.Protocol myhttps = new 
org.apache.commons.httpclient.protocol.Protocol("https", new 
EasySSLProtocolSocketFactory(), 443);
             client.getHostConfiguration().setHost(_ip, 443, myhttps);
             int statusCode = client.executeMethod(method);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bff5956/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
----------------------------------------------------------------------
diff --git 
a/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
 
b/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
index fab7d45..42650fc 100644
--- 
a/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
+++ 
b/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
@@ -19,6 +19,16 @@
 
 package org.apache.commons.httpclient.contrib.ssl;
 
+import org.apache.commons.httpclient.ConnectTimeoutException;
+import org.apache.commons.httpclient.HttpClientError;
+import org.apache.commons.httpclient.params.HttpConnectionParams;
+import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.net.SocketFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -26,20 +36,9 @@ import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.UnknownHostException;
 
-import javax.net.SocketFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-
-import org.apache.commons.httpclient.ConnectTimeoutException;
-import org.apache.commons.httpclient.HttpClientError;
-import org.apache.commons.httpclient.params.HttpConnectionParams;
-import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 /**
  * <p>
- * EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}s
+ * EasySSLProtocolSocketFactory can be used to create SSL {@link Socket}s
  * that accept self-signed certificates.
  * </p>
  * <p>
@@ -84,7 +83,7 @@ import org.apache.commons.logging.LogFactory;
  * </p>
  */
 
-public class EasySSLProtocolSocketFactory implements 
SecureProtocolSocketFactory {
+public class EasySSLProtocolSocketFactory implements ProtocolSocketFactory {
 
     /** Log object for this class. */
     private static final Log LOG = 
LogFactory.getLog(EasySSLProtocolSocketFactory.class);
@@ -117,7 +116,7 @@ public class EasySSLProtocolSocketFactory implements 
SecureProtocolSocketFactory
     }
 
     /**
-     * @see 
SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int)
+     * @see 
ProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int)
      */
     @Override
     public Socket createSocket(String host, int port, InetAddress clientHost, 
int clientPort) throws IOException, UnknownHostException {
@@ -167,17 +166,13 @@ public class EasySSLProtocolSocketFactory implements 
SecureProtocolSocketFactory
     }
 
     /**
-     * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int)
+     * @see ProtocolSocketFactory#createSocket(java.lang.String,int)
      */
     @Override
     public Socket createSocket(String host, int port) throws IOException, 
UnknownHostException {
         return getSSLContext().getSocketFactory().createSocket(host, port);
     }
 
-    /**
-     * @see 
SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean)
-     */
-    @Override
     public Socket createSocket(Socket socket, String host, int port, boolean 
autoClose) throws IOException, UnknownHostException {
         return getSSLContext().getSocketFactory().createSocket(socket, host, 
port, autoClose);
     }

Reply via email to