From 35c3eedc5eaed0f1c5c65027af8f8981c566a389 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Thu, 21 May 2015 15:21:10 +0200 Subject: [PATCH] BUG-3301 Extract additional header properly on each OS On Windows, the additional header in hello netconf message was no fully extracted and it left \n byte in front on netconf xml hello message. This is not allowed as long as the declaration is present. Change-Id: I611a5c689e86fb45065e6a9cd3b14cd5718af54f Signed-off-by: Maros Marsalek --- .../nettyutil/handler/NetconfXMLToHelloMessageDecoder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToHelloMessageDecoder.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToHelloMessageDecoder.java index 3ba49fc9f5..e6c5e5482d 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToHelloMessageDecoder.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfXMLToHelloMessageDecoder.java @@ -84,9 +84,9 @@ public final class NetconfXMLToHelloMessageDecoder extends ByteToMessageDecoder // Auth information containing username, ip address... extracted for monitoring int endOfAuthHeader = getAdditionalHeaderEndIndex(bytes); if (endOfAuthHeader > -1) { - byte[] additionalHeaderBytes = Arrays.copyOfRange(bytes, 0, endOfAuthHeader + 2); + byte[] additionalHeaderBytes = Arrays.copyOfRange(bytes, 0, endOfAuthHeader); additionalHeader = additionalHeaderToString(additionalHeaderBytes); - bytes = Arrays.copyOfRange(bytes, endOfAuthHeader + 2, bytes.length); + bytes = Arrays.copyOfRange(bytes, endOfAuthHeader, bytes.length); } } @@ -127,7 +127,7 @@ public final class NetconfXMLToHelloMessageDecoder extends ByteToMessageDecoder int idx = findByteSequence(bytes, possibleEnd); if (idx != -1) { - return idx; + return idx + possibleEnd.length; } } -- 2.36.6