Skip to content

Commit 6617d80

Browse files
committed
Ensure buffer returned by Netty is as expected
1 parent 3e88ba9 commit 6617d80

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/java/org/lmdbjava/ByteBufProxy.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ public final class ByteBufProxy extends BufferProxy<ByteBuf> {
5656
static {
5757
try {
5858
// create buffer (first is SimpleLeakAwareByteBuff but we need PooledUDBB)
59-
DEFAULT.directBuffer(0);
59+
final ByteBuf bb = DEFAULT.directBuffer(0);
60+
if (!NAME.equals(bb.getClass().getName())) {
61+
throw new IllegalStateException("Netty buffer must be " + NAME);
62+
}
6063
final Field address = findField(NAME, FIELD_NAME_ADDRESS);
6164
final Field length = findField(NAME, FIELD_NAME_LENGTH);
6265
ADDRESS_OFFSET = UNSAFE.objectFieldOffset(address);

0 commit comments

Comments
 (0)