Index: vm/vmcore/src/init/finalize.cpp =================================================================== --- vm/vmcore/src/init/finalize.cpp (revision 453131) +++ vm/vmcore/src/init/finalize.cpp (working copy) @@ -322,6 +322,11 @@ p_TLS_vmthread->finalize_thread_flags |= FINALIZER_STARTER; TRACE2("finalize", "run_finalizers() started"); + + // saves curent thread exception risen before running finalizers + // if any and clears it to allow java to work + jthrowable cte = exn_get(); + exn_clear(); jvalue args[1]; args[0].z = false; @@ -340,6 +345,11 @@ << " while running a wakeFinalization in FinalizerThread"); exn_clear(); } + // restores curent thread exception risen before if any + if (NULL != cte) { + exn_raise_object(cte); + } + p_TLS_vmthread->finalize_thread_flags &= ~FINALIZER_STARTER; } //Objects_To_Finalize::run_finalizers @@ -360,10 +370,19 @@ jboolean* finalizer_on_exit = VM_Global_State::loader_env->finalizer_on_exit; assert(finalizer_on_exit); + // saves curent thread exception risen before finalization + // if any and clears it to allow java to work + jthrowable cte = exn_get(); + exn_clear(); + for (i=0; ((i