Index: base/android/jni_android.cc |
diff --git a/base/android/jni_android.cc b/base/android/jni_android.cc |
index a746fd4e47389586a4876b795ab84bad6cf533fb..3211653238e3b7489b32fbd06c1f17b03a76d50d 100644 |
--- a/base/android/jni_android.cc |
+++ b/base/android/jni_android.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -157,13 +157,23 @@ jfieldID GetFieldID(JNIEnv* env, |
return id; |
} |
-bool CheckException(JNIEnv* env) { |
- if (env->ExceptionCheck() == JNI_FALSE) |
+bool HasException(JNIEnv* env) { |
+ return env->ExceptionCheck() != JNI_FALSE; |
+} |
+ |
+bool ClearException(JNIEnv* env) { |
+ if (!HasException(env)) |
return false; |
- env->ExceptionDescribe(); |
env->ExceptionClear(); |
return true; |
} |
+void CheckException(JNIEnv* env) { |
+ if (HasException(env)) { |
+ env->ExceptionDescribe(); |
+ CHECK(false); |
+ } |
+} |
+ |
} // namespace android |
} // namespace base |