[CONTROLLER-1066] Malformed JSON - multiline string Created: 12/Dec/14  Updated: 14/Nov/17  Resolved: 16/Jun/15

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: Helium
Fix Version/s: None

Type: Bug
Reporter: Jozef Gloncak Assignee: Jan Hajnar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 2507

 Description   

If leaf or leaf-list is of type string which contains new lines then it is outputed to JSON as multiline string, which isn't supported. It is malformed JSON.

Therefore new line characters should be escaped.



 Comments   
Comment by Jozef Gloncak [ 12/Dec/14 ]

Patch was submitted to master
https://git.opendaylight.org/gerrit/#/c/13544/

should go to stable-helium and shouldn't be solved via new line replacing

Comment by Jozef Gloncak [ 16/Dec/14 ]

patch submitted to stable/helium
https://git.opendaylight.org/gerrit/#/c/13677/

currently for replacing isn't called replace method but specific characters (\, \n, \r, ") are escaped with additional \.

Comment by Andrej Marcinek [ 20/Mar/15 ]

tested on helium SR3 with installed features: odl-mdsal-broker odl-tcpmd5-all odl-restconf odl-bgpcep-all odl-openflowjava-protocol odl-openflowplugin-flow-services-rest odl-openflowplugin-drop-test odl-l2switch-switch-rest odl-netconf-connector-ssh
new line is in response as 0A

otification-broker","name":"binding-notification-broker"},{"type":"openflow-provider-impl:msg-spy-service-impl","name":"msg-spy-service-impl","openflow-provider-impl:openflow-plugin-provider":

{"name":"openflow-provider","type":"openflow-provider:openflow-provider"}

,"openflow-provider-impl:msgStatistics":"Fri 2015.03.20 at 02:20:09 PM UTC\
FROM_SWITCH_ENQUEUED: no activity detected\
FROM_SWITCH_TRANSLATE_IN_SUCCESS: no activity detected\
FROM_SWITCH_TRANSLATE_OUT_SUCCESS: no activity detected\
FROM_SWITCH_TRANSLATE_SRC_FAILURE: no activity detected\
FROM_SWITCH_PUBLISHED_SUCCESS: no activity detected\
FROM_SWITCH_PUBLISHED_FAILURE: no activity detected\
TO_SWITCH_ENQUEUED_SUCCESS: no activity detected\
TO_SWITCH_ENQUEUED_FAILED: no activity detected\
TO_SWITCH_SUBMITTED_SUCCESS: no activity detected\
TO_SWITCH_SUBMITTED_FAILURE: no activity detected"},{"type":"odl-bgp-rib-impl-cfg:bgp-dispatcher-impl","name":"global-bgp-dispatcher","odl-bgp-rib-impl-cfg:bgp-extensions":

{"name":"global-bgp-extensions","type":"odl-bgp-parser-spi-cfg:consumer-extensions"}

,"odl-bgp-rib-impl-cfg:boss-group":

{"name":"global-boss-group","type":"netty:netty-threadgroup"}

,"odl-bgp-rib-impl-cfg:worker-group":{"name":"global-worker-group","type":"netty:netty-threadgroup"}},{"type":"odl-sal-netconf-connector-cfg:sal-netconf-connector","name":"controller-config_xrvr","odl-sal-netconf-connector-cfg:address":"10.25.2.37","odl-sal-netconf-connector-cfg:dom-registry":{"name":"dom-br

Comment by Jan Hajnar [ 26/Mar/15 ]

patch:
https://git.opendaylight.org/gerrit/#/c/17180/

Generated at Wed Feb 07 19:54:36 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.