From ab9d18ff82884788efcc108db52d89d4932a5f42 Mon Sep 17 00:00:00 2001 From: stdpain <34912776+stdpain@users.noreply.github.com> Date: Fri, 3 Jan 2025 14:35:05 +0800 Subject: [PATCH] [BugFix] Fix exception not clear in env (#54645) Signed-off-by: stdpain (cherry picked from commit 3b4c347a3b1af6da631528ba1ed5f1493facfbb6) --- be/src/udf/java/java_udf.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/be/src/udf/java/java_udf.h b/be/src/udf/java/java_udf.h index 5df5f634db956..a61c7395136d7 100644 --- a/be/src/udf/java/java_udf.h +++ b/be/src/udf/java/java_udf.h @@ -218,11 +218,12 @@ class JVMFunctionHelper { env->ExceptionClear(); \ } -#define RETURN_ERROR_IF_JNI_EXCEPTION(env) \ - if (auto e = env->ExceptionOccurred()) { \ - LOCAL_REF_GUARD(e); \ - std::string msg = JVMFunctionHelper::getInstance().dumpExceptionString(e); \ - return Status::InternalError(JVMFunctionHelper::getInstance().dumpExceptionString(e)); \ +#define RETURN_ERROR_IF_JNI_EXCEPTION(env) \ + if (auto e = env->ExceptionOccurred()) { \ + LOCAL_REF_GUARD(e); \ + std::string msg = JVMFunctionHelper::getInstance().dumpExceptionString(e); \ + env->ExceptionClear(); \ + return Status::InternalError(msg); \ } // Used for UDAF serialization and deserialization,