Skip to content

Commit

Permalink
Throw exception on unsuccessfull NewGlobalRef call.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhubner committed Jul 9, 2024
1 parent fe5549c commit 5887ad0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion java/rocksjni/jni_merge_operator_v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ JniMergeOperatorV2::JniMergeOperatorV2(JNIEnv* env, jobject java_merge_operator,
}
j_merge_class = static_cast<jclass>(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 =
Expand Down

0 comments on commit 5887ad0

Please sign in to comment.