diff --git a/source/java/org/alfresco/filesys/repo/FilesystemTransactionAdvice.java b/source/java/org/alfresco/filesys/repo/FilesystemTransactionAdvice.java index fdda5a45c2..2f36ae4111 100644 --- a/source/java/org/alfresco/filesys/repo/FilesystemTransactionAdvice.java +++ b/source/java/org/alfresco/filesys/repo/FilesystemTransactionAdvice.java @@ -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) - { - // Unwrap checked exceptions - throw (IOException) pe.getCause(); - } - + { + Throwable t = pe.getCause(); + if(t != null) + { + if(t instanceof IOException) + { + // Unwrap checked exceptions + throw pe.getCause(); + } + if(t instanceof SMBException) + { + throw pe.getCause(); + } + if(t instanceof DeviceContextException) + { + throw pe.getCause(); + } + throw t; + } + throw pe; + } } }