axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r900837 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
Date Tue, 19 Jan 2010 16:33:07 GMT
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);
+            }
         }
     }
     



Mime
View raw message