The following scenario causes a disparity between String path = node.getPath() and session.getNode(path).
- Create a new session (session1)
- Add 'testNode' as a child of root
- Save the session
- Logout of the session
- Create a new session (session2)
- Get the node at the path '/testNode'
- Remove testNode
- Re-add the node as a child of root (effectively restoring it but lets call it newTestNode for clarity), using rootNode.addNode('testNode')
- Calling newTestNode.getPath() should return '/testNode' but in fact returns '/testNode'
- Calling session2.getNode('/testNode') throws a PathNotFoundException
- Calling session2.getNode('/testNode') returns the newTestNode
It appears that the calculation for the newTestNode.getPath() is not correct for a mid-session use-case. Everything is sorted out if the session is saved after the removal and prior to the creation of newTestNode.