RFR (S): 7155168: java/util/TimeZone/Bug6912560.java: expected Asia/Tokyo
staffan.larsen at oracle.com
Tue Nov 27 12:26:17 UTC 2012
On 27 nov 2012, at 12:02, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 27/11/2012 10:22, Staffan Larsen wrote:
>> Please review this fix for the java/util/TimeZone/Bug6912560.java test.
>> The problem with the test is that it fails when running with Java Flight Recorder enabled. This is because JFR will call TimeZone.getDefault() when it starts up, before the main() method is called. This will cause TimeZone to cache the value so that when the test calls TimeZone.getDefault() it will get the old value. The solution here is to reset the value in the beginning of the test.
>> Webrev: http://cr.openjdk.java.net/~sla/7155168/webrev.00/test/java/util/TimeZone/Bug6912560.java.sdiff.html
> I suspect this test will fail with java agents too, say when doing code coverage during test runs.
> It might be better to just change the @run tag to specify -D user.timezone= Asia/Tokyo, assuming this solves the problem too.
The test installs a security manager and that has to be present during the call to getDefault() when getDefault() does the real work (not just reading from the cache). Setting -Duser.timezone will not help as the only fix.
More information about the core-libs-dev