cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1517463 - in /cxf/branches/2.7.x-fixes: ./ api/src/main/java/org/apache/cxf/interceptor/ api/src/main/java/org/apache/cxf/message/ rt/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ systests/uncategorized/src/test/...
Date Mon, 26 Aug 2013 08:46:45 GMT
Author: ffang
Date: Mon Aug 26 08:46:44 2013
New Revision: 1517463

URL: http://svn.apache.org/r1517463
Log:
Merged revisions 1517432 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1517432 | ffang | 2013-08-26 14:14:27 +0800 (δΈ€, 26  8 2013) | 1 line
  
  [CXF-5231]NoSuchElementException in ClientFaultConverter when stack trace message contains
line breaks
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
    cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
    cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
    cxf/branches/2.7.x-fixes/rt/pom.xml
    cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
    cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1517432

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=1517463&r1=1517462&r2=1517463&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Mon Aug 26 08:46:44 2013
@@ -240,7 +240,7 @@ public class ClientFaultConverter extend
                 XPathConstants.STRING);
         List<StackTraceElement> stackTraceList = new ArrayList<StackTraceElement>();
         if (!StringUtils.isEmpty(ss)) {
-            StringTokenizer st = new StringTokenizer(ss, "\n");
+            StringTokenizer st = new StringTokenizer(ss, Message.EXCEPTION_CAUSE_SUFFIX);
             while (st.hasMoreTokens()) {
                 String oneLine = st.nextToken();
                 if (oneLine.startsWith("Caused by:")) {

Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java?rev=1517463&r1=1517462&r2=1517463&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java Mon Aug
26 08:46:44 2013
@@ -118,6 +118,13 @@ public interface Message extends StringM
      */
     String EXCEPTION_MESSAGE_CAUSE_ENABLED = "exceptionMessageCauseEnabled";
 
+    /**
+     * A very unique delimiter used for exception with FAULT_STACKTRACE_ENABLED enable, 
+     * which is easy for client to differentiate the cause and stacktrace when unmarsall

+     * a fault message 
+     */
+    String EXCEPTION_CAUSE_SUFFIX = "#*#";
+
     String CONTENT_TYPE = "Content-Type";    
     String ACCEPT_CONTENT_TYPE = "Accept";
     String BASE_PATH = Message.class.getName() + ".BASE_PATH";

Modified: cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java?rev=1517463&r1=1517462&r2=1517463&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
Mon Aug 26 08:46:44 2013
@@ -82,12 +82,12 @@ public abstract class AbstractSoapInterc
             while (throwable != null) {
                 for (StackTraceElement ste : throwable.getStackTrace()) {
                     sb.append(ste.getClassName() + "!" + ste.getMethodName() + "!" + ste.getFileName()
+ "!"
-                          + ste.getLineNumber() + "\n");
+                          + ste.getLineNumber() + Message.EXCEPTION_CAUSE_SUFFIX);
                 }
                 throwable = throwable.getCause();
                 if (throwable != null) {
                     sb.append("Caused by: " +  throwable.getClass().getCanonicalName() 
-                              + " : " + throwable.getMessage() + "\n");
+                              + " : " + throwable.getMessage() + Message.EXCEPTION_CAUSE_SUFFIX);
                 }
             }
             Element detail = fault.getDetail();

Modified: cxf/branches/2.7.x-fixes/rt/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/pom.xml?rev=1517463&r1=1517462&r2=1517463&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/rt/pom.xml Mon Aug 26 08:46:44 2013
@@ -50,7 +50,6 @@
         <module>transports/http-jetty</module>
         <module>transports/http-hc</module>
         <module>transports/jms</module>
-        <module>transports/udp</module>
         <module>ws/policy</module>
         <module>ws/addr</module>
         <module>ws/rm</module>

Modified: cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java?rev=1517463&r1=1517462&r2=1517463&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
Mon Aug 26 08:46:44 2013
@@ -53,6 +53,11 @@ public class GreeterImpl11 {
             throw new Fault("greetMeFault", LOG, new IllegalArgumentException("Get a wrong
name greetMe"));
         } else if (me.startsWith("E")) {
             throw new Fault("invalid", LOG);
+        } else if (me.startsWith("newline")) {
+            Exception cause = new IllegalArgumentException("Get a wrong name <greetMe>"
+                                                           , new NullPointerException("Test
\n cause."));
+            cause.fillInStackTrace();
+            throw new Fault("greetMeFault", LOG, cause);
         } else {
             return "Hello " + me;
         }

Modified: cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java?rev=1517463&r1=1517462&r2=1517463&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
Mon Aug 26 08:46:44 2013
@@ -95,6 +95,26 @@ public class Soap11ClientServerTest exte
             assertEquals("invalid", ex.getMessage());
         } 
     }
+    
+    
+    @Test
+    public void testNewLineInExceptionMessage() throws Exception {
+        Greeter greeter = getGreeter();
+        
+        try {
+            greeter.greetMe("newline");
+            fail("Should throw Exception!");
+        } catch (SOAPFaultException ex) {
+            assertEquals("greetMeFault Caused by: Get a wrong name <greetMe>", ex.getMessage());
+            StackTraceElement[] elements = ex.getCause().getStackTrace();
+            assertEquals("org.apache.cxf.systest.soapfault.details.GreeterImpl11", 
+                         elements[0].getClassName());
+            assertTrue(ex.getCause().getMessage().endsWith("Test \n cause."));
+        } 
+
+        
+    }
+
 
     @Test
     public void testPingMeFault() throws Exception {



Mime
View raw message