#459 DateAxis refreshTicksHorizontal(): endless loop

closed
nobody
None
5
2005-03-28
2005-03-24
gumshoe_sf
No

It is possible for refreshTicksHorizontal() in
DateAxis.java (CVS revision 1.10, compiled into
1.0.0-pre2) to enter an endless loop. This bug occurs
when in daylight savings time zones or not.

Once in the

while (tickDate.before(upperDate)) {

loop tickDate is advanced by

tickDate = unit.addToDate(tickDate);

and then can be changed back by
calculateDateForPosition(). If this roll back happens
to be the same interval as tickDate was just advanced
the while loop becomes endless.

I encountered this when creating a time series of 365
points spanning 1 year. Due to the size of my chart
addToDate() was advancing the date by two month
intervals and then when I resized the chart the date
was being advanced by one month intervals. Once this
happened calculateDateForPosition() started rolling
tickDate back by one month. It keeps rolling Nov 1 2004
back by one month in my dataset spanning March 2004 to
March 2005. I have been able to reproduce this with
other datasets.

Discussion

  • gumshoe_sf
    gumshoe_sf
    2005-03-28

    Logged In: YES
    user_id=1246167

    The problem is not with JFreeChart but with my incorrect
    usage of time zones. I was setting the time zone
    (TimeZone.setDefault(TimeZone.getTimeZone("UTC"))) in a
    class instantiated from the main class, which was using the
    default time zone (different from the one later set). When
    the time zone is set in the main class the problem does not
    occur.

     
  • gumshoe_sf
    gumshoe_sf
    2005-03-28

    • status: open --> closed
     
  • Danny Sadinoff
    Danny Sadinoff
    2010-03-16

    I'm also seeing infinite loops in DateAxis routines.