summaryrefslogtreecommitdiffstats
path: root/media/libdrm
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-04-08 17:42:34 -0700
committerElliott Hughes <enh@google.com>2011-04-08 17:42:34 -0700
commit15dd15fd572df6b6f785dff75f66e9b99f40322a (patch)
tree101754d3ee5b9903fbe513b308646c8eaccab8af /media/libdrm
parent6cab9a6e3fc660ca9c2b32e01f86c71da222c181 (diff)
downloadframeworks_base-15dd15fd572df6b6f785dff75f66e9b99f40322a.zip
frameworks_base-15dd15fd572df6b6f785dff75f66e9b99f40322a.tar.gz
frameworks_base-15dd15fd572df6b6f785dff75f66e9b99f40322a.tar.bz2
Tidy up exception throwing in the media native code.
(I'm going through all of frameworks/base in multiple passes. This pass is just for exception throwing.) Change-Id: Ia14a5c720edae86ac780023be88e676aa1b3315d
Diffstat (limited to 'media/libdrm')
-rw-r--r--media/libdrm/mobile1/Android.mk1
-rw-r--r--media/libdrm/mobile1/src/jni/drm1_jni.c19
2 files changed, 6 insertions, 14 deletions
diff --git a/media/libdrm/mobile1/Android.mk b/media/libdrm/mobile1/Android.mk
index f105799..b07d91c 100644
--- a/media/libdrm/mobile1/Android.mk
+++ b/media/libdrm/mobile1/Android.mk
@@ -72,6 +72,7 @@ LOCAL_C_INCLUDES := \
LOCAL_SHARED_LIBRARIES := libdrm1 \
+ libnativehelper \
libutils \
libcutils
diff --git a/media/libdrm/mobile1/src/jni/drm1_jni.c b/media/libdrm/mobile1/src/jni/drm1_jni.c
index 79ce931..11353a7 100644
--- a/media/libdrm/mobile1/src/jni/drm1_jni.c
+++ b/media/libdrm/mobile1/src/jni/drm1_jni.c
@@ -24,6 +24,7 @@
#include <jni/drm1_jni.h>
#include <objmng/svc_drm.h>
#include "log.h"
+#include "JNIHelp.h"
#define MS_PER_SECOND 1000 /* Milliseconds per second */
@@ -659,23 +660,13 @@ Java_android_drm_mobile1_DrmRawContent_nativeReadContent
jfieldID field;
if (NULL == buf) {
- jclass newExcCls = (*env)->FindClass(env, "java/lang/NullPointerException");
-
- if (newExcCls == NULL)
- /* Unable to find the exception class, give up. */
- return JNI_DRM_FAILURE;
-
- (*env)->ThrowNew(env, newExcCls, "b is null");
+ jniThrowNullPointerException(env, "b == null");
+ return JNI_DRM_FAILURE;
}
if (len < 0 || bufOff < 0 || len + bufOff > (*env)->GetArrayLength(env, buf)) {
- jclass newExcCls = (*env)->FindClass(env, "java/lang/IndexOutOfBoundsException");
-
- if (newExcCls == NULL)
- /* Unable to find the exception class, give up. */
- return JNI_DRM_FAILURE;
-
- (*env)->ThrowNew(env, newExcCls, NULL);
+ jniThrowException(env, "java/lang/IndexOutOfBoundsException", NULL);
+ return JNI_DRM_FAILURE;
}
if (mediaOff < 0 || len == 0)