Clear exception if catch block doesn't have move-exception.
Bug: 10040419
Change-Id: Icc7a55cb3cdfbc3efd2b161bbe22b3e5007de35f
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 8d7d028..37c45fa 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -975,7 +975,9 @@
self->VerifyStack();
ThrowLocation throw_location;
mirror::Throwable* exception = self->GetException(&throw_location);
- uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(exception->GetClass(), dex_pc);
+ bool clear_exception;
+ uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(exception->GetClass(), dex_pc,
+ &clear_exception);
if (found_dex_pc == DexFile::kDexNoIndex) {
instrumentation->MethodUnwindEvent(self, this_object_ref.get(),
shadow_frame.GetMethod(), dex_pc);
@@ -984,6 +986,9 @@
instrumentation->ExceptionCaughtEvent(self, throw_location,
shadow_frame.GetMethod(),
found_dex_pc, exception);
+ if (clear_exception) {
+ self->ClearException();
+ }
return Instruction::At(insns + found_dex_pc);
}
}