SwappedByteBuf.unwrap() should return null

Fixes #945.  For swapped wrapped buffers, it should not return null.
This commit is contained in:
Trustin Lee 2013-01-17 12:05:43 +09:00
parent 5b17307b1f
commit d806e3bf81
2 changed files with 4 additions and 3 deletions

View File

@ -140,7 +140,7 @@ public class SlicedByteBuf extends AbstractByteBuf {
@Override
public ByteBuf duplicate() {
ByteBuf duplicate = new SlicedByteBuf(buffer, adjustment, length);
ByteBuf duplicate = buffer.slice(adjustment, length);
duplicate.setIndex(readerIndex(), writerIndex());
return duplicate;
}
@ -157,7 +157,8 @@ public class SlicedByteBuf extends AbstractByteBuf {
if (length == 0) {
return Unpooled.EMPTY_BUFFER;
}
return new SlicedByteBuf(buffer, index + adjustment, length);
return buffer.slice(index + adjustment, length);
//new SlicedByteBuf(buffer, index + adjustment, length);
}
@Override

View File

@ -59,7 +59,7 @@ public final class SwappedByteBuf implements ByteBuf {
@Override
public ByteBuf unwrap() {
return buf;
return buf.unwrap();
}
@Override