diff --git a/src/java.base/share/native/libjli/java.c b/src/java.base/share/native/libjli/java.c index 4f9a6426dff..3ceef480b47 100644 --- a/src/java.base/share/native/libjli/java.c +++ b/src/java.base/share/native/libjli/java.c @@ -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; diff --git a/src/java.base/share/native/libzip/Deflater.c b/src/java.base/share/native/libzip/Deflater.c index 1ed1994d471..00d4e4125c3 100644 --- a/src/java.base/share/native/libzip/Deflater.c +++ b/src/java.base/share/native/libzip/Deflater.c @@ -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; } diff --git a/src/java.base/share/native/libzip/Inflater.c b/src/java.base/share/native/libzip/Inflater.c index 1f43d3d1abf..2919c3959f7 100644 --- a/src/java.base/share/native/libzip/Inflater.c +++ b/src/java.base/share/native/libzip/Inflater.c @@ -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; } diff --git a/src/java.base/windows/native/libjava/io_util_md.c b/src/java.base/windows/native/libjava/io_util_md.c index 6a8bd434280..4709bbbae24 100644 --- a/src/java.base/windows/native/libjava/io_util_md.c +++ b/src/java.base/windows/native/libjava/io_util_md.c @@ -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; } diff --git a/src/java.base/windows/native/libnet/net_util_md.c b/src/java.base/windows/native/libnet/net_util_md.c index 5305a02f1c2..36927beff3c 100644 --- a/src/java.base/windows/native/libnet/net_util_md.c +++ b/src/java.base/windows/native/libnet/net_util_md.c @@ -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; } diff --git a/src/java.base/windows/native/libnio/ch/UnixDomainSockets.c b/src/java.base/windows/native/libnio/ch/UnixDomainSockets.c index bc185b3aa18..e29d8e28efc 100644 --- a/src/java.base/windows/native/libnio/ch/UnixDomainSockets.c +++ b/src/java.base/windows/native/libnio/ch/UnixDomainSockets.c @@ -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; } }