Fix NPE in StaticTokenAuthProvider and UrlAuthProvider when required config property is absent#18456
Merged
yashmayya merged 2 commits intoMay 12, 2026
Conversation
…config property is missing Both constructors that accept an AuthConfig called .toString() directly on the result of authConfig.getProperties().get(...) without a null check. If the required property (token or url) is absent from the config, this throws a NullPointerException with no useful context. Replace the implicit null deref with an explicit null check that throws an IllegalArgumentException naming the missing property, giving operators a clear error message.
Contributor
Author
|
@xiangfu0 please review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18456 +/- ##
============================================
+ Coverage 63.40% 63.70% +0.29%
- Complexity 1679 1684 +5
============================================
Files 3253 3262 +9
Lines 198767 199832 +1065
Branches 30791 31033 +242
============================================
+ Hits 126034 127297 +1263
+ Misses 62659 62392 -267
- Partials 10074 10143 +69
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
yashmayya
approved these changes
May 11, 2026
Contributor
Author
|
@yashmayya please merge |
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
Both
StaticTokenAuthProvider(AuthConfig)andUrlAuthProvider(AuthConfig)call.toString()directly onauthConfig.getProperties().get(...)without a null check. When the required property (tokenorurl) is absent from the config the result is an opaqueNullPointerExceptionwith no indication of which property is missing.This PR replaces the implicit null deref with an explicit check that throws
IllegalArgumentExceptionnaming the missing property, giving operators an actionable error message.The same pattern is applied to
UrlAuthProvider.Test plan
IllegalArgumentExceptionwith a clear message instead ofNullPointerException