ART: Run ExceptionDescribe on error
When a classloader cannot be printed, print the exception.
Bug: 109724219
Test: m test-art-host
Change-Id: I32fbd241cb247a0e4cbe8f13a6120a8aa736995a
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc
index 8fe68bd..44679a5 100644
--- a/runtime/jni/java_vm_ext.cc
+++ b/runtime/jni/java_vm_ext.cc
@@ -912,7 +912,11 @@
return utf.c_str();
}
}
- env->ExceptionClear();
+ if (env->ExceptionCheck()) {
+ // We can't do much better logging, really. So leave it with a Describe.
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ }
return "(Error calling toString)";
}
return "null";