jduo commented on code in PR #40101:
URL: https://github.com/apache/arrow/pull/40101#discussion_r1492791336


##########
java/dataset/src/main/cpp/jni_wrapper.cc:
##########
@@ -126,20 +160,16 @@ class ReserveFromJava : public 
arrow::dataset::jni::ReservationListener {
       : vm_(vm), java_reservation_listener_(java_reservation_listener) {}
 
   arrow::Status OnReservation(int64_t size) override {
-    JNIEnv* env;
-    if (vm_->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK) {
-      return arrow::Status::Invalid("JNIEnv was not attached to current 
thread");
-    }
+    JNIEnvGuard guard(vm_);
+    JNIEnv* env = guard.env();

Review Comment:
   This function wasn't throwing previously. It was returning an error status 
previously. Are the callers ready to handle exceptions?



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