From f966c4a3910b2d194570f8bdcd2d774230db5d20 Mon Sep 17 00:00:00 2001 From: Mark Rogers Date: Fri, 23 Sep 2011 14:55:11 +0000 Subject: [PATCH] Allow FilesystemTransactionAdvice to propogate SMBException. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30735 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/FilesystemTransactionAdvice.java | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) 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; + } } }