8199756: Simplify language, country, script, and variant property initialization

Reviewed-by: mchung, naoto, alanb
This commit is contained in:
Roger Riggs 2018-03-23 11:53:11 -04:00
parent 123ad044ab
commit 299b4b7b44
2 changed files with 154 additions and 26 deletions

View file

@ -244,21 +244,8 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
PUTPROP(props, "line.separator", sprops->line_separator);
/*
* user.language
* user.script, user.country, user.variant (if user's environment specifies them)
* file.encoding
* file encoding for stdout and stderr
*/
PUTPROP(props, "user.language", sprops->language);
if (sprops->script) {
PUTPROP(props, "user.script", sprops->script);
}
if (sprops->country) {
PUTPROP(props, "user.country", sprops->country);
}
if (sprops->variant) {
PUTPROP(props, "user.variant", sprops->variant);
}
PUTPROP(props, "file.encoding", sprops->encoding);
if (sprops->sun_stdout_encoding != NULL) {
PUTPROP(props, "sun.stdout.encoding", sprops->sun_stdout_encoding);
}
@ -314,7 +301,7 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
#endif
/* !!! DO NOT call PUTPROP_ForPlatformNString before this line !!!
* !!! I18n properties have not been set up yet !!!
* !!! The platform native encoding for strings has not been set up yet !!!
*/
InitializeEncoding(env, sprops->sun_jnu_encoding);
@ -379,17 +366,6 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
PUTPROP(props, "sun.desktop", sprops->desktop);
}
/*
* unset "user.language", "user.script", "user.country", and "user.variant"
* in order to tell whether the command line option "-DXXXX=YYYY" is
* specified or not. They will be reset in fillI18nProps() below.
*/
REMOVEPROP(props, "user.language");
REMOVEPROP(props, "user.script");
REMOVEPROP(props, "user.country");
REMOVEPROP(props, "user.variant");
REMOVEPROP(props, "file.encoding");
ret = JVM_InitProperties(env, props);
/* reconstruct i18n related properties */