Author: ningjiang
Date: Mon Aug 15 02:44:22 2011
New Revision: 1157701
URL: http://svn.apache.org/viewvc?rev=1157701&view=rev
Log:
Merged revisions 1157121,1157699 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1157121 | ningjiang | 2011-08-12 22:24:47 +0800 (Fri, 12 Aug 2011) | 1 line
CXF-3736 Send the cause of exception stack trace
........
r1157699 | ningjiang | 2011-08-15 10:28:51 +0800 (Mon, 15 Aug 2011) | 1 line
CXF-3736 Fixed the systest test error
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:1157121,1157699
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.4.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.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java?rev=1157701&r1=1157700&r2=1157701&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/AbstractSoapInterceptor.java
Mon Aug 15 02:44:22 2011
@@ -77,9 +77,16 @@ public abstract class AbstractSoapInterc
.getContextualProperty(org.apache.cxf.message.Message.FAULT_STACKTRACE_ENABLED);
if (config != null && Boolean.valueOf(config).booleanValue() &&
fault.getCause() != null) {
StringBuilder sb = new StringBuilder();
- for (StackTraceElement ste : fault.getCause().getStackTrace()) {
- sb.append(ste.getClassName() + "!" + ste.getMethodName() + "!"
+ ste.getFileName() + "!"
+ Throwable throwable = fault.getCause();
+ while (throwable != null) {
+ for (StackTraceElement ste : fault.getCause().getStackTrace())
{
+ sb.append(ste.getClassName() + "!" + ste.getMethodName() +
"!" + ste.getFileName() + "!"
+ ste.getLineNumber() + "\n");
+ }
+ throwable = throwable.getCause();
+ if (throwable != null) {
+ sb.append("Caused by:" + throwable.getClass() + ":" +
throwable.getMessage() + " ");
+ }
}
Element detail = fault.getDetail();
String soapNamespace = message.getVersion().getNamespace();
Modified:
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java?rev=1157701&r1=1157700&r2=1157701&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
(original)
+++
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/GreeterImpl11.java
Mon Aug 15 02:44:22 2011
@@ -47,8 +47,10 @@ public class GreeterImpl11 {
}
public String sayHi() {
- // throw the exception out
- Exception cause = new IllegalArgumentException("Get a wrong name
<sayHi>");
+ // throw the exception out with some cause
+ Exception cause = new IllegalArgumentException("Get a wrong name
<sayHi>"
+ , new
NullPointerException("Test cause."));
+ cause.printStackTrace();
throw new Fault("sayHiFault", LOG, cause);
}
Modified:
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java?rev=1157701&r1=1157700&r2=1157701&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
(original)
+++
cxf/branches/2.4.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapfault/details/Soap11ClientServerTest.java
Mon Aug 15 02:44:22 2011
@@ -41,7 +41,7 @@ public class Soap11ClientServerTest exte
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
- launchServer(Server11.class));
+ launchServer(Server11.class, true));
}
@Test
@@ -52,9 +52,19 @@ public class Soap11ClientServerTest exte
fail("Should throw Exception!");
} catch (SOAPFaultException ex) {
assertEquals("sayHiFault Caused by: Get a wrong name <sayHi>",
ex.getMessage());
- StackTraceElement[] element = ex.getCause().getStackTrace();
-
assertEquals("org.apache.cxf.systest.soapfault.details.GreeterImpl11",
element[0].getClassName());
- }
+ StackTraceElement[] elements = ex.getCause().getStackTrace();
+
assertEquals("org.apache.cxf.systest.soapfault.details.GreeterImpl11",
+ elements[0].getClassName());
+ ex.printStackTrace();
+ boolean findNPE = false;
+ for (StackTraceElement element : elements) {
+ if
(element.getClassName().indexOf("java.lang.NullPointerException") > 0) {
+ findNPE = true;
+ break;
+ }
+ }
+ assertTrue("Cannot find the Cause of NPE", findNPE);
+ }
}