--- a/jdk/src/macosx/native/sun/awt/CInputMethod.m Wed Mar 12 13:29:32 2014 +0400
+++ b/jdk/src/macosx/native/sun/awt/CInputMethod.m Wed Mar 12 15:43:53 2014 +0400
@@ -1,5 +1,5 @@
/*
- * 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 @@
}
// 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 @@
if (sLastKeyboardLocaleObj) {
JNFDeleteGlobalRef(env, sLastKeyboardLocaleObj);
+ sLastKeyboardLocaleObj = NULL;
}
-
- sLastKeyboardLocaleObj = JNFNewGlobalRef(env, localObj);
- (*env)->DeleteLocalRef(env, localObj);
+ if (localObj != NULL) {
+ sLastKeyboardLocaleObj = JNFNewGlobalRef(env, localObj);
+ (*env)->DeleteLocalRef(env, localObj);
+ }
}
returnValue = sLastKeyboardLocaleObj;
@@ -305,9 +313,12 @@
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);