Patch to expand tz checking scope in TimeZone_md.c

David Holmes david.holmes at oracle.com
Wed Nov 2 11:00:14 UTC 2011


On 2/11/2011 7:01 PM, Jonathan Lu wrote:
> On 11/02/2011 04:56 PM, Jonathan Lu wrote:
>> Hi core-libs-dev,
>>
>> In jdk/src/solaris/native/java/util/TimeZone_md.c, starting from line
>> 626, I found that the scope of "#ifdef __solaris__" might be too
>> narrow, since it also works for some kind of OS which I'm currently
>> working on, such as AIX.
>> So I suggest to just remove the '#ifdef __solaris__' and leave the
>> "#else" to accommodate more conditions, see attachment 'patch.diff'. I
>> think this may enhance the cross-platform ability, any ideas about
>> this modification?
>>
>> Regards
>> - Jonathan Lu
> I'm not sure why the attachment got filtered, here paste it to the mail
> content directly.
>
> diff -r 4788745572ef src/solaris/native/java/util/TimeZone_md.c
> --- a/src/solaris/native/java/util/TimeZone_md.c Mon Oct 17 19:06:53
> 2011 -0700
> +++ b/src/solaris/native/java/util/TimeZone_md.c Thu Oct 20 13:43:47
> 2011 +0800
> @@ -626,10 +626,8 @@
> #ifdef __linux__
> if (tz == NULL) {
> #else
> -#ifdef __solaris__
> if (tz == NULL || *tz == '\0') {
> #endif
> -#endif
> tz = getPlatformTimeZoneID();
> freetz = tz;
> }

I'm unclear why any of that code needs to be platform specific - is an 
empty TZ string somehow valid on linux? I would have thought the 
following would be platform neutral:

    if (tz == NULL || *tz == '\0') {
         tz = getPlatformTimeZoneID();
         freetz = tz;
     }

David
-----

> Regards
> - Jonathan Lu



More information about the core-libs-dev mailing list