Author: scheu
Date: Tue Oct 19 15:12:52 2010
New Revision: 1024265
URL: http://svn.apache.org/viewvc?rev=1024265&view=rev
Log:
AXIS2-4857
Contributor:Rich Scheuerle
Summary:
The "caused by exception" is now captured and set during inbound handler
processing.
Validation tests are added to verify the new code.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java?rev=1024265&r1=1024264&r2=1024265&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
Tue Oct 19 15:12:52 2010
@@ -75,6 +75,21 @@ public class HandlerInvokerUtils {
* context and message are transformed.
*/
HandlerChainProcessor.convertToFaultMessage(mepMessageCtx, re,
proto);
+
+ // Set the Caused By Exception on the MessageContext so that it
can be obtained in
+ // the JAXWSMessageReceiver
+ if (log.isDebugEnabled()) {
+ log.debug("Runtime Exception detected. Setting
causedByException field to " + re);
+ }
+
+ if (mepMessageCtx.getRequestMessageContext() != null) {
+
mepMessageCtx.getRequestMessageContext().setCausedByException(new
AxisFault(re.getMessage(), re));
+ }
+ if (mepMessageCtx.getResponseMessageContext() != null) {
+
mepMessageCtx.getResponseMessageContext().setCausedByException(new
AxisFault(re.getMessage(), re));
+ }
+
+
// done invoking inbound handlers, be sure to set the access lock
flag on the context to true
mepMessageCtx.setApplicationAccessLocked(true);
return false;
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java?rev=1024265&r1=1024264&r2=1024265&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
Tue Oct 19 15:12:52 2010
@@ -194,11 +194,22 @@ public class JAXWSMessageReceiver implem
//Rather than create a new AxisFault, we should use
the AxisFault that was
//created at the causedBy
- if (responseMsgCtx.getCausedByException() != null)
+ if (responseMsgCtx.getCausedByException() != null) {
faultToReturn =
responseMsgCtx.getCausedByException();
- else {
+ if (log.isDebugEnabled()) {
+ log.debug("Setting causedByException from
response MessageContext");
+ }
+ } else if (requestMsgCtx.getCausedByException() !=
null) {
+ faultToReturn =
requestMsgCtx.getCausedByException();
+ if (log.isDebugEnabled()) {
+ log.debug("Setting causedByException from
request MessageContext..which indicates an exception occured in the inbound
handler processing");
+ }
+ } else {
faultToReturn = new AxisFault("An error was
detected during JAXWS processing",
axisResponseMsgCtx);
+ if (log.isDebugEnabled()) {
+ log.debug("No causedByException detected");
+ }
}
} else {
//This assumes that we are on the ultimate execution thread