You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by na...@apache.org on 2010/06/29 20:26:12 UTC
svn commit: r959069 - in
/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher:
JavaBeanDispatcher.java JavaDispatcher.java
Author: nagy
Date: Tue Jun 29 18:26:12 2010
New Revision: 959069
URL: http://svn.apache.org/viewvc?rev=959069&view=rev
Log:
Correctly identify checked exceptions in JAX-WS as being application faults so that they are not erroneously logged.
Contributor: Phil Adams
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java?rev=959069&r1=959068&r2=959069&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java Tue Jun 29 18:26:12 2010
@@ -100,6 +100,9 @@ public class JavaBeanDispatcher extends
catch (Throwable e) {
faultThrown = true;
fault = e;
+ if (log.isDebugEnabled()) {
+ log.debug("Caught exception from 'invokeTargetOperation': " + fault.toString());
+ }
}
MessageContext response = null;
@@ -108,12 +111,20 @@ public class JavaBeanDispatcher extends
// we cannot create a MessageContext for one-way responses.
return null;
} else if (faultThrown) {
+ if (log.isDebugEnabled()) {
+ log.debug("Processing fault response: " + fault.toString());
+ }
+
response = createFaultResponse(mc, mc.getMessage().getProtocol(), fault);
setExceptionProperties(response, target, fault);
} else {
response = createResponse(mc, mc.getMessage().getProtocol(), methodInputParams, output);
}
-
+
+
+ if (log.isDebugEnabled()) {
+ log.debug("Returning from JavaBeanDispatcher.invoke()...");
+ }
return response;
}
@@ -329,7 +340,10 @@ public class JavaBeanDispatcher extends
}
public MessageContext createFaultResponse(MessageContext request, Protocol p, Throwable t) {
-
+ if (log.isDebugEnabled()) {
+ log.debug("Entered JavaBeanDispatcher.createFaultResponse()...");
+ }
+
// call the InvocationListener instances before marshalling
// the fault into a message
// call the InvocationListener instances before marshalling
@@ -354,6 +368,10 @@ public class JavaBeanDispatcher extends
response.setCausedByException(axisFault);
setFaultResponseAction(t, request, response);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Leaving JavaBeanDispatcher.createFaultResponse()...");
+ }
return response;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java?rev=959069&r1=959068&r2=959069&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java Tue Jun 29 18:26:12 2010
@@ -19,6 +19,7 @@
package org.apache.axis2.jaxws.server.dispatcher;
+import org.apache.axis2.AxisFault;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.jaxws.Constants;
import org.apache.axis2.jaxws.WebServiceExceptionLogger;
@@ -315,6 +316,10 @@ public abstract class JavaDispatcher imp
* @param t Throwable
*/
protected static void setCheckedExceptionProperty(MessageContext response, Method m, Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("Entered JavaDispatcher.setCheckedExceptionProperty(), t=" + t);
+ }
+
// Get the root of the exception
if (t instanceof InvocationTargetException) {
t = ((InvocationTargetException) t).getTargetException();
@@ -325,7 +330,20 @@ public abstract class JavaDispatcher imp
// Add the property
if (checkedException != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("The exception is a checked exception: " + checkedException.getCanonicalName());
+ }
+
response.setProperty(Constants.CHECKED_EXCEPTION, checkedException.getCanonicalName());
+
+ // Also set the AxisFault so that it's an "application" fault.
+ AxisFault fault = response.getCausedByException();
+ if (fault != null) {
+ fault.setFaultType(org.apache.axis2.Constants.APPLICATION_FAULT);
+ if (log.isDebugEnabled()) {
+ log.debug("Setting AxisFault's fault type to 'APPLICATION_FAULT': " + fault);
+ }
+ }
}
}
@@ -356,8 +374,16 @@ public abstract class JavaDispatcher imp
protected static void setExceptionProperties(MessageContext response,
Method m,
Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering JavaDispatcher.setExceptionProperties().");
+ }
setCheckedExceptionProperty(response, m, t);
setWebMethodExceptionProperty(response, t);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Leaving JavaDispatcher.setExceptionProperties().");
+ }
+
}
}