diff options
author | Andreas Gampe <agampe@google.com> | 2014-05-13 21:42:05 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-05-14 17:33:52 -0700 |
commit | 72b3e430d880ef57eaa6a34a0822165994052202 (patch) | |
tree | b102b12d67e6cbc5cf0e6dc4e4ca147325264a43 /runtime/catch_block_stack_visitor.cc | |
parent | d0916f36d27b643bca970f3645c38f44270c74ef (diff) | |
download | art-72b3e430d880ef57eaa6a34a0822165994052202.zip art-72b3e430d880ef57eaa6a34a0822165994052202.tar.gz art-72b3e430d880ef57eaa6a34a0822165994052202.tar.bz2 |
ART: Fix typo in ArtMethod::FindCatchBlock
The thrown exception is always resolved, as we have an instance of
it. What is potentially not resolved is the catch handler's exception
type.
The resolution failure will trigger a NoClassDefFoundError, which
should replace the original exception. For this, the API has to be
changed a little bit to tell callers that there was this change.
Change-Id: Id51d54a15c732ed175eb617b3b0331b89cbb2051
Diffstat (limited to 'runtime/catch_block_stack_visitor.cc')
-rw-r--r-- | runtime/catch_block_stack_visitor.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/catch_block_stack_visitor.cc b/runtime/catch_block_stack_visitor.cc index b820276..55b330a 100644 --- a/runtime/catch_block_stack_visitor.cc +++ b/runtime/catch_block_stack_visitor.cc @@ -50,9 +50,17 @@ bool CatchBlockStackVisitor::HandleTryItems(mirror::ArtMethod* method) { } if (dex_pc != DexFile::kDexNoIndex) { bool clear_exception = false; + bool exc_changed = false; StackHandleScope<1> hs(Thread::Current()); Handle<mirror::Class> to_find(hs.NewHandle((*exception_)->GetClass())); - uint32_t found_dex_pc = method->FindCatchBlock(to_find, dex_pc, &clear_exception); + uint32_t found_dex_pc = method->FindCatchBlock(to_find, dex_pc, &clear_exception, + &exc_changed); + if (UNLIKELY(exc_changed)) { + DCHECK_EQ(DexFile::kDexNoIndex, found_dex_pc); + exception_->Assign(self_->GetException(nullptr)); // TODO: Throw location? + // There is a new context installed, delete it. + delete self_->GetLongJumpContext(); + } exception_handler_->SetClearException(clear_exception); if (found_dex_pc != DexFile::kDexNoIndex) { exception_handler_->SetHandlerDexPc(found_dex_pc); |