JDK-8041674 : user.timezone property not initialized after System.setProperties(null)
Type:Bug
Component:core-libs
Sub-Component:java.lang
Affected Version:9
Priority:P4
Status:Open
Resolution:Unresolved
OS:generic
CPU:generic
Submitted:2014-04-24
Updated:2016-09-09
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The value is left empty.
The value is initialized in java.util.TimeZone but will not be retained across reinitializations.
Comments
In JDK 8, the above test output is:
os.name=Windows 7
user.timezone=Asia/Shanghai
os.name=Windows 7
user.timezone=Asia/Shanghai
os.name=Windows 7
user.timezone=
08-06-2016
public class Test {
public static void main(String[] args) {
System.out.println("os.name=" + System.getProperty("os.name"));
System.out.println("user.timezone=" + System.getProperty("user.timezone"));
TimeZone.getDefault();
System.out.println("os.name=" + System.getProperty("os.name"));
System.out.println("user.timezone=" + System.getProperty("user.timezone"));
System.setProperties(null);
System.out.println("os.name=" + System.getProperty("os.name"));
System.out.println("user.timezone=" + System.getProperty("user.timezone"));
}
}
The output is:
os.name=Windows 7
user.timezone=
os.name=Windows 7
user.timezone=Asia/Shanghai
os.name=Windows 7
user.timezone=