BUG-509: move snapshotCache get out of try block 42/7342/1
authorRobert Varga <rovarga@cisco.com>
Wed, 21 May 2014 13:21:14 +0000 (15:21 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 22 May 2014 06:59:21 +0000 (08:59 +0200)
This just moves the get which cannot throw out of the 'catch Exception'
block.

Change-Id: I936e987fa6b9e8b3eecb35656c586e3afb070046
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/InMemoryDataTreeModification.java

index 1540fec..7d0c81e 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) {