You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "eric-maynard (via GitHub)" <gi...@apache.org> on 2025/04/22 00:56:57 UTC
[PR] Remove usage of Map.containsKey(null) [iceberg]
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-unsubscribe@iceberg.apache.org
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
Re: [PR] Remove usage of Map.containsKey(null) [iceberg]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard closed pull request #12864: Remove usage of Map.containsKey(null)
URL: https://github.com/apache/iceberg/pull/12864
--
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-unsubscribe@iceberg.apache.org
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