Fix ColumnSignature error message and jdk17 test issue. (#14538)

* 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.
This commit is contained in:
Gian Merlino 2023-07-06 15:10:59 -07:00 committed by GitHub
parent 037f09bef2
commit dd78e00dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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");
}
}

View File

@ -1638,7 +1638,7 @@ public class CalciteInsertDmlTest extends CalciteIngestionDmlTest
"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();