Skip to content

Commit cb0fa0c

Browse files
Sahil Takiarjojochuang
authored andcommitted
HDFS-14321. Fix -Xcheck:jni issues in libhdfs, run ctest with -Xcheck:jni enabled. Contributed by Sahil Takiar.
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
1 parent 10b802b commit cb0fa0c

File tree

2 files changed

+2
-1
lines changed
  • hadoop-hdfs-project/hadoop-hdfs-native-client

2 files changed

+2
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs-native-client/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
243243
<exec executable="ctest" failonerror="true" dir="${project.build.directory}/">
244244
<arg line="--output-on-failure"/>
245245
<arg line="${native_ctest_args}"/>
246+
<env key="LIBHDFS_OPTS" value="${env.LIBHDFS_OPTS} -Xcheck:jni"/>
246247
<env key="CLASSPATH" value="${test_classpath}:${compile_classpath}"/>
247248
<!-- Make sure libhadoop.so is on LD_LIBRARY_PATH. -->
248249
<env key="LD_LIBRARY_PATH" value="${env.LD_LIBRARY_PATH}:${project.build.directory}/native/target/usr/local/lib:${hadoop.common.build.dir}/native/target/usr/local/lib"/>

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2508,7 +2508,7 @@ int hadoopRzOptionsSetByteBufferPool(
25082508
// Delete any previous ByteBufferPool we had.
25092509
(*env)->DeleteGlobalRef(env, opts->byteBufferPool);
25102510
}
2511-
opts->byteBufferPool = byteBufferPool;
2511+
opts->byteBufferPool = (*env)->NewGlobalRef(env, byteBufferPool);
25122512
return 0;
25132513
}
25142514

0 commit comments

Comments
 (0)