BUG-2838: Trim leading whitespaces from incoming NETCONF messages. 78/20878/5
authorGwenael Lambrouin <gwenael.lambrouin@b-com.com>
Thu, 21 May 2015 13:32:35 +0000 (15:32 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Jun 2015 10:12:14 +0000 (10:12 +0000)
commit81441c1681143050118195459a1a731cf9be21bb
treefc0cef04718c285d3f7fc2cebade7e9c445b855d
parent12d79e66e26bc7a521b0380e158dca5dd2b98abc
BUG-2838: Trim leading whitespaces from incoming NETCONF messages.

Some network devices (such as Cisco routers) send RPC replies with a leading
newline before the XML declaration. The OpenDaylight controller does not accept
those replies: the XML parsing fails.

This patch fixes the NETCONF messages before they are sent to the XML parser:
it removes all the spurious characters at the beginning of the messages.

Change-Id: Ibc6eb6dc5bad6252a3c9bed73d3db83814aff501
Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@b-com.com>
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
(cherry picked from commit eb3ebced9d3471644dece3e4e27cca9451db0685)
opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToMessageDecoder.java
opendaylight/netconf/netconf-netty-util/src/test/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToMessageDecoderTest.java