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
diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc
index 0632a68..495ae2d 100644
--- a/runtime/mirror/art_method.cc
+++ b/runtime/mirror/art_method.cc
@@ -231,7 +231,7 @@
 }
 
 uint32_t ArtMethod::FindCatchBlock(Handle<Class>& exception_type, uint32_t dex_pc,
-                                   bool* has_no_move_exception) {
+                                   bool* has_no_move_exception, bool* exc_changed) {
   MethodHelper mh(this);
   const DexFile::CodeItem* code_item = mh.GetCodeItem();
   // Set aside the exception while we resolve its type.
@@ -252,10 +252,17 @@
     }
     // Does this catch exception type apply?
     Class* iter_exception_type = mh.GetClassFromTypeIdx(iter_type_idx);
-    if (exception_type.Get() == nullptr) {
-      self->ClearException();
+    if (iter_exception_type == nullptr) {
+      // Now have a NoClassDefFoundError as exception.
+      // Note: this is not RI behavior. RI would have failed when loading the class.
+      *exc_changed = true;
+
+      // TODO: Add old exception as suppressed.
       LOG(WARNING) << "Unresolved exception class when finding catch block: "
         << mh.GetTypeDescriptorFromTypeIdx(iter_type_idx);
+
+      // Return immediately.
+      return DexFile::kDexNoIndex;
     } else if (iter_exception_type->IsAssignableFrom(exception_type.Get())) {
       found_dex_pc = it.GetHandlerAddress();
       break;