cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7231] Logging the stack traces in URLConnection conduit
Date Thu, 26 Jan 2017 21:26:15 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes b34521759 -> eff689cd8


[CXF-7231] Logging the stack traces in URLConnection conduit


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

Branch: refs/heads/3.1.x-fixes
Commit: eff689cd8559e08b92cf3595520582a227a7d8d2
Parents: b345217
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Jan 26 21:23:41 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Jan 26 21:25:22 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/cxf/transport/http/HTTPConduit.java   | 10 +++++++++-
 .../cxf/transport/http/URLConnectionHTTPConduit.java      |  6 +++---
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/eff689cd/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
index 882ad5c..f7b1390 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
@@ -24,6 +24,8 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.HttpRetryException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
@@ -1046,11 +1048,17 @@ public abstract class HTTPConduit
                 }
                 incomingObserver.onMessage(inMessage);
             } catch (IOException e) {
-                e.printStackTrace();
+                logStackTrace(e);
             }
         }
     }
     
+    protected void logStackTrace(Throwable ex) { 
+        StringWriter sw = new StringWriter();
+        ex.printStackTrace(new PrintWriter(sw));
+        LOG.warning(sw.toString());
+    }
+    
     public void assertMessage(Message message) {
         PolicyDataEngine policyDataEngine = bus.getExtension(PolicyDataEngine.class);
         policyDataEngine.assertMessage(message, getClient(), new ClientPolicyCalculator());

http://git-wip-us.apache.org/repos/asf/cxf/blob/eff689cd/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
index c73d110..a429ddf 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
@@ -165,13 +165,13 @@ public class URLConnectionHTTPConduit extends HTTPConduit {
                             ReflectionUtil.setAccessible(f).set(c2, httpRequestMethod);
                         } catch (Throwable t) {
                             //ignore
-                            t.printStackTrace();
+                            logStackTrace(t);
                         }
                     }
                     ReflectionUtil.setAccessible(f).set(connection, httpRequestMethod);
                     message.put(HTTPURL_CONNECTION_METHOD_REFLECTION, true);
                 } catch (Throwable t) {
-                    t.printStackTrace();
+                    logStackTrace(t);
                     throw ex;
                 }
             } else {
@@ -240,7 +240,7 @@ public class URLConnectionHTTPConduit extends HTTPConduit {
                     cout = connection.getOutputStream();
                     ReflectionUtil.setAccessible(f).set(connection, method);            
           
                 } catch (Throwable t) {
-                    t.printStackTrace();
+                    logStackTrace(t);
                 }
                 
             } else {


Mime
View raw message