Fixed bug in code generator when handling case defined in grouping as augment target. 80/5280/2
authorMartin Vitez <mvitez@cisco.com>
Wed, 12 Feb 2014 08:34:58 +0000 (09:34 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 12 Feb 2014 18:12:55 +0000 (18:12 +0000)
Signed-off-by: Martin Vitez <mvitez@cisco.com>
code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/BindingGeneratorImpl.xtend

index e5aa5c4c2286f9660fcfa58319cce5060f79e66c..47fb2728deea63abc9831e2a40d30a6d0730451b 100644 (file)
@@ -897,10 +897,12 @@ public class BindingGeneratorImpl implements BindingGenerator {
 \r
             do {\r
                 tmpPath.add(currentName);\r
-                val dataNodeParent = parent as DataNodeContainer;\r
-                for (u : dataNodeParent.uses) {\r
-                    if (result == null) {\r
-                        result = getResultFromUses(u, currentName.localName)\r
+                if (parent instanceof DataNodeContainer) {\r
+                    val dataNodeParent = parent as DataNodeContainer;\r
+                    for (u : dataNodeParent.uses) {\r
+                        if (result == null) {\r
+                            result = getResultFromUses(u, currentName.localName)\r
+                        }\r
                     }\r
                 }\r
                 if (result == null) {
@@ -987,8 +989,12 @@ public class BindingGeneratorImpl implements BindingGenerator {
 
             tmpPath.remove(0);
             for (name : tmpPath) {\r
-                // searching by local name is must, because node has different namespace in its original location
-                newParent = (newParent as DataNodeContainer).getDataChildByName(name.localName);
+                // searching by local name is must, because node has different namespace in its original location\r
+                if (newParent instanceof DataNodeContainer) {\r
+                    newParent = (newParent as DataNodeContainer).getDataChildByName(name.localName);\r
+                } else {\r
+                    newParent = (newParent as ChoiceNode).getCaseNodeByName(name.localName);\r
+                }
             }
             if (newParent != null && newParent.addedByUses) {
                 newParent = findOriginal(newParent);