From 3a1444ccb92fb1b11d4943c3baa1f0a3abed4f10 Mon Sep 17 00:00:00 2001 From: Alexei Zavjalov Date: Wed, 25 Jun 2014 16:04:55 +0700 Subject: ART: JNI ExceptionDescribe crashes if no exception occurred Some tests are calling ExceptionDescribe without checking if we have an exception occurred. The most JVM's like Dalvik can handle this in a good way, but art crashes with JNI error. This adds a check in art::ExceptionDescribe for a case when it called without exception. Change-Id: Id9eddcc73e78b1197109be5a6340f9ff60940c74 Signed-off-by: Alexei Zavjalov --- runtime/jni_internal_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime/jni_internal_test.cc') diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc index d255ec8dff..d50e094627 100644 --- a/runtime/jni_internal_test.cc +++ b/runtime/jni_internal_test.cc @@ -1472,6 +1472,12 @@ TEST_F(JniInternalTest, DeleteWeakGlobalRef) { env_->DeleteWeakGlobalRef(o2); } +TEST_F(JniInternalTest, ExceptionDescribe) { + // This checks how ExceptionDescribe handles call without exception. + env_->ExceptionClear(); + env_->ExceptionDescribe(); +} + TEST_F(JniInternalTest, Throw) { EXPECT_EQ(JNI_ERR, env_->Throw(nullptr)); -- cgit v1.2.3