8341792: Fix ExceptionOccurred in java.security.jgss

Reviewed-by: jlu, mullan
This commit is contained in:
Weijun Wang 2024-10-10 17:22:45 +00:00
parent 6fad6af0de
commit 76541b0646
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@ void _SCDynamicStoreCallBack(SCDynamicStoreRef store, CFArrayRef changedKeys, vo
jmethodID jm_Config_refresh = (*env)->GetStaticMethodID(env, jc_Config, "refresh", "()V"); jmethodID jm_Config_refresh = (*env)->GetStaticMethodID(env, jc_Config, "refresh", "()V");
CHECK_NULL(jm_Config_refresh); CHECK_NULL(jm_Config_refresh);
(*env)->CallStaticVoidMethod(env, jc_Config, jm_Config_refresh); (*env)->CallStaticVoidMethod(env, jc_Config, jm_Config_refresh);
if ((*env)->ExceptionOccurred(env) != NULL) { if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionClear(env); (*env)->ExceptionClear(env);
} }
if (createdFromAttach) { if (createdFromAttach) {

View File

@ -877,13 +877,13 @@ jobject BuildTicket(JNIEnv *env, PUCHAR encodedTicket, ULONG encodedTicketSize)
(*env)->SetByteArrayRegion(env, ary, (jsize) 0, encodedTicketSize, (*env)->SetByteArrayRegion(env, ary, (jsize) 0, encodedTicketSize,
(jbyte *)encodedTicket); (jbyte *)encodedTicket);
if ((*env)->ExceptionOccurred(env)) { if ((*env)->ExceptionCheck(env)) {
(*env)->DeleteLocalRef(env, ary); (*env)->DeleteLocalRef(env, ary);
return (jobject) NULL; return (jobject) NULL;
} }
ticket = (*env)->NewObject(env, ticketClass, ticketConstructor, ary); ticket = (*env)->NewObject(env, ticketClass, ticketConstructor, ary);
if ((*env)->ExceptionOccurred(env)) { if ((*env)->ExceptionCheck(env)) {
(*env)->DeleteLocalRef(env, ary); (*env)->DeleteLocalRef(env, ary);
return (jobject) NULL; return (jobject) NULL;
} }
@ -993,7 +993,7 @@ jobject BuildEncryptionKey(JNIEnv *env, PKERB_CRYPTO_KEY cryptoKey) {
} }
(*env)->SetByteArrayRegion(env, ary, (jsize) 0, cryptoKey->Length, (*env)->SetByteArrayRegion(env, ary, (jsize) 0, cryptoKey->Length,
(jbyte *)cryptoKey->Value); (jbyte *)cryptoKey->Value);
if ((*env)->ExceptionOccurred(env)) { if ((*env)->ExceptionCheck(env)) {
(*env)->DeleteLocalRef(env, ary); (*env)->DeleteLocalRef(env, ary);
} else { } else {
encryptionKey = (*env)->NewObject(env, encryptionKeyClass, encryptionKey = (*env)->NewObject(env, encryptionKeyClass,
@ -1018,7 +1018,7 @@ jobject BuildTicketFlags(JNIEnv *env, PULONG flags) {
} }
(*env)->SetByteArrayRegion(env, ary, (jsize) 0, sizeof(*flags), (*env)->SetByteArrayRegion(env, ary, (jsize) 0, sizeof(*flags),
(jbyte *)&nlflags); (jbyte *)&nlflags);
if ((*env)->ExceptionOccurred(env)) { if ((*env)->ExceptionCheck(env)) {
(*env)->DeleteLocalRef(env, ary); (*env)->DeleteLocalRef(env, ary);
} else { } else {
ticketFlags = (*env)->NewObject(env, ticketFlagsClass, ticketFlags = (*env)->NewObject(env, ticketFlagsClass,