BUG 2353 : LeafSetEntryBuilder does not compare byte array values correctly 84/12884/1
authorMoiz Raja <moraja@cisco.com>
Thu, 13 Nov 2014 17:08:04 +0000 (09:08 -0800)
committerMoiz Raja <moraja@cisco.com>
Sat, 15 Nov 2014 17:33:49 +0000 (17:33 +0000)
Use Object.deepEquals to compare the value of the NodeIdentifier and the actual
value to be set on the LeafSetEntry

Change-Id: I4482b19d029058a0f78d3b19508d6f7797448710
Signed-off-by: Moiz Raja <moraja@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/ImmutableLeafSetEntryNodeBuilder.java

index 219f58c522165d174f7dc662f3fcc5371939cdf6..40c7a654d3fd8f33f5000ea24dd8839bffb64d7a 100644 (file)
@@ -7,15 +7,14 @@
  */
 package org.opendaylight.yangtools.yang.data.impl.schema.builder.impl;
 
+import com.google.common.base.Preconditions;
 import java.util.Map;
-
+import java.util.Objects;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedValueAttrNode;
 
-import com.google.common.base.Preconditions;
-
 public class ImmutableLeafSetEntryNodeBuilder<T> extends AbstractImmutableNormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, T, LeafSetEntryNode<T>> {
 
     public static <T> ImmutableLeafSetEntryNodeBuilder<T> create() {
@@ -31,7 +30,7 @@ public class ImmutableLeafSetEntryNodeBuilder<T> extends AbstractImmutableNormal
 
         ImmutableLeafSetEntryNode(final YangInstanceIdentifier.NodeWithValue nodeIdentifier, final T value, final Map<QName, String> attributes) {
             super(nodeIdentifier, value, attributes);
-            Preconditions.checkArgument(nodeIdentifier.getValue().equals(value),
+            Preconditions.checkArgument(Objects.deepEquals(nodeIdentifier.getValue(), value),
                     "Node identifier contains different value: %s than value itself: %s", nodeIdentifier, value);
         }
     }