rdblue commented on a change in pull request #888: Use Objects.requireNonNull
to check parameter is or not null
URL: https://github.com/apache/incubator-iceberg/pull/888#discussion_r402659954
##########
File path: api/src/main/java/org/apache/iceberg/PartitionSpec.java
##########
@@ -349,7 +351,7 @@ public Builder withSpecId(int newSpecId) {
private Types.NestedField findSourceColumn(String sourceName) {
Types.NestedField sourceColumn = schema.findField(sourceName);
- Preconditions.checkArgument(sourceColumn != null, "Cannot find source
column: %s", sourceName);
+ requireNonNull(sourceColumn, "Cannot find source column: " + sourceName);
Review comment:
This isn't correct. Although the check is that the result of `findField` is
null, the actual problem is that `sourceName` does not identify a column.
That's why this throws `IllegalArgumentException` and not
`NullPointerException`. It would be _very_ weird to pass in a non-null String
and get a `NullPointerException` thrown.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]