Skip to content

Commit

Permalink
Enable helpful null pointer exceptions (#54853)
Browse files Browse the repository at this point in the history
Now that JDK 14 is available, and we are bundling it, this commit
enables us to run with helpful null pointer exceptions, which will be a
great aid in debugging.
  • Loading branch information
jasontedor committed Apr 7, 2020
1 parent dbd31b6 commit 89b70c1
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static List<String> systemJvmOptions() {
* debugging.
*/
"-XX:-OmitStackTraceInFastThrow",
// enable helpful NullPointerExceptions (https://openjdk.java.net/jeps/358), if they are supported
maybeShowCodeDetailsInExceptionMessages(),
// flags to configure Netty
"-Dio.netty.noUnsafe=true",
"-Dio.netty.noKeySetOptimization=true",
Expand All @@ -69,6 +71,14 @@ static List<String> systemJvmOptions() {
);
}

private static String maybeShowCodeDetailsInExceptionMessages() {
if (JavaVersion.majorVersion(JavaVersion.CURRENT) >= 14) {
return "-XX:+ShowCodeDetailsInExceptionMessages";
} else {
return "";
}
}

private static String javaLocaleProviders() {
/**
* SPI setting is used to allow loading custom CalendarDataProvider
Expand Down

0 comments on commit 89b70c1

Please sign in to comment.