cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1089765 - in /cxf/trunk: api/src/main/java/org/apache/cxf/message/Message.java rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java
Date Thu, 07 Apr 2011 08:06:25 GMT
Author: ningjiang
Date: Thu Apr  7 08:06:25 2011
New Revision: 1089765

URL: http://svn.apache.org/viewvc?rev=1089765&view=rev
Log:
CXF-3442 add an option exceptionMessageCauseEnabled to generate the caused by message

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?rev=1089765&r1=1089764&r2=1089765&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Thu Apr  7 08:06:25 2011
@@ -89,6 +89,7 @@ public interface Message extends StringM
     String MTOM_THRESHOLD = "mtom-threshold";
     String SCHEMA_VALIDATION_ENABLED = "schema-validation-enabled";
     String FAULT_STACKTRACE_ENABLED = "faultStackTraceEnabled";
+    String EXCEPTION_MESSAGE_CAUSE_ENABLED = "exceptionMessageCauseEnabled";
     String CONTENT_TYPE = "Content-Type";    
     String ACCEPT_CONTENT_TYPE = "Accept";
     String BASE_PATH = Message.class.getName() + ".BASE_PATH";

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java?rev=1089765&r1=1089764&r2=1089765&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java Thu
Apr  7 08:06:25 2011
@@ -97,7 +97,6 @@ public class FaultOutInterceptor extends
                         }
                     }
                 }
-    
                 f.setMessage(ex.getMessage());
             } catch (Exception fex) {
                 //ignore - if any exceptions occur here, we'll ignore them
@@ -105,6 +104,18 @@ public class FaultOutInterceptor extends
                 //the fault like it was an unchecked exception.
                 LOG.log(Level.WARNING, "EXCEPTION_WHILE_WRITING_FAULT", fex);
             }
+        } else {
+            // Cannot find the fault info, now we should check if we need to 
+            // set the cause message of the exception
+            String config = (String)message.getContextualProperty(
+                org.apache.cxf.message.Message.EXCEPTION_MESSAGE_CAUSE_ENABLED);
+            if (config != null && Boolean.valueOf(config).booleanValue()) {
+                StringBuffer buffer = new StringBuffer();
+                buffer.append(f.getMessage());
+                buffer.append(" Caused by: ");
+                buffer.append(cause.getMessage());
+                f.setMessage(buffer.toString());
+            }
         }
     }
 



Mime
View raw message