felipepessoto commented on code in PR #13560:
URL: https://github.com/apache/gluten/pull/13560#discussion_r4542028241
##########
cpp/core/jni/JniError.h:
##########
@@ -28,11 +28,17 @@
#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);
\
+ return fallback_expr;
\
+ }
\
+ catch (std::exception & e) {
\
+ if (!env->ExceptionCheck() &&
!gluten::JavaException::throwNestedToJava(env, e)) { \
+ env->ThrowNew(gluten::getJniErrorState()->glutenExceptionClass(),
e.what()); \
+ }
\
+ return fallback_expr;
\
Review Comment:
The remaining catch-all suggestion addresses a pre-existing gap:
`JNI_METHOD_END` already caught only `std::exception` before this PR. The new
`JavaException` derives from `std::exception` and is explicitly handled, so
leaving `catch (...)` out does not introduce a regression in this patch.
The const-reference cleanup is implemented. Resolving the remaining
suggestion as separate JNI-boundary hardening, not as implemented here;
translating other native throws into generic Java errors would need its own
focused coverage.
--
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]