diff --git a/src/java.base/share/native/libjava/ClassLoader.c b/src/java.base/share/native/libjava/ClassLoader.c index 927432d1509..4519a4777f8 100644 --- a/src/java.base/share/native/libjava/ClassLoader.c +++ b/src/java.base/share/native/libjava/ClassLoader.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -114,7 +114,7 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env, (*env)->GetByteArrayRegion(env, data, offset, length, body); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { goto free_body; } @@ -259,7 +259,7 @@ Java_java_lang_ClassLoader_defineClass0(JNIEnv *env, (*env)->GetByteArrayRegion(env, data, offset, length, body); - if ((*env)->ExceptionOccurred(env)) + if ((*env)->ExceptionCheck(env)) goto free_body; if (name != NULL) { diff --git a/src/java.base/share/native/libjava/System.c b/src/java.base/share/native/libjava/System.c index 098b943cc40..7b038a6a9d5 100644 --- a/src/java.base/share/native/libjava/System.c +++ b/src/java.base/share/native/libjava/System.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -70,7 +70,7 @@ Java_java_lang_System_identityHashCode(JNIEnv *env, jobject this, jobject x) if (jval == NULL) \ return NULL; \ (*env)->SetObjectArrayElement(env, array, jdk_internal_util_SystemProps_Raw_##prop_index, jval); \ - if ((*env)->ExceptionOccurred(env)) \ + if ((*env)->ExceptionCheck(env)) \ return NULL; \ (*env)->DeleteLocalRef(env, jval); \ } @@ -86,7 +86,7 @@ Java_java_lang_System_identityHashCode(JNIEnv *env, jobject this, jobject x) if (jval == NULL) \ return NULL; \ (*env)->SetObjectArrayElement(env, array, jdk_internal_util_SystemProps_Raw_##prop_index, jval); \ - if ((*env)->ExceptionOccurred(env)) \ + if ((*env)->ExceptionCheck(env)) \ return NULL; \ (*env)->DeleteLocalRef(env, jval); \ } diff --git a/src/java.base/share/native/libjava/io_util.c b/src/java.base/share/native/libjava/io_util.c index 3fb7675d277..76ff58ec632 100644 --- a/src/java.base/share/native/libjava/io_util.c +++ b/src/java.base/share/native/libjava/io_util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -175,7 +175,7 @@ writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, (*env)->GetByteArrayRegion(env, bytes, off, len, (jbyte *)buf); - if (!(*env)->ExceptionOccurred(env)) { + if (!(*env)->ExceptionCheck(env)) { off = 0; while (len > 0) { fd = getFD(env, this, fid); diff --git a/src/java.base/share/native/libjava/jni_util.c b/src/java.base/share/native/libjava/jni_util.c index 3d9004d969c..ce23d160430 100644 --- a/src/java.base/share/native/libjava/jni_util.c +++ b/src/java.base/share/native/libjava/jni_util.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 @@ -117,7 +117,7 @@ JNU_ThrowByNameWithLastError(JNIEnv *env, const char *name, (*env)->Throw(env, x); } } - if (!(*env)->ExceptionOccurred(env)) { + if (!(*env)->ExceptionCheck(env)) { JNU_ThrowByName(env, name, defaultDetail); } } @@ -166,7 +166,7 @@ JNU_ThrowByNameWithMessageAndLastError } } - if (!(*env)->ExceptionOccurred(env)) { + if (!(*env)->ExceptionCheck(env)) { if (messagelen > 0) { JNU_ThrowByName(env, name, message); } else { diff --git a/src/java.base/share/native/libjli/java.c b/src/java.base/share/native/libjli/java.c index d4e20fb21fe..355ac4b9e28 100644 --- a/src/java.base/share/native/libjli/java.c +++ b/src/java.base/share/native/libjli/java.c @@ -351,7 +351,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argv */ #define CHECK_EXCEPTION_NULL_LEAVE(CENL_exception) \ do { \ - if ((*env)->ExceptionOccurred(env)) { \ + if ((*env)->ExceptionCheck(env)) { \ JLI_ReportExceptionDescription(env); \ LEAVE(); \ } \ @@ -363,7 +363,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argv */ #define CHECK_EXCEPTION_LEAVE(CEL_return_value) \ do { \ - if ((*env)->ExceptionOccurred(env)) { \ + if ((*env)->ExceptionCheck(env)) { \ JLI_ReportExceptionDescription(env); \ ret = (CEL_return_value); \ LEAVE(); \ @@ -1522,7 +1522,7 @@ NewPlatformString(JNIEnv *env, char *s) if (ary != 0) { jstring str = 0; (*env)->SetByteArrayRegion(env, ary, 0, len, (jbyte *)s); - if (!(*env)->ExceptionOccurred(env)) { + if (!(*env)->ExceptionCheck(env)) { if (makePlatformStringMID == NULL) { NULL_CHECK0(makePlatformStringMID = (*env)->GetStaticMethodID(env, cls, "makePlatformString", "(Z[B)Ljava/lang/String;")); diff --git a/src/java.base/share/native/libjli/java.h b/src/java.base/share/native/libjli/java.h index ce5224a7da3..19493fedaae 100644 --- a/src/java.base/share/native/libjli/java.h +++ b/src/java.base/share/native/libjli/java.h @@ -246,14 +246,14 @@ typedef struct { #define CHECK_EXCEPTION_RETURN_VALUE(CER_value) \ do { \ - if ((*env)->ExceptionOccurred(env)) { \ + if ((*env)->ExceptionCheck(env)) { \ return CER_value; \ } \ } while (JNI_FALSE) #define CHECK_EXCEPTION_RETURN() \ do { \ - if ((*env)->ExceptionOccurred(env)) { \ + if ((*env)->ExceptionCheck(env)) { \ return; \ } \ } while (JNI_FALSE) diff --git a/src/java.base/unix/native/libjava/io_util_md.c b/src/java.base/unix/native/libjava/io_util_md.c index 28659b3a1c2..9895ac3b73f 100644 --- a/src/java.base/unix/native/libjava/io_util_md.c +++ b/src/java.base/unix/native/libjava/io_util_md.c @@ -135,7 +135,7 @@ void fileDescriptorClose(JNIEnv *env, jobject this) { FD fd = (*env)->GetIntField(env, this, IO_fd_fdID); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { return; } @@ -150,7 +150,7 @@ fileDescriptorClose(JNIEnv *env, jobject this) * taking extra precaution over here. */ (*env)->SetIntField(env, this, IO_fd_fdID, -1); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { return; } /* diff --git a/src/java.base/unix/native/libnet/NetworkInterface.c b/src/java.base/unix/native/libnet/NetworkInterface.c index 0cd69399d91..61267ec13d5 100644 --- a/src/java.base/unix/native/libnet/NetworkInterface.c +++ b/src/java.base/unix/native/libnet/NetworkInterface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -374,7 +374,7 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_boundInetAddress0 if (family == AF_INET) { sock = openSocket(env, AF_INET); - if (sock < 0 && (*env)->ExceptionOccurred(env)) { + if (sock < 0 && (*env)->ExceptionCheck(env)) { return JNI_FALSE; } @@ -383,7 +383,7 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_boundInetAddress0 ifs = enumIPv4Interfaces(env, sock, ifs); close(sock); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { goto cleanup; } } @@ -401,7 +401,7 @@ JNIEXPORT jboolean JNICALL Java_java_net_NetworkInterface_boundInetAddress0 ifs = enumIPv6Interfaces(env, sock, ifs); close(sock); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { goto cleanup; } @@ -856,7 +856,7 @@ static netif *enumInterfaces(JNIEnv *env) { int sock; sock = openSocket(env, AF_INET); - if (sock < 0 && (*env)->ExceptionOccurred(env)) { + if (sock < 0 && (*env)->ExceptionCheck(env)) { return NULL; } @@ -865,7 +865,7 @@ static netif *enumInterfaces(JNIEnv *env) { ifs = enumIPv4Interfaces(env, sock, ifs); close(sock); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { freeif(ifs); return NULL; } @@ -884,7 +884,7 @@ static netif *enumInterfaces(JNIEnv *env) { ifs = enumIPv6Interfaces(env, sock, ifs); close(sock); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { freeif(ifs); return NULL; } @@ -1237,7 +1237,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { &addr, broadaddrP, AF_INET, prefix); // in case of exception, free interface list and buffer and return NULL - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { free(buf); freeif(ifs); return NULL; @@ -1281,7 +1281,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { NULL, AF_INET6, (short)prefix); // if an exception occurred then return the list as is - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { break; } } @@ -1478,7 +1478,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { &addr, broadaddrP, AF_INET, prefix); // in case of exception, free interface list and buffer and return NULL - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { free(buf); freeif(ifs); return NULL; @@ -1552,7 +1552,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { NULL, AF_INET6, prefix); // if an exception occurred then free the list - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { free(buf); freeif(ifs); return NULL; @@ -1717,7 +1717,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { ifa->ifa_netmask)); // if an exception occurred then free the list - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { freeifaddrs(origifa); freeif(ifs); return NULL; @@ -1757,7 +1757,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { ifa->ifa_netmask)); // if an exception occurred then free the list - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { freeifaddrs(origifa); freeif(ifs); return NULL; diff --git a/src/java.base/unix/native/libnet/SdpSupport.c b/src/java.base/unix/native/libnet/SdpSupport.c index 6729170efb4..b56f16905fa 100644 --- a/src/java.base/unix/native/libnet/SdpSupport.c +++ b/src/java.base/unix/native/libnet/SdpSupport.c @@ -106,7 +106,7 @@ Java_sun_net_sdp_SdpSupport_convert0(JNIEnv *env, jclass cls, int fd) if (res < 0) JNU_ThrowIOExceptionWithLastError(env, "dup2"); res = close(s); - if (res < 0 && !(*env)->ExceptionOccurred(env)) + if (res < 0 && !(*env)->ExceptionCheck(env)) JNU_ThrowIOExceptionWithLastError(env, "close"); } } diff --git a/src/java.base/unix/native/libnio/ch/UnixDomainSockets.c b/src/java.base/unix/native/libnio/ch/UnixDomainSockets.c index 73db22a9176..c43c3b90695 100644 --- a/src/java.base/unix/native/libnio/ch/UnixDomainSockets.c +++ b/src/java.base/unix/native/libnio/ch/UnixDomainSockets.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, 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 @@ -62,7 +62,7 @@ jbyteArray sockaddrToUnixAddressBytes(JNIEnv *env, struct sockaddr_un *sa, sockl jbyteArray name = (*env)->NewByteArray(env, namelen); if (namelen != 0) { (*env)->SetByteArrayRegion(env, name, 0, namelen, (jbyte*)sa->sun_path); - if ((*env)->ExceptionOccurred(env)) { + if ((*env)->ExceptionCheck(env)) { return NULL; } }