toddlipcon commented on a change in pull request #600: HDFS-14348: Fix JNI
exception handling issues in libhdfs
URL: https://github.com/apache/hadoop/pull/600#discussion_r266691602
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c
##########
@@ -2498,6 +2498,11 @@ int hadoopRzOptionsSetByteBufferPool(
return -1;
}
+ if (opts->byteBufferPool) {
+ // Delete any previous ByteBufferPool we had.
+ (*env)->DeleteGlobalRef(env, opts->byteBufferPool);
Review comment:
This should probably be moved down until right before setting the _new_
value. Otherwise, if we failed somewhere below, we'd end up with two issues:
(1) the function would return an error but had a side effect of clearing the
previous value, which seems unintuitive. (2) the function would still leave
opts->byteBufferPool set, but with a now-invalid reference.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]