src/share/vm/runtime/thread.cpp

changeset 8288
efe013052465
parent 8189
c60b9a314312
child 8604
04d83ba48607
child 9056
940519c00887
equal deleted inserted replaced
8287:dae1435f96b7 8288:efe013052465
1 /* 1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
2924 // descriptive string if there is no set name 2924 // descriptive string if there is no set name
2925 const char* JavaThread::get_thread_name_string(char* buf, int buflen) const { 2925 const char* JavaThread::get_thread_name_string(char* buf, int buflen) const {
2926 const char* name_str; 2926 const char* name_str;
2927 oop thread_obj = threadObj(); 2927 oop thread_obj = threadObj();
2928 if (thread_obj != NULL) { 2928 if (thread_obj != NULL) {
2929 typeArrayOop name = java_lang_Thread::name(thread_obj); 2929 oop name = java_lang_Thread::name(thread_obj);
2930 if (name != NULL) { 2930 if (name != NULL) {
2931 if (buf == NULL) { 2931 if (buf == NULL) {
2932 name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); 2932 name_str = java_lang_String::as_utf8_string(name);
2933 } 2933 }
2934 else { 2934 else {
2935 name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length(), buf, buflen); 2935 name_str = java_lang_String::as_utf8_string(name, buf, buflen);
2936 } 2936 }
2937 } 2937 }
2938 else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306 2938 else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306
2939 name_str = "<no-name - thread is attaching>"; 2939 name_str = "<no-name - thread is attaching>";
2940 } 2940 }

mercurial