This is a fix for an issue seen in the patch 63984 on yangtools.
It handles text nodes which are empty.
Change-Id: I6cf1096c511758154df6121d26bf36184385403f
Signed-off-by: Atul Gosain <agosain@luminanetworks.com>
(cherry picked from commit
cedf67270d96f385d0c2154582c6ada267b0c005)
private void writeXmlValue(final Node node) throws IOException {
Text firstChild = getFirstChildText(node);
private void writeXmlValue(final Node node) throws IOException {
Text firstChild = getFirstChildText(node);
+ String childNodeText = firstChild != null ? firstChild.getWholeText() : "";
+ childNodeText = childNodeText != null ? childNodeText.trim() : "";
- final String childNodeText = firstChild!=null
- ? (firstChild.getWholeText()!=null ? firstChild.getWholeText().trim() : null)
- : "null";
if (NUMBER_PATTERN.matcher(childNodeText).matches()) {
writer.value(parseNumber(childNodeText));
return;
if (NUMBER_PATTERN.matcher(childNodeText).matches()) {
writer.value(parseNumber(childNodeText));
return;
"bug8927:foo": {
"alarm-information": {
"alarm-summary": {
"bug8927:foo": {
"alarm-information": {
"alarm-summary": {
- "active-alarm-count": null
+ "active-alarm-count": ""
},
"alarm-detail": {
"alarm-time": "2017-08-02 19:03:44 UTC",
},
"alarm-detail": {
"alarm-time": "2017-08-02 19:03:44 UTC",
-}
\ No newline at end of file