-
Enhancement
-
Resolution: Fixed
-
P4
-
18
-
b21
-
linux
When the /etc/localtime is a symlink and non-standard path, like "../usr/share/zoneinfo//Asia/Shanghai", default timezone return GMT. But we expect it to return zone ID.
This can be reproduced in the following way.
rm -rf /etc/localtime
ln -s ../usr/share/zoneinfo//Asia/Shanghai /etc/localtime
${TEST_JDK}/bin/java TestTimeZone
TestTimeZone source:
---------- BEGIN SOURCE ----------
import java.util.*;
public class TestTimeZone {
public static void main(String args[])
{
TimeZone time_zone_default = TimeZone.getDefault();
System.out.println("Default TimeZone: " + time_zone_default);
}
}
---------- END SOURCE ----------
EXPECTED
Default TimeZone: sun.util.calendar.ZoneInfo[id="Asia/Shanghai",offset=28800000,dstSavings=0,useDaylight=false,transitions=31,lastRule=null]
ACTUAL
Default TimeZone: sun.util.calendar.ZoneInfo[id="GMT+08:00",offset=28800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
This can be reproduced in the following way.
rm -rf /etc/localtime
ln -s ../usr/share/zoneinfo//Asia/Shanghai /etc/localtime
${TEST_JDK}/bin/java TestTimeZone
TestTimeZone source:
---------- BEGIN SOURCE ----------
import java.util.*;
public class TestTimeZone {
public static void main(String args[])
{
TimeZone time_zone_default = TimeZone.getDefault();
System.out.println("Default TimeZone: " + time_zone_default);
}
}
---------- END SOURCE ----------
EXPECTED
Default TimeZone: sun.util.calendar.ZoneInfo[id="Asia/Shanghai",offset=28800000,dstSavings=0,useDaylight=false,transitions=31,lastRule=null]
ACTUAL
Default TimeZone: sun.util.calendar.ZoneInfo[id="GMT+08:00",offset=28800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]