< prev index next >

src/java.base/share/classes/jdk/internal/util/SystemProps.java

Print this page




  73         // Use platform values if not overridden by a commandline -Dkey=value
  74         // In no particular order
  75         putIfAbsent(props, "os.name", raw.propDefault(Raw._os_name_NDX));
  76         putIfAbsent(props, "os.arch", raw.propDefault(Raw._os_arch_NDX));
  77         putIfAbsent(props, "os.version", raw.propDefault(Raw._os_version_NDX));
  78         putIfAbsent(props, "line.separator", raw.propDefault(Raw._line_separator_NDX));
  79         putIfAbsent(props, "file.separator", raw.propDefault(Raw._file_separator_NDX));
  80         putIfAbsent(props, "path.separator", raw.propDefault(Raw._path_separator_NDX));
  81         putIfAbsent(props, "java.io.tmpdir", raw.propDefault(Raw._java_io_tmpdir_NDX));
  82         putIfAbsent(props, "http.proxyHost", raw.propDefault(Raw._http_proxyHost_NDX));
  83         putIfAbsent(props, "http.proxyPort", raw.propDefault(Raw._http_proxyPort_NDX));
  84         putIfAbsent(props, "https.proxyHost", raw.propDefault(Raw._https_proxyHost_NDX));
  85         putIfAbsent(props, "https.proxyPort", raw.propDefault(Raw._https_proxyPort_NDX));
  86         putIfAbsent(props, "ftp.proxyHost", raw.propDefault(Raw._ftp_proxyHost_NDX));
  87         putIfAbsent(props, "ftp.proxyPort", raw.propDefault(Raw._ftp_proxyPort_NDX));
  88         putIfAbsent(props, "socksProxyHost", raw.propDefault(Raw._socksProxyHost_NDX));
  89         putIfAbsent(props, "socksProxyPort", raw.propDefault(Raw._socksProxyPort_NDX));
  90         putIfAbsent(props, "http.nonProxyHosts", raw.propDefault(Raw._http_nonProxyHosts_NDX));
  91         putIfAbsent(props, "ftp.nonProxyHosts", raw.propDefault(Raw._ftp_nonProxyHosts_NDX));
  92         putIfAbsent(props, "socksNonProxyHosts", raw.propDefault(Raw._socksNonProxyHosts_NDX));
  93         putIfAbsent(props, "awt.toolkit", raw.propDefault(Raw._awt_toolkit_NDX));
  94         putIfAbsent(props, "sun.arch.abi", raw.propDefault(Raw._sun_arch_abi_NDX));
  95         putIfAbsent(props, "sun.arch.data.model", raw.propDefault(Raw._sun_arch_data_model_NDX));
  96         putIfAbsent(props, "sun.os.patch.level", raw.propDefault(Raw._sun_os_patch_level_NDX));
  97         putIfAbsent(props, "sun.stdout.encoding", raw.propDefault(Raw._sun_stdout_encoding_NDX));
  98         putIfAbsent(props, "sun.stderr.encoding", raw.propDefault(Raw._sun_stderr_encoding_NDX));
  99         putIfAbsent(props, "sun.io.unicode.encoding", raw.propDefault(Raw._sun_io_unicode_encoding_NDX));
 100         putIfAbsent(props, "sun.cpu.isalist", raw.propDefault(Raw._sun_cpu_isalist_NDX));
 101         putIfAbsent(props, "sun.cpu.endian", raw.propDefault(Raw._sun_cpu_endian_NDX));
 102 
 103         /* Construct i18n related options */
 104         fillI18nProps(props,"user.language", raw.propDefault(Raw._display_language_NDX),
 105                 raw.propDefault(Raw._format_language_NDX));
 106         fillI18nProps(props,"user.script",   raw.propDefault(Raw._display_script_NDX),
 107                 raw.propDefault(Raw._format_script_NDX));
 108         fillI18nProps(props,"user.country",  raw.propDefault(Raw._display_country_NDX),
 109                 raw.propDefault(Raw._format_country_NDX));
 110         fillI18nProps(props,"user.variant",  raw.propDefault(Raw._display_variant_NDX),
 111                 raw.propDefault(Raw._format_variant_NDX));
 112 
 113         return props;


 168         if (dispValue == null && display != null && !display.equals(baseValue)) {
 169             // Create the property only if different from the base property
 170             cmdProps.put(disp, display);
 171         }
 172 
 173         /* user.xxx.format property */
 174         String fmt = base.concat(".format");
 175         String fmtValue = cmdProps.get(fmt);
 176         if (fmtValue == null && format != null && !format.equals(baseValue)) {
 177             // Create the property only if different than the base property
 178             cmdProps.put(fmt, format);
 179         }
 180     }
 181 
 182     /**
 183      * Read the raw properties from native System.c.
 184      */
 185     public static class Raw {
 186         // Array indices written by native vmProperties()
 187         // The order is arbitrary (but alphabetic for convenience)
 188         @Native private static final int _awt_toolkit_NDX = 0;
 189         @Native private static final int _display_country_NDX = 1 + _awt_toolkit_NDX;
 190         @Native private static final int _display_language_NDX = 1 + _display_country_NDX;
 191         @Native private static final int _display_script_NDX = 1 + _display_language_NDX;
 192         @Native private static final int _display_variant_NDX = 1 + _display_script_NDX;
 193         @Native private static final int _file_encoding_NDX = 1 + _display_variant_NDX;
 194         @Native private static final int _file_separator_NDX = 1 + _file_encoding_NDX;
 195         @Native private static final int _format_country_NDX = 1 + _file_separator_NDX;
 196         @Native private static final int _format_language_NDX = 1 + _format_country_NDX;
 197         @Native private static final int _format_script_NDX = 1 + _format_language_NDX;
 198         @Native private static final int _format_variant_NDX = 1 + _format_script_NDX;
 199         @Native private static final int _ftp_nonProxyHosts_NDX = 1 + _format_variant_NDX;
 200         @Native private static final int _ftp_proxyHost_NDX = 1 + _ftp_nonProxyHosts_NDX;
 201         @Native private static final int _ftp_proxyPort_NDX = 1 + _ftp_proxyHost_NDX;
 202         @Native private static final int _http_nonProxyHosts_NDX = 1 + _ftp_proxyPort_NDX;
 203         @Native private static final int _http_proxyHost_NDX = 1 + _http_nonProxyHosts_NDX;
 204         @Native private static final int _http_proxyPort_NDX = 1 + _http_proxyHost_NDX;
 205         @Native private static final int _https_proxyHost_NDX = 1 + _http_proxyPort_NDX;
 206         @Native private static final int _https_proxyPort_NDX = 1 + _https_proxyHost_NDX;
 207         @Native private static final int _java_io_tmpdir_NDX = 1 + _https_proxyPort_NDX;
 208         @Native private static final int _line_separator_NDX = 1 + _java_io_tmpdir_NDX;
 209         @Native private static final int _os_arch_NDX = 1 + _line_separator_NDX;




  73         // Use platform values if not overridden by a commandline -Dkey=value
  74         // In no particular order
  75         putIfAbsent(props, "os.name", raw.propDefault(Raw._os_name_NDX));
  76         putIfAbsent(props, "os.arch", raw.propDefault(Raw._os_arch_NDX));
  77         putIfAbsent(props, "os.version", raw.propDefault(Raw._os_version_NDX));
  78         putIfAbsent(props, "line.separator", raw.propDefault(Raw._line_separator_NDX));
  79         putIfAbsent(props, "file.separator", raw.propDefault(Raw._file_separator_NDX));
  80         putIfAbsent(props, "path.separator", raw.propDefault(Raw._path_separator_NDX));
  81         putIfAbsent(props, "java.io.tmpdir", raw.propDefault(Raw._java_io_tmpdir_NDX));
  82         putIfAbsent(props, "http.proxyHost", raw.propDefault(Raw._http_proxyHost_NDX));
  83         putIfAbsent(props, "http.proxyPort", raw.propDefault(Raw._http_proxyPort_NDX));
  84         putIfAbsent(props, "https.proxyHost", raw.propDefault(Raw._https_proxyHost_NDX));
  85         putIfAbsent(props, "https.proxyPort", raw.propDefault(Raw._https_proxyPort_NDX));
  86         putIfAbsent(props, "ftp.proxyHost", raw.propDefault(Raw._ftp_proxyHost_NDX));
  87         putIfAbsent(props, "ftp.proxyPort", raw.propDefault(Raw._ftp_proxyPort_NDX));
  88         putIfAbsent(props, "socksProxyHost", raw.propDefault(Raw._socksProxyHost_NDX));
  89         putIfAbsent(props, "socksProxyPort", raw.propDefault(Raw._socksProxyPort_NDX));
  90         putIfAbsent(props, "http.nonProxyHosts", raw.propDefault(Raw._http_nonProxyHosts_NDX));
  91         putIfAbsent(props, "ftp.nonProxyHosts", raw.propDefault(Raw._ftp_nonProxyHosts_NDX));
  92         putIfAbsent(props, "socksNonProxyHosts", raw.propDefault(Raw._socksNonProxyHosts_NDX));

  93         putIfAbsent(props, "sun.arch.abi", raw.propDefault(Raw._sun_arch_abi_NDX));
  94         putIfAbsent(props, "sun.arch.data.model", raw.propDefault(Raw._sun_arch_data_model_NDX));
  95         putIfAbsent(props, "sun.os.patch.level", raw.propDefault(Raw._sun_os_patch_level_NDX));
  96         putIfAbsent(props, "sun.stdout.encoding", raw.propDefault(Raw._sun_stdout_encoding_NDX));
  97         putIfAbsent(props, "sun.stderr.encoding", raw.propDefault(Raw._sun_stderr_encoding_NDX));
  98         putIfAbsent(props, "sun.io.unicode.encoding", raw.propDefault(Raw._sun_io_unicode_encoding_NDX));
  99         putIfAbsent(props, "sun.cpu.isalist", raw.propDefault(Raw._sun_cpu_isalist_NDX));
 100         putIfAbsent(props, "sun.cpu.endian", raw.propDefault(Raw._sun_cpu_endian_NDX));
 101 
 102         /* Construct i18n related options */
 103         fillI18nProps(props,"user.language", raw.propDefault(Raw._display_language_NDX),
 104                 raw.propDefault(Raw._format_language_NDX));
 105         fillI18nProps(props,"user.script",   raw.propDefault(Raw._display_script_NDX),
 106                 raw.propDefault(Raw._format_script_NDX));
 107         fillI18nProps(props,"user.country",  raw.propDefault(Raw._display_country_NDX),
 108                 raw.propDefault(Raw._format_country_NDX));
 109         fillI18nProps(props,"user.variant",  raw.propDefault(Raw._display_variant_NDX),
 110                 raw.propDefault(Raw._format_variant_NDX));
 111 
 112         return props;


 167         if (dispValue == null && display != null && !display.equals(baseValue)) {
 168             // Create the property only if different from the base property
 169             cmdProps.put(disp, display);
 170         }
 171 
 172         /* user.xxx.format property */
 173         String fmt = base.concat(".format");
 174         String fmtValue = cmdProps.get(fmt);
 175         if (fmtValue == null && format != null && !format.equals(baseValue)) {
 176             // Create the property only if different than the base property
 177             cmdProps.put(fmt, format);
 178         }
 179     }
 180 
 181     /**
 182      * Read the raw properties from native System.c.
 183      */
 184     public static class Raw {
 185         // Array indices written by native vmProperties()
 186         // The order is arbitrary (but alphabetic for convenience)
 187         @Native private static final int _display_country_NDX = 0;

 188         @Native private static final int _display_language_NDX = 1 + _display_country_NDX;
 189         @Native private static final int _display_script_NDX = 1 + _display_language_NDX;
 190         @Native private static final int _display_variant_NDX = 1 + _display_script_NDX;
 191         @Native private static final int _file_encoding_NDX = 1 + _display_variant_NDX;
 192         @Native private static final int _file_separator_NDX = 1 + _file_encoding_NDX;
 193         @Native private static final int _format_country_NDX = 1 + _file_separator_NDX;
 194         @Native private static final int _format_language_NDX = 1 + _format_country_NDX;
 195         @Native private static final int _format_script_NDX = 1 + _format_language_NDX;
 196         @Native private static final int _format_variant_NDX = 1 + _format_script_NDX;
 197         @Native private static final int _ftp_nonProxyHosts_NDX = 1 + _format_variant_NDX;
 198         @Native private static final int _ftp_proxyHost_NDX = 1 + _ftp_nonProxyHosts_NDX;
 199         @Native private static final int _ftp_proxyPort_NDX = 1 + _ftp_proxyHost_NDX;
 200         @Native private static final int _http_nonProxyHosts_NDX = 1 + _ftp_proxyPort_NDX;
 201         @Native private static final int _http_proxyHost_NDX = 1 + _http_nonProxyHosts_NDX;
 202         @Native private static final int _http_proxyPort_NDX = 1 + _http_proxyHost_NDX;
 203         @Native private static final int _https_proxyHost_NDX = 1 + _http_proxyPort_NDX;
 204         @Native private static final int _https_proxyPort_NDX = 1 + _https_proxyHost_NDX;
 205         @Native private static final int _java_io_tmpdir_NDX = 1 + _https_proxyPort_NDX;
 206         @Native private static final int _line_separator_NDX = 1 + _java_io_tmpdir_NDX;
 207         @Native private static final int _os_arch_NDX = 1 + _line_separator_NDX;


< prev index next >