nastra commented on code in PR #17751:
URL: https://github.com/apache/iceberg/pull/17751#discussion_r3827823244
##########
core/src/main/java/org/apache/iceberg/rest/responses/FetchPlanningResultResponse.java:
##########
@@ -99,8 +99,11 @@ public Builder withErrorResponse(ErrorResponse response) {
return this;
}
- public Builder withCredentials(List<Credential> credentialsToAdd) {
- credentials.addAll(credentialsToAdd);
+ public Builder withCredentials(List<Credential> newCredentials) {
+ Preconditions.checkArgument(null != newCredentials, "Invalid credentials
list: null");
+ Preconditions.checkArgument(!newCredentials.contains(null), "Invalid
credential: null");
+ credentials.clear();
Review Comment:
this feels weird. why not just assign an immutable copy of
`credentialsToAdd` to `credentials`?
##########
core/src/main/java/org/apache/iceberg/rest/responses/FetchPlanningResultResponse.java:
##########
@@ -99,8 +99,11 @@ public Builder withErrorResponse(ErrorResponse response) {
return this;
}
- public Builder withCredentials(List<Credential> credentialsToAdd) {
- credentials.addAll(credentialsToAdd);
+ public Builder withCredentials(List<Credential> newCredentials) {
+ Preconditions.checkArgument(null != newCredentials, "Invalid credentials
list: null");
Review Comment:
```suggestion
Preconditions.checkArgument(null != newCredentials, "Invalid
credentials: null");
```
--
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]