Skip to content

Commit 00ea39b

Browse files
committed
MINOR: actually throw in PooledByteBufAllocatorL
There was a check in that class that looks like it throws an exception, but actually does not. This means that when that branch is hit, instead of an actionable error, the user gets a ClassCastException like ``` java.lang.ClassCastException: class io.netty.buffer.PooledDirectByteBuf cannot be cast to class io.netty.buffer.PooledUnsafeDirectByteBuf (io.netty.buffer.PooledDirectByteBuf and io.netty.buffer.PooledUnsafeDirectByteBuf are in unnamed module of loader org.springframework.boot.loader.launch.LaunchedClassLoader@5e9f23b4) ``` Actually throwing the exception prevents this.
1 parent 85d7ef3 commit 00ea39b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

memory/memory-netty-buffer-patch/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private UnsafeDirectLittleEndian newDirectBufferL(int initialCapacity, int maxCa
172172
// within chunk, use arena.
173173
ByteBuf buf = directArena.allocate(cache, initialCapacity, maxCapacity);
174174
if (!(buf instanceof PooledUnsafeDirectByteBuf)) {
175-
fail();
175+
throw fail();
176176
}
177177

178178
if (!AssertionUtil.ASSERT_ENABLED) {

0 commit comments

Comments
 (0)