acl rules Developer Jahia 7.3 Jahia 8 Legacy

The rule action of "a node is moved" is receiving null locale

Question

executeActionNow works in different JCR session depending on the node move context: 

  • Drag&Drop -> JCR session contains the locale 
  • Cut&Paste -> System JCR session doesn't contain the locale 
     

Cause

The code path for Drag&Drop and Cut&Paste are not the same and are not executed in the same context.

Solution

If you can work in only one language in your action, you can force the locale on the node you receive in the action by adding: 

node = JCRSessionFactory.getInstance().getCurrentUserSession(null,new Locale("en")).getNode(node.getPath());