1.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Tue Oct 04 10:07:07 2011 -0700 1.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Tue Oct 04 14:30:04 2011 -0700 1.3 @@ -659,12 +659,14 @@ 1.4 int scope_depth = 0; 1.5 if (!force_unwind) { 1.6 int bci = sd->bci(); 1.7 + bool recursive_exception = false; 1.8 do { 1.9 bool skip_scope_increment = false; 1.10 // exception handler lookup 1.11 KlassHandle ek (THREAD, exception->klass()); 1.12 handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD); 1.13 if (HAS_PENDING_EXCEPTION) { 1.14 + recursive_exception = true; 1.15 // We threw an exception while trying to find the exception handler. 1.16 // Transfer the new exception to the exception handle which will 1.17 // be set into thread local storage, and do another lookup for an 1.18 @@ -680,6 +682,9 @@ 1.19 skip_scope_increment = true; 1.20 } 1.21 } 1.22 + else { 1.23 + recursive_exception = false; 1.24 + } 1.25 if (!top_frame_only && handler_bci < 0 && !skip_scope_increment) { 1.26 sd = sd->sender(); 1.27 if (sd != NULL) { 1.28 @@ -687,7 +692,7 @@ 1.29 } 1.30 ++scope_depth; 1.31 } 1.32 - } while (!top_frame_only && handler_bci < 0 && sd != NULL); 1.33 + } while (recursive_exception || (!top_frame_only && handler_bci < 0 && sd != NULL)); 1.34 } 1.35 1.36 // found handling method => lookup exception handler