From ae7e40e74eda2cb448f250ca35ee81bd29887283 Mon Sep 17 00:00:00 2001 From: ccheung Date: Fri, 14 Feb 2014 09:50:17 -0800 Subject: [PATCH] 8034860: Fatal error due to incorrect thread state during nightly testing Summary: use the HAS_PENDING_EXCEPTION and CLEAR_PENDING_EXCEPTION macros Reviewed-by: dholmes, coleenp, dcubed --- src/share/vm/prims/whitebox.hpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/share/vm/prims/whitebox.hpp b/src/share/vm/prims/whitebox.hpp index 42d00b2fc..a6e27b490 100644 --- a/src/share/vm/prims/whitebox.hpp +++ b/src/share/vm/prims/whitebox.hpp @@ -36,20 +36,22 @@ #define WB_END JNI_END #define WB_METHOD_DECLARE(result_type) extern "C" result_type JNICALL -#define CHECK_JNI_EXCEPTION_(env, value) \ - do { \ - if (env->ExceptionCheck()) { \ - env->ExceptionClear(); \ - return(value); \ - } \ +#define CHECK_JNI_EXCEPTION_(env, value) \ + do { \ + JavaThread* THREAD = JavaThread::thread_from_jni_environment(env); \ + if (HAS_PENDING_EXCEPTION) { \ + CLEAR_PENDING_EXCEPTION; \ + return(value); \ + } \ } while (0) -#define CHECK_JNI_EXCEPTION(env) \ - do { \ - if (env->ExceptionCheck()) { \ - env->ExceptionClear(); \ - return; \ - } \ +#define CHECK_JNI_EXCEPTION(env) \ + do { \ + JavaThread* THREAD = JavaThread::thread_from_jni_environment(env); \ + if (HAS_PENDING_EXCEPTION) { \ + CLEAR_PENDING_EXCEPTION; \ + return; \ + } \ } while (0) class WhiteBox : public AllStatic { -- GitLab