Allow soft failures at runtime and fix null referrer for ICCE and NSME.
Change-Id: I814369f4e41cebf37007cb514a8bf19cbaf17e94
diff --git a/src/runtime_support.cc b/src/runtime_support.cc
index c5ce4b3..572da97 100644
--- a/src/runtime_support.cc
+++ b/src/runtime_support.cc
@@ -148,10 +148,12 @@
std::ostringstream msg;
msg << "The method '" << PrettyMethod(method) << "' was expected to be of type "
<< expected_type << " but instead was found to be of type " << found_type;
- ClassHelper kh(referrer->GetDeclaringClass());
- std::string location(kh.GetLocation());
- if (!location.empty()) {
- msg << " (accessed from " << location << ")";
+ if (referrer != NULL) {
+ ClassHelper kh(referrer->GetDeclaringClass());
+ std::string location(kh.GetLocation());
+ if (!location.empty()) {
+ msg << " (accessed from " << location << ")";
+ }
}
Thread::Current()->ThrowNewException("Ljava/lang/IncompatibleClassChangeError;",
msg.str().c_str());
@@ -163,10 +165,12 @@
std::ostringstream msg;
msg << "No " << type << " method " << name << signature
<< " in class " << kh.GetDescriptor() << " or its superclasses";
- kh.ChangeClass(referrer->GetDeclaringClass());
- std::string location(kh.GetLocation());
- if (!location.empty()) {
- msg << " (accessed from " << location << ")";
+ if (referrer != NULL) {
+ kh.ChangeClass(referrer->GetDeclaringClass());
+ std::string location(kh.GetLocation());
+ if (!location.empty()) {
+ msg << " (accessed from " << location << ")";
+ }
}
Thread::Current()->ThrowNewException("Ljava/lang/NoSuchMethodError;", msg.str().c_str());
}