The constructor of DefaultXYDataSource incorrectly assumes that all series will have the same extact count of items in them and that causes ArrayOutOfBounds exception in such cases.
public DefaultXYDataSource(List seriesNames, Object[][][] data) {
this.seriesNames = seriesNames;
int seriesCount = data.length;
int maxItemCount = data[0].length;
^^^^
This assignment of data[0].length is at fault.
The fix is here: Since maxItemCount is only used in the loop following, instead of preassigning a value to it before the loop, do the assignment in the loop:
Here is the relevant part of the code:
public DefaultXYDataSource(List seriesNames, Object[][][] data) {
this.seriesNames = seriesNames;
int seriesCount = data.length;
allSeriesData = new ArrayList(seriesCount);
for (int seriesIndex=0; seriesIndex<seriesCount; seriesIndex++)
{
List oneSeriesData = new ArrayList();
int maxItemCount = data[seriesIndex].length;
for (int itemIndex=0; itemIndex<maxItemCount; itemIndex++)
Bug in DefaultXYDataSource
RE: Bug in DefaultXYDataSource
Andrzej,
Thanks for finding and fixing this bug. The correction has been made and will be in the next release.
Regards,
DG.
Thanks for finding and fixing this bug. The correction has been made and will be in the next release.
Regards,
DG.