OSDN Git Service

CW on Master: Propagate or throw exception when no class found happens in interpreter.
authorSean Wan <swan@google.com>
Wed, 9 Jul 2014 19:08:29 +0000 (12:08 -0700)
committerBrian Carlstrom <bdc@google.com>
Wed, 9 Jul 2014 23:37:14 +0000 (16:37 -0700)
The old behavior is a check fail which causes zygote process crash.

This is particular a problem for CW in which webview is not used, and
this stops CW system start.

(cherry picked from commit 41a71f3db62e5bccb162a2b18ed3801e00ff6f87)

Change-Id: Iabe091ebe4bbdd86d931ac6c06abd089f1338d59

runtime/interpreter/interpreter_common.cc

index c7fb884..9f04b90 100644 (file)
@@ -772,8 +772,13 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh,
     // shadow_frame.GetMethod()->GetDeclaringClass()->GetClassLoader();
     Class* found = Runtime::Current()->GetClassLinker()->FindClass(
         self, descriptor.c_str(), NullHandle<mirror::ClassLoader>());
-    CHECK(found != NULL) << "Class.forName failed in un-started runtime for class: "
-        << PrettyDescriptor(descriptor);
+    if (found == NULL) {
+      if (!self->IsExceptionPending()) {
+        AbortTransaction(self, "Class.forName failed in un-started runtime for class: %s",
+                         PrettyDescriptor(descriptor).c_str());
+      }
+      return;
+    }
     result->SetL(found);
   } else if (name == "java.lang.Class java.lang.Void.lookupType()") {
     result->SetL(Runtime::Current()->GetClassLinker()->FindPrimitiveClass('V'));