Program: 68478
Project: 68478
Buggy source:
private void updateQuery(String queryType,Query query,String expr,SeriesDefinition seriesDefinition){
  String actualExpr=expr;
  if (dataProvider.checkState(IDataServiceProvider.SHARE_QUERY) || dataProvider.checkState(IDataServiceProvider.INHERIT_COLUMNS_GROUPS)) {
    boolean isGroupOrAggr=false;
    Object obj=getCurrentColumnHeadObject();
    if (obj instanceof ColumnBindingInfo) {
      ColumnBindingInfo cbi=(ColumnBindingInfo)obj;
      int type=cbi.getColumnType();
      if (type == ColumnBindingInfo.GROUP_COLUMN || type == ColumnBindingInfo.AGGREGATE_COLUMN) {
        actualExpr=cbi.getExpression();
        isGroupOrAggr=true;
      }
    }
    if (seriesDefinition != null && (queryType.equals(ChartUIConstants.QUERY_CATEGORY) || queryType.equals(ChartUIConstants.QUERY_VALUE))) {
      seriesDefinition.getGrouping().setEnabled(isGroupOrAggr);
    }
  }
  if (ChartUIConstants.QUERY_VALUE.equals(queryType)) {
    if (!dataProvider.checkState(IDataServiceProvider.SHARE_QUERY) && dataProvider.checkState(IDataServiceProvider.HAS_DATA_SET)) {
      if (dataProvider.getDataType(actualExpr) == DataType.DATE_TIME_LITERAL) {
        ChartAdapter.beginIgnoreNotifications();
        if (query.getGrouping() == null) {
          query.setGrouping(DataFactoryImpl.init().createSeriesGrouping());
        }
        SeriesGrouping group=query.getGrouping();
        group.setEnabled(true);
        group.setAggregateExpression("String_Node_Str");
        ChartAdapter.endIgnoreNotifications();
      }
    }
  }
  query.setDefinition(actualExpr);
}

Fixed version (ground truth):
private void updateQuery(String queryType,Query query,String expr,SeriesDefinition seriesDefinition){
  String actualExpr=expr;
  if (dataProvider.checkState(IDataServiceProvider.SHARE_QUERY) || dataProvider.checkState(IDataServiceProvider.INHERIT_COLUMNS_GROUPS)) {
    boolean isGroupOrAggr=false;
    Object obj=getCurrentColumnHeadObject();
    if (obj instanceof ColumnBindingInfo) {
      ColumnBindingInfo cbi=(ColumnBindingInfo)obj;
      int type=cbi.getColumnType();
      if (type == ColumnBindingInfo.GROUP_COLUMN || type == ColumnBindingInfo.AGGREGATE_COLUMN) {
        actualExpr=cbi.getExpression();
        isGroupOrAggr=true;
      }
    }
    if (seriesDefinition != null && (queryType.equals(ChartUIConstants.QUERY_CATEGORY) || queryType.equals(ChartUIConstants.QUERY_VALUE))) {
      seriesDefinition.getGrouping().setEnabled(isGroupOrAggr);
    }
  }
  if (ChartUIConstants.QUERY_VALUE.equals(queryType)) {
    if (!dataProvider.checkState(IDataServiceProvider.SHARE_QUERY) && dataProvider.checkState(IDataServiceProvider.HAS_DATA_SET)) {
      if (dataProvider.getDataType(actualExpr) == DataType.DATE_TIME_LITERAL) {
        ChartAdapter.beginIgnoreNotifications();
        if (query.getGrouping() == null) {
          query.setGrouping(DataFactoryImpl.init().createSeriesGrouping());
        }
        SeriesGrouping group=query.getGrouping();
        group.setEnabled(true);
        group.setAggregateExpression("String_Node_Str");
        ChartAdapter.endIgnoreNotifications();
      }
    }
  }
 else   if (ChartUIConstants.QUERY_CATEGORY.equals(queryType)) {
    DataType type=context.getDataServiceProvider().getDataType(expr);
    ChartAdapter.beginIgnoreNotifications();
    if (seriesDefinition.getGrouping() == null) {
      query.setGrouping(DataFactoryImpl.init().createSeriesGrouping());
    }
    seriesDefinition.getGrouping().setGroupType(type);
    if (type == DataType.DATE_TIME_LITERAL) {
      seriesDefinition.getGrouping().setGroupingUnit(GroupingUnitType.YEARS_LITERAL);
    }
    ChartAdapter.endIgnoreNotifications();
  }
  query.setDefinition(actualExpr);
}