summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_Class.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2015-03-29 18:27:50 -0700
committer Mathieu Chartier <mathieuc@google.com> 2015-03-29 18:54:20 -0700
commitca239af73e512df5eeb80fe6c09c2ca614649e06 (patch)
treecee8641c42385f40b567c686cd5053fde152a088 /runtime/native/java_lang_Class.cc
parentf381645a336f7092ab6f5900c0a2cf183a9dbdf7 (diff)
Fix some reflection errors
Fixed incorrectly using 2nd frame instead of 1st in VerifyAccess. Added regression test to ART. Fixed broken setShort, getDeclaredFieldInternal. Change-Id: I4b21d52d998cb768fe9503b8bccec506b7b972e5
Diffstat (limited to 'runtime/native/java_lang_Class.cc')
-rw-r--r--runtime/native/java_lang_Class.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 3cb6b367f0..0ca9d24824 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -253,7 +253,10 @@ static jobject Class_getDeclaredField(JNIEnv* env, jobject javaThis, jstring nam
mirror::Field* result = GetDeclaredField(soa.Self(), klass, name_string);
if (result == nullptr) {
std::string name_str = name_string->ToModifiedUtf8();
- soa.Self()->ThrowNewException("Ljava/lang/NoSuchFieldException;", name_str.c_str());
+ // We may have a pending exception if we failed to resolve.
+ if (!soa.Self()->IsExceptionPending()) {
+ soa.Self()->ThrowNewException("Ljava/lang/NoSuchFieldException;", name_str.c_str());
+ }
return nullptr;
}
return soa.AddLocalReference<jobject>(result);