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>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/TreeNodeUtils.java

index a2a706a9da3f84b197aaa80d57487b89ff2cb55b..b2ec119ca942ac33ba2b7fbdecbaf26ee5831ceb 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;
 
     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);
             nested.add(pathArg);
         for(PathArgument pathArg : path.getPath()) {
             Optional<T> potential = current.getChild(pathArg);
             nested.add(pathArg);