Skip to content
Browse files

8231769: Test tools/javac/tree/ fails with -Xcheck:jni

Delete local jni handles in create_from_platform_dependent_str() after upcall to Java.

Reviewed-by: dholmes, hseigel
  • Loading branch information
Coleen Phillimore
Coleen Phillimore committed Oct 11, 2019
1 parent 179aab2 commit 986f2bbf2c22bbbab0d522b03ed7c4b7733591b9
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/hotspot/share/classfile/javaClasses.cpp
@@ -384,13 +384,17 @@ Handle java_lang_String::create_from_platform_dependent_str(const char* str, TRA

jstring js = NULL;
{ JavaThread* thread = (JavaThread*)THREAD;
assert(thread->is_Java_thread(), "must be java thread");
assert(THREAD->is_Java_thread(), "must be java thread");
JavaThread* thread = (JavaThread*)THREAD;
HandleMark hm(thread);
ThreadToNativeFromVM ttn(thread);
js = (_to_java_string_fn)(thread->jni_environment(), str);
return Handle(THREAD, JNIHandles::resolve(js));

Handle native_platform_string(THREAD, JNIHandles::resolve(js));
JNIHandles::destroy_local(js); // destroy local JNIHandle.
return native_platform_string;

// Converts a Java String to a native C string that can be used for

0 comments on commit 986f2bb

Please sign in to comment.
You can’t perform that action at this time.