Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof ByteBuf) { CodecOutputList out = CodecOutputList.newInstance(); ByteBuf data = (ByteBuf) msg; try { do { first = cumulation == null; if (first) { cumulation = data; data = null; callDecode(ctx, cumulation, out); if (cumulation == null || !cumulation.isReadable()) { break; } data = cumulation; cumulation = Unpooled.EMPTY_BUFFER; } int oldReadableBytes = cumulation.readableBytes(); int newReadableBytes = data.readableBytes(); cumulation = cumulator.cumulate(ctx.alloc(), cumulation, data); if (cumulation.readableBytes() == oldReadableBytes + newReadableBytes) { data = null; if (first) { break; } } callDecode(ctx, cumulation, out); if (!cumulation.isReadable()) { cumulation.release(); cumulation = null; } } while (data != null); } catch (Exception e) { if (data != null) { if (cumulation == null) { cumulation = data; data = null; } else { Cumulator cumulator = this.cumulator; if (cumulator != COMPOSITE_CUMULATOR) { cumulator = MERGE_CUMULATOR; } cumulation = cumulator.cumulate(ctx.alloc(), cumulation, data); data = null; } } if (e instanceof DecoderException) throw e; throw new DecoderException(e); } finally { if (data != null) { data.release(); } if (cumulation != null && !cumulation.isReadable()) { numReads = 0; cumulation.release(); cumulation = null; } else if (++ numReads >= discardAfterReads) { numReads = 0; discardSomeReadBytes(); } int size = out.size(); decodeWasNull = !out.insertSinceRecycled(); fireChannelRead(ctx, out, size); out.recycle(); } } else { ctx.fireChannelRead(msg); } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof ByteBuf) { CodecOutputList out = CodecOutputList.newInstance(); inProgress = (ByteBuf) msg; try { do { first = cumulation == null; if (first) { callDecode(ctx, inProgress, out); if (cumulation != null) { callDecode(ctx, cumulation, out); break; } else if (inProgress == null || !inProgress.isReadable()) { break; } cumulation = Unpooled.EMPTY_BUFFER; } int oldReadableBytes = cumulation.readableBytes(); int newReadableBytes = inProgress.readableBytes(); cumulation = cumulator.cumulate(ctx.alloc(), cumulation, inProgress); if (cumulation.readableBytes() == oldReadableBytes + newReadableBytes) { inProgress = null; } if (first) { break; } boolean hadInProgress = inProgress != null; callDecode(ctx, cumulation, out); if (cumulation == null) { break; } else if (!cumulation.isReadable()) { cumulation.release(); cumulation = null; numReads = 0; } else if (hadInProgress && inProgress == null) { callDecode(ctx, cumulation, out); break; } } while (inProgress != null); } catch (DecoderException e) { throw e; } catch (Exception e) { throw new DecoderException(e); } finally { saveInProgressToCumulation(); if (cumulation == null) { numReads = 0; } else if (!cumulation.isReadable()) { numReads = 0; cumulation.release(); cumulation = null; } else if (++ numReads >= discardAfterReads) { numReads = 0; discardSomeReadBytes(); } int size = out.size(); decodeWasNull = !out.insertSinceRecycled(); fireChannelRead(ctx, out, size); out.recycle(); } } else { ctx.fireChannelRead(msg); } }