Skip to content

Dell: Fix EcsURI null-location check that never triggers#16886

Open
thswlsqls wants to merge 2 commits into
apache:mainfrom
thswlsqls:fix/dell-ecsuri-null-check
Open

Dell: Fix EcsURI null-location check that never triggers#16886
thswlsqls wants to merge 2 commits into
apache:mainfrom
thswlsqls:fix/dell-ecsuri-null-check

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Summary

  • EcsURI(String location) passed the boolean location == null to Preconditions.checkNotNull, whose first argument is the reference to null-check — so the autoboxed Boolean was always non-null and the guard never fired.
  • When location was null the check passed and URI.create(location) threw a NullPointerException with no message.
  • Fix: pass location itself so the intended null check runs and yields the "Location ... can not be null" message.
  • The sibling S3URI constructor in the AWS module already validates its location up front: https://github.com/apache/iceberg/blob/main/aws/src/main/java/org/apache/iceberg/aws/s3/S3URI.java

Testing done

  • Added TestEcsURI#testNullLocation covering a null location input.
  • Verified the regression: before the fix this test fails (the unguarded NPE from URI.create(null) has no "can not be null" message); after the fix it passes.
  • ./gradlew :iceberg-dell:check — passed, TestEcsURI runs 4 tests (test + spotlessCheck + checkstyle + errorProne).

The EcsURI(String location) constructor passed the boolean expression
`location == null` as the first argument to Preconditions.checkNotNull.
checkNotNull's first argument is the reference to null-check, so the
autoboxed Boolean was always non-null and the guard never fired. When
location was null, the check passed and URI.create(location) threw a
NullPointerException with no message.

Pass `location` itself as the reference so the intended null check runs
and produces the "Location ... can not be null" message.

Generated-by: Claude Code
@github-actions github-actions Bot added the DELL label Jun 20, 2026
Comment thread dell/src/main/java/org/apache/iceberg/dell/ecs/EcsURI.java Outdated
Comment thread dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java Outdated
Comment thread dell/src/test/java/org/apache/iceberg/dell/ecs/TestEcsURI.java Outdated
- Drop redundant "null" from the message ("Location null can not be null" -> "Location can not be null").
- Remove unnecessary (String) cast in TestEcsURI; the single-arg constructor is unambiguous.
- Use hasMessage() instead of hasMessageContaining() to match testInvalidLocation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thswlsqls thswlsqls requested a review from ebyhr June 21, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants