BUG 8927: Netconf response payload fails to render in JSON 94/65394/7
authorTomas Cere <tcere@cisco.com>
Tue, 3 Oct 2017 10:36:26 +0000 (12:36 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 29 Nov 2017 09:53:42 +0000 (09:53 +0000)
commitae5d24135f2aade5b2c10a0254714701627fc8c4
treec5371104525822b9e240ff149f303c650bd67879
parent47e6079a80189ec0237eba83b938f10dcfd6090b
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.

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>
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]