Correct encoding 76/5376/1
authorRobert Varga <rovarga@cisco.com>
Sun, 16 Feb 2014 03:31:16 +0000 (04:31 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 18 Feb 2014 05:22:35 +0000 (06:22 +0100)
NETCONF chunked encoding is transferred in US_ASCII, not UTF-8.

Change-Id: I33d45b0d2806c91aaf5c22fcaf3731fdad6cf7f6
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageChunkDecoder.java

index 5c00b9b..77ef386 100644 (file)
@@ -13,7 +13,6 @@ import io.netty.buffer.Unpooled;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.ByteToMessageDecoder;
 
-import java.nio.charset.Charset;
 import java.util.List;
 
 import org.opendaylight.controller.netconf.api.NetconfDeserializerException;
@@ -21,8 +20,9 @@ import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NetconfMessageChunkDecoder extends ByteToMessageDecoder {
+import com.google.common.base.Charsets;
 
+public class NetconfMessageChunkDecoder extends ByteToMessageDecoder {
     private final static Logger logger = LoggerFactory.getLogger(NetconfMessageChunkDecoder.class);
 
     @Override
@@ -63,7 +63,7 @@ public class NetconfMessageChunkDecoder extends ByteToMessageDecoder {
         while ((b = in.readByte()) != 10) {
             chunkSize.writeByte(b);
         }
-        return Integer.parseInt(chunkSize.toString(Charset.forName("UTF-8")));
+        return Integer.parseInt(chunkSize.toString(Charsets.US_ASCII));
     }
 
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.