impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Behm (Code Review)" <ger...@cloudera.org>
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. ( http://gerrit.cloudera.org:8080/8334 )

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


Patch Set 1:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/8334/1/be/src/util/jni-util.h
File be/src/util/jni-util.h:

http://gerrit.cloudera.org:8080/#/c/8334/1/be/src/util/jni-util.h@159
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.


http://gerrit.cloudera.org:8080/#/c/8334/1/be/src/util/jni-util.cc
File be/src/util/jni-util.cc:

http://gerrit.cloudera.org:8080/#/c/8334/1/be/src/util/jni-util.cc@30
PS1, Line 30: Status JniUtfCharGuard::create(JNIEnv *env, jstring jstr, JniUtfCharGuard *out)
{
fix pointer style while you are here: JNIEnv* env, etc.


http://gerrit.cloudera.org:8080/#/c/8334/1/be/src/util/jni-util.cc@197
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.


http://gerrit.cloudera.org:8080/#/c/8334/1/be/src/util/jni-util.cc@208
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 http://gerrit.cloudera.org:8080/8334
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

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 <twang@cloudera.com>
Gerrit-Reviewer: Alex Behm <alex.behm@cloudera.com>
Gerrit-Comment-Date: Fri, 20 Oct 2017 04:41:41 +0000
Gerrit-HasComments: Yes

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