X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnettyutil%2Fhandler%2FNetconfChunkAggregator.java;h=6a7b752023fef30717e1067d57d029ea7c6eee2f;hb=8350f87e0e1190fcc84099d3b7446a2f1de9e5f9;hp=e2a745f3fb876ba296b835210ec10486d5c5d86d;hpb=b78e63501576638e1f000fd46663f8c42340f9e2;p=controller.git diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfChunkAggregator.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfChunkAggregator.java index e2a745f3fb..6a7b752023 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfChunkAggregator.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/NetconfChunkAggregator.java @@ -8,19 +8,17 @@ package org.opendaylight.controller.netconf.nettyutil.handler; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.netty.buffer.ByteBuf; import io.netty.buffer.CompositeByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class NetconfChunkAggregator extends ByteToMessageDecoder { - private final static Logger logger = LoggerFactory.getLogger(NetconfChunkAggregator.class); + private final static Logger LOG = LoggerFactory.getLogger(NetconfChunkAggregator.class); private static final String GOT_PARAM_WHILE_WAITING_FOR_PARAM = "Got byte {} while waiting for {}"; private static final String GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM = "Got byte {} while waiting for {}-{}"; public static final int DEFAULT_MAXIMUM_CHUNK_SIZE = 16 * 1024 * 1024; @@ -44,21 +42,21 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { private void checkNewLine(byte b,String errorMessage){ if (b != '\n') { - logger.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM, b, (byte)'\n'); + LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM, b, (byte)'\n'); throw new IllegalStateException(errorMessage); } } private void checkHash(byte b,String errorMessage){ if (b != '#') { - logger.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM, b, (byte)'#'); + LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM, b, (byte)'#'); throw new IllegalStateException(errorMessage); } } private void checkChunkSize(){ if (chunkSize > maxChunkSize) { - logger.debug("Parsed chunk size {}, maximum allowed is {}", chunkSize, maxChunkSize); + LOG.debug("Parsed chunk size {}, maximum allowed is {}", chunkSize, maxChunkSize); throw new IllegalStateException("Maximum chunk size exceeded"); } @@ -101,7 +99,7 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { } if (b < '0' || b > '9') { - logger.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, b, (byte)'0', (byte)'9'); + LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, b, (byte)'0', (byte)'9'); throw new IllegalStateException("Invalid chunk size encountered"); } @@ -118,7 +116,7 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { * comes through. */ if (in.readableBytes() < chunkSize) { - logger.debug("Buffer has {} bytes, need {} to complete chunk", in.readableBytes(), chunkSize); + LOG.debug("Buffer has {} bytes, need {} to complete chunk", in.readableBytes(), chunkSize); in.discardReadBytes(); return; } @@ -175,7 +173,7 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { } else if (b == '#') { state = State.FOOTER_FOUR; } else { - logger.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, b, (byte) '#', (byte) '1', (byte) '9'); + LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, b, (byte) '#', (byte) '1', (byte) '9'); throw new IllegalStateException("Malformed chunk footer encountered (byte 2)"); } } @@ -193,7 +191,7 @@ public class NetconfChunkAggregator extends ByteToMessageDecoder { private static int processHeaderLengthFirst(byte b) { if (!isHeaderLengthFirst(b)) { - logger.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, b, (byte)'1', (byte)'9'); + LOG.debug(GOT_PARAM_WHILE_WAITING_FOR_PARAM_PARAM, b, (byte)'1', (byte)'9'); throw new IllegalStateException("Invalid chunk size encountered (byte 0)"); }