Index: core/src/main/java/org/mule/transaction/TransactionTemplate.java
===================================================================
--- core/src/main/java/org/mule/transaction/TransactionTemplate.java (revision 17734)
+++ core/src/main/java/org/mule/transaction/TransactionTemplate.java (working copy)
@@ -10,8 +10,6 @@
package org.mule.transaction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.mule.api.MuleContext;
import org.mule.api.transaction.ExternalTransactionAwareTransactionFactory;
import org.mule.api.transaction.Transaction;
@@ -23,6 +21,9 @@
import java.beans.ExceptionListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
public class TransactionTemplate
{
private static final Log logger = LogFactory.getLog(TransactionTemplate.class);
@@ -130,7 +131,7 @@
catch (Exception e)
{
tx = TransactionCoordination.getInstance().getTransaction();
- if (exceptionListener != null)
+ if (isExceptionHandledAtThisLevel(tx))
{
logger.info("Exception Caught in Transaction template. Handing off to exception handler: "
+ exceptionListener);
@@ -163,9 +164,10 @@
return null;
}
- else if (exceptionListener != null && tx != null)
+ else if (isExceptionHandledAtThisLevel(tx))
{
- + + return null;
}
else
@@ -189,6 +191,18 @@
}
}
+ /**
+ * The exception must be handled at this level if there is an
+ * {@link #exceptionListener} and there is a transaction.
+ *
+ * @param tx
+ * @return
+ */
+ protected boolean isExceptionHandledAtThisLevel(Transaction tx)
+ {
+ return exceptionListener != null && tx != null;
+ }
+
protected void resolveTransaction(Transaction tx) throws TransactionException
{
if (tx.isRollbackOnly())
This issue was detected on EE-1968.