Fixed uninitialized DOMResult in XML codecs. 03/9203/1
authorTony Tkacik <ttkacik@cisco.com>
Mon, 21 Jul 2014 14:59:20 +0000 (16:59 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Mon, 21 Jul 2014 14:59:20 +0000 (16:59 +0200)
Change-Id: I8c0833985b42be304edc445c40a5528ed8a2dcbe
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/XmlDocumentUtils.java

index 3f087ede0221874a29548a6787697705d15695de..eabba23153c65afd9598227429a58ee51dd4e704 100644 (file)
@@ -106,8 +106,7 @@ public class XmlDocumentUtils {
             throw new UnsupportedDataTypeException("Schema can be ContainerSchemaNode or ListSchemaNode. Other types are not supported yet.");
         }
 
-        final DOMResult result = new DOMResult();
-        result.setNode(getDocument());
+        final DOMResult result = new DOMResult(getDocument());
         try {
             final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(result);
             XmlStreamUtils.create(codecProvider).writeDocument(writer, data, (SchemaNode)schema);
@@ -142,7 +141,7 @@ public class XmlDocumentUtils {
      * @throws UnsupportedDataTypeException
      */
     public static Document toDocument(final CompositeNode data, final XmlCodecProvider codecProvider) {
-        final DOMResult result = new DOMResult();
+        final DOMResult result = new DOMResult(getDocument());
         try {
             final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(result);
             XmlStreamUtils.create(codecProvider).writeDocument(writer, data);