X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2FXmlMapper.java;h=4a077e663f187f6d23e05a771d4ec988290c8c90;hp=c0de0d80a8c0f04fbb5a322c822acf4ca5e91661;hb=4f91a0d45521d9225dbcd22b5c38bf7b7b369f9d;hpb=ac65af650d550ae56dd02b660e1c5eef24b78740 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java index c0de0d80a8..4a077e663f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java @@ -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));