BUG 8927: Netconf response payload fails to render in JSON 46/66046/3
authorTomas Cere <tcere@cisco.com>
Tue, 3 Oct 2017 10:36:26 +0000 (12:36 +0200)
committerBalaji Varadaraju <bvaradar@brocade.com>
Wed, 6 Dec 2017 03:38:34 +0000 (21:38 -0600)
commit90a5fb4cd2a38324420d98ef3ca6de89618bf6f6
tree948b46c77d27e0d7610c98baf4932e5bdea2cf93
parenta370484a16d7982763a5c5ea5ccaf9b25a569ddd
BUG 8927: Netconf response payload fails to render in JSON

JSONNormalizedNodeStreamWriter does not write a content of anyXml nodes
correctly mainly due to Text nodes containing whitespaces before, between
or after Element nodes. Therefore the first Text node only was serialized
to JSON and the rest of anyXML content was missing.
This patch provides fix of anyXml content serialization to JSON.

Added a fix for a null pointer for empty text node.

Fixed the unit test to pass the anyxml test.

Change-Id: I74f34aecec1a85b2ede4be63e5b6dd74522981e4
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Atul Gosain <agosain@luminanetworks.com>
Signed-off-by: Balaji Varadaraju <bvaradar@brocade.com>
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AnyXmlSupportTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestUtils.java
yang/yang-data-codec-gson/src/test/resources/bug8927/json/expected.json [new file with mode: 0644]
yang/yang-data-codec-gson/src/test/resources/bug8927/xml/input.xml [new file with mode: 0644]
yang/yang-data-codec-gson/src/test/resources/complexjson/yang/bug8927.yang [new file with mode: 0644]