Merge "Clean up ExceptionOccurred."

This commit is contained in:
Mathieu Chartier
2014-08-20 23:31:38 +00:00
committed by Gerrit Code Review
6 changed files with 44 additions and 44 deletions

View File

@@ -57,7 +57,7 @@ socket_connect_local(JNIEnv *env, jobject object,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -95,7 +95,7 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -118,7 +118,7 @@ socket_listen (JNIEnv *env, jobject object, jobject fileDescriptor, jint backlog
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -154,7 +154,7 @@ socket_accept (JNIEnv *env, jobject object, jobject fileDescriptor, jobject s)
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return NULL;
}
@@ -184,7 +184,7 @@ socket_shutdown (JNIEnv *env, jobject object, jobject fileDescriptor,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -246,7 +246,7 @@ socket_getOption(JNIEnv *env, jobject object, jobject fileDescriptor, jint optID
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return 0;
}
@@ -293,7 +293,7 @@ static void socket_setOption(
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -353,7 +353,7 @@ static jint socket_pending (JNIEnv *env, jobject object,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return (jint)-1;
}
@@ -378,7 +378,7 @@ static jint socket_available (JNIEnv *env, jobject object,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return (jint)-1;
}
@@ -459,20 +459,20 @@ static int socket_process_cmsg(JNIEnv *env, jobject thisJ, struct msghdr * pMsg)
jobject fdObject
= jniCreateFileDescriptor(env, pDescriptors[i]);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
env->SetObjectArrayElement(fdArray, i, fdObject);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
}
env->SetObjectField(thisJ, field_inboundFileDescriptors, fdArray);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
}
@@ -558,7 +558,7 @@ static int socket_write_all(JNIEnv *env, jobject object, int fd,
= (jobjectArray)env->GetObjectField(
object, field_outboundFileDescriptors);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
@@ -570,18 +570,18 @@ static int socket_write_all(JNIEnv *env, jobject object, int fd,
// Add any pending outbound file descriptors to the message
if (outboundFds != NULL) {
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
for (int i = 0; i < countFds; i++) {
jobject fdObject = env->GetObjectArrayElement(outboundFds, i);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
fds[i] = jniGetFDFromFileDescriptor(env, fdObject);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
}
@@ -638,7 +638,7 @@ static jint socket_read (JNIEnv *env, jobject object, jobject fileDescriptor)
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return (jint)0;
}
@@ -683,7 +683,7 @@ static jint socket_readba (JNIEnv *env, jobject object,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return (jint)-1;
}
@@ -717,7 +717,7 @@ static void socket_write (JNIEnv *env, jobject object,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -745,7 +745,7 @@ static void socket_writeba (JNIEnv *env, jobject object,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -777,7 +777,7 @@ static jobject socket_get_peer_credentials(JNIEnv *env,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return NULL;
}
@@ -816,7 +816,7 @@ static jobject socket_getSockName(JNIEnv *env,
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return NULL;
}

View File

@@ -54,8 +54,8 @@ MessageQueue::~MessageQueue() {
}
bool MessageQueue::raiseAndClearException(JNIEnv* env, const char* msg) {
jthrowable exceptionObj = env->ExceptionOccurred();
if (exceptionObj) {
if (env->ExceptionCheck()) {
jthrowable exceptionObj = env->ExceptionOccurred();
env->ExceptionClear();
raiseException(env, msg, exceptionObj);
env->DeleteLocalRef(exceptionObj);

View File

@@ -97,7 +97,7 @@ static jstring getPeerCon(JNIEnv *env, jobject, jobject fileDescriptor) {
}
int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
ALOGE("getPeerCon => getFD for %p failed", fileDescriptor);
return NULL;
}

View File

@@ -35,7 +35,7 @@ static jint QTagUid_tagSocketFd(JNIEnv* env, jclass,
jint tagNum, jint uid) {
int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
ALOGE("Can't get FileDescriptor num");
return (jint)-1;
}
@@ -51,7 +51,7 @@ static jint QTagUid_untagSocketFd(JNIEnv* env, jclass,
jobject fileDescriptor) {
int userFd = jniGetFDFromFileDescriptor(env, fileDescriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
ALOGE("Can't get FileDescriptor num");
return (jint)-1;
}

View File

@@ -272,9 +272,9 @@ protected:
//printf("\n");
jboolean res = env->CallBooleanMethod(mObject, gBinderOffsets.mExecTransact,
code, reinterpret_cast<jlong>(&data), reinterpret_cast<jlong>(reply), flags);
jthrowable excep = env->ExceptionOccurred();
if (excep) {
if (env->ExceptionCheck()) {
jthrowable excep = env->ExceptionOccurred();
report_exception(env, excep,
"*** Uncaught remote exception! "
"(Exceptions are not yet supported across processes.)");
@@ -296,12 +296,12 @@ protected:
set_dalvik_blockguard_policy(env, strict_policy_before);
}
jthrowable excep2 = env->ExceptionOccurred();
if (excep2) {
report_exception(env, excep2,
if (env->ExceptionCheck()) {
jthrowable excep = env->ExceptionOccurred();
report_exception(env, excep,
"*** Uncaught exception in onBinderStrictModePolicyChange");
/* clean up JNI local ref -- we don't return to Java code */
env->DeleteLocalRef(excep2);
env->DeleteLocalRef(excep);
}
// Need to always call through the native implementation of
@@ -403,8 +403,8 @@ public:
env->CallStaticVoidMethod(gBinderProxyOffsets.mClass,
gBinderProxyOffsets.mSendDeathNotice, mObject);
jthrowable excep = env->ExceptionOccurred();
if (excep) {
if (env->ExceptionCheck()) {
jthrowable excep = env->ExceptionOccurred();
report_exception(env, excep,
"*** Uncaught exception returned from death notification!");
}

View File

@@ -96,7 +96,7 @@ static void com_android_internal_os_ZygoteInit_reopenStdio(JNIEnv* env,
fd = jniGetFDFromFileDescriptor(env, in);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -106,7 +106,7 @@ static void com_android_internal_os_ZygoteInit_reopenStdio(JNIEnv* env,
fd = jniGetFDFromFileDescriptor(env, out);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -116,7 +116,7 @@ static void com_android_internal_os_ZygoteInit_reopenStdio(JNIEnv* env,
fd = jniGetFDFromFileDescriptor(env, errfd);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -134,7 +134,7 @@ static void com_android_internal_os_ZygoteInit_setCloseOnExec (JNIEnv *env,
fd = jniGetFDFromFileDescriptor(env, descriptor);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return;
}
@@ -170,7 +170,7 @@ static jint com_android_internal_os_ZygoteInit_selectReadable (
jsize length = env->GetArrayLength(fds);
fd_set fdset;
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
@@ -179,14 +179,14 @@ static jint com_android_internal_os_ZygoteInit_selectReadable (
int nfds = 0;
for (jsize i = 0; i < length; i++) {
jobject fdObj = env->GetObjectArrayElement(fds, i);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
if (fdObj == NULL) {
continue;
}
int fd = jniGetFDFromFileDescriptor(env, fdObj);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
@@ -209,14 +209,14 @@ static jint com_android_internal_os_ZygoteInit_selectReadable (
for (jsize i = 0; i < length; i++) {
jobject fdObj = env->GetObjectArrayElement(fds, i);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
if (fdObj == NULL) {
continue;
}
int fd = jniGetFDFromFileDescriptor(env, fdObj);
if (env->ExceptionOccurred() != NULL) {
if (env->ExceptionCheck()) {
return -1;
}
if (FD_ISSET(fd, &fdset)) {