pitrou commented on code in PR #13246:
URL: https://github.com/apache/arrow/pull/13246#discussion_r884967969


##########
cpp/src/jni/dataset/jni_util.cc:
##########
@@ -167,9 +167,16 @@ 
ReservationListenableMemoryPool::~ReservationListenableMemoryPool() {}
 
 Status CheckException(JNIEnv* env) {
   if (env->ExceptionCheck()) {
-    env->ExceptionDescribe();
+    jthrowable t = env->ExceptionOccurred();
     env->ExceptionClear();
-    return Status::Invalid("Error during calling Java code from native code");
+    jclass describer_class =
+        env->FindClass("org/apache/arrow/dataset/jni/JniExceptionDescriber");
+    jmethodID describe_method = env->GetStaticMethodID(
+        describer_class, "describe", 
"(Ljava/lang/Throwable;)Ljava/lang/String;");
+    std::string description = JStringToCString(
+        env, (jstring)env->CallStaticObjectMethod(describer_class, 
describe_method, t));
+    return Status::Invalid("Error during calling Java code from native code: " 
+
+                           description);

Review Comment:
   Also this helper function should be moved out of dataset-specific code to be 
reused generically in all JNI bindings.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to