Program: 70677
Project: 70677
Buggy source:
public void changeTask(Notification notification){
  if (previewPainter != null) {
    if (notification == null) {
      if (getChartModel() instanceof ChartWithAxes) {
        checkDataTypeForChartWithAxes();
      }
      return;
    }
    List<String> errorMsgs=new ArrayList<String>(2);
    if ((notification.getNotifier() instanceof Query && ((Query)notification.getNotifier()).eContainer() instanceof Series)) {
      errorMsgs.addAll(checkDataType((Query)notification.getNotifier(),(Series)((Query)notification.getNotifier()).eContainer()));
      if (!(((ChartWizardContext)getContext()).getChartType() instanceof GanttChart) && !getDataServiceProvider().checkState(IDataServiceProvider.SHARE_QUERY) && getDataServiceProvider().checkState(IDataServiceProvider.HAS_DATA_SET)) {
        if (getChartModel() instanceof ChartWithAxes) {
          Axis axisWithCurrentQuery=(Axis)((Query)notification.getNotifier()).eContainer().eContainer().eContainer();
          if (ChartUIUtil.getAxisXForProcessing((ChartWithAxes)getChartModel()).isCategoryAxis() && axisWithCurrentQuery.eContainer() instanceof Axis) {
            SeriesDefinition base=ChartUIUtil.getBaseSeriesDefinitions(getChartModel()).get(0);
            if (!base.getGrouping().isEnabled()) {
              base.getGrouping().setEnabled(true);
            }
            if (axisWithCurrentQuery.getType() == AxisType.DATE_TIME_LITERAL) {
              SeriesDefinition valueSdWithCurrQuery=(SeriesDefinition)((Query)notification.getNotifier()).eContainer().eContainer();
              valueSdWithCurrQuery.getGrouping().setEnabled(true);
              valueSdWithCurrQuery.getGrouping().setAggregateExpression("String_Node_Str");
            }
          }
        }
 else {
          if (((Query)notification.getNotifier()).eContainer().eContainer().eContainer() instanceof SeriesDefinition) {
            SeriesDefinition base=ChartUIUtil.getBaseSeriesDefinitions(getChartModel()).get(0);
            if (!base.getGrouping().isEnabled()) {
              base.getGrouping().setEnabled(true);
            }
          }
        }
      }
    }
    if (notification.getNotifier() instanceof SeriesDefinition && getChartModel() instanceof ChartWithAxes) {
      errorMsgs.addAll(checkDataTypeForChartWithAxes());
    }
    if (notification.getNotifier() instanceof Query || notification.getNotifier() instanceof Axis || notification.getNotifier() instanceof SeriesDefinition|| notification.getNotifier() instanceof SeriesGrouping) {
      doPreview(errorMsgs);
    }
 else     if (ChartPreviewPainter.isLivePreviewActive()) {
      ChartAdapter.beginIgnoreNotifications();
      ChartUIUtil.syncRuntimeSeries(getChartModel());
      ChartAdapter.endIgnoreNotifications();
      doPreview(errorMsgs);
    }
 else {
      doPreview(errorMsgs);
    }
  }
}

Fixed version (ground truth):
public void changeTask(Notification notification){
  if (previewPainter != null) {
    if (notification == null) {
      if (getChartModel() instanceof ChartWithAxes) {
        checkDataTypeForChartWithAxes();
      }
      return;
    }
    List<String> errorMsgs=new ArrayList<String>(2);
    if ((notification.getNotifier() instanceof Query && ((Query)notification.getNotifier()).eContainer() instanceof Series)) {
      Query query=(Query)notification.getNotifier();
      errorMsgs.addAll(checkDataType(query,(Series)query.eContainer()));
      if (!(((ChartWizardContext)getContext()).getChartType() instanceof GanttChart) && !getDataServiceProvider().checkState(IDataServiceProvider.SHARE_QUERY) && getDataServiceProvider().checkState(IDataServiceProvider.HAS_DATA_SET)) {
        if (getChartModel() instanceof ChartWithAxes) {
          Axis axisWithCurrentQuery=(Axis)((Query)notification.getNotifier()).eContainer().eContainer().eContainer();
          if (ChartUIUtil.getAxisXForProcessing((ChartWithAxes)getChartModel()).isCategoryAxis() && axisWithCurrentQuery.eContainer() instanceof Axis) {
            SeriesDefinition base=ChartUIUtil.getBaseSeriesDefinitions(getChartModel()).get(0);
            if (!base.getGrouping().isEnabled()) {
              base.getGrouping().setEnabled(true);
            }
            if (axisWithCurrentQuery.getType() == AxisType.DATE_TIME_LITERAL || getDataServiceProvider().getDataType(query.getDefinition()) == DataType.DATE_TIME_LITERAL) {
              if (query.getGrouping() == null) {
                query.setGrouping(DataFactoryImpl.init().createSeriesGrouping());
              }
              SeriesGrouping group=query.getGrouping();
              group.setEnabled(true);
              group.setAggregateExpression("String_Node_Str");
            }
          }
        }
 else {
          if (((Query)notification.getNotifier()).eContainer().eContainer().eContainer() instanceof SeriesDefinition) {
            SeriesDefinition base=ChartUIUtil.getBaseSeriesDefinitions(getChartModel()).get(0);
            if (!base.getGrouping().isEnabled()) {
              base.getGrouping().setEnabled(true);
            }
          }
        }
      }
    }
    if (notification.getNotifier() instanceof SeriesDefinition && getChartModel() instanceof ChartWithAxes) {
      errorMsgs.addAll(checkDataTypeForChartWithAxes());
    }
    if (notification.getNotifier() instanceof Query || notification.getNotifier() instanceof Axis || notification.getNotifier() instanceof SeriesDefinition|| notification.getNotifier() instanceof SeriesGrouping) {
      doPreview(errorMsgs);
    }
 else     if (ChartPreviewPainter.isLivePreviewActive()) {
      ChartAdapter.beginIgnoreNotifications();
      ChartUIUtil.syncRuntimeSeries(getChartModel());
      ChartAdapter.endIgnoreNotifications();
      doPreview(errorMsgs);
    }
 else {
      doPreview(errorMsgs);
    }
  }
}