8067662: "java.lang.NullPointerException: Method name is null" from StackTraceElement.<init>

Use method cpref and klass version to provide meaningful methods name in stacktraces

Reviewed-by: coleenp, dcubed
This commit is contained in:
Serguei Spitsyn 2015-03-20 02:44:51 -07:00
parent f2ecc46c20
commit cc2bb40bf3
4 changed files with 103 additions and 40 deletions

View file

@ -3708,6 +3708,37 @@ Method* InstanceKlass::method_with_idnum(int idnum) {
return m;
}
Method* InstanceKlass::method_with_orig_idnum(int idnum) {
if (idnum >= methods()->length()) {
return NULL;
}
Method* m = methods()->at(idnum);
if (m != NULL && m->orig_method_idnum() == idnum) {
return m;
}
// Obsolete method idnum does not match the original idnum
for (int index = 0; index < methods()->length(); ++index) {
m = methods()->at(index);
if (m->orig_method_idnum() == idnum) {
return m;
}
}
// None found, return null for the caller to handle.
return NULL;
}
Method* InstanceKlass::method_with_orig_idnum(int idnum, int version) {
InstanceKlass* holder = get_klass_version(version);
if (holder == NULL) {
return NULL; // The version of klass is gone, no method is found
}
Method* method = holder->method_with_orig_idnum(idnum);
return method;
}
jint InstanceKlass::get_cached_class_file_len() {
return VM_RedefineClasses::get_cached_class_file_len(_cached_class_file);
}