8341789: Fix ExceptionOccurred in java.base

Reviewed-by: bpb, jpai, dfuchs, lancea, rriggs, naoto
This commit is contained in:
Justin Lu 2024-10-10 17:33:22 +00:00
parent 76541b0646
commit 7eb55357ab
10 changed files with 34 additions and 34 deletions

View file

@ -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) {

View file

@ -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); \
}

View file

@ -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);

View file

@ -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 {

View file

@ -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;"));

View file

@ -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)