diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c index 405ee3fd657..837c7e0ed53 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c @@ -551,6 +551,10 @@ JNIEnv* getJNIEnv(void) state->env = getGlobalJNIEnv(); mutexUnlock(&jvmMutex); + if (!state->env) { + goto fail; + } + jthrowable jthr = NULL; jthr = initCachedClasses(state->env); if (jthr) { @@ -558,10 +562,6 @@ JNIEnv* getJNIEnv(void) "initCachedClasses failed"); goto fail; } - - if (!state->env) { - goto fail; - } return state->env; fail: