Akanksha-kedia opened a new pull request, #18456:
URL: https://github.com/apache/pinot/pull/18456
## Summary
Both `StaticTokenAuthProvider(AuthConfig)` and `UrlAuthProvider(AuthConfig)`
call `.toString()` directly on `authConfig.getProperties().get(...)` without a
null check. When the required property (`token` or `url`) is absent from the
config the result is an opaque `NullPointerException` with no indication of
which property is missing.
This PR replaces the implicit null deref with an explicit check that throws
`IllegalArgumentException` naming the missing property, giving operators an
actionable error message.
```java
// Before
String userToken = authConfig.getProperties().get(TOKEN).toString(); // NPE
if TOKEN absent
// After
Object tokenValue = authConfig.getProperties().get(TOKEN);
if (tokenValue == null) {
throw new IllegalArgumentException("Missing required auth config
property: " + TOKEN);
}
String userToken = tokenValue.toString();
```
The same pattern is applied to `UrlAuthProvider`.
## Test plan
- [ ] Existing auth provider unit tests pass
- [ ] Constructing either provider with a config missing the required
property throws `IllegalArgumentException` with a clear message instead of
`NullPointerException`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]