Hi Valentin

I noticed that this removed the previous checking of whether the ex is
one of the method m declared exceptions.  Method m is now not used at
all in this postCallWithException.  Is that intended?

Lin

On Sat, Mar 27, 2010 at 5:30 AM,  <[email protected]> wrote:
http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java?rev=928178&r1=928177&r2=928178&view=diff
> ==============================================================================
> --- 
> incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
>  (original)
> +++ 
> incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxInterceptorImpl.java
>  Sat Mar 27 09:30:32 2010
> @@ -43,7 +43,7 @@ public class TxInterceptorImpl implement
>     }
>
>     public void postCallWithException(ComponentMetadata cm, Method m,
> -        Exception ex, Object preCallToken)
> +        Throwable ex, Object preCallToken)
>      {
>        if (preCallToken instanceof TransactionToken)
>        {
> @@ -51,20 +51,11 @@ public class TxInterceptorImpl implement
>          try {
>              Transaction tran = token.getActiveTransaction();
>              if (tran != null) {
> -                 Class<?> exceptionClass = ex.getClass();
> -                 boolean isAppException = false;
> -
> -                 if 
> (!RuntimeException.class.isAssignableFrom(exceptionClass)) {
> -                     for (Class<?> cls : m.getExceptionTypes()) {
> -                         isAppException = 
> cls.isAssignableFrom(exceptionClass);
> -
> -                         if (isAppException)
> -                             break;
> -                     }
> -                 }
> -
> -                 if (!isAppException)
> +                 if (ex instanceof RuntimeException || ex instanceof Error) {
>                      tran.setRollbackOnly();
> +                 } else {
> +                     //declared exception, we don't set rollback
> +                 }
>              }
>
>              token.getTransactionStrategy().finish(tm, token);
>

Reply via email to