Skip to content

MINOR: actually throw in PooledByteBufAllocatorL - #1259

Open
no23reason wants to merge 2 commits into
apache:mainfrom
no23reason:buffer-patch-fail
Open

MINOR: actually throw in PooledByteBufAllocatorL#1259
no23reason wants to merge 2 commits into
apache:mainfrom
no23reason:buffer-patch-fail

Conversation

@no23reason

@no23reason no23reason commented Aug 12, 2026

Copy link
Copy Markdown

What's Changed

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 and should not break anything: there is still an exception being thrown, just a different type.

Also, make getNormalBufferCount actually return the count, not the size.

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.
@github-actions

This comment has been minimized.

This used to return size, which is wrong.
@lidavidm lidavidm added the bug-fix PRs that fix a big. label Aug 14, 2026
@github-actions github-actions Bot added this to the 20.0.0 milestone Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants