fix(client): tolerate null connection lists from client providers - #2926
Open
yyqdbngt wants to merge 1 commit into
Open
fix(client): tolerate null connection lists from client providers#2926yyqdbngt wants to merge 1 commit into
yyqdbngt wants to merge 1 commit into
Conversation
RockteMQ-AI
approved these changes
Sep 1, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. Clean defensive fix that prevents NPE when client providers return null for unavailable lookups.
Observations
- Correctness ✓ —
nullToEmpty()helper centralizes the null-safety pattern, applied consistently acrossClientService,ProducerConnectionService, andConsumerConnectionService. - Tests ✓ — Good coverage including null-returning mock scenarios.
- Design — The Javadoc on
nullToEmptyclearly explains the rationale.
Automated review by github-manager-bot
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.
Summary
The client connection endpoints trust the provider layer to return non-null lists, but the
ClientProvidercontract only declaresList<...>return types:ProducerConnectionService.listConnections()called.stream()directly on the provider result, so a provider reporting an unavailable lookup asnullsurfaced as a raw NPE 500.ClientServiceandlistProducerGroups()passed anullstraight through the API asdata: null, breaking the list contract the frontend maps over.The service layer now normalizes a
nullprovider result to an empty list, matching how the provider implementations already report "nothing found" (List.of()).Why
The provider interface is the boundary between Studio and the RocketMQ runtime; implementations can report unavailable lookups as
nullwithout violating anything, and the endpoints should degrade to "no connections" instead of a 500 or a null payload.Testing
Extended
ClientServiceTest(+2) andProducerConnectionServiceTest(+2) with null-provider-result cases for all four endpoints.