[ISSUE #10419] Fix NPE when class filter route data is missing#10420
Open
yin-bo-Final wants to merge 2 commits into
Open
[ISSUE #10419] Fix NPE when class filter route data is missing#10420yin-bo-Final wants to merge 2 commits into
yin-bo-Final wants to merge 2 commits into
Conversation
oss-taishan-ai
approved these changes
Jun 4, 2026
oss-taishan-ai
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes NPE in PullAPIWrapper#computePullFromWhichFilterServer when topicRouteData is null, allowing the method to fall through to the existing MQClientException error path.
Findings
- [Correctness] ✅ The null check on
topicRouteData(line 302) correctly addresses the NPE reported in #10419. The additional null check ongetFilterServerTable()is a good defensive measure. - [Correctness] ✅ The control flow after the fix is correct: when route data or filter server table is missing, the method falls through to the existing
MQClientException("Find Filter Server Failed, ...")at the bottom of the method. - [Tests] ✅
testPullKernelImplWithMissingTopicRouteDataForClassFiltervalidates the fix well — emptyConcurrentHashMapensuresget(topic)returns null, and the assertion checks forMQClientExceptionwith the expected message. - [Compatibility] ✅ No public API changes. Backward compatible.
Verdict
LGTM. Clean, minimal fix that aligns with the existing error handling pattern. Test coverage is adequate.
Automated review by github-manager-bot
3 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10420 +/- ##
=============================================
- Coverage 48.05% 47.94% -0.11%
+ Complexity 13303 13279 -24
=============================================
Files 1377 1377
Lines 100611 100614 +3
Branches 12991 12993 +2
=============================================
- Hits 48347 48240 -107
- Misses 46348 46431 +83
- Partials 5916 5943 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Brief Description
This PR avoids a potential
NullPointerExceptioninPullAPIWrapper#computePullFromWhichFilterServerwhen class filter is enabled but the local topic route table does not contain route data for the target topic.Instead of dereferencing a missing
TopicRouteData, the code falls through to the existingMQClientExceptionpath.How Did You Test This Change?
mvn -pl client -Dtest=org.apache.rocketmq.client.impl.consumer.PullAPIWrapperTest -Djacoco.skip=true testThe test passed with
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0.