TimeZone.setDefault changes in JDK6

时光总嘲笑我的痴心妄想 提交于 2019-11-27 22:05:27

Searching the bugs database was actually quite a good idea :)

http://bugs.sun.com/view_bug.do?bug_id=6352812

and also (re docs):

http://bugs.sun.com/view_bug.do?bug_id=6181786

Summary: JDK 1.5 was an exception to the rule, with JDK 1.6 things are back to 'normal', which, according to the docs, is that a timezone change is VM wide.

This was probably done to fix a bug. I'd search bugs.sun.com to find the rationale for it. (Clues might also be found in the release notes.)

The API documentation for TimeZone.getDefault() states that "the source of the default TimeZone may vary with implementation." If your code relies on implementation specific behaviour of the standard API classes (in this case, that the default time zone is kept at a thread local level), you must expect that your code fails with newer versions of the VM or with VMs from different vendors.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!