Merge "Fix for bug 24."
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / builder / impl / ModuleBuilder.java
index 1f281898a33ef0aee0c58700c2ca11081bd562a2..740f39916843f8cf27697390a827bcf2bedfa7a5 100644 (file)
@@ -555,7 +555,7 @@ public class ModuleBuilder implements Builder {
                 .get(pathToAnyXml);
         if (parent != null) {
             if (parent instanceof AugmentationSchemaBuilder) {
-                throw new UnsupportedOperationException(
+                throw new YangParseException(
                         "An anyxml node cannot be augmented.");
             }
             parent.addChildNode(builder);
@@ -646,9 +646,11 @@ public class ModuleBuilder implements Builder {
         Builder builder = moduleNodes.get(parentPath);
         // current api did not support adding config to deviate
         if (!(builder instanceof DeviationBuilder)) {
-            DataSchemaNodeBuilder configBuilder = (DataSchemaNodeBuilder) moduleNodes
-                    .get(parentPath);
-            configBuilder.setConfiguration(configuration);
+            if(builder instanceof RefineHolder) {
+                ((RefineHolder)builder).setConfig(configuration);
+            } else {
+                ((DataSchemaNodeBuilder)builder).setConfiguration(configuration);
+            }
         }
     }
 
@@ -993,26 +995,12 @@ public class ModuleBuilder implements Builder {
         public String toString() {
             StringBuilder sb = new StringBuilder(
                     ModuleImpl.class.getSimpleName());
-            sb.append("[\n");
-            sb.append("name=" + name + ",\n");
-            sb.append("namespace=" + namespace + ",\n");
-            sb.append("revision=" + revision + ",\n");
-            sb.append("prefix=" + prefix + ",\n");
-            sb.append("yangVersion=" + yangVersion + ",\n");
-            sb.append("description=" + description + ",\n");
-            sb.append("reference=" + reference + ",\n");
-            sb.append("organization=" + organization + ",\n");
-            sb.append("contact=" + contact + ",\n");
-            sb.append("childNodes=" + childNodes.values() + ",\n");
-            sb.append("groupings=" + groupings + ",\n");
-            sb.append("imports=" + imports + ",\n");
-            sb.append("features=" + features + ",\n");
-            sb.append("typeDefinitions=" + typeDefinitions + ",\n");
-            sb.append("notifications=" + notifications + ",\n");
-            sb.append("augmentations=" + augmentations + ",\n");
-            sb.append("rpcs=" + rpcs + ",\n");
-            sb.append("deviations=" + deviations + "\n");
-            sb.append("uses=" + uses + "\n");
+            sb.append("[");
+            sb.append("name=" + name);
+            sb.append(", namespace=" + namespace);
+            sb.append(", revision=" + revision);
+            sb.append(", prefix=" + prefix);
+            sb.append(", yangVersion=" + yangVersion);
             sb.append("]");
             return sb.toString();
         }