waterWang opened a new pull request, #17540:
URL: https://github.com/apache/iceberg/pull/17540
Closes #17536
## Summary
In `AwsClientProperties.credentialsProvider()`, when
`client.credentials-provider` is set, the code unconditionally puts
`refreshCredentialsEndpoint` into `clientCredentialsProviderProperties` under
`VendedCredentialsProvider.URI`. When `refreshCredentialsEndpoint` is `null`
(i.e. neither `CatalogProperties.URI` nor `client.refresh-credentials-endpoint`
is configured), this puts a `null` value into the map.
This null value propagates to custom `AwsCredentialsProvider`
implementations that receive the properties map, causing a
`NullPointerException` in `PropertyUtil.filterProperties` when the map is
processed:
```
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:233)
at
java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
...
at
org.apache.iceberg.util.PropertyUtil.filterProperties(PropertyUtil.java:191)
at
org.apache.iceberg.aws.AwsClientProperties.<init>(AwsClientProperties.java:116)
```
## Fix
Guard the `put` with a null/empty check on `refreshCredentialsEndpoint`,
matching the pattern already used in the `VendedCredentialsProvider` branch
below it. This ensures a `null` value is never inserted into the properties map
when the endpoint is not configured.
## Testing
No new tests added — this is a defensive null-safety fix. The existing
`TestAwsClientProperties` suite covers the unaffected paths. Manually verified
that the `refreshCredentialsEndpoint` is only put into the map when it is
non-null/non-empty.
--
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]