FULL PRODUCT VERSION :
java version " 1.7.0_25 "
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
Linux platform 3.5.0-25-generic #39~precise1-Ubuntu SMP Tue Feb 26 00:07:14 UTC 2013 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
We provide an webstart application which is downloaded with pack200
packed jars.
There a multiple jars referenced in the jnlp.
The first time the app is downloaded the timetone on the client is
not same like defined on the client system.
On the second start of the app (no download of jars) the timezone is correct.
When we delete the local application in java control panel the occurs again.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- put the provided main (see source code) into a signed pack200 jar.
- create some dummy jars with data an different sizes an provide them also in the jnlp
(also signed and packed, see example jnlp in source code). in my tests i needed about 10 jars to reproduce the problem consistently.
- the jars have to be bigger then the jar with the main class.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
TimeZone property: Europe/Berlin
TimeZone.getDefault(): sun.util.calendar.ZoneInfo[id= " Europe/Berlin " ,offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]
ACTUAL -
TimeZone property: Europe/Berlin
TimeZone.getDefault(): sun.util.calendar.ZoneInfo[id= " UTC " ,offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) {
System.out.println( " TimeZone property: " + System.getProperty( " user.timezone " ));
System.out.println( " TimeZone.getDefault(): " + TimeZone.getDefault());
}
<?xml version= " 1.0 " encoding= " utf-8 " ?>
<jnlp spec= " 1.0+ " codebase= " http://localhost:40000/ulcjnlp " >
<information>
<title>ABACUS</title>
<vendor>ABACUS Research AG</vendor>
<homepage href= " http://www.abacus.ch " />
<icon href= " http://localhost:40000/ulc/aba.jpg " />
</information>
<security>
<all-permissions/>
</security>
<resources>
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy1.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_TimeZoneBug.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy2.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy3.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy4.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy5.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy6.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy7.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy8.jar " />
<jar href= " http://localhost:40000/ulc/lib/signed_Dummy9.jar " />
</resources>
<application-desc main-class= " ch.abacus.java_bugs.Pack200WebStartTimeZoneBug " />
</jnlp>
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
put the following code into the first line of the main method:
final String zoneID = System.getProperty( " user.timezone " );
if(!TimeZone.getDefault().getID().equals(zoneID)) {
TimeZone.setDefault(TimeZone.getTimeZone(zoneID));
}