From: Robert Varga Date: Wed, 21 May 2014 13:21:14 +0000 (+0200) Subject: BUG-509: move snapshotCache get out of try block X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~38 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7206d41640f98943c64da8f8486e5205b279c943;ds=inline BUG-509: move snapshotCache get out of try block This just moves the get which cannot throw out of the 'catch Exception' block. Change-Id: I936e987fa6b9e8b3eecb35656c586e3afb070046 Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/InMemoryDataTreeModification.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/InMemoryDataTreeModification.java index 1540feca66..7d0c81e39d 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/InMemoryDataTreeModification.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/InMemoryDataTreeModification.java @@ -108,11 +108,12 @@ final class InMemoryDataTreeModification implements DataTreeModification { private Optional resolveSnapshot(final InstanceIdentifier path, final NodeModification modification) { + final Optional> potentialSnapshot = modification.getSnapshotCache(); + if(potentialSnapshot.isPresent()) { + return potentialSnapshot.get(); + } + try { - Optional> potentialSnapshot = modification.getSnapshotCache(); - if(potentialSnapshot.isPresent()) { - return potentialSnapshot.get(); - } return resolveModificationStrategy(path).apply(modification, modification.getOriginal(), StoreUtils.increase(snapshot.getRootNode().getSubtreeVersion())); } catch (Exception e) {