Skip to content

Commit

Permalink
Fix ColumnSignature error message and jdk17 test issue. (#14538)
Browse files Browse the repository at this point in the history
* Fix ColumnSignature error message and jdk17 test issue.

On jdk17, the "problem" part of the error message could change from
NullPointerException to:

  Cannot invoke "String.length()" because "s" is null

Due to the new more-helpful NPEs in Java 17. This broke the expectation
and led to test failures on this case.

This patch fixes the problem by improving the error message so it isn't
a generic NullPointerException.

* Fix format.
  • Loading branch information
gianm authored Jul 6, 2023
1 parent 037f09b commit dd78e00
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ColumnSignature

// Name must be nonnull, but type can be null (if the type is unknown)
if (name == null || name.isEmpty()) {
throw new IAE(name, "Column name must be non-empty");
throw new IAE("Column name must be provided and non-empty");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ public void testErrorWithUnableToConstructColumnSignatureWithExtern()
"general"
)
.expectMessageContains(
"Cannot construct instance of `org.apache.druid.segment.column.ColumnSignature`, problem: `java.lang.NullPointerException`\n"
"Cannot construct instance of `org.apache.druid.segment.column.ColumnSignature`, problem: Column name must be provided and non-empty"
)
)
.verify();
Expand Down

0 comments on commit dd78e00

Please sign in to comment.