summaryrefslogtreecommitdiffstats
path: root/runtime/jni_internal.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-05-04 10:18:24 -0700
committerMathieu Chartier <mathieuc@google.com>2015-05-04 11:17:53 -0700
commita6ce5b2d5ade23087ab15f26d4c487570ad84b5e (patch)
tree09372d08ae90bc85f87bc61eee43993f3fbf7e4c /runtime/jni_internal.cc
parent46578a4a3bf235fde35ed80c6e6cbe8fb5f06b48 (diff)
downloadart-a6ce5b2d5ade23087ab15f26d4c487570ad84b5e.tar.gz
art-a6ce5b2d5ade23087ab15f26d4c487570ad84b5e.tar.bz2
art-a6ce5b2d5ade23087ab15f26d4c487570ad84b5e.zip
Improve JNI registration failure logging
Print INTERNAL_FATAL instead of ERROR, print the "Failed to register native method" message last. (cherry picked from commit 5c02d6cd0cc7e10d30d8c26166ebaaf6d313d771) Bug: 13885477 Change-Id: I9f1a7ea45bd926f3984b8008d84c75e676a1ed10
Diffstat (limited to 'runtime/jni_internal.cc')
-rw-r--r--runtime/jni_internal.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index fc3826b023..9bb08a23d2 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -2109,10 +2109,12 @@ class JNI {
m = c->FindVirtualMethod(name, sig);
}
if (m == nullptr) {
- c->DumpClass(LOG(ERROR), mirror::Class::kDumpClassFullDetail);
- LOG(return_errors ? ERROR : FATAL) << "Failed to register native method "
+ LOG(return_errors ? ERROR : INTERNAL_FATAL) << "Failed to register native method "
<< PrettyDescriptor(c) << "." << name << sig << " in "
<< c->GetDexCache()->GetLocation()->ToModifiedUtf8();
+ // Safe to pass in LOG(FATAL) since the log object aborts in destructor and only goes
+ // out of scope after the DumpClass is done executing.
+ c->DumpClass(LOG(return_errors ? ERROR : FATAL), mirror::Class::kDumpClassFullDetail);
ThrowNoSuchMethodError(soa, c, name, sig, "static or non-static");
return JNI_ERR;
} else if (!m->IsNative()) {