From 83f20db5fe50e95d1851acd796985adc10e89efc Mon Sep 17 00:00:00 2001 From: Radek Hubner Date: Tue, 2 Jul 2024 16:28:21 +0200 Subject: [PATCH] Throw exception on unsuccessfull NewGlobalRef call. --- java/rocksjni/jni_merge_operator_v2.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/rocksjni/jni_merge_operator_v2.cc b/java/rocksjni/jni_merge_operator_v2.cc index d0cdf2cdb3b9..cacfaf5c9edd 100644 --- a/java/rocksjni/jni_merge_operator_v2.cc +++ b/java/rocksjni/jni_merge_operator_v2.cc @@ -57,7 +57,11 @@ JniMergeOperatorV2::JniMergeOperatorV2(JNIEnv* env, jobject java_merge_operator, } j_merge_class = static_cast(env->NewGlobalRef(j_merge_class)); if (j_merge_class == nullptr) { - return; // Exception + if(env->ExceptionCheck() == JNI_FALSE) { + RocksDBExceptionJni::ThrowNew( + env, "Unable to obtain GlobalRef for merge operator"); + } + return; } j_merge_internal =