mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RetryingTransactionInterceptor was bypassing all nested interceptors
- The code did this: return method.invoke(target.getThis(), target.getArguments()); rather than this: return target.proceed(); - Services that used this are PublishingService, ChannelService, TransferService and old CMIS dmServicesProxyCreator - None of the above are adversely affected because the first 3 don't apply permissions and the last one uses the interceptor in reverse order - BUT: None of the aforementioned services will be auditable! git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32276 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.transaction;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
@@ -46,36 +45,27 @@ public class RetryingTransactionInterceptor extends TransactionAspectSupport imp
|
||||
if ((null != target) && (null != target.getThis()) && (null != target.getMethod()))
|
||||
{
|
||||
final Method method = target.getMethod();
|
||||
final TransactionAttribute transactionAttribute = getTransactionAttributeSource().getTransactionAttribute(method, target.getThis().getClass());
|
||||
if (null != transactionAttribute)
|
||||
final TransactionAttribute txnAttr = getTransactionAttributeSource().getTransactionAttribute(method, target.getThis().getClass());
|
||||
if (null != txnAttr && txnAttr.getPropagationBehavior() != TransactionAttribute.PROPAGATION_SUPPORTS)
|
||||
{
|
||||
return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
RetryingTransactionCallback<Object> txnCallback = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
@Override
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
try
|
||||
{
|
||||
return method.invoke(target.getThis(), target.getArguments());
|
||||
}
|
||||
catch (InvocationTargetException e)
|
||||
{
|
||||
if (null != e.getTargetException())
|
||||
{
|
||||
throw e.getTargetException();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return target.proceed();
|
||||
}
|
||||
}, transactionAttribute.isReadOnly(), (TransactionAttribute.PROPAGATION_REQUIRES_NEW == transactionAttribute.getPropagationBehavior()));
|
||||
};
|
||||
return transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
txnCallback,
|
||||
txnAttr.isReadOnly(),
|
||||
(TransactionAttribute.PROPAGATION_REQUIRES_NEW == txnAttr.getPropagationBehavior()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return method.invoke(target.getThis(), target.getArguments());
|
||||
return target.proceed();
|
||||
}
|
||||
}
|
||||
throw new AlfrescoRuntimeException("Invalid undefined MethodInvocation instance");
|
||||
throw new AlfrescoRuntimeException("Invalid or undefined MethodInvocation instance: " + target.getMethod());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user