Program: 70243
Project: 70243
Buggy source:
/** 
 * Format base series data. Now it is only used to format datetime data, format date for different grouping unit.
 * @param cm
 * @param lhmLookup
 * @param rowSet
 */
public void formatBaseSeriesData(Chart cm,GroupingLookupHelper lhmLookup,List rowSet) throws ChartException {
  SeriesDefinition sdBase=null;
  if (cm instanceof ChartWithAxes) {
    ChartWithAxes cwa=(ChartWithAxes)cm;
    Axis[] axaBase=cwa.getBaseAxes();
    for (int j=0; j < axaBase.length; j++) {
      sdBase=axaBase[j].getSeriesDefinitions().get(0);
    }
  }
 else   if (cm instanceof ChartWithoutAxes) {
    ChartWithoutAxes cwoa=(ChartWithoutAxes)cm;
    sdBase=cwoa.getSeriesDefinitions().get(0);
  }
  final SeriesGrouping sg=sdBase.getGrouping();
  if (sg == null || !sg.isEnabled()) {
    return;
  }
  final Series seBaseDesignTime=sdBase.getDesignTimeSeries();
  final Query q=seBaseDesignTime.getDataDefinition().get(0);
  final int iBaseColumnIndex=lhmLookup.findIndexOfBaseSeries(q.getDefinition());
  final DataType dtGrouping=sg.getGroupType();
  String aggr=sdBase.getGrouping().getAggregateExpression();
  IAggregateFunction aFunc=PluginSettings.instance().getAggregateFunction(aggr);
  boolean bIsSumAggr=aFunc != null && aFunc.getType() == IAggregateFunction.SUMMARY_AGGR;
  if (dtGrouping == DataType.DATE_TIME_LITERAL && bIsSumAggr) {
    int cunit=GroupingUtil.groupingUnit2CDateUnit(sg.getGroupingUnit());
    CDateTime baseReference=null;
    for (Iterator iter=rowSet.iterator(); iter.hasNext(); ) {
      Object[] oaTuple=(Object[])iter.next();
      Object obj=oaTuple[iBaseColumnIndex];
      if (obj instanceof CDateTime) {
        baseReference=(CDateTime)obj;
      }
 else       if (obj instanceof Calendar) {
        baseReference=new CDateTime((Calendar)obj);
      }
 else       if (obj instanceof Date) {
        baseReference=new CDateTime((Date)obj);
      }
 else {
        baseReference=new CDateTime(0);
      }
      baseReference.clearBelow(cunit);
      oaTuple[iBaseColumnIndex]=baseReference;
    }
  }
}

Fixed version (ground truth):
/** 
 * Format base series data. Now it is only used to format datetime data, format date for different grouping unit.
 * @param cm
 * @param lhmLookup
 * @param rowSet
 */
public void formatBaseSeriesData(Chart cm,GroupingLookupHelper lhmLookup,List rowSet) throws ChartException {
  SeriesDefinition sdBase=null;
  if (cm instanceof ChartWithAxes) {
    ChartWithAxes cwa=(ChartWithAxes)cm;
    Axis[] axaBase=cwa.getBaseAxes();
    for (int j=0; j < axaBase.length; j++) {
      sdBase=axaBase[j].getSeriesDefinitions().get(0);
    }
  }
 else   if (cm instanceof ChartWithoutAxes) {
    ChartWithoutAxes cwoa=(ChartWithoutAxes)cm;
    sdBase=cwoa.getSeriesDefinitions().get(0);
  }
  final SeriesGrouping sg=sdBase.getGrouping();
  if (sg == null || !sg.isEnabled()) {
    return;
  }
  final Series seBaseDesignTime=sdBase.getDesignTimeSeries();
  final Query q=seBaseDesignTime.getDataDefinition().get(0);
  final int iBaseColumnIndex=lhmLookup.findIndexOfBaseSeries(q.getDefinition());
  final DataType dtGrouping=sg.getGroupType();
  String aggr=sdBase.getGrouping().getAggregateExpression();
  IAggregateFunction aFunc=PluginSettings.instance().getAggregateFunction(aggr);
  boolean bIsSumAggr=aFunc != null && aFunc.getType() == IAggregateFunction.SUMMARY_AGGR;
  if (dtGrouping == DataType.DATE_TIME_LITERAL && bIsSumAggr) {
    int cunit=GroupingUtil.groupingUnit2CDateUnit(sg.getGroupingUnit());
    CDateTime baseReference=null;
    for (Iterator iter=rowSet.iterator(); iter.hasNext(); ) {
      Object[] oaTuple=(Object[])iter.next();
      Object obj=oaTuple[iBaseColumnIndex];
      if (obj instanceof CDateTime) {
        baseReference=(CDateTime)obj;
      }
 else {
        baseReference=new CDateTime(0);
      }
      baseReference.clearBelow(cunit);
      oaTuple[iBaseColumnIndex]=baseReference;
    }
  }
}