zhztheplayer commented on code in PR #13246:
URL: https://github.com/apache/arrow/pull/13246#discussion_r913967682
##########
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:
I changed to use `DCHECK` to guard against debug build since class_name is
hard coded. Would you please take a look?
--
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]