Fixed sal-netconf-connector readConfiguration
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / XmlMapper.java
index c0de0d80a8c0f04fbb5a322c822acf4ca5e91661..4a077e663f187f6d23e05a771d4ec988290c8c90 100644 (file)
@@ -59,7 +59,6 @@ public class XmlMapper {
             throws UnsupportedDataTypeException {
         QName dataType = data.getNodeType();
         Element itemEl = doc.createElementNS(dataType.getNamespace().toString(), dataType.getLocalName());
-
         if (data instanceof SimpleNode<?>) {
             if (schema instanceof LeafListSchemaNode) {
                 writeValueOfNodeByType(itemEl, (SimpleNode<?>) data, ((LeafListSchemaNode) schema).getType());
@@ -73,11 +72,14 @@ public class XmlMapper {
             }
         } else { // CompositeNode
             for (Node<?> child : ((CompositeNode) data).getChildren()) {
-                DataSchemaNode childSchema = findFirstSchemaForNode(child, ((DataNodeContainer) schema).getChildNodes());
-                if (logger.isDebugEnabled()) {
-                    if (childSchema == null) {
-                        logger.debug("Probably the data node \"" + ((child == null) ? "" : child.getNodeType().getLocalName())
-                                + "\" is not conform to schema");
+                DataSchemaNode childSchema = null;
+                if(schema != null){
+                    childSchema = findFirstSchemaForNode(child, ((DataNodeContainer) schema).getChildNodes());
+                    if (logger.isDebugEnabled()) {
+                        if (childSchema == null) {
+                            logger.debug("Probably the data node \"" + ((child == null) ? "" : child.getNodeType().getLocalName())
+                                    + "\" is not conform to schema");
+                        }
                     }
                 }
                 itemEl.appendChild(translateToXmlAndReturnRootElement(doc, child, childSchema));