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;
|
package org.alfresco.repo.transaction;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
@@ -46,36 +45,27 @@ public class RetryingTransactionInterceptor extends TransactionAspectSupport imp
|
|||||||
if ((null != target) && (null != target.getThis()) && (null != target.getMethod()))
|
if ((null != target) && (null != target.getThis()) && (null != target.getMethod()))
|
||||||
{
|
{
|
||||||
final Method method = target.getMethod();
|
final Method method = target.getMethod();
|
||||||
final TransactionAttribute transactionAttribute = getTransactionAttributeSource().getTransactionAttribute(method, target.getThis().getClass());
|
final TransactionAttribute txnAttr = getTransactionAttributeSource().getTransactionAttribute(method, target.getThis().getClass());
|
||||||
if (null != transactionAttribute)
|
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
|
public Object execute() throws Throwable
|
||||||
{
|
{
|
||||||
try
|
return target.proceed();
|
||||||
{
|
|
||||||
return method.invoke(target.getThis(), target.getArguments());
|
|
||||||
}
|
}
|
||||||
catch (InvocationTargetException e)
|
};
|
||||||
{
|
return transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||||
if (null != e.getTargetException())
|
txnCallback,
|
||||||
{
|
txnAttr.isReadOnly(),
|
||||||
throw e.getTargetException();
|
(TransactionAttribute.PROPAGATION_REQUIRES_NEW == txnAttr.getPropagationBehavior()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException(e.getMessage(), e);
|
return target.proceed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
throw new AlfrescoRuntimeException("Invalid or undefined MethodInvocation instance: " + target.getMethod());
|
||||||
}, transactionAttribute.isReadOnly(), (TransactionAttribute.PROPAGATION_REQUIRES_NEW == transactionAttribute.getPropagationBehavior()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return method.invoke(target.getThis(), target.getArguments());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new AlfrescoRuntimeException("Invalid undefined MethodInvocation instance");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user