Allow FilesystemTransactionAdvice to propogate SMBException.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-09-23 14:55:11 +00:00
parent 646dd196af
commit f966c4a391

View File

@@ -59,14 +59,8 @@ public class FilesystemTransactionAdvice implements MethodInterceptor
this.readOnly = readOnly;
}
public Object invoke(final MethodInvocation methodInvocation) throws IOException, Throwable
public Object invoke(final MethodInvocation methodInvocation) throws IOException, SMBException, Throwable
{
// Object[] args = methodInvocation.getArguments();
//
// if(args.length == 0 || !(args[0] instanceof SrvSession))
// {
// throw new AlfrescoRuntimeException("First argument is not of correct type");
// }
RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
@@ -112,9 +106,16 @@ public class FilesystemTransactionAdvice implements MethodInterceptor
{
if(t instanceof IOException)
{
// Unwrap checked exceptions
throw (IOException) pe.getCause();
}
if(t instanceof SMBException)
{
throw pe.getCause();
}
if(t instanceof DeviceContextException)
{
throw pe.getCause();
}
throw t;
}
throw pe;
@@ -128,11 +129,27 @@ public class FilesystemTransactionAdvice implements MethodInterceptor
return tran.doInTransaction(callback);
}
catch(PropagatingException pe)
{
Throwable t = pe.getCause();
if(t != null)
{
if(t instanceof IOException)
{
// Unwrap checked exceptions
throw (IOException) pe.getCause();
throw pe.getCause();
}
if(t instanceof SMBException)
{
throw pe.getCause();
}
if(t instanceof DeviceContextException)
{
throw pe.getCause();
}
throw t;
}
throw pe;
}
}
}