From a94fc5243721350787ad405a94a64eec5dc61f7c Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Sun, 22 Nov 2015 14:21:25 -0800 Subject: Map Errors.h's UNEXPECTED_NULL to NullPointerException Many native services reject null references with this status_t. Map it to an appropriate exception for Java Binder clients. Bug: 25615695 Change-Id: I16a4f44da35839892fc4d332f95382f06485b2a7 --- core/jni/android_util_Binder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index c139cd78b4c0..ae109c6566cb 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -711,6 +711,9 @@ void signalExceptionForError(JNIEnv* env, jobject obj, status_t err, jniThrowException(env, "java/lang/RuntimeException", "Not allowed to write file descriptors here"); break; + case UNEXPECTED_NULL: + jniThrowNullPointerException(env, NULL); + break; case -EBADF: jniThrowException(env, "java/lang/RuntimeException", "Bad file descriptor"); -- cgit v1.2.3-59-g8ed1b