cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1450511 - /cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Date Tue, 26 Feb 2013 22:58:28 GMT
Author: ay
Date: Tue Feb 26 22:58:27 2013
New Revision: 1450511

URL: http://svn.apache.org/r1450511
Log:
[CXF-4857] Workaround for Socket Closed exception for jdk1.6

Modified:
    cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Modified: cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1450511&r1=1450510&r2=1450511&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Tue Feb 26 22:58:27 2013
@@ -28,6 +28,7 @@ import java.net.HttpRetryException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.Proxy;
+import java.net.SocketException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Arrays;
@@ -1396,12 +1397,23 @@ public class HTTPConduit 
             
             // If we need to cache for retransmission, store data in a
             // CacheAndWriteOutputStream. Otherwise write directly to the output stream.
+            OutputStream cout = null;
+            try {
+                cout = connection.getOutputStream();
+            } catch (SocketException e) {
+                if ("Socket Closed".equals(e.getMessage())) {
+                    connection.connect();
+                    cout = connection.getOutputStream();
+                } else {
+                    throw e;
+                }
+            }
             if (cachingForRetransmission) {
                 cachedStream =
-                    new CacheAndWriteOutputStream(connection.getOutputStream());
+                    new CacheAndWriteOutputStream(cout);
                 wrappedStream = cachedStream;
             } else {
-                wrappedStream = connection.getOutputStream();
+                wrappedStream = cout;
             }
             
         }



Mime
View raw message