BUG-509: Fix a constructor typo/thinko 91/5991/2
authorRobert Varga <rovarga@cisco.com>
Wed, 9 Apr 2014 03:39:58 +0000 (05:39 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 9 Apr 2014 11:01:24 +0000 (11:01 +0000)
The 'nested' array should be initialized as empty, but sized for
the size of path.getPath(), as we fill it continuously as we traverse
the tree.

The original initialization also copied path.getPath(), resulting in the
path reported in full and then correctly.

Change-Id: I9a918ced62a845b985459699e23f1f2f1d55cf35
Signed-off-by: Robert Varga <rovarga@cisco.com>

index a2a706a..b2ec119 100644 (file)
@@ -43,7 +43,7 @@ public class TreeNodeUtils {
     public static <T extends StoreTreeNode<T>> T findNodeChecked(final T tree, final InstanceIdentifier path) {
         T current = tree;
-        List<PathArgument> nested = new ArrayList<>(path.getPath());
+        List<PathArgument> nested = new ArrayList<>(path.getPath().size());
         for(PathArgument pathArg : path.getPath()) {
             Optional<T> potential = current.getChild(pathArg);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.