}
try {
- return resolveModificationStrategy(path).apply(modification, modification.getOriginal(), version);
+ return resolveModificationStrategy(path).apply(modification, modification.original(), version);
} catch (Exception e) {
LOG.error("Could not create snapshot for {}:{}", path, modification, e);
throw e;
* have same version each time this method is called.
*/
final var originalSnapshotRoot = snapshot.getRootNode();
- final var tempRoot = getStrategy().apply(rootNode, Optional.of(originalSnapshotRoot), version);
- checkState(tempRoot.isPresent(), "Data tree root is not present, possibly removed by previous modification");
-
- final var tempTree = new InMemoryDataTreeSnapshot(snapshot.getEffectiveModelContext(), tempRoot.orElseThrow(),
- strategyTree);
- return tempTree.newModification();
+ return new InMemoryDataTreeSnapshot(snapshot.getEffectiveModelContext(),
+ getStrategy().apply(rootNode, originalSnapshotRoot, version)
+ .orElseThrow(() -> new IllegalStateException(
+ "Data tree root is not present, possibly removed by previous modification")), strategyTree)
+ .newModification();
}
Version getVersion() {