diff --git a/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Decoder.java b/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Decoder.java index 98f470169b83..b66ff5956f3a 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Decoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Decoder.java @@ -104,6 +104,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t streamCRC = 0; currentState = State.INIT_BLOCK; + // fall through case INIT_BLOCK: if (!reader.hasReadableBytes(10)) { return; @@ -125,6 +126,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t } blockCRC = reader.readInt(); currentState = State.INIT_BLOCK_PARAMS; + // fall through case INIT_BLOCK_PARAMS: if (!reader.hasReadableBits(25)) { return; @@ -135,12 +137,14 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t blockDecompressor = new Bzip2BlockDecompressor(this.blockSize, blockCRC, blockRandomised, bwtStartPointer, reader); currentState = State.RECEIVE_HUFFMAN_USED_MAP; + // fall through case RECEIVE_HUFFMAN_USED_MAP: if (!reader.hasReadableBits(16)) { return; } blockDecompressor.huffmanInUse16 = reader.readBits(16); currentState = State.RECEIVE_HUFFMAN_USED_BITMAPS; + // fall through case RECEIVE_HUFFMAN_USED_BITMAPS: Bzip2BlockDecompressor blockDecompressor = this.blockDecompressor; final int inUse16 = blockDecompressor.huffmanInUse16; @@ -175,6 +179,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t } huffmanStageDecoder = new Bzip2HuffmanStageDecoder(reader, totalTables, alphaSize); currentState = State.RECEIVE_SELECTORS_NUMBER; + // fall through case RECEIVE_SELECTORS_NUMBER: if (!reader.hasReadableBits(15)) { return; @@ -186,6 +191,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t huffmanStageDecoder.selectors = new byte[totalSelectors]; currentState = State.RECEIVE_SELECTORS; + // fall through case RECEIVE_SELECTORS: Bzip2HuffmanStageDecoder huffmanStageDecoder = this.huffmanStageDecoder; byte[] selectors = huffmanStageDecoder.selectors; @@ -209,6 +215,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t } currentState = State.RECEIVE_HUFFMAN_LENGTH; + // fall through case RECEIVE_HUFFMAN_LENGTH: huffmanStageDecoder = this.huffmanStageDecoder; totalTables = huffmanStageDecoder.totalTables; @@ -268,6 +275,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t // Finally create the Huffman tables huffmanStageDecoder.createHuffmanDecodingTables(); currentState = State.DECODE_HUFFMAN_DATA; + // fall through case DECODE_HUFFMAN_DATA: blockDecompressor = this.blockDecompressor; final int oldReaderIndex = in.readerIndex(); diff --git a/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Encoder.java b/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Encoder.java index a9dfe55c9ed5..1282ca295dfe 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Encoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Encoder.java @@ -113,9 +113,11 @@ protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws out.writeMedium(MAGIC_NUMBER); out.writeByte('0' + streamBlockSize / BASE_BLOCK_SIZE); currentState = State.INIT_BLOCK; + // fall through case INIT_BLOCK: blockCompressor = new Bzip2BlockCompressor(writer, streamBlockSize); currentState = State.WRITE_DATA; + // fall through case WRITE_DATA: if (!in.isReadable()) { return; @@ -132,6 +134,7 @@ protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws } } currentState = State.CLOSE_BLOCK; + // fall through case CLOSE_BLOCK: closeBlock(out); currentState = State.INIT_BLOCK; diff --git a/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java b/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java index 10f14b09d551..64a7915754c6 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java @@ -159,6 +159,7 @@ static void allocateHuffmanCodeLengths(final int[] array, final int maximumLengt switch (array.length) { case 2: array[1] = 1; + // fall through case 1: array[0] = 1; return; diff --git a/codec/src/main/java/io/netty/handler/codec/compression/FastLz.java b/codec/src/main/java/io/netty/handler/codec/compression/FastLz.java index 9251deb581f9..d23e44cb39d2 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/FastLz.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/FastLz.java @@ -90,6 +90,7 @@ static int calculateOutputBufferLength(int inputLength) { * * If the input is not compressible, the return value might be larger than length (input buffer size). */ + @SuppressWarnings("IdentityBinaryExpression") static int compress(final byte[] input, final int inOffset, final int inLength, final byte[] output, final int outOffset, final int proposedLevel) { final int level; diff --git a/codec/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java b/codec/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java index 341f72a18525..52ce381666f6 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoder.java @@ -126,6 +126,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t hasChecksum = (options & 0x10) == BLOCK_WITH_CHECKSUM; currentState = State.INIT_BLOCK_PARAMS; + // fall through case INIT_BLOCK_PARAMS: if (in.readableBytes() < 2 + (isCompressed ? 2 : 0) + (hasChecksum ? 4 : 0)) { break; @@ -135,6 +136,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t originalLength = isCompressed ? in.readUnsignedShort() : chunkLength; currentState = State.DECOMPRESS_DATA; + // fall through case DECOMPRESS_DATA: final int chunkLength = this.chunkLength; if (in.readableBytes() < chunkLength) { diff --git a/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java b/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java index d9b4b914f19e..865c0546eb88 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java @@ -269,6 +269,7 @@ private boolean readGZIPHeader(ByteBuf in) { crc.update(in.readUnsignedByte()); // operating system gzipState = GzipState.FLG_READ; + // fall through case FLG_READ: if ((flags & FEXTRA) != 0) { if (in.readableBytes() < 2) { @@ -282,6 +283,7 @@ private boolean readGZIPHeader(ByteBuf in) { xlen |= xlen1 << 8 | xlen2; } gzipState = GzipState.XLEN_READ; + // fall through case XLEN_READ: if (xlen != -1) { if (in.readableBytes() < xlen) { @@ -291,6 +293,7 @@ private boolean readGZIPHeader(ByteBuf in) { in.skipBytes(xlen); } gzipState = GzipState.SKIP_FNAME; + // fall through case SKIP_FNAME: if ((flags & FNAME) != 0) { if (!in.isReadable()) { @@ -305,6 +308,7 @@ private boolean readGZIPHeader(ByteBuf in) { } while (in.isReadable()); } gzipState = GzipState.SKIP_COMMENT; + // fall through case SKIP_COMMENT: if ((flags & FCOMMENT) != 0) { if (!in.isReadable()) { @@ -319,6 +323,7 @@ private boolean readGZIPHeader(ByteBuf in) { } while (in.isReadable()); } gzipState = GzipState.PROCESS_FHCRC; + // fall through case PROCESS_FHCRC: if ((flags & FHCRC) != 0) { if (in.readableBytes() < 4) { @@ -328,6 +333,7 @@ private boolean readGZIPHeader(ByteBuf in) { } crc.reset(); gzipState = GzipState.HEADER_END; + // fall through case HEADER_END: return true; default: diff --git a/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibEncoder.java b/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibEncoder.java index 49be347890c3..f039fa66e849 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibEncoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/JdkZlibEncoder.java @@ -242,6 +242,8 @@ protected final ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, case ZLIB: sizeEstimate += 2; // first two magic bytes break; + default: + // no op } } return ctx.alloc().heapBuffer(sizeEstimate); diff --git a/codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameDecoder.java b/codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameDecoder.java index 1dbe3f8c6e81..addf105df888 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameDecoder.java @@ -202,6 +202,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t this.currentChecksum = currentChecksum; currentState = State.DECOMPRESS_DATA; + // fall through case DECOMPRESS_DATA: blockType = this.blockType; compressedLength = this.compressedLength; diff --git a/codec/src/main/java/io/netty/handler/codec/compression/LzfDecoder.java b/codec/src/main/java/io/netty/handler/codec/compression/LzfDecoder.java index 2aef048030c2..61a5f0edbb01 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/LzfDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/LzfDecoder.java @@ -140,6 +140,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t if (type != BLOCK_TYPE_COMPRESSED) { break; } + // fall through case INIT_ORIGINAL_LENGTH: if (in.readableBytes() < 2) { break; @@ -147,6 +148,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t originalLength = in.readUnsignedShort(); currentState = State.DECOMPRESS_DATA; + // fall through case DECOMPRESS_DATA: final int chunkLength = this.chunkLength; if (in.readableBytes() < chunkLength) { diff --git a/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java b/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java index 3173557e328c..1c72021e033a 100644 --- a/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java +++ b/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java @@ -272,6 +272,7 @@ public void decode(ByteBuf in, ByteBuf out) { switch (state) { case READY: state = State.READING_PREAMBLE; + // fall through case READING_PREAMBLE: int uncompressedLength = readPreamble(in); if (uncompressedLength == PREAMBLE_NOT_FULL) { @@ -285,6 +286,7 @@ public void decode(ByteBuf in, ByteBuf out) { } out.ensureWritable(uncompressedLength); state = State.READING_TAG; + // fall through case READING_TAG: if (!in.isReadable()) { return; diff --git a/common/src/main/java/io/netty/util/internal/StringUtil.java b/common/src/main/java/io/netty/util/internal/StringUtil.java index 14fe2c1d22ac..8841001789a7 100644 --- a/common/src/main/java/io/netty/util/internal/StringUtil.java +++ b/common/src/main/java/io/netty/util/internal/StringUtil.java @@ -490,6 +490,7 @@ public static List unescapeCsvFields(CharSequence value) { break; } // double-quote appears without being enclosed with double-quotes + // fall through case LINE_FEED: // fall through case CARRIAGE_RETURN: diff --git a/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java b/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java index 331182e0e777..3da502ab9ef0 100644 --- a/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java +++ b/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java @@ -439,8 +439,8 @@ protected void run() { if (wakenUp.get()) { selector.wakeup(); } + // fall through default: - // fallthrough } cancelledKeys = 0;