summaryrefslogtreecommitdiff
path: root/src/java_lang_Class.cc
diff options
context:
space:
mode:
author Jesse Wilson <jessewilson@google.com> 2011-11-29 16:43:09 -0500
committer Jesse Wilson <jessewilson@google.com> 2011-11-29 16:43:09 -0500
commit53494318448f783b89c20d7b42be7a608b168de1 (patch)
treed89b9e892797868b0393814b62798beae9536e2d /src/java_lang_Class.cc
parent8aa6fc39f5cc0279d4ba2ee064de9758560dfedd (diff)
Move the exception check to after the code that throws the exception.
I'd mistakenly put the exception check after the method lookup, but the exception was actually thrown by IsVisibleField(). The test passed because this class had multiple fields to initialize. Change-Id: I7c76abfad5d90cc36cb4fadedeb6628ca51ed433
Diffstat (limited to 'src/java_lang_Class.cc')
-rw-r--r--src/java_lang_Class.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/java_lang_Class.cc b/src/java_lang_Class.cc
index 0ed6ceaad6..9d48edeb96 100644
--- a/src/java_lang_Class.cc
+++ b/src/java_lang_Class.cc
@@ -116,21 +116,21 @@ jobjectArray Class_getDeclaredFields(JNIEnv* env, jclass, jclass javaClass, jboo
std::vector<Field*> fields;
for (size_t i = 0; i < c->NumInstanceFields(); ++i) {
Field* f = c->GetInstanceField(i);
- if (env->ExceptionOccurred()) {
- return NULL;
- }
if (IsVisibleField(f, publicOnly)) {
fields.push_back(f);
}
- }
- for (size_t i = 0; i < c->NumStaticFields(); ++i) {
- Field* f = c->GetStaticField(i);
if (env->ExceptionOccurred()) {
return NULL;
}
+ }
+ for (size_t i = 0; i < c->NumStaticFields(); ++i) {
+ Field* f = c->GetStaticField(i);
if (IsVisibleField(f, publicOnly)) {
fields.push_back(f);
}
+ if (env->ExceptionOccurred()) {
+ return NULL;
+ }
}
return ToArray(env, "java/lang/reflect/Field", fields);
@@ -153,21 +153,21 @@ jobjectArray Class_getDeclaredMethods(JNIEnv* env, jclass, jclass javaClass, jbo
std::vector<Method*> methods;
for (size_t i = 0; i < c->NumVirtualMethods(); ++i) {
Method* m = c->GetVirtualMethod(i);
- if (env->ExceptionOccurred()) {
- return NULL;
- }
if (IsVisibleMethod(m, publicOnly)) {
methods.push_back(m);
}
- }
- for (size_t i = 0; i < c->NumDirectMethods(); ++i) {
- Method* m = c->GetDirectMethod(i);
if (env->ExceptionOccurred()) {
return NULL;
}
+ }
+ for (size_t i = 0; i < c->NumDirectMethods(); ++i) {
+ Method* m = c->GetDirectMethod(i);
if (IsVisibleMethod(m, publicOnly)) {
methods.push_back(m);
}
+ if (env->ExceptionOccurred()) {
+ return NULL;
+ }
}
return ToArray(env, "java/lang/reflect/Method", methods);