JDK-8025879 : Java Webstart downloading packed files can result in Timezone set to UTC
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 7u40
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_8
  • Submitted: 2013-09-26
  • Updated: 2014-12-09
  • Resolved: 2013-10-03
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.2.9200]

A DESCRIPTION OF THE PROBLEM :
This is i guess related to this bug:

JDK-6791805 : Pack200 unpacker implementation can set timezone to utc

problem is this, when the java (webstart) cache is cleared, so javawebstart has to download all the jars from the server to start the application.
Those jars are all pack200 files. Currently java webstart download them in a few threads together
I guess the unpacker is then used as in that issue above. Because the unpacker is running in more then one thread the default timezone check and set back is completely bogus.

So the end result is that if should be in timezone "pst" but in the end it is just "utc"

if the jars are already downloaded so the next start of the application then it is fine


REGRESSION.  Last worked in version 6u43

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
have a webstart applicaiton with a lot of jars that are all pack200 files.
so that the client webstart app will download them over multiply threads then it is very likely to happen that the timezone is sticking to utc

Why (un)packer needs to fiddle with the default timezone i still don't get, why not just give it as a state to the right functions, so that you don't depend on a default toggling.



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
that the application is always in the correct timezone

ACTUAL -
TimeZone.getDefault() can be UTC instead of the actual one.

REPRODUCIBILITY :
This bug can be reproduced often.

CUSTOMER SUBMITTED WORKAROUND :
doing this as the first thing in the main:

public static void main(final String[] args)
{
String userTimeZone = System.getProperty("user.timezone");
// Bug around java when downloading the first time (pack or gzip seems to alter the timezone and don't set it back)
if (userTimeZone != null && !userTimeZone.equals(TimeZone.getDefault().getID()))
{
TimeZone timeZone = TimeZone.getTimeZone(userTimeZone);
if (userTimeZone.equals(timeZone.getID()))
{
TimeZone.setDefault(timeZone);
}
}


so i really look what the user.timezone property is and if the TimeZone.getDefault is the correct one at the first entry point of my application.
When jars are being downloaded that setDefault is hit constantly
Comments
Regression from JDK 6. Unclear if this needs to be addressed in >= JDK7
03-10-2013