< prev index next >

src/java.base/share/native/libjava/System.c

Print this page
rev 52426 : 8185496: Improve performance of system properties initialization in initPhase1
8213424: VersionProps duplicate and skipped initialization


 194 
 195     removeID = (*env)->GetMethodID(env,
 196                                    (*env)->GetObjectClass(env, props),
 197                                    "remove",
 198             "(Ljava/lang/Object;)Ljava/lang/Object;");
 199     CHECK_NULL_RETURN(removeID, NULL);
 200 
 201     getPropID = (*env)->GetMethodID(env,
 202                                     (*env)->GetObjectClass(env, props),
 203                                     "getProperty",
 204             "(Ljava/lang/String;)Ljava/lang/String;");
 205     CHECK_NULL_RETURN(getPropID, NULL);
 206 
 207     PUTPROP(props, "java.specification.version",
 208             VERSION_SPECIFICATION);
 209     PUTPROP(props, "java.specification.name",
 210             "Java Platform API Specification");
 211     PUTPROP(props, "java.specification.vendor",
 212             JAVA_SPECIFICATION_VENDOR);
 213 
 214     PUTPROP(props, "java.version", VERSION_SHORT);
 215     PUTPROP(props, "java.vendor", VENDOR);
 216     PUTPROP(props, "java.vendor.url", VENDOR_URL);
 217     PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
 218 
 219     jio_snprintf(buf, sizeof(buf), "%d.%d", JVM_CLASSFILE_MAJOR_VERSION,
 220                                             JVM_CLASSFILE_MINOR_VERSION);
 221     PUTPROP(props, "java.class.version", buf);
 222 
 223     if (sprops->awt_toolkit) {
 224         PUTPROP(props, "awt.toolkit", sprops->awt_toolkit);
 225     }
 226 #ifdef MACOSX
 227     if (sprops->awt_headless) {
 228         PUTPROP(props, "java.awt.headless", sprops->awt_headless);
 229     }
 230 #endif
 231 
 232     /* os properties */
 233     PUTPROP(props, "os.name", sprops->os_name);
 234     PUTPROP(props, "os.version", sprops->os_version);


 238     PUTPROP(props, "sun.arch.abi", sprops->sun_arch_abi);
 239 #endif
 240 
 241     /* file system properties */
 242     PUTPROP(props, "file.separator", sprops->file_separator);
 243     PUTPROP(props, "path.separator", sprops->path_separator);
 244     PUTPROP(props, "line.separator", sprops->line_separator);
 245 
 246     /*
 247      * file encoding for stdout and stderr
 248      */
 249     if (sprops->sun_stdout_encoding != NULL) {
 250         PUTPROP(props, "sun.stdout.encoding", sprops->sun_stdout_encoding);
 251     }
 252     if (sprops->sun_stderr_encoding != NULL) {
 253         PUTPROP(props, "sun.stderr.encoding", sprops->sun_stderr_encoding);
 254     }
 255 
 256     /* unicode_encoding specifies the default endianness */
 257     PUTPROP(props, "sun.io.unicode.encoding", sprops->unicode_encoding);
 258     PUTPROP(props, "sun.cpu.isalist",
 259             (sprops->cpu_isalist ? sprops->cpu_isalist : ""));


 260     PUTPROP(props, "sun.cpu.endian",  sprops->cpu_endian);
 261 
 262 
 263 #ifdef MACOSX
 264     /* Proxy setting properties */
 265     if (sprops->httpProxyEnabled) {
 266         PUTPROP(props, "http.proxyHost", sprops->httpHost);
 267         PUTPROP(props, "http.proxyPort", sprops->httpPort);
 268     }
 269 
 270     if (sprops->httpsProxyEnabled) {
 271         PUTPROP(props, "https.proxyHost", sprops->httpsHost);
 272         PUTPROP(props, "https.proxyPort", sprops->httpsPort);
 273     }
 274 
 275     if (sprops->ftpProxyEnabled) {
 276         PUTPROP(props, "ftp.proxyHost", sprops->ftpHost);
 277         PUTPROP(props, "ftp.proxyPort", sprops->ftpPort);
 278     }
 279 


 313      * It is explicitly not designed to be overridden by clients as
 314      * a way of replacing the implementation class, and in any case
 315      * the mechanism by which the class is loaded is constrained to only
 316      * find and load classes that are part of the JRE.
 317      * This property may be removed if that mechanism is redesigned
 318      */
 319     PUTPROP(props, "java.awt.printerjob", sprops->printerJob);
 320 
 321     /* data model */
 322     if (sizeof(sprops) == 4) {
 323         sprops->data_model = "32";
 324     } else if (sizeof(sprops) == 8) {
 325         sprops->data_model = "64";
 326     } else {
 327         sprops->data_model = "unknown";
 328     }
 329     PUTPROP(props, "sun.arch.data.model",  \
 330                     sprops->data_model);
 331 
 332     /* patch level */

 333     PUTPROP(props, "sun.os.patch.level",  \
 334                     sprops->patch_level);

 335 
 336     /* Java2D properties */
 337     /* Note: java.awt.graphicsenv is an implementation private property which
 338      * just happens to have a java.* name because it is referenced in
 339      * a java.awt class. It is the mechanism by which the implementation
 340      * finds the appropriate class in the JRE for the platform.
 341      * It is explicitly not designed to be overridden by clients as
 342      * a way of replacing the implementation class, and in any case
 343      * the mechanism by which the class is loaded is constrained to only
 344      * find and load classes that are part of the JRE.
 345      * This property may be removed if that mechanism is redesigned
 346      */
 347     PUTPROP(props, "java.awt.graphicsenv", sprops->graphics_env);
 348     if (sprops->font_dir != NULL) {
 349         PUTPROP_ForPlatformNString(props,
 350                                    "sun.java2d.fontpath", sprops->font_dir);
 351     }
 352 
 353     PUTPROP_ForPlatformNString(props, "java.io.tmpdir", sprops->tmp_dir);
 354 
 355     PUTPROP_ForPlatformNString(props, "user.name", sprops->user_name);
 356     PUTPROP_ForPlatformNString(props, "user.home", sprops->user_home);
 357 
 358     PUTPROP(props, "user.timezone", sprops->timezone);
 359 
 360     PUTPROP_ForPlatformNString(props, "user.dir", sprops->user_dir);
 361 
 362     /* This is a sun. property as it is currently only set for Gnome and
 363      * Windows desktops.
 364      */
 365     if (sprops->desktop != NULL) {
 366         PUTPROP(props, "sun.desktop", sprops->desktop);
 367     }
 368 
 369     ret = JVM_InitProperties(env, props);
 370 
 371     /* reconstruct i18n related properties */
 372     fillI18nProps(env, props, "user.language", sprops->display_language,
 373         sprops->format_language, putID, getPropID);
 374     fillI18nProps(env, props, "user.script",
 375         sprops->display_script, sprops->format_script, putID, getPropID);
 376     fillI18nProps(env, props, "user.country",
 377         sprops->display_country, sprops->format_country, putID, getPropID);
 378     fillI18nProps(env, props, "user.variant",
 379         sprops->display_variant, sprops->format_variant, putID, getPropID);




 194 
 195     removeID = (*env)->GetMethodID(env,
 196                                    (*env)->GetObjectClass(env, props),
 197                                    "remove",
 198             "(Ljava/lang/Object;)Ljava/lang/Object;");
 199     CHECK_NULL_RETURN(removeID, NULL);
 200 
 201     getPropID = (*env)->GetMethodID(env,
 202                                     (*env)->GetObjectClass(env, props),
 203                                     "getProperty",
 204             "(Ljava/lang/String;)Ljava/lang/String;");
 205     CHECK_NULL_RETURN(getPropID, NULL);
 206 
 207     PUTPROP(props, "java.specification.version",
 208             VERSION_SPECIFICATION);
 209     PUTPROP(props, "java.specification.name",
 210             "Java Platform API Specification");
 211     PUTPROP(props, "java.specification.vendor",
 212             JAVA_SPECIFICATION_VENDOR);
 213 

 214     PUTPROP(props, "java.vendor", VENDOR);
 215     PUTPROP(props, "java.vendor.url", VENDOR_URL);
 216     PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
 217 
 218     jio_snprintf(buf, sizeof(buf), "%d.%d", JVM_CLASSFILE_MAJOR_VERSION,
 219                                             JVM_CLASSFILE_MINOR_VERSION);
 220     PUTPROP(props, "java.class.version", buf);
 221 
 222     if (sprops->awt_toolkit) {
 223         PUTPROP(props, "awt.toolkit", sprops->awt_toolkit);
 224     }
 225 #ifdef MACOSX
 226     if (sprops->awt_headless) {
 227         PUTPROP(props, "java.awt.headless", sprops->awt_headless);
 228     }
 229 #endif
 230 
 231     /* os properties */
 232     PUTPROP(props, "os.name", sprops->os_name);
 233     PUTPROP(props, "os.version", sprops->os_version);


 237     PUTPROP(props, "sun.arch.abi", sprops->sun_arch_abi);
 238 #endif
 239 
 240     /* file system properties */
 241     PUTPROP(props, "file.separator", sprops->file_separator);
 242     PUTPROP(props, "path.separator", sprops->path_separator);
 243     PUTPROP(props, "line.separator", sprops->line_separator);
 244 
 245     /*
 246      * file encoding for stdout and stderr
 247      */
 248     if (sprops->sun_stdout_encoding != NULL) {
 249         PUTPROP(props, "sun.stdout.encoding", sprops->sun_stdout_encoding);
 250     }
 251     if (sprops->sun_stderr_encoding != NULL) {
 252         PUTPROP(props, "sun.stderr.encoding", sprops->sun_stderr_encoding);
 253     }
 254 
 255     /* unicode_encoding specifies the default endianness */
 256     PUTPROP(props, "sun.io.unicode.encoding", sprops->unicode_encoding);
 257     if (sprops->cpu_isalist  != NULL) {
 258         // leave undefined if none
 259         PUTPROP(props, "sun.cpu.isalist", sprops->cpu_isalist);
 260     }
 261     PUTPROP(props, "sun.cpu.endian",  sprops->cpu_endian);
 262 
 263 
 264 #ifdef MACOSX
 265     /* Proxy setting properties */
 266     if (sprops->httpProxyEnabled) {
 267         PUTPROP(props, "http.proxyHost", sprops->httpHost);
 268         PUTPROP(props, "http.proxyPort", sprops->httpPort);
 269     }
 270 
 271     if (sprops->httpsProxyEnabled) {
 272         PUTPROP(props, "https.proxyHost", sprops->httpsHost);
 273         PUTPROP(props, "https.proxyPort", sprops->httpsPort);
 274     }
 275 
 276     if (sprops->ftpProxyEnabled) {
 277         PUTPROP(props, "ftp.proxyHost", sprops->ftpHost);
 278         PUTPROP(props, "ftp.proxyPort", sprops->ftpPort);
 279     }
 280 


 314      * It is explicitly not designed to be overridden by clients as
 315      * a way of replacing the implementation class, and in any case
 316      * the mechanism by which the class is loaded is constrained to only
 317      * find and load classes that are part of the JRE.
 318      * This property may be removed if that mechanism is redesigned
 319      */
 320     PUTPROP(props, "java.awt.printerjob", sprops->printerJob);
 321 
 322     /* data model */
 323     if (sizeof(sprops) == 4) {
 324         sprops->data_model = "32";
 325     } else if (sizeof(sprops) == 8) {
 326         sprops->data_model = "64";
 327     } else {
 328         sprops->data_model = "unknown";
 329     }
 330     PUTPROP(props, "sun.arch.data.model",  \
 331                     sprops->data_model);
 332 
 333     /* patch level */
 334     if (sprops->patch_level != NULL) {
 335         PUTPROP(props, "sun.os.patch.level",  \
 336                     sprops->patch_level);
 337     }
 338 
 339     /* Java2D properties */
 340     /* Note: java.awt.graphicsenv is an implementation private property which
 341      * just happens to have a java.* name because it is referenced in
 342      * a java.awt class. It is the mechanism by which the implementation
 343      * finds the appropriate class in the JRE for the platform.
 344      * It is explicitly not designed to be overridden by clients as
 345      * a way of replacing the implementation class, and in any case
 346      * the mechanism by which the class is loaded is constrained to only
 347      * find and load classes that are part of the JRE.
 348      * This property may be removed if that mechanism is redesigned
 349      */
 350     PUTPROP(props, "java.awt.graphicsenv", sprops->graphics_env);
 351     if (sprops->font_dir != NULL) {
 352         PUTPROP_ForPlatformNString(props,
 353                                    "sun.java2d.fontpath", sprops->font_dir);
 354     }
 355 
 356     PUTPROP_ForPlatformNString(props, "java.io.tmpdir", sprops->tmp_dir);
 357 
 358     PUTPROP_ForPlatformNString(props, "user.name", sprops->user_name);
 359     PUTPROP_ForPlatformNString(props, "user.home", sprops->user_home);



 360     PUTPROP_ForPlatformNString(props, "user.dir", sprops->user_dir);
 361 
 362     /* This is a sun. property as it is currently only set for Gnome and
 363      * Windows desktops.
 364      */
 365     if (sprops->desktop != NULL) {
 366         PUTPROP(props, "sun.desktop", sprops->desktop);
 367     }
 368 
 369     ret = JVM_InitProperties(env, props);
 370 
 371     /* reconstruct i18n related properties */
 372     fillI18nProps(env, props, "user.language", sprops->display_language,
 373         sprops->format_language, putID, getPropID);
 374     fillI18nProps(env, props, "user.script",
 375         sprops->display_script, sprops->format_script, putID, getPropID);
 376     fillI18nProps(env, props, "user.country",
 377         sprops->display_country, sprops->format_country, putID, getPropID);
 378     fillI18nProps(env, props, "user.variant",
 379         sprops->display_variant, sprops->format_variant, putID, getPropID);


< prev index next >