You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/06/18 21:19:50 UTC

[GitHub] [iceberg] jackye1995 commented on a change in pull request #2703: Add more null checks to TableIdentifier

jackye1995 commented on a change in pull request #2703:
URL: https://github.com/apache/iceberg/pull/2703#discussion_r653836208



##########
File path: api/src/main/java/org/apache/iceberg/catalog/TableIdentifier.java
##########
@@ -36,6 +36,7 @@
   private final String name;
 
   public static TableIdentifier of(String... names) {
+    Preconditions.checkArgument(names != null, "Cannot create table identifier from null array");

Review comment:
       I don't think null check is needed for java varargs. The names will be empty array if no input is given. I verified it locally:
   
   ```
   private void met(String... strs) {
       System.out.println(Arrays.toString(strs));
     }
   
   met();
   ```
   
   The result is `[]`

##########
File path: api/src/main/java/org/apache/iceberg/catalog/TableIdentifier.java
##########
@@ -36,6 +36,7 @@
   private final String name;
 
   public static TableIdentifier of(String... names) {
+    Preconditions.checkArgument(names != null, "Cannot create table identifier from null array");

Review comment:
       Ah I see, never thought about this use case, thanks!




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org