< prev index next >

src/java.desktop/macosx/native/libosxapp/PropertiesUtilities.m

Print this page
rev 54094 : 8257853: Remove dependencies on JNF's JNI utility functions in AWT and 2D code
rev 54098 : 8260616: Removing remaining JNF dependencies in the java.desktop module
8259729: Missed JNFInstanceOf -> IsInstanceOf conversion

*** 22,43 **** * or visit www.oracle.com if you need additional information or have any * questions. */ #import "PropertiesUtilities.h" @implementation PropertiesUtilities + (NSString *) javaSystemPropertyForKey:(NSString *)key withEnv:(JNIEnv *)env { ! static JNF_CLASS_CACHE(jc_System, "java/lang/System"); ! static JNF_STATIC_MEMBER_CACHE(jm_getProperty, jc_System, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;"); ! jstring jKey = JNFNSToJavaString(env, key); ! jstring jValue = JNFCallStaticObjectMethod(env, jm_getProperty, jKey); (*env)->DeleteLocalRef(env, jKey); ! NSString *value = JNFJavaToNSString(env, jValue); (*env)->DeleteLocalRef(env, jValue); return value; } @end --- 22,46 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ #import "PropertiesUtilities.h" + #import "JNIUtilities.h" @implementation PropertiesUtilities + (NSString *) javaSystemPropertyForKey:(NSString *)key withEnv:(JNIEnv *)env { ! DECLARE_CLASS_RETURN(jc_System, "java/lang/System", nil); ! DECLARE_STATIC_METHOD_RETURN(jm_getProperty, jc_System, ! "getProperty", "(Ljava/lang/String;)Ljava/lang/String;", nil); ! jstring jKey = NSStringToJavaString(env, key); ! jstring jValue = (*env)->CallStaticObjectMethod(env, jc_System, jm_getProperty, jKey); (*env)->DeleteLocalRef(env, jKey); + CHECK_EXCEPTION_NULL_RETURN(jValue, nil); ! NSString *value = JavaStringToNSString(env, jValue); (*env)->DeleteLocalRef(env, jValue); return value; } @end
< prev index next >