felipepessoto commented on code in PR #13560:
URL: https://github.com/apache/gluten/pull/13560#discussion_r4542785383
##########
cpp/core/jni/JniError.h:
##########
@@ -28,11 +28,25 @@
#endif
#ifndef JNI_METHOD_END
-#define JNI_METHOD_END(fallback_expr)
\
- }
\
- catch (std::exception & e) {
\
- env->ThrowNew(gluten::getJniErrorState()->glutenExceptionClass(),
e.what()); \
- return fallback_expr;
\
+#define JNI_METHOD_END(fallback_expr)
\
+ }
\
+ catch (const gluten::JavaException& e) {
\
+ e.throwToJava(env);
\
+ if (!env->ExceptionCheck() &&
\
+ env->ThrowNew(gluten::getJniErrorState()->glutenExceptionClass(),
e.what()) != JNI_OK) { \
+ LOG(ERROR) << "Unable to throw GlutenException at JNI boundary";
\
+ }
\
+ return fallback_expr;
\
+ }
\
Review Comment:
Fixed in 412c773b. The direct handler now checks for an existing pending
Java exception before restoring the carrier, matching the nested path. The
failed-restoration fallback is unchanged.
Added real-JVM direct and nested tests that install a distinct newer
exception before the production boundary handler runs and assert its exact
identity. The direct case fails on the previous code because it receives the
original exception instead; all ten JUnit cases and eleven native regressions
pass with the guard.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]