提交 21f60042 编写于 作者: S serb

8034214: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/CInputMethod.m

Reviewed-by: pchelko, azvegint
上级 d01756f9
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, 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,17 +70,23 @@ static jobject CreateLocaleObjectFromNSString(JNIEnv *env, NSString *name)
}
// Create the java.util.Locale object
jobject localeObj = NULL;
jobject langObj = (*env)->NewStringUTF(env, language);
jobject ctryObj = (*env)->NewStringUTF(env, country);
jobject vrntObj = (*env)->NewStringUTF(env, variant);
jobject localeObj = JNFNewObject(env, jm_localeCons, langObj, ctryObj, vrntObj); // AWT_THREADING Safe (known object)
if (langObj != NULL) {
jobject ctryObj = (*env)->NewStringUTF(env, country);
if(ctryObj != NULL) {
jobject vrntObj = (*env)->NewStringUTF(env, variant);
if (vrntObj != NULL) {
localeObj = JNFNewObject(env, jm_localeCons,langObj, ctryObj,
vrntObj);
(*env)->DeleteLocalRef(env, vrntObj);
}
(*env)->DeleteLocalRef(env, ctryObj);
}
(*env)->DeleteLocalRef(env, langObj);
}
// Clean up and return.
free(language);
(*env)->DeleteLocalRef(env, langObj);
(*env)->DeleteLocalRef(env, ctryObj);
(*env)->DeleteLocalRef(env, vrntObj);
return localeObj;
}
......@@ -234,10 +240,12 @@ JNF_COCOA_ENTER(env);
if (sLastKeyboardLocaleObj) {
JNFDeleteGlobalRef(env, sLastKeyboardLocaleObj);
sLastKeyboardLocaleObj = NULL;
}
if (localObj != NULL) {
sLastKeyboardLocaleObj = JNFNewGlobalRef(env, localObj);
(*env)->DeleteLocalRef(env, localObj);
}
sLastKeyboardLocaleObj = JNFNewGlobalRef(env, localObj);
(*env)->DeleteLocalRef(env, localObj);
}
returnValue = sLastKeyboardLocaleObj;
......@@ -305,9 +313,12 @@ JNF_COCOA_ENTER(env);
for(NSString *locale in selectableArray) {
jobject localeObj = CreateLocaleObjectFromNSString(env, locale);
if (localeObj == NULL) {
break;
}
if (JNFCallBooleanMethod(env, returnValue, jm_listContains, localeObj) == JNI_FALSE) { // AWT_THREADING Safe (known object)
JNFCallBooleanMethod(env, returnValue, jm_listAdd, localeObj); // AWT_THREADING Safe (known object)
if (JNFCallBooleanMethod(env, returnValue, jm_listContains, localeObj) == JNI_FALSE) {
JNFCallBooleanMethod(env, returnValue, jm_listAdd, localeObj);
}
(*env)->DeleteLocalRef(env, localeObj);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册