8210235: JvmtiTrace::safe_get_current_thread_name is unsafe in debug builds
authorkbarrett
Fri, 31 Aug 2018 16:29:49 -0400
changeset 51614 36773a4fe3e7
parent 51613 3835dc32de5e
child 51615 afbb33428df7
8210235: JvmtiTrace::safe_get_current_thread_name is unsafe in debug builds Summary: Use Thread::current_or_null and handle NULL result. Reviewed-by: coleenp
src/hotspot/share/prims/jvmtiTrace.cpp
--- a/src/hotspot/share/prims/jvmtiTrace.cpp	Fri Aug 31 11:56:43 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiTrace.cpp	Fri Aug 31 16:29:49 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -291,7 +291,7 @@
 // return the name of the current thread
 const char *JvmtiTrace::safe_get_current_thread_name() {
   if (JvmtiEnv::is_vm_live()) {
-    return JvmtiTrace::safe_get_thread_name(Thread::current());
+    return JvmtiTrace::safe_get_thread_name(Thread::current_or_null());
   } else {
     return "VM not live";
   }