impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Behm (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-6060: Check the return value of JNI exception handling functions
Date Fri, 20 Oct 2017 04:41:41 GMT
Alex Behm has posted comments on this change. ( )

Change subject: IMPALA-6060: Check the return value of JNI exception handling functions

Patch Set 1:

File be/src/util/jni-util.h:
PS1, Line 159:   /// lives as long as this guard. jstr should not be null.
Usually such a comment indicates a precondition, but in this case a nullptr is handled gracefully
by returning a status.

I think it's actually better to make it a precondition and use a DCHECK instead of returning
a Status.
File be/src/util/
PS1, Line 30: Status JniUtfCharGuard::create(JNIEnv *env, jstring jstr, JniUtfCharGuard *out)
fix pointer style while you are here: JNIEnv* env, etc.
PS1, Line 197:   if (msg == nullptr) {
I think the real cause of the bug is here. The general rule is that you always need to check
for exceptions after a JNI function call. I think we are missing a RETURN_ERROR_IF_EXC(env);
at this point.

This handles checked as well as unchecked Java exceptions, including OOM.
PS1, Line 208:     if (stack == nullptr) {
same here, I think the right fix is to add a RETURN_ERROR_IF_EXC(env);

To view, visit
To unsubscribe, visit

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie3ed88bf8739c56a066f2402727c8204e96aa116
Gerrit-Change-Number: 8334
Gerrit-PatchSet: 1
Gerrit-Owner: Tianyi Wang <>
Gerrit-Reviewer: Alex Behm <>
Gerrit-Comment-Date: Fri, 20 Oct 2017 04:41:41 +0000
Gerrit-HasComments: Yes

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message