From f0a3f849f7d0e028eb97e672a3cbf52648b98617 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 18 Jul 2013 09:53:45 +0900 Subject: [PATCH] Fix a bug in AbstractByteBuf.writeZero() where the capacity is not auto-expanded --- buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java b/buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java index 1b972e045c..2358cb5f13 100644 --- a/buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java +++ b/buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java @@ -862,8 +862,7 @@ public abstract class AbstractByteBuf extends ByteBuf { } @Override - public int writeBytes(ScatteringByteChannel in, int length) - throws IOException { + public int writeBytes(ScatteringByteChannel in, int length) throws IOException { ensureWritable(length); int writtenBytes = setBytes(writerIndex, in, length); if (writtenBytes > 0) { @@ -878,6 +877,7 @@ public abstract class AbstractByteBuf extends ByteBuf { return this; } + ensureWritable(length); checkIndex(writerIndex, length); int nLong = length >>> 3;