Hi Sean (CC distro-pkg-dev added), On Sun, 2009-08-30 at 13:34 +0100, Sean Coffey wrote: > Mark Wielaard wrote: > > I was debugging the following bug report: > > http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=377 > > "TimeZone.getOffset() fails for some TZ" > > The issue is caused because there is a start rule in the Asia/Amman > > timezone that starts at the end of a day. SimpleTimeZone doesn't allow > > that. I have a simple "fix" (attached), but I haven't fully tested it > > yet, and don't know if there could be other problems with allowing a > > rule to start on the last milisecond of a day. > > > > I noticed there is a similar bug report here: > > http://bugs.sun.com/view_bug.do?bug_id=6851214 > > That is marked as "State 11-Closed, Verified, bug". > > There is however very little information on how this was fixed. > > Does anybody on this list know more? > > Yes - that's the same fix that was put in the JDK releases. > The issue is only relevant for the Asia/Amman TZ as you mentioned.
Thanks for the update and confirmation of the fix. I added it to IcedTea6 plus a new testcase for the general issue. 2009-08-30 Mark Wielaard <m...@klomp.org> PR377. SimpleTimeZone checks too strict for Asia/Amman TimeZone. * overlays/openjdk/jdk/test/java/util/SimpleTimeZone/EndOfDay.java: New test. * patches/icedtea-simpletimezone-relax.patch: New patch. * Makefile.am: Add new patch. * HACKING: Describe new patch. Thanks, Mark
diff -r 188db4af2dc5 -r b8b498cda0b0 HACKING --- a/HACKING Fri Aug 28 09:18:57 2009 -0400 +++ b/HACKING Sun Aug 30 17:58:20 2009 +0200 @@ -114,8 +114,10 @@ * icedtea-lucene-crash.patch: Fix lucene bad code generation bug #6707044. * icedtea-6700047-loopopts.patch: Fix partial peeling issue, bug #6700047. * icedtea-6712835-ifnode.patch: Fix infinite loop in PhaseIterGVN::transform. -* icedtea-timezone.patch : Makes java only look for time zone information in /etc/sysconfig/clock if /etc/localtime is not found (fix - for rh-489586) +* icedtea-timezone.patch : Makes java only look for time zone information in + /etc/sysconfig/clock if /etc/localtime is not found (fix for rh-489586) +* icedtea-simpletimezone-relax.patch: Fix for PR377, Jordan end of day rule + in Asia/Amman TimeZone. SimpleTimeZone checks too strict. * icedtea-dnd-filelists.patch: Fix drag and drop behaviour when dragging a file list between JVMs (S5079469). Backported from OpenJDK. * icedtea-signed-types-hot6.patch: Make use of unsigned/signed types explicit. * openjdk/6648816.patch: Backport of regression (NPE) fix in AccessControlContext diff -r 188db4af2dc5 -r b8b498cda0b0 Makefile.am --- a/Makefile.am Fri Aug 28 09:18:57 2009 -0400 +++ b/Makefile.am Sun Aug 30 17:58:20 2009 +0200 @@ -540,6 +540,7 @@ patches/icedtea-rmi_amd64.patch \ patches/icedtea-tools.patch \ patches/icedtea-timezone.patch \ + patches/icedtea-simpletimezone-relax.patch \ patches/icedtea-use-system-tzdata.patch \ patches/icedtea-headers.patch \ patches/hotspot/$(HSBUILD)/icedtea-headers.patch \ diff -r 188db4af2dc5 -r b8b498cda0b0 overlays/openjdk/jdk/test/java/util/SimpleTimeZone/EndOfDay.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/overlays/openjdk/jdk/test/java/util/SimpleTimeZone/EndOfDay.java Sun Aug 30 17:58:20 2009 +0200 @@ -0,0 +1,23 @@ +/* + * @test + * @bug 0000377 + * @summary SimpleTimeZone should accept start/end rules at end of day + */ + +import java.util.Calendar; +import java.util.SimpleTimeZone; + +public class EndOfDay +{ + public static void main(String[] args) + { + SimpleTimeZone stz; + stz = new SimpleTimeZone(0, "End/Day", + Calendar.MARCH, -1, Calendar.FRIDAY, + 24 * 60 * 60 * 1000, + Calendar.APRIL, 1, Calendar.THURSDAY, + 24 * 60 * 60 * 1000, + 3600000); + System.err.println(stz); + } +} diff -r 188db4af2dc5 -r b8b498cda0b0 patches/icedtea-simpletimezone-relax.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/icedtea-simpletimezone-relax.patch Sun Aug 30 17:58:20 2009 +0200 @@ -0,0 +1,21 @@ +diff -r 348fce38de3f src/share/classes/java/util/SimpleTimeZone.java +--- openjdk/jdk/src/share/classes/java/util/SimpleTimeZone.java Fri Jun 26 19:50:44 2009 +0400 ++++ openjdk/jdk/src/share/classes/java/util/SimpleTimeZone.java Sat Aug 29 22:36:41 2009 +0200 +@@ -1372,7 +1372,7 @@ + throw new IllegalArgumentException( + "Illegal start month " + startMonth); + } +- if (startTime < 0 || startTime >= millisPerDay) { ++ if (startTime < 0 || startTime > millisPerDay) { + throw new IllegalArgumentException( + "Illegal start time " + startTime); + } +@@ -1419,7 +1419,7 @@ + throw new IllegalArgumentException( + "Illegal end month " + endMonth); + } +- if (endTime < 0 || endTime >= millisPerDay) { ++ if (endTime < 0 || endTime > millisPerDay) { + throw new IllegalArgumentException( + "Illegal end time " + endTime); + }