diff options
| author | 2016-09-26 19:45:22 +0000 | |
|---|---|---|
| committer | 2016-09-26 19:45:23 +0000 | |
| commit | a4850b0fa18c8b92dd5c20c166856cfe87aec72f (patch) | |
| tree | f38d8d8aae51f53e7ee6b474f47597b784fc2316 /runtime/jni_internal.cc | |
| parent | 0cfe19af3b7395658210ea6044a65c9811962a7a (diff) | |
| parent | 3fec9ac0d5af1358d216eb2fdc2000ec0205f3f0 (diff) | |
Merge "ART: Use libbase logging"
Diffstat (limited to 'runtime/jni_internal.cc')
| -rw-r--r-- | runtime/jni_internal.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index d9cb1c66a4..59b2b07096 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -100,8 +100,9 @@ static void ThrowNoSuchMethodError(ScopedObjectAccess& soa, mirror::Class* c, static void ReportInvalidJNINativeMethod(const ScopedObjectAccess& soa, mirror::Class* c, const char* kind, jint idx, bool return_errors) REQUIRES_SHARED(Locks::mutator_lock_) { - LOG(return_errors ? ERROR : FATAL) << "Failed to register native method in " - << PrettyDescriptor(c) << " in " << c->GetDexCache()->GetLocation()->ToModifiedUtf8() + LOG(return_errors ? ::android::base::ERROR : ::android::base::FATAL) + << "Failed to register native method in " << PrettyDescriptor(c) + << " in " << c->GetDexCache()->GetLocation()->ToModifiedUtf8() << ": " << kind << " is null at index " << idx; soa.Self()->ThrowNewExceptionF("Ljava/lang/NoSuchMethodError;", "%s is null at index %d", kind, idx); @@ -2226,16 +2227,20 @@ class JNI { } if (m == nullptr) { - LOG(return_errors ? ERROR : INTERNAL_FATAL) << "Failed to register native method " + c->DumpClass( + LOG_STREAM(return_errors + ? ::android::base::ERROR + : ::android::base::FATAL_WITHOUT_ABORT), + mirror::Class::kDumpClassFullDetail); + LOG(return_errors ? ::android::base::ERROR : ::android::base::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()) { - LOG(return_errors ? ERROR : FATAL) << "Failed to register non-native method " + LOG(return_errors ? ::android::base::ERROR : ::android::base::FATAL) + << "Failed to register non-native method " << PrettyDescriptor(c) << "." << name << sig << " as native"; ThrowNoSuchMethodError(soa, c, name, sig, "native"); @@ -2478,7 +2483,7 @@ class JNI { } else if (kWarnJniAbort && memcmp(array_data, elements, bytes) != 0) { // Warn if we have JNI_ABORT and the arrays don't match since this is usually an error. LOG(WARNING) << "Possible incorrect JNI_ABORT in Release*ArrayElements"; - soa.Self()->DumpJavaStack(LOG(WARNING)); + soa.Self()->DumpJavaStack(LOG_STREAM(WARNING)); } } if (mode != JNI_COMMIT) { @@ -3042,7 +3047,7 @@ std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs) { os << "JNIWeakGlobalRefType"; return os; default: - LOG(::art::FATAL) << "jobjectRefType[" << static_cast<int>(rhs) << "]"; + LOG(FATAL) << "jobjectRefType[" << static_cast<int>(rhs) << "]"; UNREACHABLE(); } } |