diff options
author | Elliott Hughes <enh@google.com> | 2011-04-08 14:10:28 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2011-04-08 15:01:19 -0700 |
commit | 69a017bc1d1649350f830dfada5c6ed5eac0b770 (patch) | |
tree | 6ecc6d9658272b268ce931d417930e2ea1bfa3f7 /core/jni/android_media_ToneGenerator.cpp | |
parent | 5008e92d1fd573d926cd55c39ca723a6fbdf7c4b (diff) | |
download | frameworks_base-69a017bc1d1649350f830dfada5c6ed5eac0b770.zip frameworks_base-69a017bc1d1649350f830dfada5c6ed5eac0b770.tar.gz frameworks_base-69a017bc1d1649350f830dfada5c6ed5eac0b770.tar.bz2 |
More JNI exception-throwing cleanup.
There are a few (unimportant) bug fixes here. There were several attempts to
throw exceptions in situations where there's already a pending exception.
There were also cases where the code was wrong; it was checking for a NULL
return from Get*ArrayElements and throwing NPE, but passing NULL is an error
that causes a crash and a NULL return means an exception has already been
thrown. I didn't want to get into the Scoped* classes just yet, but that
was by far the easiest way to fix this.
Change-Id: I0b31160ee51b96e82539f6514b8412b149dba7c3
Diffstat (limited to 'core/jni/android_media_ToneGenerator.cpp')
-rw-r--r-- | core/jni/android_media_ToneGenerator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp index 50aa967..fdd586b 100644 --- a/core/jni/android_media_ToneGenerator.cpp +++ b/core/jni/android_media_ToneGenerator.cpp @@ -44,7 +44,7 @@ static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz, ToneGenerator *lpToneGen = (ToneGenerator *)env->GetIntField(thiz, fields.context); if (lpToneGen == NULL) { - jniThrowException(env, "java/lang/RuntimeException", "Method called after release()"); + jniThrowRuntimeException(env, "Method called after release()"); return false; } @@ -59,7 +59,7 @@ static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) { LOGV("ToneGenerator lpToneGen: %x\n", (unsigned int)lpToneGen); if (lpToneGen == NULL) { - jniThrowException(env, "java/lang/RuntimeException", "Method called after release()"); + jniThrowRuntimeException(env, "Method called after release()"); return; } lpToneGen->stopTone(); @@ -94,7 +94,7 @@ static void android_media_ToneGenerator_native_setup(JNIEnv *env, jobject thiz, if (!lpToneGen->isInited()) { LOGE("ToneGenerator init failed \n"); - jniThrowException(env, "java/lang/RuntimeException", "Init failed"); + jniThrowRuntimeException(env, "Init failed"); return; } |