Bug 107309. JSJ_AttachCurrentThreadToJava doesn't return JNIEnv in all cases.

r=brendan.
This commit is contained in:
alfred.peng%sun.com 2007-02-15 06:33:34 +00:00
Родитель c518c1c5de
Коммит 7843897cb5
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -699,14 +699,16 @@ JSJ_AttachCurrentThreadToJava(JSJavaVM *jsjava_vm, const char *name, JNIEnv **ja
return NULL;
/* Try to attach a Java thread to the current native thread */
if (!JSJ_callbacks || !JSJ_callbacks->attach_current_thread)
return NULL;
java_vm = jsjava_vm->java_vm;
if (JSJ_callbacks && JSJ_callbacks->attach_current_thread)
jEnv = JSJ_callbacks->attach_current_thread(java_vm);
else
return NULL;
if (jEnv == NULL)
if (!(jEnv = JSJ_callbacks->attach_current_thread(java_vm)))
return NULL;
if (java_envp)
*java_envp = jEnv;
/* If we found an existing thread state, just return it. */
jsj_env = find_jsjava_thread(jEnv);
if (jsj_env)
@ -715,8 +717,6 @@ JSJ_AttachCurrentThreadToJava(JSJavaVM *jsjava_vm, const char *name, JNIEnv **ja
/* Create a new wrapper around the thread/VM state */
jsj_env = new_jsjava_thread_state(jsjava_vm, name, jEnv);
if (java_envp)
*java_envp = jEnv;
return jsj_env;
}