You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2010/01/19 17:33:07 UTC
svn commit: r900837 -
/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
Author: scheu
Date: Tue Jan 19 16:33:06 2010
New Revision: 900837
URL: http://svn.apache.org/viewvc?rev=900837&view=rev
Log:
AXIS2-4606: OnError processing causes a secondary exception. Also hardened the code to ensure that
exceptions that occur during exception processing don't get propogated. In this case, the secondary
exception caused a hang higher in the stack.
Contributor: Rich Scheuerle
Analysis: Rich Scheuerle and Paul Mariduena
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java?rev=900837&r1=900836&r2=900837&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java Tue Jan 19 16:33:06 2010
@@ -96,29 +96,64 @@
checkClassLoader(cl, contextCL);
}
+ /**
+ * @param flt Throwable fault that occurred
+ * @param faultCtx MessageContext if fault is a SOAP Fault
+ */
protected void onError(Throwable flt, MessageContext faultCtx) {
+ // Note:
+ // This code is hardened to prevent a secondary exception from being
+ // thrown back to the caller of onError. It is likely that a
+ // thrown exception will cause other errors leading to
+ // system fragility.
if (log.isDebugEnabled()) {
log.debug("AsyncResponse received a fault.");
}
+ Throwable t = null;
+ try {
+ fault = flt;
+ faultMessageContext = faultCtx;
+ if (faultMessageContext != null) {
+ faultMessageContext.setEndpointDescription(endpointDescription);
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("The faultMessageContext is not available because the error likely occurred on" +
+ " the client and is not the result of a SOAP Fault");
+ }
+ }
- fault = flt;
- faultMessageContext = faultCtx;
- faultMessageContext.setEndpointDescription(endpointDescription);
-
- // Probably a good idea to invalidate the cache
- cacheValid = false;
- cachedObject = null;
+ // Probably a good idea to invalidate the cache
+ cacheValid = false;
+ cachedObject = null;
- Throwable t = processFaultResponse();
+ t = processFaultResponse();
+ } catch (Throwable unexpected) {
+ // An unexpected error occurred while processing the fault.
+ // The Response's throwable is set to this unexpected exception.
+ if (log.isDebugEnabled()) {
+ log.debug("A secondary exception occurred during onError processing: " +
+ unexpected);
+ }
+ t = unexpected;
+ }
// JAXWS 4.3.3 conformance bullet says to throw an ExecutionException from here
savedException = new ExecutionException(t);
- // Countdown so that the Future object will know that procesing is complete.
- latch.countDown();
-
- if (log.isDebugEnabled()) {
- log.debug("New latch count = [" + latch.getCount() + "]");
+ try {
+ // Countdown so that the Future object will know that procesing is complete.
+ latch.countDown();
+
+ if (log.isDebugEnabled()) {
+ log.debug("New latch count = [" + latch.getCount() + "]");
+ }
+ } catch (Throwable unexpected) {
+ // An unexpected error occurred after processing the fault response
+ // The Response's throwable has already been set to the savedException
+ if (log.isDebugEnabled()) {
+ log.debug("A secondary exception occurred during onError processing " +
+ "after the fault is processed: " + unexpected);
+ }
}
}