FULL PRODUCT VERSION : j2re1.4.2_13 ADDITIONAL OS VERSION INFORMATION : Microsoft Windows XP [Version 5.1.2600] A DESCRIPTION OF THE PROBLEM : After introduction of Daylight Savings Time in Western Australia, I used the Timezone Updater Tool to update the timezones. I got incorrect results parsing and formatting times in this timezone. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Run the Timezone Updater Tool to make sure the latest timezones are available 2. Run Test code below for timezones Australia/Perth and compare running it for Australia/Melbourne EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Output: Success ACTUAL - Output: 20071112020000 Coordinated Universal Time -> 20071112110000 Western Summer Time (Australia) in DST 20071112030000 Coordinated Universal Time since epoch before: 1194832800000 since epoch after 1194836400000 REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public void testSimple() { TimeZone tz = TimeZone.getTimeZone("Australia/Perth"); //TimeZone tz = TimeZone.getTimeZone("Australia/Melbourne"); TimeZone utcTZ = TimeZone.getTimeZone("UTC"); SimpleDateFormat f = new SimpleDateFormat("yyyyMMddHHmmss zzzz"); f.setTimeZone(tz); String time = "20071112020000 Coordinated Universal Time"; SimpleDateFormat utcFormatter = new SimpleDateFormat("yyyyMMddHHmmss zzzz"); utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); String output; Date date; String dateS; boolean inDST; long sinceEpoch1; long sinceEpoch2; try { output = time; date = utcFormatter.parse(time); sinceEpoch1 = date.getTime(); dateS = f.format(date); output += " -> " + dateS; inDST = tz.inDaylightTime(date); if (!inDST) { output += " not"; } output +=" in DST"; date = f.parse(dateS); sinceEpoch2 = date.getTime(); f.setTimeZone(utcTZ); dateS = utcFormatter.format(date); output += "\n" + dateS; if (!dateS.equals(time)) { output += "\nsince epoch before: " + sinceEpoch1 + " since epoch after " + sinceEpoch2; System.out.println(output); } else { System.out.println("Success"); } } catch (ParseException e) { e.printStackTrace(System.err); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Have not found a workaround.
|