You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/12/11 11:59:38 UTC

svn commit: r725654 - in /servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src: main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java test/java/org/apache/servicemix/common/TransactionsTest.java

Author: gnodet
Date: Thu Dec 11 02:59:35 2008
New Revision: 725654

URL: http://svn.apache.org/viewvc?rev=725654&view=rev
Log:
SM-1728: AsyncBaseLifecycle should catch all throwables when processing exchanges

Modified:
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
    servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java

Modified: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java?rev=725654&r1=725653&r2=725654&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java Thu Dec 11 02:59:35 2008
@@ -421,16 +421,16 @@
                 transactionManager.resume(tx);
             }
             processExchange(exchange);
-        } catch (Exception e) {
-            logger.error("Error processing exchange " + exchange, e);
+        } catch (Throwable t) {
+            logger.error("Error processing exchange " + exchange, t);
             try {
                 // If we are transacted, check if this exception should
                 // rollback the transaction
                 if (transactionManager != null && transactionManager.getStatus() == Status.STATUS_ACTIVE
-                                && exceptionShouldRollbackTx(e)) {
+                                && exceptionShouldRollbackTx(t)) {
                     transactionManager.setRollbackOnly();
                 }
-                exchange.setError(e);
+                exchange.setError(t instanceof Exception ? (Exception) t : new Exception(t));
                 channel.send(exchange);
             } catch (Exception inner) {
                 logger.error("Error setting exchange status to ERROR", inner);
@@ -459,7 +459,7 @@
         }
     }
 
-    protected boolean exceptionShouldRollbackTx(Exception e) {
+    protected boolean exceptionShouldRollbackTx(Throwable t) {
         return false;
     }
 

Modified: servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java?rev=725654&r1=725653&r2=725654&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java (original)
+++ servicemix/smx3/branches/servicemix-3.2/common/servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java Thu Dec 11 02:59:35 2008
@@ -197,7 +197,7 @@
                 super.doStop();
                 su.stop();
             }
-            protected boolean exceptionShouldRollbackTx(Exception e) {
+            protected boolean exceptionShouldRollbackTx(Throwable t) {
                 return exceptionShouldRollback;
             }
         }