diff --git a/source/java/org/alfresco/repo/action/ActionServiceImpl.java b/source/java/org/alfresco/repo/action/ActionServiceImpl.java index cf325d3c39..a16a2ceccb 100644 --- a/source/java/org/alfresco/repo/action/ActionServiceImpl.java +++ b/source/java/org/alfresco/repo/action/ActionServiceImpl.java @@ -365,6 +365,9 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A logger.debug("Current action = " + action.getId()); } + // get the current user early in case the process fails and we are unable to do it later + String currentUserName = this.authenticationComponent.getCurrentUserName(); + if (actionChain == null || actionChain.contains(action.getId()) == false) { if (logger.isDebugEnabled() == true) @@ -432,7 +435,7 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A if (compensatingAction != null) { // Set the current user - ((ActionImpl)compensatingAction).setRunAsUser(this.authenticationComponent.getCurrentUserName()); + ((ActionImpl)compensatingAction).setRunAsUser(currentUserName); // Queue the compensating action ready for execution this.asynchronousActionExecutionQueue.executeAction(this, compensatingAction, actionedUponNodeRef, false, null);