You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2007/04/10 19:44:12 UTC

svn commit: r527217 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java

Author: scheu
Date: Tue Apr 10 10:44:11 2007
New Revision: 527217

URL: http://svn.apache.org/viewvc?view=rev&rev=527217
Log:
AXIS2-2496
Contributor:Rich Scheuerle
JAX-WS Exception Flow Servicability Changes

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?view=diff&rev=527217&r1=527216&r2=527217
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java Tue Apr 10 10:44:11 2007
@@ -538,6 +538,7 @@
             log.debug("Marshal Throwable =" + throwable.getClass().getName());
             log.debug("  rootCause =" + t.getClass().getName());
             log.debug("  exception=" + t.toString());
+            log.debug("  stack=" + stackToString(t));
         }
 
         XMLFault xmlfault = null;
@@ -1076,5 +1077,19 @@
         return false;
 
 
+    }
+    
+    /**
+     * Get a string containing the stack of the specified exception   
+     * @param e   
+     * @return    
+     */   
+    public static String stackToString(Throwable e) {       
+        java.io.StringWriter sw= new java.io.StringWriter();        
+        java.io.BufferedWriter bw = new java.io.BufferedWriter(sw);       
+        java.io.PrintWriter pw= new java.io.PrintWriter(bw);       
+        e.printStackTrace(pw);       
+        pw.close();       
+        return sw.getBuffer().toString();      
     }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java?view=diff&rev=527217&r1=527216&r2=527217
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java Tue Apr 10 10:44:11 2007
@@ -259,14 +259,17 @@
                 // Skip over this cause
                 nextCause = getCause(t);
                 if (nextCause == null) {
+                    logRootCause(t);
                     return t;
                 }
                 t = nextCause;
             } else {
                 // This is the root cause
+                logRootCause(t);
                 return t;
             }
         }
+        logRootCause(t);
         return t;
     }
 
@@ -290,6 +293,31 @@
             return Messages.getMessage("JABGraphProblem");
 
         return null;
+    }
+    /**
+     * Log the root cause
+     * @param t
+     */
+    private static void logRootCause(Throwable t) {
+        // TODO Should certain throwables be logged elsewhere
+        if (log.isDebugEnabled()) {
+            log.debug("Root Cause:" +  t.toString());
+            log.debug("stack:" + stackToString(t));
+        }
+    }
+    
+    /**
+     * Get a string containing the stack of the specified exception
+     * @param e
+     * @return
+     */
+    public static String stackToString(Throwable e) {
+        java.io.StringWriter sw= new java.io.StringWriter(); 
+        java.io.BufferedWriter bw = new java.io.BufferedWriter(sw);
+        java.io.PrintWriter pw= new java.io.PrintWriter(bw); 
+        e.printStackTrace(pw);
+        pw.close();
+        return sw.getBuffer().toString();
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org