From d886d8c465ff25c398a87b4a0ebdc138a6db6511 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Thu, 25 Jun 2020 08:36:59 -0700 Subject: [PATCH] 8247730: 2 JNI exception pending defect groups in DwarfParser.cpp Reviewed-by: sspitsyn, amenkov --- .../linux/native/libsaproc/DwarfParser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp index bd50a17b9af..33554463e2a 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp @@ -104,7 +104,9 @@ JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_cr DwarfParser *parser = new DwarfParser(reinterpret_cast(lib)); if (!parser->is_parseable()) { jclass ex_cls = env->FindClass("sun/jvm/hotspot/debugger/DebuggerException"); - env->ThrowNew(ex_cls, "DWARF not found"); + if (!env->ExceptionOccurred()) { + env->ThrowNew(ex_cls, "DWARF not found"); + } return 0L; } @@ -146,7 +148,9 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_pro DwarfParser *parser = reinterpret_cast(get_dwarf_context(env, this_obj)); if (!parser->process_dwarf(pc)) { jclass ex_cls = env->FindClass("sun/jvm/hotspot/debugger/DebuggerException"); - env->ThrowNew(ex_cls, "Could not find PC in DWARF"); + if (!env->ExceptionOccurred()) { + env->ThrowNew(ex_cls, "Could not find PC in DWARF"); + } return; } }