Hello,
I encountered a problem using TaskSeriesCollection.java. Here is the simplest way I found to reproduce it:
In DemoDatasetFactory.java, at the end of createGanttDataset2 right before the "return collection;" statement , add the 2 lines:
s1.getTasks().clear();
s1.fireSeriesChanged();
After recompiling, if you launch GanttDemo2, you get:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.jrefinery.data.TaskSeries.get(Unknown Source)
at com.jrefinery.data.TaskSeriesCollection.getStartValue(Unknown Source)
at com.jrefinery.data.DatasetUtilities.getRangeExtent(Unknown Source)
at com.jrefinery.chart.plot.HorizontalCategoryPlot.getHorizontalDataRange(Unk
at com.jrefinery.chart.axis.HorizontalDateAxis.autoAdjustRange(Unknown Source
at com.jrefinery.chart.axis.HorizontalDateAxis.configure(Unknown Source)
at com.jrefinery.chart.axis.Axis.setPlot(Unknown Source)
at com.jrefinery.chart.plot.CategoryPlot.<init>(Unknown Source)
at com.jrefinery.chart.plot.HorizontalCategoryPlot.<init>(Unknown Source)
at com.jrefinery.chart.ChartFactory.createGanttChart(Unknown Source)
at com.waidan.analysis.GanttDemo2.<init>(GanttDemo2.java:68)
at com.waidan.analysis.GanttDemo2.main(GanttDemo2.java:91)
I tried to investigate a bit: I modified code in TaskSeriesCollection.java the following way (several methods should be changed too...)
public Number getStartValue (int row, int column) {
Number result = new Integer(0); // SECOND POTENTIAL BUG HERE?
TaskSeries series = (TaskSeries) this.data.get(row);
int tasks = series.getItemCount();
if (column < tasks) { // FIRST POTENTIAL BUG HERE?
com.jrefinery.data.Task task = series.get(column);
result = new Long(task.getDuration().getStart().getTime());
}
return result;
}
But, I then got a BadPath exception... and I'm lost!
Thank for the help.
Regards,
bye
jp
Potential bug when clearing a serie in TaskSeriesCollection.
Re: Potential bug when clearing a serie in TaskSeriesCollect
Thanks for the report. I've added this to the bug database on SourceForge (697153), and will look at it when I get a chance.
Regards,
Dave Gilbert
Regards,
Dave Gilbert