mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8059677: Thread.getName() instantiates Strings
Reviewed-by: coleenp, dholmes, sla
This commit is contained in:
parent
0bad624124
commit
f8712e7800
6 changed files with 17 additions and 22 deletions
|
@ -2872,14 +2872,12 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const {
|
|||
const char* name_str;
|
||||
oop thread_obj = threadObj();
|
||||
if (thread_obj != NULL) {
|
||||
typeArrayOop name = java_lang_Thread::name(thread_obj);
|
||||
oop name = java_lang_Thread::name(thread_obj);
|
||||
if (name != NULL) {
|
||||
if (buf == NULL) {
|
||||
name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR),
|
||||
name->length());
|
||||
name_str = java_lang_String::as_utf8_string(name);
|
||||
} else {
|
||||
name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR),
|
||||
name->length(), buf, buflen);
|
||||
name_str = java_lang_String::as_utf8_string(name, buf, buflen);
|
||||
}
|
||||
} else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306
|
||||
name_str = "<no-name - thread is attaching>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue