<i18n dev> Using system tzdata

Masayoshi Okutsu Masayoshi.Okutsu at Sun.COM
Wed Aug 15 18:54:01 PDT 2007


Hi Keith,

Sorry for taking time to respond. I've filed an RFE for this request to 
make sure Sun's JRE supports the same mechanism. Sun's Change Request ID 
(aka bug ID) is 6593486.

I have a few comments on the change.

    * I think the "java." name space should be avoided for this purpose.
      "user.timezone.dir" should be OK.
    * I'd also suggest that "/usr/share/zoneinfo/java" be changed to
      something like "/usr/share/javazi" because Java runtime may search
      files under /usr/share/zoneinfo to detect the platform time zone
      setting. It costs extra to skip all the files under
      /usr/share/zoneinfo/java if the directory comes before other
      directories in /usr/share/zoneinfo. Also I think
      /usr/share/zoneinfo should contain the native Olson time zone data
      files only.
    * I'm not sure if the current implementation is robust enough to be
      able to reject all broken data files. It does check magic numbers,
      though. You may need extra tests with random directory paths. Or
      you could add more checking to see if the directory is right, such
      as existence of the ZoneInfoMappings file.

Thanks,
--
Masayoshi Okutsu
Java Internationalization
Sun Microsystems

On 8/16/2007 1:52 AM, Keith Seitz wrote:
> Ping?
>
> Iris Garcia wrote:
>> Hi, Keith.
>>
>> The timezone information files are owned by the i18n team
>> (i18n-dev at openjdk.java.net).  They should be able to provide you with
>> guidance.
>>
>> Thanks,
>> iris
>>
>>> Date: Wed, 08 Aug 2007 12:40:08 -0700
>>> From: Keith Seitz <keiths at redhat.com>
>>> Subject: Using system tzdata
>>>
>>> Hi,
>>>
>>> The JRE contains pre-compiled timezone information files. As an OS
>>> vendor, Red Hat would prefer not to respin or repackage the JRE every
>>> time tzdata changes somewhere in the world.
>>>
>>> In order to facilitate this, we're in the process of modifying our
>>> tzdata package to include pre-compiled zoneinfo files for use with 
>>> JREs.
>>> I have created a patch to the openjdk JRE that would optionally use
>>> these files instead of the pre-packaged ones in the JRE.
>>>
>>> We would really like to solicit advice/comments about how to get
>>> something like this accepted upstream so that other distros can use 
>>> this.
>>>
>>> Keith
>>>
>>>
>>> --- openjdk/hotspot/src/os/linux/vm/os_linux.cpp.keiths    
>>> 2007-08-01 10:21:19.000000000 -0700
>>> +++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp    2007-08-01 
>>> 10:21:36.000000000 -0700
>>> @@ -376,6 +376,10 @@
>>>      }
>>>    }
>>>  
>>> +  // Use the system zoneinfo files, if present
>>> +  SystemProperty* sp = Arguments::system_properties();
>>> +  Arguments::PropertyList_add (&sp,
>>> +                   "java.zoneinfo.dir", "/usr/share/zoneinfo/java");
>>>  #undef malloc
>>>  #undef getenv
>>>  #undef EXTENSIONS_DIR
>>> --- 
>>> openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java.keiths    
>>> 2007-08-01 12:31:03.000000000 -0700
>>> +++ 
>>> openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java    
>>> 2007-08-01 12:29:44.000000000 -0700
>>> @@ -1021,10 +1021,18 @@
>>>      byte[] buffer = null;
>>>  
>>>      try {
>>> -        String homeDir = (String) AccessController.doPrivileged(
>>> +        String zi_dir = (String) AccessController.doPrivileged(
>>> +                    new 
>>> sun.security.action.GetPropertyAction("java.zoneinfo.dir"));
>>> +        File dir = null;
>>> +        if (zi_dir != null)
>>> +          dir = new File(zi_dir);
>>> +        if (dir == null || !dir.exists() || !dir.isDirectory()) {
>>> +          String homeDir = (String) AccessController.doPrivileged(
>>>                  new 
>>> sun.security.action.GetPropertyAction("java.home"));
>>> -        final String fname = homeDir + File.separator + "lib" + 
>>> File.separator
>>> -                 + "zi" + File.separator + fileName;
>>> +          zi_dir = homeDir + File.separator + "lib" + File.separator
>>> +        + "zi";
>>> +        }
>>> +        final String fname =  zi_dir + File.separator + fileName;
>>>          buffer = (byte[]) AccessController.doPrivileged(new 
>>> PrivilegedExceptionAction() {
>>>          public Object run() throws IOException {
>>>              File file = new File(fname);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/i18n-dev/attachments/20070816/96ad8c9f/attachment.html 


More information about the i18n-dev mailing list