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


##########
java/dataset/src/main/cpp/jni_util.cc:
##########
@@ -162,11 +165,104 @@ std::shared_ptr<ReservationListener> 
ReservationListenableMemoryPool::get_listen
 
 ReservationListenableMemoryPool::~ReservationListenableMemoryPool() {}
 
+std::string Describe(JNIEnv* env, jthrowable t) {
+  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 description;
+}
+
+arrow::Result<bool> IsErrorInstanceOf(JNIEnv* env, jthrowable t, std::string 
class_name) {
+  jclass jclass = env->FindClass(class_name.c_str());
+  if (jclass == nullptr) {
+    return arrow::Status::Invalid("Class not found: " + class_name);

Review Comment:
   Well, DCHECK will abort the program (in a debug build). Presumably it's a 
bug if we can't find any of these classes/we shouldn't continue execution? But 
returning `false` is OK



-- 
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