diff options
author | Ian Rogers <irogers@google.com> | 2012-01-11 10:14:05 -0800 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2012-01-11 10:14:05 -0800 |
commit | 761bfa80704937024fdbe58c2b6fd4599760efaf (patch) | |
tree | 6568a442e34764eed4353653eb84114df9f90a96 | |
parent | c981848a3425662034c5429b61c035e7533b896d (diff) | |
download | art-761bfa80704937024fdbe58c2b6fd4599760efaf.zip art-761bfa80704937024fdbe58c2b6fd4599760efaf.tar.gz art-761bfa80704937024fdbe58c2b6fd4599760efaf.tar.bz2 |
Don't throw NPE in findClass if an exception is pending.
Bug in Change Icf6363e1 that inhibits the phone booting.
Change-Id: I2b8d4723fe34b649416baad64197f7abf49a46f9
-rw-r--r-- | src/class_linker.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc index b06d108..1a9618c 100644 --- a/src/class_linker.cc +++ b/src/class_linker.cc @@ -1159,18 +1159,19 @@ Class* ClassLinker::FindClass(const char* descriptor, const ClassLoader* class_l return NULL; } ScopedLocalRef<jobject> class_loader_object(env, AddLocalReference<jobject>(env, class_loader)); - ScopedLocalRef<jobject> result(env, env->CallObjectMethod(class_loader_object.get(), mid, class_name_object.get())); - if (result.get() == NULL) { + ScopedLocalRef<jobject> result(env, env->CallObjectMethod(class_loader_object.get(), mid, + class_name_object.get())); + if (env->ExceptionOccurred()) { + env->ExceptionClear(); // Failed to find class fall-through to NCDFE + // TODO: initialize the cause of the NCDFE to this exception + } else if (result.get() == NULL) { // broken loader - throw NPE to be compatible with Dalvik ThrowNullPointerException("ClassLoader.loadClass returned null for %s", class_name_string.c_str()); return NULL; - } else if (!env->ExceptionOccurred()) { + } else { // success, return Class* return Decode<Class*>(env, result.get()); - } else { - env->ExceptionClear(); // Failed to find class fall-through to NCDFE - // TODO: initialize the cause of the NCDFE to this exception } } |