use of org.apache.flink.shaded.netty4.io.netty.util.IllegalReferenceCountException in project drill by axbaretto.
the class BoundsCheckingTest method testLengthCheck.
@Test
public void testLengthCheck() {
try {
BoundsChecking.lengthCheck(null, 0, 0);
fail("expecting NullPointerException");
} catch (NullPointerException e) {
logger.debug("", e);
}
try (DrillBuf buffer = allocator.buffer(1)) {
try {
BoundsChecking.lengthCheck(buffer, 0, -1);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException e) {
logger.debug("", e);
}
BoundsChecking.lengthCheck(buffer, 0, 0);
BoundsChecking.lengthCheck(buffer, 0, 1);
try {
BoundsChecking.lengthCheck(buffer, 0, 2);
fail("expecting IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
logger.debug("", e);
}
try {
BoundsChecking.lengthCheck(buffer, 2, 0);
fail("expecting IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
logger.debug("", e);
}
try {
BoundsChecking.lengthCheck(buffer, -1, 0);
fail("expecting IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
logger.debug("", e);
}
}
DrillBuf buffer = allocator.buffer(1);
buffer.release();
try {
BoundsChecking.lengthCheck(buffer, 0, 0);
fail("expecting IllegalReferenceCountException");
} catch (IllegalReferenceCountException e) {
logger.debug("", e);
}
}
use of org.apache.flink.shaded.netty4.io.netty.util.IllegalReferenceCountException in project drill by apache.
the class BoundsCheckingTest method testLengthCheck.
@Test
public void testLengthCheck() {
assertTrue(BoundsChecking.BOUNDS_CHECKING_ENABLED);
try {
BoundsChecking.lengthCheck(null, 0, 0);
fail("expecting NullPointerException");
} catch (NullPointerException e) {
logger.debug("", e);
}
try (DrillBuf buffer = allocator.buffer(1)) {
try {
BoundsChecking.lengthCheck(buffer, 0, -1);
fail("expecting IllegalArgumentException");
} catch (IllegalArgumentException e) {
logger.debug("", e);
}
BoundsChecking.lengthCheck(buffer, 0, 0);
BoundsChecking.lengthCheck(buffer, 0, 1);
try {
BoundsChecking.lengthCheck(buffer, 0, 2);
fail("expecting IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
logger.debug("", e);
}
try {
BoundsChecking.lengthCheck(buffer, 2, 0);
fail("expecting IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
logger.debug("", e);
}
try {
BoundsChecking.lengthCheck(buffer, -1, 0);
fail("expecting IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
logger.debug("", e);
}
}
DrillBuf buffer = allocator.buffer(1);
buffer.release();
try {
BoundsChecking.lengthCheck(buffer, 0, 0);
fail("expecting IllegalReferenceCountException");
} catch (IllegalReferenceCountException e) {
logger.debug("", e);
}
}
use of org.apache.flink.shaded.netty4.io.netty.util.IllegalReferenceCountException in project flink by apache.
the class AbstractByteBufTest method assertSliceFailAfterRelease.
private static void assertSliceFailAfterRelease(ByteBuf... bufs) {
for (ByteBuf buf : bufs) {
if (buf.refCnt() > 0) {
buf.release();
}
}
for (ByteBuf buf : bufs) {
try {
assertEquals(0, buf.refCnt());
buf.slice();
fail();
} catch (IllegalReferenceCountException ignored) {
// as expected
}
}
}
use of org.apache.flink.shaded.netty4.io.netty.util.IllegalReferenceCountException in project flink by apache.
the class AbstractByteBufTest method assertRetainedSliceFailAfterRelease.
private static void assertRetainedSliceFailAfterRelease(ByteBuf... bufs) {
for (ByteBuf buf : bufs) {
if (buf.refCnt() > 0) {
buf.release();
}
}
for (ByteBuf buf : bufs) {
try {
assertEquals(0, buf.refCnt());
buf.retainedSlice();
fail();
} catch (IllegalReferenceCountException ignored) {
// as expected
}
}
}
use of org.apache.flink.shaded.netty4.io.netty.util.IllegalReferenceCountException in project flink by apache.
the class AbstractByteBufTest method assertRetainedDuplicateFailAfterRelease.
private static void assertRetainedDuplicateFailAfterRelease(ByteBuf... bufs) {
for (ByteBuf buf : bufs) {
if (buf.refCnt() > 0) {
buf.release();
}
}
for (ByteBuf buf : bufs) {
try {
assertEquals(0, buf.refCnt());
buf.retainedDuplicate();
fail();
} catch (IllegalReferenceCountException ignored) {
// as expected
}
}
}
Aggregations