6584008: jvmtiStringPrimitiveCallback should not be invoked when string value is null
Reviewed-by: sla, sspitsyn
--- 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) {