Skip to content

Commit 9aa3383

Browse files
committed
feat(jvm/JEP-358): enhance NullPointerException handling
- update condition to check for NullPointerException instances - maintain compatibility with both pre-Java 14 and Java 14+ versions - address JEP 358 changes to NullPointerException behavior - ensure correct handling of non-empty NPE messages in Java 14+ Refs: JEP 358, JDK-8220715
1 parent 1e35f79 commit 9aa3383

File tree

1 file changed

+4
-1
lines changed
  • actuator/src/main/java/org/tron/core/vm

1 file changed

+4
-1
lines changed

actuator/src/main/java/org/tron/core/vm/VM.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ public static void play(Program program, JumpTable jumpTable) {
108108
} catch (JVMStackOverFlowException | OutOfTimeException e) {
109109
throw e;
110110
} catch (RuntimeException e) {
111-
if (StringUtils.isEmpty(e.getMessage())) {
111+
// https://openjdk.org/jeps/358
112+
// https://bugs.openjdk.org/browse/JDK-8220715
113+
// since jdk 14, the NullPointerExceptions message is not empty
114+
if (e instanceof NullPointerException || StringUtils.isEmpty(e.getMessage())) {
112115
logger.warn("Unknown Exception occurred, tx id: {}",
113116
Hex.toHexString(program.getRootTransactionId()), e);
114117
program.setRuntimeFailure(new RuntimeException("Unknown Exception"));

0 commit comments

Comments
 (0)