Author: eglynn
Date: Thu Jan 4 07:01:29 2007
New Revision: 492590
URL: http://svn.apache.org/viewvc?view=rev&rev=492590
Log:
Eliminating duplicate calls to SSLSocket.setEnableCipherSuites()
Modified:
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
Modified:
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java?view=diff&rev=492590&r1=492589&r2=492590
==============================================================================
---
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
(original)
+++
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
Thu Jan 4 07:01:29 2007
@@ -55,76 +55,45 @@
public Socket createSocket(Socket s, String host, int port, boolean
autoClose)
throws IOException, UnknownHostException {
-
- SSLSocket socket = null;
- socket = (SSLSocket)sslSocketFactory.createSocket(s, host, port,
autoClose);
- if ((socket != null) && (ciphers != null)) {
- socket.setEnabledCipherSuites(ciphers);
- }
-
- return socket;
+ return enableCipherSuites(sslSocketFactory.createSocket(s, host, port,
autoClose),
+ new Object[]{host, port});
}
public Socket createSocket(String host, int port) throws IOException,
UnknownHostException {
- SSLSocket socket = null;
- socket = (SSLSocket)sslSocketFactory.createSocket(host, port);
- if ((socket != null) && (ciphers != null)) {
- socket.setEnabledCipherSuites(ciphers);
- }
- if (socket == null) {
- LogUtils.log(LOG, Level.SEVERE,
"PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
- new Object[]{host, port});
- }
- return socket;
+ return enableCipherSuites(sslSocketFactory.createSocket(host, port),
+ new Object[]{host, port});
}
-
public Socket createSocket(String host, int port, InetAddress localHost,
int localPort)
throws IOException, UnknownHostException {
- SSLSocket socket = null;
- socket = (SSLSocket)sslSocketFactory.createSocket(host, port,
localHost, localPort);
- if ((socket != null) && (ciphers != null)) {
- socket.setEnabledCipherSuites(ciphers);
- }
-
- if (socket == null) {
- LogUtils.log(LOG, Level.SEVERE,
"PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
- new Object[]{host, port});
- }
- return socket;
+ return enableCipherSuites(sslSocketFactory.createSocket(host, port,
localHost, localPort),
+ new Object[]{host, port});
}
-
public Socket createSocket(InetAddress host, int port) throws IOException {
- SSLSocket socket = null;
- socket = (SSLSocket)sslSocketFactory.createSocket(host, port);
- if ((socket != null) && (ciphers != null)) {
- socket.setEnabledCipherSuites(ciphers);
- }
-
- if (socket == null) {
- LogUtils.log(LOG, Level.SEVERE,
"PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
- new Object[]{host, port});
- }
- return socket;
+ return enableCipherSuites(sslSocketFactory.createSocket(host, port),
+ new Object[]{host, port});
}
-
public Socket createSocket(InetAddress address, int port, InetAddress
localAddress, int localPort)
throws IOException {
- SSLSocket socket = null;
- socket = (SSLSocket)sslSocketFactory.createSocket(address, port,
localAddress, localPort);
+ return enableCipherSuites(sslSocketFactory.createSocket(address, port,
localAddress, localPort),
+ new Object[]{address, port});
+ }
+
+ private Socket enableCipherSuites(Socket s, Object[] logParams) {
+ SSLSocket socket = (SSLSocket)s;
if ((socket != null) && (ciphers != null)) {
socket.setEnabledCipherSuites(ciphers);
}
if (socket == null) {
- LogUtils.log(LOG, Level.SEVERE,
"PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
- new Object[]{address, port});
+ LogUtils.log(LOG, Level.SEVERE,
+ "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
+ logParams);
}
- return socket;
+ return socket;
}
-
/*
* For testing only
*/