diff --git a/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java b/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java index f5d2022e0bda..3f895972f732 100644 --- a/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java +++ b/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java @@ -35,7 +35,7 @@ class EcsURI { private final String name; EcsURI(String location) { - Preconditions.checkNotNull(location == null, "Location %s can not be null", location); + Preconditions.checkNotNull(location, "Location can not be null"); this.location = location; diff --git a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java index ec56e76bb717..6566dc25f92f 100644 --- a/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java +++ b/dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java @@ -59,4 +59,11 @@ public void testInvalidLocation() { .isInstanceOf(ValidationException.class) .hasMessage("Invalid ecs location: http://bucket/a"); } + + @Test + public void testNullLocation() { + assertThatThrownBy(() -> new EcsURI(null)) + .isInstanceOf(NullPointerException.class) + .hasMessage("Location can not be null"); + } }