1.1 --- a/src/share/vm/oops/constantPoolOop.cpp Wed May 13 08:46:58 2009 -0700 1.2 +++ b/src/share/vm/oops/constantPoolOop.cpp Wed May 20 09:36:53 2009 +0200 1.3 @@ -1181,7 +1181,28 @@ 1.4 unsigned int hash; 1.5 char *str = string_at_noresolve(idx); 1.6 symbolOop sym = SymbolTable::lookup_only(str, (int) strlen(str), hash); 1.7 - idx1 = tbl->symbol_to_value(sym); 1.8 + if (sym == NULL) { 1.9 + // sym can be NULL if string refers to incorrectly encoded JVM_CONSTANT_Utf8 1.10 + // this can happen with JVM TI; see CR 6839599 for more details 1.11 + oop string = *(obj_at_addr(idx)); 1.12 + assert(java_lang_String::is_instance(string),"Not a String"); 1.13 + DBG(printf("Error #%03hd tag=%03hd\n", idx, tag)); 1.14 + idx1 = 0; 1.15 + for (int j = 0; j < tbl->table_size() && idx1 == 0; j++) { 1.16 + for (SymbolHashMapEntry* cur = tbl->bucket(j); cur != NULL; cur = cur->next()) { 1.17 + int length; 1.18 + sym = cur->symbol(); 1.19 + jchar* chars = sym->as_unicode(length); 1.20 + if (java_lang_String::equals(string, chars, length)) { 1.21 + idx1 = cur->value(); 1.22 + DBG(printf("Index found: %d\n",idx1)); 1.23 + break; 1.24 + } 1.25 + } 1.26 + } 1.27 + } else { 1.28 + idx1 = tbl->symbol_to_value(sym); 1.29 + } 1.30 assert(idx1 != 0, "Have not found a hashtable entry"); 1.31 Bytes::put_Java_u2((address) (bytes+1), idx1); 1.32 DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str));