SwappedByteBuf.unwrap() should return null
Fixes #945. For swapped wrapped buffers, it should not return null.
This commit is contained in:
parent
5b17307b1f
commit
d806e3bf81
@ -140,7 +140,7 @@ public class SlicedByteBuf extends AbstractByteBuf {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBuf duplicate() {
|
public ByteBuf duplicate() {
|
||||||
ByteBuf duplicate = new SlicedByteBuf(buffer, adjustment, length);
|
ByteBuf duplicate = buffer.slice(adjustment, length);
|
||||||
duplicate.setIndex(readerIndex(), writerIndex());
|
duplicate.setIndex(readerIndex(), writerIndex());
|
||||||
return duplicate;
|
return duplicate;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,8 @@ public class SlicedByteBuf extends AbstractByteBuf {
|
|||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
return Unpooled.EMPTY_BUFFER;
|
return Unpooled.EMPTY_BUFFER;
|
||||||
}
|
}
|
||||||
return new SlicedByteBuf(buffer, index + adjustment, length);
|
return buffer.slice(index + adjustment, length);
|
||||||
|
//new SlicedByteBuf(buffer, index + adjustment, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,7 +59,7 @@ public final class SwappedByteBuf implements ByteBuf {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBuf unwrap() {
|
public ByteBuf unwrap() {
|
||||||
return buf;
|
return buf.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user