changeset 28624:88972fd01f71

6584008: jvmtiStringPrimitiveCallback should not be invoked when string value is null Reviewed-by: sla, sspitsyn
author aph
date Fri, 16 Jan 2015 09:15:22 +0100
parents c6d1cfa63594
children cc1cdba85235
files hotspot/src/share/vm/prims/jvmtiTagMap.cpp
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Thu Jan 15 14:10:49 2015 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Fri Jan 16 09:15:22 2015 +0100
@@ -1046,10 +1046,16 @@
 {
   assert(str->klass() == SystemDictionary::String_klass(), "not a string");
 
+  typeArrayOop s_value = java_lang_String::value(str);
+
+  // JDK-6584008: the value field may be null if a String instance is
+  // partially constructed.
+  if (s_value == NULL) {
+    return 0;
+  }
   // get the string value and length
   // (string value may be offset from the base)
   int s_len = java_lang_String::length(str);
-  typeArrayOop s_value = java_lang_String::value(str);
   int s_offset = java_lang_String::offset(str);
   jchar* value;
   if (s_len > 0) {