Dell: Fix EcsURI null-location check that never triggers#16886
Open
thswlsqls wants to merge 2 commits into
Open
Dell: Fix EcsURI null-location check that never triggers#16886thswlsqls wants to merge 2 commits into
thswlsqls wants to merge 2 commits into
Conversation
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
ebyhr
reviewed
Jun 21, 2026
- 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>
ebyhr
approved these changes
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EcsURI(String location)passed the booleanlocation == nulltoPreconditions.checkNotNull, whose first argument is the reference to null-check — so the autoboxedBooleanwas always non-null and the guard never fired.locationwas null the check passed andURI.create(location)threw aNullPointerExceptionwith no message.locationitself so the intended null check runs and yields the "Location ... can not be null" message.S3URIconstructor 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.javaTesting done
TestEcsURI#testNullLocationcovering a null location input.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).