From b2b10ac5211f870bc5b8ce2a0019b122e54a8e04 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Fri, 2 Dec 2011 19:02:50 +0000 Subject: [PATCH] ALF-11625: Exception occurs on server startup relating to FeedNotifier git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32492 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../action/executer/MailActionExecuter.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java index 686f7040aa..0f21ff1dd2 100644 --- a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java @@ -316,8 +316,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase @Override public Void execute() throws Throwable { - // Only try and send the email if the actioned upon node reference still exists - if (nodeService.exists(actionedUponNodeRef) == true) + if (validNodeRefIfPresent(actionedUponNodeRef)) { prepareAndSendEmail(ruleAction, actionedUponNodeRef); } @@ -329,13 +328,30 @@ public class MailActionExecuter extends ActionExecuterAbstractBase } else { - if (nodeService.exists(actionedUponNodeRef) == true) + if (validNodeRefIfPresent(actionedUponNodeRef)) { prepareAndSendEmail(ruleAction, actionedUponNodeRef); } } } + + private boolean validNodeRefIfPresent(NodeRef actionedUponNodeRef) + { + if (actionedUponNodeRef == null) + { + // We must expect that null might be passed in (ALF-11625) + // since the mail action might not relate to a specific nodeRef. + return true; + } + else + { + // Only try and send the email if the actioned upon node reference still exists + // (i.e. if one has been specified it must be valid) + return nodeService.exists(actionedUponNodeRef); + } + } + private boolean sendAfterCommit(Action action) { Boolean sendAfterCommit = (Boolean) action.getParameterValue(PARAM_SEND_AFTER_COMMIT);