[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/32443] Calendar.set(HOUR_OF_DAY) makes time jump back or
From: |
thomas dot g dot girard at free dot fr |
Subject: |
[Bug classpath/32443] Calendar.set(HOUR_OF_DAY) makes time jump back or forward |
Date: |
23 Jun 2007 13:49:21 -0000 |
------- Comment #2 from thomas dot g dot girard at free dot fr 2007-06-23
13:49 -------
This bug cannot be easily reproduced.
Using macfly[1] to set date back to 2007-06-20 (i.e. when I first encountered
it) helps a lot reproducing it.
To recap, to reproduce this bug:
1. set system date to 2007-06-20
2. launch the CalendarBug program, which:
a. creates a new Calendar
b. sets its date and time to 2005-05-23 08:04
c. sets its hour to 0
3. the date has changed to 2005-05-20!
The patch I'm about to attach fixes the problem for me, but I'm unsure about
its other consequences.
It removes three lines invalidating all isSet[] fields in Calendar.set().
Because of these invalidations, the next computeTime() call ended up in the
code block with if (! isSet[MONTH]) which would then use fields[DAY_OF_YEAR]
which was *not* updated in the first call to set() (in 2.b.) but computed in
2.a. Indeed fields[DAY_OF_YEAR] is only set in calculateDay(), which is itself
only called from computeField().
The patch avoids that code path. But it might break others. My understanding of
isSet[i] is that it's true if there is a value in the associated fields[i]. So
I don't see why setting a fields[j] should invalidate all fields[i] with i !=
j.
[1] http://software.inl.fr/trac/trac.cgi/wiki/Macfly
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32443