Merge "Fix xml->CompositeNode transformation for rpc replies for rpcs with no output"
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / codec / xml / XmlDocumentUtils.java
index f0d82c33b9829ee97e85d063c2fcff0b40a27a94..68fc432e96952789b42d8164e7e25d39b347b138 100644 (file)
@@ -432,14 +432,15 @@ public class XmlDocumentUtils {
         if (rpcDefinition.isPresent()) {
             RpcDefinition rpc = rpcDefinition.get();
 
-            final Collection<DataSchemaNode> outputNode = rpc.getOutput().getChildNodes();
+            final Collection<DataSchemaNode> outputNode = rpc.getOutput() != null ? rpc.getOutput().getChildNodes() : null;
             final Element rpcReplyElement = document.getDocumentElement();
             final QName partialQName = qNameFromElement(rpcReplyElement);
 
             if (RPC_REPLY_QNAME.equals(partialQName)) {
                 final List<Node<?>> domNodes = toDomNodes(rpcReplyElement, Optional.fromNullable(outputNode), context);
+                QName qName = rpc.getOutput() != null ? rpc.getOutput().getQName() : QName.cachedReference(QName.create(rpcName, "output"));
                 List<Node<?>> rpcOutNodes = Collections.<Node<?>>singletonList(ImmutableCompositeNode.create(
-                        rpc.getOutput().getQName(), domNodes));
+                        qName, domNodes));
                 return ImmutableCompositeNode.create(rpcName, rpcOutNodes);
             }
         }