diff --git a/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java b/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java index 16310dede7..2699e7dcbd 100644 --- a/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java @@ -107,9 +107,6 @@ public abstract class ByteToMessageDecoder protected void callDecode(ChannelHandlerContext ctx, ByteBuf in) { boolean wasNull = false; OutputMessageBuf out = OutputMessageBuf.get(); - - assert out.isEmpty(); - try { while (in.isReadable()) { try { diff --git a/codec/src/main/java/io/netty/handler/codec/MessageToMessageEncoder.java b/codec/src/main/java/io/netty/handler/codec/MessageToMessageEncoder.java index 5c7dda5b3a..ab212d0618 100644 --- a/codec/src/main/java/io/netty/handler/codec/MessageToMessageEncoder.java +++ b/codec/src/main/java/io/netty/handler/codec/MessageToMessageEncoder.java @@ -48,7 +48,6 @@ public abstract class MessageToMessageEncoder extends ChannelOutboundMessageH @Override public final void flush(ChannelHandlerContext ctx, I msg) throws Exception { OutputMessageBuf out = OutputMessageBuf.get(); - try { encode(ctx, msg, out); } catch (CodecException e) { diff --git a/codec/src/main/java/io/netty/handler/codec/OutputMessageBuf.java b/codec/src/main/java/io/netty/handler/codec/OutputMessageBuf.java index eeaaef2f39..fc9844eede 100644 --- a/codec/src/main/java/io/netty/handler/codec/OutputMessageBuf.java +++ b/codec/src/main/java/io/netty/handler/codec/OutputMessageBuf.java @@ -35,8 +35,7 @@ final class OutputMessageBuf extends DefaultMessageBuf { @Override public OutputMessageBuf get() { OutputMessageBuf buf = super.get(); - // Just to be sure - buf.clear(); + assert buf.isEmpty(); return buf; } }; @@ -46,6 +45,7 @@ final class OutputMessageBuf extends DefaultMessageBuf { } private OutputMessageBuf() { + super(2); } @Override diff --git a/codec/src/main/java/io/netty/handler/codec/ReplayingDecoder.java b/codec/src/main/java/io/netty/handler/codec/ReplayingDecoder.java index c0f6246dce..a69a520433 100644 --- a/codec/src/main/java/io/netty/handler/codec/ReplayingDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/ReplayingDecoder.java @@ -364,7 +364,6 @@ public abstract class ReplayingDecoder extends ByteToMessageDecoder { @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { OutputMessageBuf out = OutputMessageBuf.get(); - try { replayable.terminate(); ByteBuf in = cumulation; @@ -396,8 +395,6 @@ public abstract class ReplayingDecoder extends ByteToMessageDecoder { boolean wasNull = false; ByteBuf in = cumulation; OutputMessageBuf out = OutputMessageBuf.get(); - assert out.isEmpty(); - try { while (in.isReadable()) { try {