BUG-509: move snapshotCache get out of try block
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / tree / data / InMemoryDataTreeModification.java
index 1540feca661aed15b7a41ffdfa40f6077e9f712d..7d0c81e39de8efe564c33925280c9dbb9c71ff22 100644 (file)
@@ -108,11 +108,12 @@ final class InMemoryDataTreeModification implements DataTreeModification {
 
     private Optional<StoreMetadataNode> resolveSnapshot(final InstanceIdentifier path,
             final NodeModification modification) {
+        final Optional<Optional<StoreMetadataNode>> potentialSnapshot = modification.getSnapshotCache();
+        if(potentialSnapshot.isPresent()) {
+            return potentialSnapshot.get();
+        }
+
         try {
-            Optional<Optional<StoreMetadataNode>> potentialSnapshot = modification.getSnapshotCache();
-            if(potentialSnapshot.isPresent()) {
-                return potentialSnapshot.get();
-            }
             return resolveModificationStrategy(path).apply(modification, modification.getOriginal(),
                     StoreUtils.increase(snapshot.getRootNode().getSubtreeVersion()));
         } catch (Exception e) {