fix(provider): report null vendor as missing in the provider registry - #2970
Open
yyqdbngt wants to merge 1 commit into
Open
fix(provider): report null vendor as missing in the provider registry#2970yyqdbngt wants to merge 1 commit into
yyqdbngt wants to merge 1 commit into
Conversation
RockteMQ-AI
approved these changes
Sep 2, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. Correct guard against EnumMap.get(null) NPE — surfacing a 501 for null vendors is the right behavior. Tests verify both forVendor and catalogFor.
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
InstanceProviderRegistry.forVendorandcatalogForlooked the vendor updirectly in an
EnumMap.EnumMap.get(null)throws NPE, so a null vendorcrashed with a raw NullPointerException instead of the same 501
"No ... provider registered for vendor" that an unregistered vendor already
produces. Both lookups now map a null vendor onto the existing missing-entry
code path.
Why
The registry is the single lookup SPI for vendor-scoped providers; current
call sites normalize a null
InstanceVO.vendorto APACHE first, but the SPIcontract ("unknown vendor -> 501") should hold for null too, so a future
caller passing a raw persisted vendor cannot 500 the request with an NPE.
Testing
Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
New regression tests
forVendorShouldReportNullVendorAsMissingTestandcatalogForShouldReportNullVendorAsMissingTestassert the 501 BusinessException(message "No ... provider registered for vendor null") instead of an NPE.