A modification could potentially remove the root node, which would
trigger a failure in Optional.get(). Add an explicit check to provide
better diagnostic in that case.
Change-Id: I0e27910497169a080aa8185c66f65c9639ccf2e7
Signed-off-by: Robert Varga <rovarga@cisco.com>
*/
TreeNode originalSnapshotRoot = snapshot.getRootNode();
Optional<TreeNode> tempRoot = strategyTree.apply(rootNode, Optional.of(originalSnapshotRoot), version);
+ Preconditions.checkState(tempRoot.isPresent(), "Data tree root is not present, possibly removed by previous modification");
InMemoryDataTreeSnapshot tempTree = new InMemoryDataTreeSnapshot(snapshot.getSchemaContext(), tempRoot.get(), strategyTree);
return tempTree.newModification();