Index: base/android/jni_android.cc |
diff --git a/base/android/jni_android.cc b/base/android/jni_android.cc |
index d3b4e79058381652baf17f512ce57c2c8b2fb0fe..f980fe655340911d7e51b9d6be6b0aa788c63d29 100644 |
--- a/base/android/jni_android.cc |
+++ b/base/android/jni_android.cc |
@@ -165,10 +165,20 @@ jmethodID GetMethodID(JNIEnv* env, |
jclass clazz, |
const char* method_name, |
const char* jni_signature) { |
+ jmethodID method_id = GetMethodIDOrNULL( |
+ env, clazz, method_name, jni_signature); |
+ CHECK(method_id) << "Failed to find method " << |
+ method_name << " " << jni_signature; |
+ return method_id; |
+} |
+ |
+jmethodID GetMethodIDOrNULL(JNIEnv* env, |
+ jclass clazz, |
+ const char* method_name, |
+ const char* jni_signature) { |
jmethodID method_id = |
env->GetMethodID(clazz, method_name, jni_signature); |
- CHECK(method_id && !ClearException(env)) << "Failed to find method " << |
- method_name << " " << jni_signature; |
+ ClearException(env); |
Sami
2012/10/01 11:32:15
This causes some log spam which could be misleadin
bulach
2012/10/01 15:08:37
good point! done..
|
return method_id; |
} |
@@ -184,10 +194,20 @@ jmethodID GetStaticMethodID(JNIEnv* env, |
jclass clazz, |
const char* method_name, |
const char* jni_signature) { |
+ jmethodID method_id = GetStaticMethodIDOrNULL( |
+ env, clazz, method_name, jni_signature); |
+ CHECK(method_id) << "Failed to find static method " << |
+ method_name << " " << jni_signature; |
+ return method_id; |
+} |
+ |
+jmethodID GetStaticMethodIDOrNULL(JNIEnv* env, |
+ jclass clazz, |
+ const char* method_name, |
+ const char* jni_signature) { |
jmethodID method_id = |
env->GetStaticMethodID(clazz, method_name, jni_signature); |
- CHECK(method_id && !ClearException(env)) << "Failed to find static method " << |
- method_name << " " << jni_signature; |
+ ClearException(env); |
return method_id; |
} |