8344525: Fix leftover ExceptionOccurred in java.base
Reviewed-by: lbourges, alanb, naoto, iris
This commit is contained in:
parent
4b1653056d
commit
51763b6700
@ -650,7 +650,7 @@ JavaMain(void* _args)
|
||||
* The launcher's exit code (in the absence of calls to
|
||||
* System.exit) will be non-zero if main threw an exception.
|
||||
*/
|
||||
if (ret && (*env)->ExceptionOccurred(env) == NULL) {
|
||||
if (ret && !(*env)->ExceptionCheck(env)) {
|
||||
// main method was invoked and no exception was thrown from it,
|
||||
// return success.
|
||||
ret = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -197,14 +197,14 @@ Java_java_util_zip_Deflater_deflateBytesBytes(JNIEnv *env, jobject this, jlong a
|
||||
jint res;
|
||||
|
||||
if (input == NULL) {
|
||||
if (inputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (inputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
output = (*env)->GetPrimitiveArrayCritical(env, outputArray, 0);
|
||||
if (output == NULL) {
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, inputArray, input, 0);
|
||||
if (outputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (outputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
@ -231,7 +231,7 @@ Java_java_util_zip_Deflater_deflateBytesBuffer(JNIEnv *env, jobject this, jlong
|
||||
jlong retVal;
|
||||
jint res;
|
||||
if (input == NULL) {
|
||||
if (inputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (inputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
@ -257,7 +257,7 @@ Java_java_util_zip_Deflater_deflateBufferBytes(JNIEnv *env, jobject this, jlong
|
||||
jlong retVal;
|
||||
jint res;
|
||||
if (output == NULL) {
|
||||
if (outputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (outputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
|
@ -194,14 +194,14 @@ Java_java_util_zip_Inflater_inflateBytesBytes(JNIEnv *env, jobject this, jlong a
|
||||
jlong retVal;
|
||||
|
||||
if (input == NULL) {
|
||||
if (inputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (inputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
output = (*env)->GetPrimitiveArrayCritical(env, outputArray, 0);
|
||||
if (output == NULL) {
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, inputArray, input, 0);
|
||||
if (outputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (outputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
@ -227,7 +227,7 @@ Java_java_util_zip_Inflater_inflateBytesBuffer(JNIEnv *env, jobject this, jlong
|
||||
jlong retVal;
|
||||
|
||||
if (input == NULL) {
|
||||
if (inputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (inputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
@ -252,7 +252,7 @@ Java_java_util_zip_Inflater_inflateBufferBytes(JNIEnv *env, jobject this, jlong
|
||||
jlong retVal;
|
||||
|
||||
if (output == NULL) {
|
||||
if (outputLen != 0 && (*env)->ExceptionOccurred(env) == NULL)
|
||||
if (outputLen != 0 && !(*env)->ExceptionCheck(env))
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0L;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ fileDescriptorClose(JNIEnv *env, jobject this)
|
||||
{
|
||||
FD fd = (*env)->GetLongField(env, this, IO_handle_fdID);
|
||||
HANDLE h = (HANDLE)fd;
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ fileDescriptorClose(JNIEnv *env, jobject this)
|
||||
* taking extra precaution over here.
|
||||
*/
|
||||
(*env)->SetLongField(env, this, IO_handle_fdID, -1);
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -143,7 +143,7 @@ NET_ThrowNew(JNIEnv *env, int errorNum, char *msg)
|
||||
/*
|
||||
* If exception already throw then don't overwrite it.
|
||||
*/
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,7 +48,7 @@ jbyteArray sockaddrToUnixAddressBytes(JNIEnv *env, struct sockaddr_un *sa, sockl
|
||||
jbyteArray name = (*env)->NewByteArray(env, namelen);
|
||||
if (name != NULL) {
|
||||
(*env)->SetByteArrayRegion(env, name, 0, namelen, (jbyte*)sa->sun_path);
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user