[Bug 377] TimeZone.getOffset() fails for some TZ

bugzilla-daemon at icedtea.classpath.org bugzilla-daemon at icedtea.classpath.org
Sat Aug 29 12:44:56 PDT 2009


http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=377





------- Comment #6 from mark at klomp.org  2009-08-29 19:44 -------
The problem is this rule for Zone Asia/Amman:
Rule    Jordan  2002    max     -       Mar     lastThu 24:00   1:00    S

Which is explained as:

# > The Council of Ministers decided in 2002 to adopt the principle of timely
# > submission of the summer at 60 minutes as of midnight on the last Thursday
# > of the month of March of each year.
#
# So - this means the midnight between Thursday and Friday since 2002.

As can be seen by running the testcase:

$ java CalTest2
***begin***
Asia/Amman      7200000 Asia/Amman              true    3600000 
Exception in thread "main" java.lang.IllegalArgumentException: Illegal start
time 86400000
        at java.util.SimpleTimeZone.decodeStartRule(SimpleTimeZone.java:1376)
        at java.util.SimpleTimeZone.decodeRules(SimpleTimeZone.java:1340)
        at java.util.SimpleTimeZone.<init>(SimpleTimeZone.java:350)
        at sun.util.calendar.ZoneInfo.getLastRuleInstance(ZoneInfo.java:648)
        at sun.util.calendar.ZoneInfo.getLastRule(ZoneInfo.java:631)
        at sun.util.calendar.ZoneInfo.getOffsets(ZoneInfo.java:283)
        at sun.util.calendar.ZoneInfo.getOffset(ZoneInfo.java:229)
        at CalTest2.main(CalTest2.java:15)

that 86400000 = 24 hours * 60 minutes * 60 seconds * 1000 miliseconds. Which
means "at the end of the day". But SimpleTimeZone doesn't accept that:

            if (startTime < 0 || startTime >= millisPerDay) {
                throw new IllegalArgumentException(
                        "Illegal start time " + startTime);
            }

The simplest solution would be to change that >= to an > in decodeStartRule()
and probably also in decodeEndRule(). But I haven't looked at the rest of the
code to see if that would cause trouble sometime later.


-- 
Configure bugmail: http://icedtea.classpath.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the distro-pkg-dev mailing list