eric-maynard opened a new pull request, #12864:
URL: https://github.com/apache/iceberg/pull/12864

   When working on a change for Apache Polaris, I hit an error of the following 
form:
   
   ```
   java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:233)
        at 
java.base/java.util.ImmutableCollections$MapN.containsKey(ImmutableCollections.java:1207)
        at 
org.apache.iceberg.rest.requests.CreateNamespaceRequest$Builder.setProperties(CreateNamespaceRequest.java:85)
        at 
org.apache.iceberg.rest.RESTSessionCatalog.createNamespace(RESTSessionCatalog.java:626)
        at 
org.apache.iceberg.catalog.BaseSessionCatalog$AsCatalog.createNamespace(BaseSessionCatalog.java:128)
        at 
org.apache.iceberg.rest.RESTCatalog.createNamespace(RESTCatalog.java:223)
        at 
org.apache.polaris.service.it.test.PolarisRestCatalogIntegrationTest.testCreateNamespaceWithReservedProperty(PolarisRestCatalogIntegrationTest.java:1376)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
   ```
   
   Looking closer, I see that in `java.util.ImmutableCollections.MapN`, the 
`containsKey` method looks like:
   ```
           @Override
           public boolean containsKey(Object o) {
               Objects.requireNonNull(o);
               return size > 0 && probe(o) >= 0;
           }
   ```
   
   This suggests to me that `containsKey(null)` should probably be avoided; to 
keep the same semantics I suggest that we can use `keySet().contains(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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to