HDFS-14482: Crash when using libhdfs with bad classpath

This commit is contained in:
Sahil Takiar 2019-05-13 13:29:52 -05:00 committed by Todd Lipcon
parent 7d831eca64
commit e2dfdaee7c
1 changed files with 4 additions and 4 deletions

View File

@ -551,6 +551,10 @@ JNIEnv* getJNIEnv(void)
state->env = getGlobalJNIEnv(); state->env = getGlobalJNIEnv();
mutexUnlock(&jvmMutex); mutexUnlock(&jvmMutex);
if (!state->env) {
goto fail;
}
jthrowable jthr = NULL; jthrowable jthr = NULL;
jthr = initCachedClasses(state->env); jthr = initCachedClasses(state->env);
if (jthr) { if (jthr) {
@ -558,10 +562,6 @@ JNIEnv* getJNIEnv(void)
"initCachedClasses failed"); "initCachedClasses failed");
goto fail; goto fail;
} }
if (!state->env) {
goto fail;
}
return state->env; return state->env;
fail: fail: