mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 17:14:41 +02:00
8302491
: NoClassDefFoundError omits the original cause of an error
Reviewed-by: coleenp, dholmes
This commit is contained in:
parent
671a45219f
commit
5685107579
3 changed files with 48 additions and 40 deletions
|
@ -981,18 +981,18 @@ void InstanceKlass::add_initialization_error(JavaThread* current, Handle excepti
|
|||
// If the initialization error is OOM, this might not work, but if GC kicks in
|
||||
// this would be still be helpful.
|
||||
JavaThread* THREAD = current;
|
||||
Handle cause = java_lang_Throwable::get_cause_with_stack_trace(exception, THREAD);
|
||||
if (HAS_PENDING_EXCEPTION || cause.is_null()) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
Handle init_error = java_lang_Throwable::create_initialization_error(current, exception);
|
||||
ResourceMark rm(THREAD);
|
||||
if (init_error.is_null()) {
|
||||
log_trace(class, init)("Initialization error is null for class %s", external_name());
|
||||
return;
|
||||
}
|
||||
|
||||
MutexLocker ml(THREAD, ClassInitError_lock);
|
||||
OopHandle elem = OopHandle(Universe::vm_global(), cause());
|
||||
bool created = false;
|
||||
OopHandle elem = OopHandle(Universe::vm_global(), init_error());
|
||||
bool created;
|
||||
_initialization_error_table.put_if_absent(this, elem, &created);
|
||||
assert(created, "Initialization is single threaded");
|
||||
ResourceMark rm(THREAD);
|
||||
log_trace(class, init)("Initialization error added for class %s", external_name());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue