Skip to content

MINOR: actually throw in PooledByteBufAllocatorL - #1259

Merged
lidavidm merged 2 commits into
apache:mainfrom
no23reason:buffer-patch-fail
Aug 25, 2026
Merged

MINOR: actually throw in PooledByteBufAllocatorL#1259
lidavidm merged 2 commits into
apache:mainfrom
no23reason:buffer-patch-fail

Conversation

@no23reason

@no23reason no23reason commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

This comment has been minimized.

@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

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, can you rebase to pick up CI fixes?

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.
This used to return size, which is wrong.
@lidavidm
lidavidm merged commit 522b0a2 into apache:main Aug 25, 2026
23 checks passed
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