BUG 1440 - incorrect inserting of augment node 97/10997/1
authorJozef Gloncak <jgloncak@cisco.com>
Wed, 10 Sep 2014 14:33:25 +0000 (16:33 +0200)
committerJozef Gloncak <jgloncak@cisco.com>
Wed, 10 Sep 2014 14:33:28 +0000 (16:33 +0200)
Augment node was incorrectly inserted to normalized node structure in
cases when node was child of choice (case) or child of case.

This fix cause that for such cases augment will never found and therefore
children will be added to collection of children and not children which
were added via augmentation.

Change-Id: I9bb0e08def798ee387539bf57b60b4eea1cf65c2
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/CompositeNodeDataWithSchema.java

index c2997a84d74814feae68fec7fc76adc9122e66b7..ee2541d8e651888fd4062db56828e0046b3a8168 100644 (file)
@@ -13,16 +13,13 @@ import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Deque;
 import java.util.List;
 import java.util.Map.Entry;
-
 import javax.annotation.Nonnull;
-
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
@@ -193,7 +190,7 @@ class CompositeNodeDataWithSchema extends AbstractNodeDataWithSchema {
      * node is found then it is returned, else null.
      */
     AugmentationSchema findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) {
-        if (parent instanceof AugmentationTarget) {
+        if (parent instanceof AugmentationTarget && !((parent instanceof ChoiceCaseNode) || (parent instanceof ChoiceNode))) {
             for (AugmentationSchema augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
                 DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName());
                 if (childInAugmentation != null) {