pulsar
pulsar copied to clipboard
[fix][client] Prevent NPE when seeking with null topic in TopicMessageId
Motivation
This PR addresses a potential NullPointerException (NPE) that could occur when calling the seek() method with a TopicMessageIdImpl that has a null topic.
Modifications
- Added null check for the owner topic in
MultiTopicsConsumerImpl.javabefore attempting to access it - Added comprehensive test case in
SubscriptionSeekTest.javato verify the fix:- Creates a partitioned topic
- Attempts to seek using a
TopicMessageIdImplwith null topic - Verifies the proper exception is thrown with a clear error message
Verifying this change
- [x] Make sure that the change passes the CI checks.
If the box was checked, please highlight the changes
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Matching PR in forked repository
PR in forked repository: https://github.com/3pacccccc/pulsar/pull/8